Split bill done - TODO: If the products have different price due to paid modifiers
This commit is contained in:
2020-09-28 08:09:38 +05:30
parent cf34c2b855
commit f8778fee74
9 changed files with 159 additions and 123 deletions

View File

@ -13,6 +13,7 @@ const httpOptions = {
const url = '/api/voucher';
const urlMoveTable = '/api/move-table';
const urlMoveKot = '/api/move-kot';
const urlSplitBill = '/api/split-bill';
const serviceName = 'VoucherService';
@Injectable({providedIn: 'root'})
@ -140,11 +141,10 @@ export class VoucherService {
}
splitBill(id: string, inventoriesToMove: string[], table: Table) {
const options = {params: new HttpParams().set('split-bill', '').set('u', 'true')};
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {
voucher: {id: id},
const options = {params: new HttpParams().set('u', 'true')};
return <Observable<boolean>>this.http.post<boolean>(`${urlSplitBill}/${id}`, {
inventories: inventoriesToMove,
table: {id: table.id}
tableId: table.id
}, options).pipe(
catchError(this.log.handleError(serviceName, 'splitBill'))
);