import Loc from '../../../helpers/localization'; import {template} from '../../../helpers/helpers'; import * as ORDER from '../../../helpers/statuses/order'; import CurrencyUpdate from '../../../helpers/emitters/currency-update'; import ProfileService from "../services/profile.service"; export default function OrderProfileComponent() { return { templateUrl: template('profile', 'order-food'), controller: DeliveryProfileController } } class DeliveryProfileController { private currency: any; private subCurrency: { unsubscribe: (() => any) }; private orderFood: { news: any; confirmeds: any; abandoneds: any; denieds: any; completeds: any; problems: any }; private lc: any; constructor (private ProfileService: ProfileService) { 'ngInject'; this.lc = Loc.get('profile'); this.currency = null; this.subCurrency = CurrencyUpdate.subscribe(currency => { this.currency = currency; }); this.orderFood = { news: [], confirmeds: [], abandoneds: [], denieds: [], completeds: [], problems: [] }; } $onDestroy() { this.subCurrency.unsubscribe(); } $onInit () { this.ProfileService.getOrderFoods(ORDER.NEW).then(data => { this.orderFood.news = data; }); this.ProfileService.getOrderFoods(ORDER.CONFIRMED).then(data => { this.orderFood.confirmeds = data; }); this.ProfileService.getOrderFoods(ORDER.ABANDONED).then(data => { this.orderFood.abandoneds = data; }); this.ProfileService.getOrderFoods(ORDER.DENIED).then(data => { this.orderFood.denieds = data; }); this.ProfileService.getOrderFoods(ORDER.COMPLETED).then(data => { this.orderFood.completeds = data; }); this.ProfileService.getOrderFoods(ORDER.PROBLEM).then(data => { this.orderFood.problems = data; }); } } // пример вывода новых заказов