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:
1 parent
e229ecefa2
commit
e4500f0d46
48 files changed
+353
-277
No files matched your search
@@ -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