Added Charges cap

This commit is contained in:
Ramveer
2022-06-08 08:56:23 +02:00
committed by Arnold Gálovics
parent 0644fcdfd7
commit 9d43181cea
2 changed files with 19 additions and 1 deletions
@@ -147,6 +147,16 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>Minimum Charge Cap</mat-label>
<input matInput formControlName="minCap">
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>Maximum Charge Cap</mat-label>
<input matInput formControlName="maxCap">
</mat-form-field>
<div fxFlex="48%" fxLayout="row" fxLayoutGap="2%" fxLayout.lt-md="column">
<div fxFlex="50%" class="active-wrapper">
<mat-checkbox labelPosition="before" formControlName="active">
@@ -81,7 +81,9 @@ export class CreateChargeComponent implements OnInit {
'amount': ['', [Validators.required, Validators.pattern('^\\s*(?=.*[1-9])\\d*(?:\\.\\d+)?\\s*$')]],
'active': [false],
'penalty': [false],
'taxGroupId': ['']
'taxGroupId': [''],
'minCap': [''],
'maxCap': ['']
});
}
@@ -225,6 +227,12 @@ export class CreateChargeComponent implements OnInit {
if (!charge.taxGroupId) {
delete charge.taxGroupId;
}
if (!charge.minCap) {
delete charge.minCap;
}
if (!charge.maxCap) {
delete charge.maxCap;
}
this.productsService.createCharge(charge).subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});