From e19d538588f2f2b7037f1d32a60f81fd1f84e226 Mon Sep 17 00:00:00 2001 From: kj1352 Date: Sat, 6 Mar 2021 13:31:42 +0530 Subject: [PATCH] Add menu item Flow --- src/app/menu-items/menu-items.component.ts | 28 +++++++++++++++++++++- src/app/services/item.service.ts | 2 -- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/app/menu-items/menu-items.component.ts b/src/app/menu-items/menu-items.component.ts index a665473..e360b8b 100644 --- a/src/app/menu-items/menu-items.component.ts +++ b/src/app/menu-items/menu-items.component.ts @@ -53,6 +53,8 @@ export class MenuItemsComponent implements OnInit { } this.menuItems = JSON.parse(JSON.stringify(this.profile_info.menuitems)); + + console.log(this.menuItems); } updateItem(menuItem) { @@ -81,7 +83,31 @@ export class MenuItemsComponent implements OnInit { addNewItem() { this.itemService.addMenuItem(this.newItem, this.profile_info.outlet_id).then((data) => { - console.log(data); + this.menuItems.push(data); + this.profile_info.menuitems = this.menuItems; + + if (this.profile_type === 'VENDOR') { + localStorage.vendor_info = JSON.stringify(this.profile_info); + } else if (this.profile_type === 'OUTLET') { + localStorage.outlet_info = JSON.stringify(this.profile_info); + } + + + this.showAddItemModal = false; + + this.newItem = { + image_url: '', + is_available: false, + is_vegetarian: true, + item_categories: [], + item_discount: null, + item_price: null, + menu_item_name: '', + rating: 3, + soft_delete: false, + wait_duration:"00:30:00" + }; + }, (err) => { alert("Failed to create item"); }) diff --git a/src/app/services/item.service.ts b/src/app/services/item.service.ts index b7ac178..acbc475 100644 --- a/src/app/services/item.service.ts +++ b/src/app/services/item.service.ts @@ -30,8 +30,6 @@ export class ItemService { menuItem.outlet = { outlet_id: outlet_id }; - - console.log(menuItem); const httpOptions = { headers: new HttpHeaders({