fix: edit charge - tax group is mandatory by backend, but cannot be set on UI

now no empty tax-group request is sent to backend from edit charge

Fixes: #1722
This commit is contained in:
Pushpendra Kumar
2023-03-29 14:05:53 +02:00
committed by Adam Saghy
parent 6af25660d9
commit f6f72c25e2
2 changed files with 5 additions and 5 deletions
@@ -101,15 +101,15 @@
<mat-form-field fxFlex="48%">
<mat-label>Tax Group</mat-label>
<mat-select *ngIf="chargeData.taxGroup" required formControlName="taxGroupId">
<mat-select *ngIf="chargeData.taxGroup" formControlName="taxGroupId">
<mat-option *ngFor="let taxGroup of chargeData.taxGroupOptions" [value]="taxGroup.id">
{{ taxGroup.name }}
</mat-option>
</mat-select>
<mat-select *ngIf="!chargeData.taxGroup" required formControlName="taxGroupId">
<mat-option value="?">
Select Option
<mat-select *ngIf="!chargeData.taxGroup" formControlName="taxGroupId">
<mat-option *ngFor="let taxGroup of chargeData.taxGroupOptions" [value]="taxGroup.id">
{{ taxGroup.name }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -125,7 +125,7 @@ export class EditChargeComponent implements OnInit {
if (this.chargeData.taxGroup) {
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: this.chargeData.taxGroup.id }, Validators.required));
} else {
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: '' }));
delete this.chargeData.taxGroupId;
}
}