Receive payment working.
TODO: Nested subscribe in Receive Payment in sales-home-component.ts should be refactored into something more readable.
This commit is contained in:
@ -15,7 +15,19 @@
|
||||
<mat-card fxLayout="column" class="square-button warn" matRipple [routerLink]="['../../tables']">
|
||||
<h3 class="item-name">Back to Tables</h3>
|
||||
</mat-card>
|
||||
<mat-card fxLayout="column" class="square-button" matRipple [routerLink]="['../../tables']">
|
||||
<mat-card fxLayout="column" class="square-button" matRipple (click)="receivePayment()">
|
||||
<h3 class="item-name">Receive Payment</h3>
|
||||
</mat-card>
|
||||
<mat-card fxLayout="column" class="square-button" matRipple [routerLink]="['../../tables']">
|
||||
<h3 class="item-name">Move Table</h3>
|
||||
</mat-card>
|
||||
<mat-card fxLayout="column" class="square-button" matRipple [routerLink]="['../../tables']">
|
||||
<h3 class="item-name">Void Bill</h3>
|
||||
</mat-card>
|
||||
<mat-card fxLayout="column" class="square-button" matRipple [routerLink]="['../../tables']">
|
||||
<h3 class="item-name">Move KOT</h3>
|
||||
</mat-card>
|
||||
<mat-card fxLayout="column" class="square-button" matRipple [routerLink]="['../../tables']">
|
||||
<h3 class="item-name">Split Bill</h3>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
@ -10,6 +10,7 @@ import { SaleCategoryService } from "../../sale-category/sale-category.service";
|
||||
import { BillTypeComponent } from "../bill-type/bill-type.component";
|
||||
import { PrintType } from "../bills/bill";
|
||||
import { AuthService } from "../../auth/auth.service";
|
||||
import { ReceivePaymentComponent } from "../receive-payment/receive-payment.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-sales-home',
|
||||
@ -106,4 +107,24 @@ export class SalesHomeComponent implements OnInit {
|
||||
this.toaster.show('Error', "No Bill Type Chosen")
|
||||
});
|
||||
}
|
||||
|
||||
receivePayment() {
|
||||
let amount = this.bs.amount();
|
||||
let type = this.bs.type();
|
||||
const dialogRef = this.dialog.open(ReceivePaymentComponent, {
|
||||
// width: '750px',
|
||||
data: {
|
||||
type: type,
|
||||
amount: amount
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((result: boolean | { id: string, name: string, amount: number }[]) => {
|
||||
if (!!result) {
|
||||
this.bs.receivePayment(result as { id: string, name: string, amount: number }[]).subscribe(() => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/sales']);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user