|
|
@@ -1,4 +1,5 @@ |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import { ItemService } from '../services/item.service'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'app-menu-items', |
|
|
@@ -12,7 +13,9 @@ export class MenuItemsComponent implements OnInit { |
|
|
|
searchTerm: string = ''; |
|
|
|
menuItems: any = []; |
|
|
|
|
|
|
|
constructor() { } |
|
|
|
constructor( |
|
|
|
private itemService: ItemService |
|
|
|
) { } |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
this.profile_type = localStorage.current_login_type; |
|
|
@@ -24,7 +27,22 @@ export class MenuItemsComponent implements OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
this.menuItems = JSON.parse(JSON.stringify(this.profile_info.menuitems)); |
|
|
|
} |
|
|
|
|
|
|
|
updateItem(menuItem) { |
|
|
|
this.itemService.updateMenuItem(menuItem, this.profile_info.outlet_id).then((data) => { |
|
|
|
this.profile_info.menuitems = JSON.parse(JSON.stringify(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); |
|
|
|
} |
|
|
|
|
|
|
|
}, (err) => { |
|
|
|
console.log(err); |
|
|
|
alert("Failed to update"); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
searchItems() { |
|
|
|