Переглянути джерело

Add menu item Flow

master
kj1352 4 роки тому
джерело
коміт
e19d538588
2 змінених файлів з 27 додано та 3 видалено
  1. +27
    -1
      src/app/menu-items/menu-items.component.ts
  2. +0
    -2
      src/app/services/item.service.ts

+ 27
- 1
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");
})


+ 0
- 2
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({


Завантаження…
Відмінити
Зберегти