Fully working with the rule no explicit any
This commit is contained in:
@ -16,12 +16,12 @@ export class Bill {
|
||||
kotId: string;
|
||||
table: Table;
|
||||
guest: GuestBook;
|
||||
settlements: any[];
|
||||
// settlements: any[];
|
||||
voidReason: string;
|
||||
voucherType: string;
|
||||
serial: number;
|
||||
kots: Kot[];
|
||||
reprints: any[];
|
||||
// reprints: any[];
|
||||
|
||||
get dateTip(): string {
|
||||
return this.date;
|
||||
@ -46,12 +46,12 @@ export class Bill {
|
||||
this.kotId = '';
|
||||
this.table = new Table();
|
||||
this.guest = new GuestBook();
|
||||
this.settlements = [];
|
||||
// this.settlements = [];
|
||||
this.voidReason = '';
|
||||
this.voucherType = '';
|
||||
this.serial = 0;
|
||||
this.kots = [];
|
||||
this.reprints = [];
|
||||
// this.reprints = [];
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export class BillsDataSource extends DataSource<any> {
|
||||
constructor(private data: Observable<any[]>) {
|
||||
import { BillViewItem } from '../../core/bill-view-item';
|
||||
|
||||
export class BillsDataSource extends DataSource<BillViewItem> {
|
||||
constructor(private data: Observable<BillViewItem[]>) {
|
||||
super();
|
||||
}
|
||||
|
||||
connect(): Observable<any[]> {
|
||||
connect(): Observable<BillViewItem[]> {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
<ng-container matColumnDef="select">
|
||||
<mat-cell *matCellDef="let row">
|
||||
<mat-checkbox
|
||||
*ngIf="row.oldKot"
|
||||
*ngIf="row.isOldKot"
|
||||
(change)="$event ? masterToggle(row) : null"
|
||||
[checked]="bs.selection.hasValue() && isAllSelected(row)"
|
||||
[indeterminate]="isAnySelected(row)"
|
||||
@ -70,7 +70,7 @@
|
||||
</ng-container>
|
||||
<!-- Info Column -->
|
||||
<ng-container matColumnDef="info">
|
||||
<mat-cell *matCellDef="let row" [class.blue800]="row.newKot">
|
||||
<mat-cell *matCellDef="let row" [class.blue800]="row.isNewKot">
|
||||
<span>
|
||||
{{ row.info }}
|
||||
</span>
|
||||
@ -123,7 +123,12 @@
|
||||
>
|
||||
<mat-icon class="del">assignment</mat-icon>
|
||||
</button>
|
||||
<button mat-icon-button (click)="moveKot(row)" [disabled]="row.newKot" *ngIf="row.isKot">
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="moveKot(row)"
|
||||
[disabled]="row.isKot && !row.id"
|
||||
*ngIf="row.isKot"
|
||||
>
|
||||
<mat-icon class="del">open_in_new</mat-icon>
|
||||
</button>
|
||||
</mat-cell>
|
||||
@ -166,8 +171,8 @@
|
||||
<mat-header-row *matHeaderRowDef="['table-title', 'table-details']"></mat-header-row>
|
||||
<mat-row
|
||||
*matRowDef="let row; columns: displayedColumns"
|
||||
[class.blue400]="row.oldKot"
|
||||
[class.blue800]="row.newKot"
|
||||
[class.blue400]="row.isOldKot"
|
||||
[class.blue800]="row.isNewKot"
|
||||
[class.red100]="row.isPrinted"
|
||||
></mat-row>
|
||||
<mat-footer-row *matFooterRowDef="['net-title', 'net-amount']"></mat-footer-row>
|
||||
|
||||
@ -5,6 +5,7 @@ import { Observable } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
|
||||
import { AuthService } from '../../auth/auth.service';
|
||||
import { BillViewItem } from '../../core/bill-view-item';
|
||||
import { Table } from '../../core/table';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
|
||||
@ -68,7 +69,7 @@ export class BillsComponent implements OnInit {
|
||||
isAllSelected(kot: Kot) {
|
||||
return this.bs.data
|
||||
.filter((x) => x.kotId === kot.id)
|
||||
.reduce((p: boolean, c: any) => p && this.bs.selection.isSelected(c), true);
|
||||
.reduce((p: boolean, c: BillViewItem) => p && this.bs.selection.isSelected(c), true);
|
||||
}
|
||||
|
||||
isAnySelected(kot: Kot) {
|
||||
@ -76,7 +77,7 @@ export class BillsComponent implements OnInit {
|
||||
let found = 0;
|
||||
this.bs.data
|
||||
.filter((x) => x.kotId === kot.id)
|
||||
.forEach((c: any) => {
|
||||
.forEach((c: BillViewItem) => {
|
||||
total += 1;
|
||||
if (this.bs.selection.isSelected(c)) {
|
||||
found += 1;
|
||||
@ -94,11 +95,11 @@ export class BillsComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
addOne(item: any): void {
|
||||
addOne(item: BillViewItem): void {
|
||||
this.bs.addOne(item);
|
||||
}
|
||||
|
||||
quantity(item: any): void {
|
||||
quantity(item: BillViewItem): void {
|
||||
const dialogRef = this.dialog.open(QuantityComponent, {
|
||||
// width: '750px',
|
||||
data: item.quantity,
|
||||
@ -123,16 +124,16 @@ export class BillsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
subtractOne(item: any): void {
|
||||
subtractOne(item: BillViewItem): void {
|
||||
const canEdit = this.auth.allowed('edit-printed-product');
|
||||
this.bs.subtractOne(item, canEdit);
|
||||
}
|
||||
|
||||
removeItem(item: any): void {
|
||||
removeItem(item: BillViewItem): void {
|
||||
this.bs.removeItem(item);
|
||||
}
|
||||
|
||||
modifier(item: any): void {
|
||||
modifier(item: BillViewItem): void {
|
||||
this.bs.modifier(item);
|
||||
}
|
||||
|
||||
@ -202,7 +203,7 @@ export class BillsComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
rowQuantityDisabled(row: any) {
|
||||
rowQuantityDisabled(row: BillViewItem) {
|
||||
if (!row.isPrinted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user