Product Group renamed to Menu Category
Extracted Product Group -> Group_type to a a new object called Sale Category. Moved tax from product to Sale Category for uniform taxes on types of sales.
This commit is contained in:
@ -3,11 +3,11 @@ import { ToasterService } from '../../core/toaster.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ProductService } from '../product.service';
|
||||
import { Product } from '../../core/product';
|
||||
import { ProductGroup } from '../../core/product-group';
|
||||
import { MenuCategory } from '../../core/menu-category';
|
||||
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { Tax } from "../../core/tax";
|
||||
import { SaleCategory } from "../../core/sale-category";
|
||||
|
||||
@Component({
|
||||
selector: 'app-product-detail',
|
||||
@ -17,8 +17,8 @@ import { Tax } from "../../core/tax";
|
||||
export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('name', { static: true }) nameElement: ElementRef;
|
||||
form: FormGroup;
|
||||
productGroups: ProductGroup[];
|
||||
taxes: Tax[];
|
||||
menuCategories: MenuCategory[];
|
||||
saleCategories: SaleCategory[];
|
||||
item: Product;
|
||||
|
||||
constructor(
|
||||
@ -37,8 +37,8 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
code: {value: '', disabled: true},
|
||||
name: '',
|
||||
units: '',
|
||||
productGroup: '',
|
||||
tax: '',
|
||||
menuCategory: '',
|
||||
saleCategory: '',
|
||||
price: '',
|
||||
hasHappyHour: '',
|
||||
isNotAvailable: '',
|
||||
@ -49,9 +49,10 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { item: Product, productGroups: ProductGroup[], taxes: Tax[] }) => {
|
||||
this.productGroups = data.productGroups;
|
||||
this.taxes = data.taxes;
|
||||
.subscribe((data: { item: Product, menuCategories: MenuCategory[], saleCategories: SaleCategory[] }) => {
|
||||
this.menuCategories = data.menuCategories;
|
||||
this.saleCategories = data.saleCategories;
|
||||
console.log(this.saleCategories);
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
@ -62,8 +63,8 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
code: this.item.code || '(Auto)',
|
||||
name: this.item.name || '',
|
||||
units: this.item.units || '',
|
||||
productGroup: this.item.tax.id ? this.item.tax.id : '',
|
||||
tax: this.item.productGroup.id ? this.item.productGroup.id : '',
|
||||
menuCategory: this.item.menuCategory.id ? this.item.menuCategory.id : '',
|
||||
saleCategory: this.item.saleCategory.id ? this.item.saleCategory.id : '',
|
||||
price: this.item.price || '',
|
||||
hasHappyHour: this.item.hasHappyHour,
|
||||
isNotAvailable: this.item.isNotAvailable,
|
||||
@ -121,8 +122,8 @@ export class ProductDetailComponent implements OnInit, AfterViewInit {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
this.item.units = formModel.units;
|
||||
this.item.productGroup.id = formModel.productGroup;
|
||||
this.item.tax.id = formModel.tax;
|
||||
this.item.menuCategory.id = formModel.menuCategory;
|
||||
this.item.saleCategory.id = formModel.saleCategory;
|
||||
this.item.price = +formModel.price;
|
||||
this.item.hasHappyHour = formModel.hasHappyHour;
|
||||
this.item.isNotAvailable = formModel.isNotAvailable;
|
||||
|
||||
Reference in New Issue
Block a user