Refactored customer discount and choose discount. They were using the same schema unnecessarily which was leading to confusion.
This commit is contained in:
@ -50,7 +50,7 @@ export class DiscountComponent {
|
||||
new FormGroup({
|
||||
name: new FormControl(x.name, { nonNullable: true }),
|
||||
discount: new FormControl(x.discount * 100, {
|
||||
validators: [Validators.min(0), Validators.max(x.discountLimit * 100)],
|
||||
validators: [Validators.min(0), Validators.max(x.limit * 100)],
|
||||
nonNullable: true,
|
||||
}),
|
||||
}),
|
||||
@ -68,7 +68,7 @@ export class DiscountComponent {
|
||||
if (control.pristine && control.value === 0) {
|
||||
this.list.splice(i, 1);
|
||||
} else {
|
||||
item.discount = Math.max(Math.min(round(control.value / 100, 5), item.discountLimit), 0);
|
||||
item.discount = Math.max(Math.min(round(control.value / 100, 5), item.limit), 0);
|
||||
}
|
||||
}
|
||||
this.dialogRef.close(this.list);
|
||||
|
||||
Reference in New Issue
Block a user