Breaking: Discount is applicable on sale category and not on menu category

Fix the import, etc on this.
While entering discount in sale, it checks the max allowed.
This commit is contained in:
2020-12-16 11:49:22 +05:30
parent e229ecefa2
commit e4500f0d46
48 changed files with 353 additions and 277 deletions

View File

@ -63,8 +63,8 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
code: this.item.code || '(Auto)',
name: this.item.name || '',
units: this.item.units || '',
menuCategory: this.item.menuCategory.id ? this.item.menuCategory.id : '',
saleCategory: this.item.saleCategory.id ? this.item.saleCategory.id : '',
menuCategory: this.item.menuCategory ? this.item.menuCategory.id : '',
saleCategory: this.item.saleCategory ? this.item.saleCategory.id : '',
price: this.item.price || '',
hasHappyHour: this.item.hasHappyHour,
isNotAvailable: this.item.isNotAvailable,
@ -121,7 +121,13 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
const formModel = this.form.value;
this.item.name = formModel.name;
this.item.units = formModel.units;
if (this.item.menuCategory === null || this.item.menuCategory === undefined) {
this.item.menuCategory = new MenuCategory();
}
this.item.menuCategory.id = formModel.menuCategory;
if (this.item.saleCategory === null || this.item.saleCategory === undefined) {
this.item.saleCategory = new SaleCategory();
}
this.item.saleCategory.id = formModel.saleCategory;
this.item.price = +formModel.price;
this.item.hasHappyHour = formModel.hasHappyHour;