Tax is added directly to product for sale

Auth guard and auth service simplified and fixed so that user is updated upon login
Home component changed to use square buttons
Fixed showing the totals in the bill

ng linted the project
This commit is contained in:
Amritanshu
2019-08-11 01:37:14 +05:30
parent d7fdf751b9
commit dcaf23b390
23 changed files with 334 additions and 266 deletions

View File

@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material';
import { PrintType } from "../bills/bill";
import { PrintType } from '../bills/bill';
@Component({
selector: 'app-bill-type',

View File

@ -9,16 +9,19 @@ import { ModifierCategoryService } from '../modifier-categories/modifier-categor
import { ModifierCategory } from '../core/modifier-category';
import { Bill, Inventory, Kot, PrintType } from './bills/bill';
import { VoucherService } from './bills/voucher.service';
import { ToasterService } from "../core/toaster.service";
import { tap } from "rxjs/operators";
import { Table } from "../core/table";
import {observableToBeFn} from "rxjs/internal/testing/TestScheduler";
import { ToasterService } from '../core/toaster.service';
import { tap } from 'rxjs/operators';
import { Table } from '../core/table';
@Injectable()
export class BillService {
public dataObs;
public data;
private bill;
public netAmount: BehaviorSubject<number>;
public discountAmount: BehaviorSubject<number>;
public taxAmount: BehaviorSubject<number>;
public amount: BehaviorSubject<number>;
constructor(
private dialog: MatDialog,
@ -28,6 +31,10 @@ export class BillService {
) {
this.data = [];
this.dataObs = new BehaviorSubject<any[]>(this.data);
this.netAmount = new BehaviorSubject(0);
this.discountAmount = new BehaviorSubject(0);
this.taxAmount = new BehaviorSubject(0);
this.amount = new BehaviorSubject(0);
}
loadData(bill: Bill): void {
@ -58,6 +65,7 @@ export class BillService {
this.data = view.reduce((a, c) => a.concat(c) , []);
this.data.push({isKot: true, newKot: true, info: '== New Kot =='});
this.dataObs.next(this.data);
this.updateAmounts();
}
addProduct(product: Product): void {
@ -76,8 +84,8 @@ export class BillService {
price: product.price,
quantity: 1,
discount: 0,
taxRate: product.saleCategory.tax.rate,
tax: product.saleCategory.tax,
taxRate: product.tax.rate,
tax: product.tax,
modifiers: []
};
this.data.push(item);
@ -90,6 +98,7 @@ export class BillService {
});
}
this.dataObs.next(this.data);
this.updateAmounts();
}
showModifier(item: any): void {
@ -114,17 +123,20 @@ export class BillService {
addOne(item: any): void {
item.quantity += 1;
this.dataObs.next(this.data);
this.updateAmounts();
}
quantity(item: any, quantity: number): void {
item.quantity = quantity;
this.dataObs.next(this.data);
this.updateAmounts();
}
subtractOne(item: any): void {
if (item.quantity > 1) {
item.quantity -= 1;
this.dataObs.next(this.data);
this.updateAmounts();
} else if (item.quantity === 0) {
this.removeItem(item);
}
@ -133,20 +145,22 @@ export class BillService {
removeItem(item: any): void {
this.data.splice(this.data.indexOf(item), 1);
this.dataObs.next(this.data);
this.updateAmounts();
}
modifier(item: any): void {
this.showModifier(item);
}
discount(discounts:{id: string, name: string, discount: number}[]): void {
this.data.forEach(x=> {
discount(discounts: {id: string, name: string, discount: number}[]): void {
this.data.forEach(x => {
if (!x.isKot) {
x.discount = discounts.find(d => d.id === x.product.saleCategory.id).discount / 100;
x.info = `${x.product.name} (${x.product.units}) @ ${x.price} - ${math.round(x.discount * 100, 2)}%`;
}
});
this.dataObs.next(this.data);
this.updateAmounts();
}
private getKot(): Kot {
@ -165,28 +179,24 @@ export class BillService {
}
printKot(guest_book_id: string): Observable<Bill> {
let item = JSON.parse(JSON.stringify(this.bill));
let newKot = this.getKot();
const item = JSON.parse(JSON.stringify(this.bill));
const newKot = this.getKot();
if (newKot.inventories.length == 0) {
this.toaster.show('Error', 'Cannot print a blank KOT\nPlease add some products!');
}
item.kots.push(newKot);
return this.ser.saveOrUpdate(item, PrintType.Kot, guest_book_id, true).pipe(
tap(x => console.log(x))
);
return this.ser.saveOrUpdate(item, PrintType.Kot, guest_book_id, true);
}
printBill(guest_book_id: string, printType: PrintType): Observable<Bill> {
let item = JSON.parse(JSON.stringify(this.bill));
const item = JSON.parse(JSON.stringify(this.bill));
item.kots.forEach(k => {
k.inventories.forEach(i => {
i.discount = this.data.find(x => !x.isKot && x.id === i.id).discount;
})
});
});
item.kots.push(this.getKot());
return this.ser.saveOrUpdate(item, printType, guest_book_id, true).pipe(
tap(x => console.log(x))
);
return this.ser.saveOrUpdate(item, printType, guest_book_id, true);
}
type() {
@ -194,48 +204,49 @@ export class BillService {
}
receivePayment(amounts: { id: string; name: string; amount: number }[]): Observable<boolean> {
return this.ser.receivePayment(this.bill.id, amounts, true).pipe(
tap(x => console.log(x))
);
return this.ser.receivePayment(this.bill.id, amounts, true);
}
moveTable(table: Table): Observable<boolean> {
return this.ser.moveTable(this.bill.id, table);
}
moveKot(id: string, table: Table): Observable<boolean> {
return this.ser.moveKot(this.bill.id, id, table);
}
voidBill(reason: string): Observable<boolean> {
return this.ser.voidBill(this.bill.id, reason, true);
}
netAmount() {
return math.round(this.bill.kots.reduce(
(ka: number, k: Kot) => ka + k.inventories.reduce(
(ca: number, c: Inventory) => ca + ((c.isHappyHour ? 0 : c.price) * c.quantity)
, 0)
, 0))
}
discountAmount() {
return math.round(this.bill.kots.reduce(
(ka: number, k: Kot) => ka + k.inventories.reduce(
updateAmounts() {
this.netAmount.next(
math.round(this.data.filter(x => !x.isKot).reduce(
(ca: number, c: any) => ca + ((c.isHappyHour ? 0 : c.price) * c.quantity)
, 0))
);
this.discountAmount.next(
math.round(this.data.filter(x => !x.isKot).reduce(
(ca: number, c: Inventory) => ca + ((c.isHappyHour ? 0 : c.price) * c.quantity * c.discount)
, 0)
, 0))
}
taxAmount() {
return math.round(this.bill.kots.reduce(
(ka: number, k: Kot) => ka + k.inventories.reduce(
, 0))
);
this.taxAmount.next(
math.round(this.data.filter(x => !x.isKot).reduce(
(ca: number, c: Inventory) => ca + ((c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * c.taxRate)
, 0)
, 0))
, 0))
);
this.amount.next(
math.round(this.data.filter(x => !x.isKot).reduce(
(ca: number, c: Inventory) => ca + ((c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * (1 + c.taxRate))
, 0))
);
}
amount() {
amountVal(): number {
return math.round(this.bill.kots.reduce(
(ka: number, k: Kot) => ka + k.inventories.reduce(
(ca: number, c: Inventory) => ca + ((c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * (1 + c.taxRate))
, 0)
, 0))
, 0));
}
}

View File

@ -39,26 +39,29 @@
<button mat-icon-button (click)="modifier(row)" [disabled]="row.isPrinted" *ngIf="!row.isKot">
<mat-icon class="del">assignment</mat-icon>
</button>
<button mat-icon-button (click)="modifier(row)" [disabled]="row.newKot" *ngIf="row.isKot">
<mat-icon class="del">open_in_new</mat-icon>
</button>
</mat-cell>
<mat-footer-cell *matFooterCellDef class="grey900 bold right-align">{{ amount() | currency: 'INR' }}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef class="grey900 bold right-align">{{ bs.amount | async | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="net-title">
<mat-footer-cell *matFooterCellDef class="grey300 bold">Net</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="net-amount">
<mat-footer-cell *matFooterCellDef class="grey300 bold right-align">{{ netAmount() | currency: 'INR' }}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef class="grey300 bold right-align">{{ bs.netAmount | async | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="discount-title">
<mat-footer-cell *matFooterCellDef class="grey500 bold">Discount</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="discount-amount">
<mat-footer-cell *matFooterCellDef class="grey500 bold right-align">{{ discountAmount() | currency: 'INR' }}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef class="grey500 bold right-align">{{ bs.discountAmount | async | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="tax-title">
<mat-footer-cell *matFooterCellDef class="grey700 bold">Tax</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="tax-amount">
<mat-footer-cell *matFooterCellDef class="grey700 bold right-align">{{ taxAmount() | currency: 'INR' }}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef class="grey700 bold right-align">{{ bs.taxAmount | async | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<mat-row *matRowDef="let row; columns: displayedColumns;" [class.blue400]="row.oldKot" [class.blue800]="row.newKot"

View File

@ -1,10 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Bill } from './bill';
import { ActivatedRoute, Router } from '@angular/router';
import { Bill, Kot } from './bill';
import { BillsDataSource } from './bills-datasource';
import { BillService } from '../bill.service';
import { QuantityComponent } from '../quantity/quantity.component';
import { MatDialog } from '@angular/material';
import { Table } from '../../core/table';
import { Observable, throwError } from 'rxjs';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { map, switchMap } from 'rxjs/operators';
import { TablesDialogComponent } from '../tables-dialog/tables-dialog.component';
import { TableService } from '../../tables/table.service';
import { ToasterService } from '../../core/toaster.service';
@Component({
selector: 'app-bills',
@ -19,8 +26,11 @@ export class BillsComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private router: Router,
private dialog: MatDialog,
private bs: BillService
private toaster: ToasterService,
private bs: BillService,
private tSer: TableService
) {
}
@ -62,20 +72,4 @@ export class BillsComponent implements OnInit {
modifier(item: any): void {
this.bs.modifier(item);
}
netAmount(): number {
return this.bs.netAmount();
}
discountAmount(): number {
return this.bs.discountAmount();
}
taxAmount(): number {
return this.bs.taxAmount();
}
amount(): number {
return this.bs.amount();
}
}

View File

@ -4,7 +4,7 @@ import { catchError } from 'rxjs/operators';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { ErrorLoggerService } from '../../core/error-logger.service';
import { Bill, PrintType } from './bill';
import { Table } from "../../core/table";
import { Table } from '../../core/table';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
@ -50,7 +50,7 @@ export class VoucherService {
save(voucher: Bill, printType: PrintType, guest_book_id: string, updateTable: boolean): Observable<Bill> {
const options = {params: new HttpParams().set('p', printType).set('u', updateTable.toString())};
if (guest_book_id !== null) {
options.params = options.params.set('g', guest_book_id)
options.params = options.params.set('g', guest_book_id);
}
return <Observable<Bill>>this.http.post<Bill>(`${url}/new`, voucher, options)
.pipe(
@ -61,7 +61,7 @@ export class VoucherService {
update(voucher: Bill, printType: PrintType, guest_book_id: string, updateTable: boolean): Observable<Bill> {
const options = {params: new HttpParams().set('p', printType).set('u', updateTable.toString())};
if (guest_book_id !== null) {
options.params = options.params.set('g', guest_book_id)
options.params = options.params.set('g', guest_book_id);
}
return <Observable<Bill>>this.http.put<Bill>(`${url}/${voucher.id}`, voucher, options)
.pipe(
@ -78,7 +78,7 @@ export class VoucherService {
}
receivePayment(id: string, amounts: { id: string; name: string; amount: number }[], updateTable: boolean): Observable<boolean> {
const options = {params: new HttpParams().set('receive-payment', "").set('u', updateTable.toString())};
const options = {params: new HttpParams().set('receive-payment', '').set('u', updateTable.toString())};
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, amounts, options)
.pipe(
catchError(this.log.handleError(serviceName, 'receivePayment'))
@ -87,14 +87,14 @@ export class VoucherService {
moveTable(id: string, table: Table): Observable<boolean> {
const options = {params: new HttpParams().set('move-table', '')};
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {table:{id: table.id}}, options)
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {table: {id: table.id}}, options)
.pipe(
catchError(this.log.handleError(serviceName, 'moveTable'))
);
}
voidBill(id: string, reason: string, updateTable: boolean): Observable<boolean> {
const options = {params: new HttpParams().set('void-bill', "").set('u', updateTable.toString())};
const options = {params: new HttpParams().set('void-bill', '').set('u', updateTable.toString())};
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {reason: reason}, options)
.pipe(
catchError(this.log.handleError(serviceName, 'voidBill'))

View File

@ -1,8 +1,8 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { Observable } from 'rxjs';
import { FormArray, FormBuilder, FormGroup, Validators } from "@angular/forms";
import { DiscountDataSource } from "./discount-datasource";
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { DiscountDataSource } from './discount-datasource';
@Component({
selector: 'app-modifiers',
@ -28,7 +28,7 @@ export class DiscountComponent {
this.list.map(
x => this.fb.group({
name: [x.name],
discount: ["", [Validators.min(0), Validators.max(100)]]
discount: ['', [Validators.min(0), Validators.max(100)]]
})
)
));

View File

@ -1,21 +1,21 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { MatDialog } from "@angular/material";
import { concatMap, map, switchMap, tap } from "rxjs/operators";
import { iif, Observable, of as observableOf, throwError } from "rxjs";
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog } from '@angular/material';
import { concatMap, map, switchMap, tap } from 'rxjs/operators';
import { iif, Observable, of as observableOf, throwError } from 'rxjs';
import { BillService } from '../bill.service';
import { ToasterService } from "../../core/toaster.service";
import { DiscountComponent } from "../discount/discount.component";
import { SaleCategoryService } from "../../sale-category/sale-category.service";
import { BillTypeComponent } from "../bill-type/bill-type.component";
import { PrintType } from "../bills/bill";
import { AuthService } from "../../auth/auth.service";
import { ReceivePaymentComponent } from "../receive-payment/receive-payment.component";
import { TableService } from "../../tables/table.service";
import { Table } from "../../core/table";
import { TablesDialogComponent } from "../tables-dialog/tables-dialog.component";
import { ConfirmDialogComponent } from "../../shared/confirm-dialog/confirm-dialog.component";
import { VoidReasonComponent } from "../void-reason/void-reason.component";
import { ToasterService } from '../../core/toaster.service';
import { DiscountComponent } from '../discount/discount.component';
import { SaleCategoryService } from '../../sale-category/sale-category.service';
import { BillTypeComponent } from '../bill-type/bill-type.component';
import { PrintType } from '../bills/bill';
import { AuthService } from '../../auth/auth.service';
import { ReceivePaymentComponent } from '../receive-payment/receive-payment.component';
import { TableService } from '../../tables/table.service';
import { Table } from '../../core/table';
import { TablesDialogComponent } from '../tables-dialog/tables-dialog.component';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { VoidReasonComponent } from '../void-reason/void-reason.component';
@Component({
selector: 'app-sales-home',
@ -40,8 +40,8 @@ export class SalesHomeComponent implements OnInit {
printKot() {
let guestBookId = null;
if (this.route.snapshot.queryParamMap.has("guest")) {
guestBookId = this.route.snapshot.queryParamMap.get("guest");
if (this.route.snapshot.queryParamMap.has('guest')) {
guestBookId = this.route.snapshot.queryParamMap.get('guest');
}
this.bs.printKot(guestBookId).subscribe(x => {
this.toaster.show('Success', '');
@ -50,7 +50,7 @@ export class SalesHomeComponent implements OnInit {
}
discount(): void {
if (this.auth.hasPermission("Discount")) {
if (this.auth.hasPermission('Discount')) {
this.showDiscount().subscribe();
}
}
@ -66,15 +66,15 @@ export class SalesHomeComponent implements OnInit {
this.bs.discount(result as { id: string, name: string, discount: number }[]);
}
})
)
);
}
discountDialog (canGiveDiscount: boolean) : Observable<any> {
discountDialog (canGiveDiscount: boolean): Observable<any> {
let discObs = null;
if (canGiveDiscount) {
return discObs = this.showDiscount();
} else {
return discObs = observableOf("");
return discObs = observableOf('');
}
}
@ -83,10 +83,10 @@ export class SalesHomeComponent implements OnInit {
return this.dialog.open(BillTypeComponent).afterClosed().pipe(
tap(x => {
if (!x) {
throwError ("No Bill Type Chosen")
throwError ('No Bill Type Chosen');
}
})
)
);
}
confirmMoveTableDialog(table: Table): Observable<{table: Table, confirmed: boolean}> {
@ -108,10 +108,10 @@ export class SalesHomeComponent implements OnInit {
}
printBill() {
const canGiveDiscount = this.auth.hasPermission("Discount");
const canGiveDiscount = this.auth.hasPermission('Discount');
let guestBookId = null;
if (this.route.snapshot.queryParamMap.has("guest")) {
guestBookId = this.route.snapshot.queryParamMap.get("guest");
if (this.route.snapshot.queryParamMap.has('guest')) {
guestBookId = this.route.snapshot.queryParamMap.get('guest');
}
this.discountDialog(canGiveDiscount).pipe(
concatMap(() => this.billTypeDialog())
@ -128,13 +128,13 @@ export class SalesHomeComponent implements OnInit {
this.router.navigate(['/sales']);
},
x => {
this.toaster.show('Error', "No Bill Type Chosen")
this.toaster.show('Error', 'No Bill Type Chosen');
});
}
receivePayment() {
let amount = this.bs.amount();
let type = this.bs.type();
const amount = this.bs.amountVal();
const type = this.bs.type();
const dialogRef = this.dialog.open(ReceivePaymentComponent, {
// width: '750px',
data: {
@ -149,7 +149,7 @@ export class SalesHomeComponent implements OnInit {
this.router.navigate(['/sales']);
});
}
})
});
}
moveTable() {
@ -164,14 +164,14 @@ export class SalesHomeComponent implements OnInit {
if (!!x) {
return this.confirmMoveTableDialog(x as Table);
} else {
return throwError("Please choose a table");
return throwError('Please choose a table');
}
}),
switchMap((value: { table: Table, confirmed: boolean }, index: number) => {
if (!!value.confirmed) {
return this.bs.moveTable(value.table)
return this.bs.moveTable(value.table);
} else {
return throwError("Please confirm move")
return throwError('Please confirm move');
}
}
)
@ -180,8 +180,8 @@ export class SalesHomeComponent implements OnInit {
this.router.navigate(['/sales']);
},
x => {
this.toaster.show('Error', x)
})
this.toaster.show('Error', x);
});
}
voidBill() {
@ -192,14 +192,14 @@ export class SalesHomeComponent implements OnInit {
if (!!x) {
return this.confirmVoidDialog(x as string);
} else {
return throwError("Please choose a reason to void the bill");
return throwError('Please choose a reason to void the bill');
}
}),
switchMap((x: boolean | string) => {
if (!!x) {
return this.bs.voidBill(x as string)
return this.bs.voidBill(x as string);
} else {
return throwError("You chose not to void the bill")
return throwError('You chose not to void the bill');
}
})
).subscribe((x) => {
@ -207,7 +207,7 @@ export class SalesHomeComponent implements OnInit {
this.router.navigate(['/sales']);
},
x => {
this.toaster.show('Error', x)
})
this.toaster.show('Error', x);
});
}
}

View File

@ -23,3 +23,8 @@
background-color: #d32f2f;
color: #ffffff;
}
.grey800 {
background-color: #424242;
color: #ffffff;
}

View File

@ -1,6 +1,7 @@
<mat-card>
<mat-card-content fxLayout="row wrap" fxLayoutGap="grid 20px">
<mat-card fxLayout="column" class="square-button" matRipple *ngFor="let item of list" (click)="addProduct(item)" [class.yellow300]="item.hasHappyHour">
<mat-card fxLayout="column" class="square-button" matRipple *ngFor="let item of list" (click)="addProduct(item)"
[class.yellow300]="item.hasHappyHour" [class.grey800]="item.isNotAvailable">
<h3 class="item-name">{{item.name}}</h3>
</mat-card>
<mat-card fxLayout="column" class="square-button red700" matRipple [routerLink]="['../../menu-categories']"

View File

@ -1,9 +1,9 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { FormArray, FormBuilder, FormGroup } from "@angular/forms";
import { distinctUntilChanged } from "rxjs/operators";
import { ReceivePaymentDatasource } from "./receive-payment-datasource";
import { PrintType } from "../bills/bill";
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { distinctUntilChanged } from 'rxjs/operators';
import { ReceivePaymentDatasource } from './receive-payment-datasource';
import { PrintType } from '../bills/bill';
@Component({
selector: 'app-receive-payment',
@ -15,22 +15,22 @@ export class ReceivePaymentComponent {
REGULAR_BILL: [
{
id: 2,
name: "Cash",
name: 'Cash',
amount: 0
},
{
id: 3,
name: "Credit Card",
name: 'Credit Card',
amount: 0
},
{
id: 5,
name: "Bill To Company",
name: 'Bill To Company',
amount: 0
},
{
id: 6,
name: "Tip",
name: 'Tip',
amount: 0
}
]
@ -38,14 +38,14 @@ export class ReceivePaymentComponent {
NO_CHARGE: [
{
id: 4,
name: "No Charge",
name: 'No Charge',
amount: 0
}
],
STAFF: [
{
id: 10,
name: "Staff Account",
name: 'Staff Account',
amount: 0
}
]
@ -71,7 +71,7 @@ export class ReceivePaymentComponent {
this.choices[this.type].map(
x => this.fb.group({
name: [x.name],
amount: [""]
amount: ['']
})
)
));
@ -91,7 +91,7 @@ export class ReceivePaymentComponent {
(z, i) => array.controls[i].valueChanges.pipe(
distinctUntilChanged()
).subscribe(x => {
this.choices[this.type].find(s => s.name == x.name).amount = (x.amount === "" ? 0 : parseInt(x.amount, 10));
this.choices[this.type].find(s => s.name == x.name).amount = (x.amount === '' ? 0 : parseInt(x.amount, 10));
this.balance = this.amount - this.choices[this.type].reduce((a, c) => a + c.amount, 0);
})
);

View File

@ -1,9 +1,13 @@
.running {
background-color: green;
/* Red 900 */
background-color: #b71c1c;
color: #ffffff;
}
.printed {
background-color: firebrick;
/* Green 900 */
background-color: #1b5e20;
color: #ffffff;
}
.square-button {

View File

@ -15,7 +15,7 @@ import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { FlexLayoutModule } from '@angular/flex-layout';
import { SharedModule } from "../shared/shared.module";
import { SharedModule } from '../shared/shared.module';
import { SalesRoutingModule } from './sales-routing.module';
import { RunningTablesComponent } from './running-tables/running-tables.component';
import { MenuCategoriesComponent } from './menu-categories/menu-categories.component';
@ -25,11 +25,11 @@ import { BillsComponent } from './bills/bills.component';
import { SalesHomeComponent } from './home/sales-home.component';
import { BillService } from './bill.service';
import { QuantityComponent } from './quantity/quantity.component';
import { DiscountComponent } from "./discount/discount.component";
import { BillTypeComponent } from "./bill-type/bill-type.component";
import { ReceivePaymentComponent } from "./receive-payment/receive-payment.component";
import { TablesDialogComponent } from "./tables-dialog/tables-dialog.component";
import { VoidReasonComponent } from "./void-reason/void-reason.component";
import { DiscountComponent } from './discount/discount.component';
import { BillTypeComponent } from './bill-type/bill-type.component';
import { ReceivePaymentComponent } from './receive-payment/receive-payment.component';
import { TablesDialogComponent } from './tables-dialog/tables-dialog.component';
import { VoidReasonComponent } from './void-reason/void-reason.component';
@NgModule({
providers: [

View File

@ -1,9 +1,13 @@
.running {
background-color: green;
/* Red 900 */
background-color: #b71c1c;
color: #ffffff;
}
.printed {
background-color: firebrick;
/* Green 900 */
background-color: #1b5e20;
color: #ffffff;
}
.square-button {

View File

@ -1,7 +1,7 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { Observable } from 'rxjs';
import { Table } from "../../core/table";
import { Table } from '../../core/table';
@Component({
selector: 'app-tables-dialog',

View File

@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material';
import { VoidReasonDatasource } from "./void-reason-datasource";
import { VoidReasonDatasource } from './void-reason-datasource';
@Component({
selector: 'app-void-reason',
@ -11,14 +11,14 @@ export class VoidReasonComponent {
dataSource: VoidReasonDatasource;
selected: string;
reasons = [
"Discount",
"Printing fault",
"Item changed",
"Quantity reduced",
"Costing bill for party",
"Cashier mistake",
"Management free sale",
"Other"
'Discount',
'Printing fault',
'Item changed',
'Quantity reduced',
'Costing bill for party',
'Cashier mistake',
'Management free sale',
'Other'
];
displayedColumns = ['reason'];