Breaking: Discount is applicable on sale category and not on menu category
Fix the import, etc on this. While entering discount in sale, it checks the max allowed.
This commit is contained in:
@ -2,6 +2,7 @@ import { DataSource } from '@angular/cdk/collections';
|
||||
import { merge, Observable } from 'rxjs';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
|
||||
import { MenuCategory } from '../../core/menu-category';
|
||||
import { Product } from '../../core/product';
|
||||
|
||||
export class ProductListDataSource extends DataSource<Product> {
|
||||
@ -44,9 +45,9 @@ export class ProductListDataSource extends DataSource<Product> {
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
private getFilteredData(data: Product[], filter: string): Product[] {
|
||||
if (filter === undefined) {
|
||||
if (filter === null || filter === undefined || filter === '') {
|
||||
return data;
|
||||
}
|
||||
return data.filter((x) => x.menuCategory.id === filter);
|
||||
return data.filter((x) => (x.menuCategory as MenuCategory).id === filter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ export class ProductListComponent implements OnInit {
|
||||
this.list = this.dataSource.filteredData;
|
||||
} else {
|
||||
this.list = this.list
|
||||
.filter((x) => x.menuCategory.id !== this.dataSource.filterValue)
|
||||
.filter((x) => (x.menuCategory as MenuCategory).id !== this.dataSource.filterValue)
|
||||
.concat(this.dataSource.filteredData);
|
||||
}
|
||||
this.data.next(this.list);
|
||||
|
||||
Reference in New Issue
Block a user