add carousel & test submenu
This commit is contained in:
parent
edcccaaab9
commit
7102f644d4
7 changed files with 242 additions and 314 deletions
|
|
@ -92,6 +92,7 @@ export class RecipeDetailsComponent implements OnInit {
|
|||
tpl = []
|
||||
|
||||
toppingSet: ToppingSet[] | null = null;
|
||||
submenus: Recipe01[] | null = null;
|
||||
|
||||
ngOnInit() {
|
||||
this.productCode = this._route.snapshot.params['productCode'];
|
||||
|
|
@ -101,13 +102,18 @@ export class RecipeDetailsComponent implements OnInit {
|
|||
.pipe(first());
|
||||
this.recipeDetail$.subscribe((detail) => {
|
||||
|
||||
console.log('Recipe Detail', detail);
|
||||
// console.log('Recipe Detail', detail);
|
||||
|
||||
this.recipeDetailForm.patchValue(detail);
|
||||
this.isLoaded = true;
|
||||
this.recipeOriginalDetail = { ...this.recipeDetailForm.getRawValue() };
|
||||
});
|
||||
|
||||
this._recipeService.getSubMenus(this._recipeService.getCurrentCountry(), this._recipeService.getCurrentFile(), this.productCode).subscribe((data) => {
|
||||
console.log('Submenus', data);
|
||||
this.submenus = data;
|
||||
});
|
||||
|
||||
this.recipeDetailForm.valueChanges.subscribe(this.onRecipeDetailFormChange);
|
||||
|
||||
|
||||
|
|
@ -243,4 +249,21 @@ export class RecipeDetailsComponent implements OnInit {
|
|||
this.changedProductCode = event.target.value;
|
||||
}
|
||||
}
|
||||
|
||||
// Submenus
|
||||
selectedSubProductCode: string | undefined = undefined;
|
||||
hasSubmenu = () => this.submenus != null && this.submenus!.length > 0;
|
||||
listSubMenuProductcodes = () => 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue