Feature: Added a column called print in bill to the table customer.
This will prevent printing all customer's names and phone numbers in the bill in case of simple walkins. This is a breaking change as there is schema changes in the database. It also bolds the customers who are to be printed in the bill in the running tables list.
This commit is contained in:
@ -41,6 +41,16 @@
|
||||
<textarea matInput placeholder="Address" formControlName="address"> </textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div
|
||||
fxLayout="row"
|
||||
fxLayoutAlign="space-around start"
|
||||
fxLayout.lt-md="column"
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
>
|
||||
<mat-checkbox formControlName="printInBill">Print in Bill?</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
<div formArrayName="discounts">
|
||||
<div
|
||||
|
||||
@ -34,6 +34,7 @@ export class CustomerDetailComponent implements OnInit, AfterViewInit {
|
||||
name: '',
|
||||
phone: '',
|
||||
address: '',
|
||||
printInBill: false,
|
||||
discounts: this.fb.array([]),
|
||||
});
|
||||
}
|
||||
@ -50,6 +51,7 @@ export class CustomerDetailComponent implements OnInit, AfterViewInit {
|
||||
(this.form.get('name') as AbstractControl).setValue(item.name);
|
||||
(this.form.get('phone') as AbstractControl).setValue(item.phone);
|
||||
(this.form.get('address') as AbstractControl).setValue(item.address);
|
||||
(this.form.get('printInBill') as AbstractControl).setValue(item.printInBill);
|
||||
this.form.setControl(
|
||||
'discounts',
|
||||
this.fb.array(
|
||||
@ -112,6 +114,7 @@ export class CustomerDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.name = formModel.name;
|
||||
this.item.phone = formModel.phone;
|
||||
this.item.address = formModel.address;
|
||||
this.item.printInBill = formModel.printInBill;
|
||||
const array = this.form.get('discounts') as FormArray;
|
||||
this.item.discounts.forEach((item, index) => {
|
||||
item.discount = Math.max(
|
||||
|
||||
@ -28,6 +28,12 @@
|
||||
<mat-cell *matCellDef="let row">{{ row.address }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Print In Bill Column -->
|
||||
<ng-container matColumnDef="printInBill">
|
||||
<mat-header-cell *matHeaderCellDef>Print in Bill</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.printInBill }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Discounts Column -->
|
||||
<ng-container matColumnDef="discounts">
|
||||
<mat-header-cell *matHeaderCellDef>Discounts</mat-header-cell>
|
||||
|
||||
@ -14,7 +14,7 @@ export class CustomerListComponent implements OnInit {
|
||||
dataSource: CustomerListDatasource = new CustomerListDatasource([]);
|
||||
list: Customer[] = [];
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'phone', 'address', 'discounts'];
|
||||
displayedColumns = ['name', 'phone', 'address', 'printInBill', 'discounts'];
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user