Show proper error messages on Save Bill / Save Kot
This commit is contained in:
parent
7baf79c3fa
commit
73f83f1aa7
@ -59,10 +59,15 @@ export class SalesHomeComponent {
|
||||
if (this.route.snapshot.queryParamMap.has('guest')) {
|
||||
guestBookId = this.route.snapshot.queryParamMap.get('guest');
|
||||
}
|
||||
this.bs.printKot(guestBookId).subscribe(() => {
|
||||
this.bs.printKot(guestBookId).subscribe(
|
||||
() => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/sales']);
|
||||
});
|
||||
},
|
||||
(result) => {
|
||||
this.toaster.show('Error', result);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
discountAllowed(): boolean {
|
||||
@ -96,14 +101,7 @@ export class SalesHomeComponent {
|
||||
}
|
||||
return this.dialog
|
||||
.open(BillTypeComponent)
|
||||
.afterClosed()
|
||||
.pipe(
|
||||
tap((x) => {
|
||||
if (!x) {
|
||||
throwError('No Bill Type Chosen');
|
||||
}
|
||||
}),
|
||||
);
|
||||
.afterClosed();
|
||||
}
|
||||
|
||||
confirmTableDialog(table: Table): Observable<{ table: Table; confirmed: boolean }> {
|
||||
@ -161,20 +159,21 @@ export class SalesHomeComponent {
|
||||
}
|
||||
}),
|
||||
switchMap(() => this.billTypeDialog()),
|
||||
switchMap((x: boolean | PrintType) => {
|
||||
switchMap((x)=> {
|
||||
if (x) {
|
||||
return this.bs.printBill(guestBookId, x as PrintType);
|
||||
return observableOf(x);
|
||||
}
|
||||
return throwError(x);
|
||||
return throwError('No Bill Type Chosen')
|
||||
}),
|
||||
switchMap((x: PrintType) => this.bs.printBill(guestBookId, x as PrintType)),
|
||||
)
|
||||
.subscribe(
|
||||
() => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/sales']);
|
||||
},
|
||||
() => {
|
||||
this.toaster.show('Error', 'No Bill Type Chosen');
|
||||
(result) => {
|
||||
this.toaster.show('Error', result);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user