Fix: Prevent creation of customer with blank name when adding a guest book item.

Fix: Also prevent creation of customer with blank phone number when adding a guest book.
Feature: Show the old bill of a customer in guest book
Fix: In reprint, allow changing of customer
Chore: Updated dependencies
This commit is contained in:
2023-04-09 15:42:32 +05:30
parent 302ed4a18f
commit 8bc7d66123
9 changed files with 81 additions and 31 deletions

View File

@ -54,7 +54,12 @@
<ng-container matColumnDef="action">
<mat-header-cell *matHeaderCellDef class="center">Action</mat-header-cell>
<mat-cell *matCellDef="let row" class="center">
<button mat-icon-button [routerLink]="['/sales']" [queryParams]="{ guest: row.id }" *ngIf="!row.tableId">
<button
mat-icon-button
[routerLink]="['/sales']"
[queryParams]="{ guest: row.id }"
*ngIf="!row.tableId && !row.voucherId"
>
<mat-icon>chair</mat-icon>
</button>
<button
@ -66,6 +71,15 @@
>
{{ row.tableName }}
</button>
<button
mat-stroked-button
color="primary"
[routerLink]="['/sales', 'bill']"
[queryParams]="{ voucher: row.voucherId }"
*ngIf="!row.tableId && row.voucherId"
>
{{ row.tableName }}
</button>
<button mat-icon-button [routerLink]="['/guest-book/', row.id]">
<mat-icon>edit</mat-icon>
</button>

View File

@ -22,6 +22,9 @@ export class BillResolver implements Resolve<Bill> {
if (tableId !== null) {
return this.ser.getFromTable(tableId as string, voucherId, guestId);
}
if (voucherId !== null) {
return this.ser.getFromId(voucherId);
}
throw new Error('Unable to get bill');
}
}

View File

@ -52,6 +52,12 @@ export class VoucherService {
.pipe(catchError(this.log.handleError(serviceName, `getFromBill billId=${billId}`))) as Observable<Bill>;
}
getFromId(voucherId: string): Observable<Bill> {
return this.http
.get<Bill>(`${url}/from-id/${voucherId}`)
.pipe(catchError(this.log.handleError(serviceName, `getFromId voucherId=${voucherId}`))) as Observable<Bill>;
}
save(voucher: Bill, voucherType: VoucherType, guestBookId: string | null, updateTable: boolean): Observable<boolean> {
const options = {
params: new HttpParams().set('p', voucherType.toString()).set('u', updateTable.toString()),