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:
@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from "@angular/router";
|
||||
import { Observable } from "rxjs";
|
||||
import { Product } from "../../core/product";
|
||||
import { ProductService } from "../../product/product.service";
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Product } from '../../core/product';
|
||||
import { ProductService } from '../../product/product.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<mat-card>
|
||||
<mat-card-content fxLayout="row wrap" fxLayoutGap="grid 20px">
|
||||
<button mat-raised-button class="square-button"
|
||||
*ngFor="let item of list" (click)="showModifier(item)">{{item.name}}</button>
|
||||
*ngFor="let item of list" (click)="addProduct(item)">{{item.name}}</button>
|
||||
<button mat-raised-button class="square-button" color="warn" (click)="goBack()">Back</button>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { MatDialog } from "@angular/material";
|
||||
import { Product } from "../../core/product";
|
||||
import {ModifiersComponent} from "../modifiers/modifiers.component";
|
||||
import {ModifierCategoryService} from "../../modifier-categories/modifier-category.service";
|
||||
import { Location } from '@angular/common';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Product } from '../../core/product';
|
||||
import { BillService } from '../bill.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-products',
|
||||
@ -13,7 +12,11 @@ import {ModifierCategoryService} from "../../modifier-categories/modifier-catego
|
||||
export class ProductsComponent implements OnInit {
|
||||
list: Product[];
|
||||
|
||||
constructor(private route: ActivatedRoute, private dialog: MatDialog, private modifierCategoryService: ModifierCategoryService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private location: Location,
|
||||
private bs: BillService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -23,17 +26,12 @@ export class ProductsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
showModifier(product: Product): void {
|
||||
// [routerLink]="['/sales', 'modifiers', item.id]"
|
||||
let dialogRef = this.dialog.open(ModifiersComponent, {
|
||||
position: {
|
||||
top: '10vh'
|
||||
},
|
||||
data: this.modifierCategoryService.listIsActiveOfProduct(product.id)
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log('The dialog was closed');
|
||||
});
|
||||
addProduct(product: Product): void {
|
||||
this.bs.addProduct(product);
|
||||
}
|
||||
|
||||
goBack(): void {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user