Change (Reprint bill)

Chore:
  Refactored save voucher so that the save function can be reused in change voucher route

Fix:
  Show voucher sent modifiers in a wrong format
  Inventory schema used rate instead of price
This commit is contained in:
2020-09-29 10:50:55 +05:30
parent f8778fee74
commit 046504e097
8 changed files with 204 additions and 132 deletions

View File

@ -69,11 +69,24 @@ export class VoucherService {
);
}
change(voucher: Bill, printType: PrintType, guest_book_id: string, updateTable: boolean): Observable<boolean> {
const options = {params: new HttpParams().set('u', updateTable.toString())};
if (guest_book_id !== null) {
options.params = options.params.set('g', guest_book_id);
}
return <Observable<boolean>>this.http.put<boolean>(`${url}/change/${voucher.id}`, voucher, options)
.pipe(
catchError(this.log.handleError(serviceName, 'change'))
);
}
saveOrUpdate(voucher: Bill, printType: PrintType, guest_book_id: string, updateTable: boolean): Observable<boolean> {
if (!voucher.id) {
return this.save(voucher, printType, guest_book_id, updateTable);
} else {
} else if (voucher.voucherType === PrintType.Kot) {
return this.update(voucher, printType, guest_book_id, updateTable);
} else {
return this.change(voucher, printType, guest_book_id, updateTable);
}
}