Removed IsModifierCompulsory from MenuCategory as it is now not needed and minimum in ModifierCategory set to non-zero to achieve the same.
Fix: DiscountLimit was not scaled to 100 in MenuCategory detail. So it is now chaled in the json and scaled back in the frontend for the list as that was not supposed to be scaled. Feature: Modifier is now done Fix: In product save, it was checking menu_category second time again instead of sale_category
This commit is contained in:
@ -0,0 +1,53 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ModifierListDataSource } from './modifier-list-datasource';
|
||||
import { MatTable } from "@angular/material";
|
||||
import { Modifier } from '../../core/modifier';
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import {ModifierCategory} from "../../core/modifier-category";
|
||||
|
||||
@Component({
|
||||
selector: 'app-modifier-list',
|
||||
templateUrl: './modifier-list.component.html',
|
||||
styleUrls: ['./modifier-list.component.css']
|
||||
})
|
||||
export class ModifierListComponent implements OnInit {
|
||||
@ViewChild('table', { static: true }) table: MatTable<Modifier>;
|
||||
dataSource: ModifierListDataSource;
|
||||
filter: BehaviorSubject<string>;
|
||||
form: FormGroup;
|
||||
list: Modifier[];
|
||||
data: BehaviorSubject<Modifier[]>;
|
||||
modifierCategories: ModifierCategory[];
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns: string[] = ['name', 'showInBill', 'price', 'modifierCategory'];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private fb: FormBuilder,
|
||||
private router: Router
|
||||
) {
|
||||
this.form = this.fb.group({
|
||||
modifierCategory: ''
|
||||
});
|
||||
this.filter = new BehaviorSubject("");
|
||||
this.data = new BehaviorSubject([]);
|
||||
this.data.subscribe((data: Modifier[]) => {
|
||||
this.list = data;
|
||||
})
|
||||
}
|
||||
|
||||
filterOn(val: any) {
|
||||
this.filter.next(val.value);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { list: Modifier[], modifierCategories: ModifierCategory[] }) => {
|
||||
this.data.next(data.list);
|
||||
this.modifierCategories = data.modifierCategories;
|
||||
});
|
||||
this.dataSource = new ModifierListDataSource(this.filter, this.data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user