add submenu
This commit is contained in:
parent
9b0f111f5b
commit
84f18b6141
5 changed files with 91 additions and 19 deletions
|
|
@ -112,12 +112,12 @@
|
|||
|
||||
<div *ngIf="hasSubmenu()">
|
||||
<div *ngFor="let sub of listSubMenuProductcodes()">
|
||||
<button
|
||||
<a
|
||||
class="btn btn-sm btn-primary m-2"
|
||||
(click)="selectSubmenu(sub)"
|
||||
href="/{{department}}/recipe/{{ sub }}"
|
||||
>
|
||||
{{ sub }}
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -326,14 +326,9 @@ export class RecipeDetailsComponent implements OnInit {
|
|||
this.submenus!.map((recipe) => recipe.productCode);
|
||||
|
||||
selectSubmenu(productCode: string) {
|
||||
if (this.selectedSubProductCode == productCode) {
|
||||
this.selectedSubProductCode = undefined;
|
||||
console.log('Unselected submenu', productCode);
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectedSubProductCode = productCode;
|
||||
console.log('Selected submenu', productCode);
|
||||
void this._router.navigate([
|
||||
'/' + this.department + '/recipes/' + productCode,
|
||||
]);
|
||||
}
|
||||
|
||||
// concat remaining unused keys
|
||||
|
|
|
|||
|
|
@ -279,20 +279,22 @@ export class RecipeToppingComponent implements OnInit {
|
|||
value.ListGroupID = concatArr;
|
||||
|
||||
// get last element that is not 0
|
||||
// let lastIndex = concatArr.findIndex((x: any) => x == 0) - 1;
|
||||
// if(lastIndex <= -1){
|
||||
// lastIndex = 0;
|
||||
// }
|
||||
let lastIndex = concatArr.findIndex((x: any) => x == 0) - 1;
|
||||
if(lastIndex <= -1){
|
||||
lastIndex = 0;
|
||||
}
|
||||
|
||||
let overrideDefault = parseInt(this.extraToppingDefault![concatArr[lastIndex]]);
|
||||
|
||||
// value.defaultIDSelect = parseInt(this.extraToppingDefault![value.groupID]);
|
||||
// console.log("value.defaultIDSelect", value.defaultIDSelect);
|
||||
console.log("value.defaultIDSelect", value.defaultIDSelect, "if override", overrideDefault);
|
||||
// TODO: Turn on if need to overwrite
|
||||
// value.defaultIDSelect = overrideDefault;
|
||||
|
||||
} else {
|
||||
value.ListGroupID = [parseInt(value.groupID), 0, 0, 0];
|
||||
}
|
||||
|
||||
// do cat array from list group id
|
||||
// let testSpliceArr = Array(value.ListGroupID).splice(1, value.ListGroupID.length -1 , ...(this.listGroupId[0] as Array<string>).slice(1, value.ListGroupID.length));
|
||||
|
||||
return {
|
||||
isUse: value.isUse,
|
||||
groupID: value.groupID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue