This commit is contained in:
2023-07-21 21:06:45 +03:00
parent 2f108bef4f
commit fa5a8a9001
37 changed files with 2319 additions and 28 deletions
@@ -28,7 +28,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of myCurrencies">
<tr *ngFor="let item of myCurrencies" [ngClass]="item.isPrimary ? 'bg-purple' : ''">
<td>{{item.code}}</td>
<td>{{item.name}}</td>
<td>{{item.shortName}}</td>
@@ -20,6 +20,7 @@ export class SettingsCurrencyComponent {
public currencies?: CurrencyModel[];
public myCurrencies?: CurrencyModel[];
public primaryId?: string;
constructor(
private httpClient: HttpClient,
@@ -74,6 +75,7 @@ export class SettingsCurrencyComponent {
.subscribe(data => {
this.myCurrencies = data.map(myCurrency => {
var globalCurrency = this.currencies?.find(x => x.id === myCurrency.code);
return {
id: myCurrency.id,
code: myCurrency.code,
@@ -83,6 +85,7 @@ export class SettingsCurrencyComponent {
rateDate: myCurrency.rateDate,
shortName: myCurrency.shortName,
symbol: globalCurrency?.symbol,
isPrimary: myCurrency.isPrimary,
};
});
});
@@ -64,7 +64,7 @@
<mat-form-field class="example-full-width">
<mat-label>Rate Date</mat-label>
<input matInput [matDatepicker]="picker3" (focus)="picker3.open()" value={{currency.rateDate}} formControlName="rateDate" required>
<mat-hint>YYYY/MM/DD</mat-hint>
<mat-hint>DD/MM/YYYY</mat-hint>
<mat-datepicker-toggle matSuffix [for]="picker3"></mat-datepicker-toggle>
<mat-datepicker #picker3></mat-datepicker>
<mat-error *ngIf="addForm.controls?.['rateDate']?.hasError('required')">
@@ -74,6 +74,15 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="text-inside">
<mat-checkbox class="example-margin" formControlName="isPrimary">
Primary currency
</mat-checkbox>
</div>
</div>
</div>
<mat-dialog-actions class="mat-dialog-actions">
<div class="mat-dialog-left">
<div class="alert alert-danger mat-dialog-error" *ngIf="errorMessage">
@@ -60,6 +60,9 @@ export class SettingsRateCurrencyComponent {
this.currency.rateDate,
[Validators.required],
],
isPrimary: [
this.currency.isPrimary,
],
});
}
@@ -73,7 +76,6 @@ export class SettingsRateCurrencyComponent {
this.httpClient
.put<CurrencyModel>(ApiRoutes.SettingsCurrency.replace(':id', this.addForm.value.id), this.addForm.value)
.subscribe(response => {
console.log(this.addForm.value);
this.httpClient
.post<CurrencyModel[]>(ApiRoutes.SettingsCurrenciesRate.replace(':id', this.addForm.value.id), this.addForm.value)
.subscribe(response => {