Chore:
Deduplicated the settle options function for save/update/void/receive payment Ported: Void Receive payment
This commit is contained in:
@ -26,7 +26,7 @@
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="table-details">
|
||||
<mat-header-cell *matHeaderCellDef class="deep-purple-50 bold right-align">{{ bs.bill.table.name }}
|
||||
/ {{ bs.bill.pax }} / {{ bs.bill.customer.name }}</mat-header-cell>
|
||||
/ {{ bs.bill.pax }} / {{ bs.bill.customer?.name }}</mat-header-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Checkbox Column -->
|
||||
|
||||
@ -13,7 +13,7 @@ import { TablesDialogComponent } from '../tables-dialog/tables-dialog.component'
|
||||
import { TableService } from '../../tables/table.service';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { AuthService } from '../../auth/auth.service';
|
||||
import { PaxComponent } from "../pax/pax.component";
|
||||
import { PaxComponent } from '../pax/pax.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bills',
|
||||
@ -46,8 +46,8 @@ export class BillsComponent implements OnInit {
|
||||
}
|
||||
|
||||
getPax(): void {
|
||||
if (this.bs.bill.id || this.bs.bill.customer.id) {
|
||||
return
|
||||
if (this.bs.bill.id || this.bs.bill.customer) {
|
||||
return;
|
||||
}
|
||||
const dialogRef = this.dialog.open(PaxComponent, {
|
||||
// width: '750px',
|
||||
|
||||
@ -76,19 +76,24 @@ export class VoucherService {
|
||||
}
|
||||
}
|
||||
|
||||
receivePayment(id: string, amounts: { id: number; name: string; amount: number }[], name: string, updateTable: boolean): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('receive-payment', '').set('u', updateTable.toString())};
|
||||
receivePayment(
|
||||
id: string,
|
||||
amounts: { id: number; name: string; amount: number }[],
|
||||
name: string,
|
||||
updateTable: boolean
|
||||
): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(
|
||||
`${url}/${id}`, {name: name, amounts: amounts}, options
|
||||
`${url}/receive-payment/${id}`, {name: name, amounts: amounts}, options
|
||||
).pipe(
|
||||
catchError(this.log.handleError(serviceName, 'receivePayment'))
|
||||
);
|
||||
}
|
||||
|
||||
voidBill(id: string, reason: string, updateTable: boolean): Observable<boolean> {
|
||||
const options = {params: new HttpParams().set('void-bill', '').set('u', updateTable.toString())};
|
||||
const options = {params: new HttpParams().set('reason', reason).set('u', updateTable.toString())};
|
||||
return <Observable<boolean>>this.http.post<boolean>(
|
||||
`${url}/${id}`, {reason: reason}, options
|
||||
`${url}/void-bill/${id}`, {}, options
|
||||
).pipe(
|
||||
catchError(this.log.handleError(serviceName, 'voidBill'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user