Ported:
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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user