Chore: Moved from css to sass, god knows what to do now.
Chore: Prettier line length changed to 120 from 100 Fix: Hard coded the face as the primary color to make the buttons stand out
This commit is contained in:
@ -166,22 +166,18 @@ export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
isMenuCategoryPartiallySelected(node: NodeItem) {
|
||||
const total = (this.productsOfMenuCategory.get(node.id) as Product[]).length;
|
||||
const ticked = (this.productsOfMenuCategory.get(node.id) as Product[]).reduce(
|
||||
(acc, current) => {
|
||||
if (current.enabled) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
acc += 1;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
0,
|
||||
);
|
||||
const ticked = (this.productsOfMenuCategory.get(node.id) as Product[]).reduce((acc, current) => {
|
||||
if (current.enabled) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
acc += 1;
|
||||
}
|
||||
return acc;
|
||||
}, 0);
|
||||
return ticked > 0 && ticked < total;
|
||||
}
|
||||
|
||||
toggleProductSelection(node: NodeItem) {
|
||||
(this.products.get(node.id) as Product).enabled = !(this.products.get(node.id) as Product)
|
||||
.enabled;
|
||||
(this.products.get(node.id) as Product).enabled = !(this.products.get(node.id) as Product).enabled;
|
||||
}
|
||||
|
||||
toggleMenuCategorySelection(node: NodeItem) {
|
||||
|
||||
@ -9,10 +9,7 @@ describe('ModifierCategoryListResolver', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject(
|
||||
[ModifierCategoryListResolver],
|
||||
(service: ModifierCategoryListResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
},
|
||||
));
|
||||
it('should be created', inject([ModifierCategoryListResolver], (service: ModifierCategoryListResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -9,10 +9,7 @@ describe('ModifierCategoryResolver', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject(
|
||||
[ModifierCategoryResolver],
|
||||
(service: ModifierCategoryResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
},
|
||||
));
|
||||
it('should be created', inject([ModifierCategoryResolver], (service: ModifierCategoryResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -22,25 +22,19 @@ export class ModifierCategoryService {
|
||||
const getUrl: string = id === null ? url : `${url}/${id}`;
|
||||
return this.http
|
||||
.get<ModifierCategory>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`)),
|
||||
) as Observable<ModifierCategory>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<ModifierCategory>;
|
||||
}
|
||||
|
||||
list(): Observable<ModifierCategory[]> {
|
||||
return this.http
|
||||
.get<ModifierCategory[]>(`${url}/list`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<
|
||||
ModifierCategory[]
|
||||
>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<ModifierCategory[]>;
|
||||
}
|
||||
|
||||
listForProduct(id: string): Observable<ModifierCategory[]> {
|
||||
return this.http
|
||||
.get<ModifierCategory[]>(`${url}/for-product/${id}`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'listIsActiveOfProduct'))) as Observable<
|
||||
ModifierCategory[]
|
||||
>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'listIsActiveOfProduct'))) as Observable<ModifierCategory[]>;
|
||||
}
|
||||
|
||||
save(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
|
||||
@ -52,9 +46,7 @@ export class ModifierCategoryService {
|
||||
update(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
|
||||
return this.http
|
||||
.put<ModifierCategory>(`${url}/${modifierCategory.id}`, modifierCategory, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'update')),
|
||||
) as Observable<ModifierCategory>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<ModifierCategory>;
|
||||
}
|
||||
|
||||
saveOrUpdate(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
|
||||
@ -67,8 +59,6 @@ export class ModifierCategoryService {
|
||||
delete(id: string): Observable<ModifierCategory> {
|
||||
return this.http
|
||||
.delete<ModifierCategory>(`${url}/${id}`, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'delete')),
|
||||
) as Observable<ModifierCategory>;
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<ModifierCategory>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user