Table Merge/Move and Kot Merge/Move
This commit is contained in:
2020-09-25 08:48:50 +05:30
parent bf09471e9e
commit cf34c2b855
7 changed files with 191 additions and 140 deletions

View File

@ -133,7 +133,7 @@ export class BillsComponent implements OnInit {
}
moveKot(kot: Kot) {
const canMergeTables = (this.auth.user.perms.indexOf('merge-tables') === -1);
const canMergeTables = (this.auth.user.perms.indexOf('merge-tables') !== -1);
this.dialog.open(TablesDialogComponent, {
// width: '750px',
data: {

View File

@ -100,45 +100,41 @@ export class VoucherService {
}
moveTable(id: string, table: Table): Observable<boolean> {
const options = {params: new HttpParams().set('move', '')};
return <Observable<boolean>>this.http.post<boolean>(urlMoveTable, {
voucher: {id: id},
table: {id: table.id}
}, options).pipe(
return <Observable<boolean>>this.http.post<boolean>(`${urlMoveTable}/move`, {
voucherId: id,
tableId: table.id
}).pipe(
catchError(this.log.handleError(serviceName, 'moveTable'))
);
}
mergeTable(id: string, table: Table): Observable<boolean> {
const options = {params: new HttpParams().set('merge', '')};
return <Observable<boolean>>this.http.post<boolean>(urlMoveTable, {
voucher: {id: id},
table: {id: table.id},
newVoucher: {id: table.voucherId}
}, options).pipe(
return <Observable<boolean>>this.http.post<boolean>(`${urlMoveTable}/merge`, {
voucherId: id,
tableId: table.id,
newVoucherId: table.voucherId
}).pipe(
catchError(this.log.handleError(serviceName, 'mergeTable'))
);
}
moveKotToNewTable(id: string, kotId: string, table: Table): Observable<boolean> {
const options = {params: new HttpParams().set('move', '')};
return <Observable<boolean>>this.http.post<boolean>(urlMoveKot, {
voucher: {id: id},
kot: {id: kotId},
table: {id: table.id}
}, options).pipe(
return <Observable<boolean>>this.http.post<boolean>(`${urlMoveKot}/move`, {
voucherId: id,
kotId: kotId,
tableId: table.id
}).pipe(
catchError(this.log.handleError(serviceName, 'moveKotToNewTable'))
);
}
mergeKotWithOldBill(id: string, kotId: string, table: Table): Observable<boolean> {
const options = {params: new HttpParams().set('merge', '')};
return <Observable<boolean>>this.http.post<boolean>(urlMoveKot, {
voucher: {id: id},
kot: {id: kotId},
table: {id: table.id},
newVoucher: {id: table.voucherId}
}, options).pipe(
return <Observable<boolean>>this.http.post<boolean>(`${urlMoveKot}/merge`, {
voucherId: id,
kotId: kotId,
tableId: table.id,
newVoucherId: table.voucherId
}).pipe(
catchError(this.log.handleError(serviceName, 'mergeKotWithOldBill'))
);
}

View File

@ -265,7 +265,7 @@ export class SalesHomeComponent implements OnInit {
if (!this.moveTableAllowed()) {
return;
}
const canMergeTables = (this.auth.user.perms.indexOf('merge-tables') === -1);
const canMergeTables = (this.auth.user.perms.indexOf('merge-tables') !== -1);
this.dialog.open(TablesDialogComponent, {
// width: '750px',
data: {