Bills initially working just as proof of concept

ng linted
modifier categories list is better at displaying data sanely now
This commit is contained in:
Amritanshu
2019-07-11 12:17:41 +05:30
parent d69ab0063a
commit 4513e8b263
74 changed files with 599 additions and 235 deletions

View File

@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from "@angular/router";
import { Table } from "../../core/table";
import { ActivatedRoute } from '@angular/router';
import {Bill, Inventory, Kot} from './bill';
import {ModifierCategoryListDatasource} from '../../modifier-categories/modifier-category-list/modifier-category-list-datasource';
import {BillsDataSource} from './bills-datasource';
import {BillService} from "../bill.service";
@Component({
selector: 'app-bills',
@ -8,15 +11,50 @@ import { Table } from "../../core/table";
styleUrls: ['./bills.component.css']
})
export class BillsComponent implements OnInit {
list: Table[];
dataSource: BillsDataSource;
item: Bill;
view: any[];
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns: string[] = ['info', 'quantity'];
constructor(private route: ActivatedRoute) {
constructor(
private route: ActivatedRoute,
private bs: BillService
) {
}
ngOnInit() {
this.route.data
.subscribe((data: { list: Table[] }) => {
this.list = data.list;
.subscribe((data: { item: Bill }) => {
this.updateView(data.item);
});
this.dataSource = new BillsDataSource(this.bs.dataObs);
}
updateView(item) {
this.item = item;
// this.view = item.kots.reduce((p: Kot, c:Kot) => {
//
// }, [])
}
addOne(item: any): void {
this.bs.addOne(item);
}
quantity(item: any): void {
this.bs.quantity(item);
}
subtractOne(item: any): void {
this.bs.subtractOne(item);
}
removeItem(item: any): void {
this.bs.removeItem(item);
}
modifier(item: any): void {
this.bs.modifier(item);
}
}