Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- });
- }
- }
- // пример вывода новых заказов
- <div role="tabpanel" class="tab-pane active" id="news">
- <div ng-repeat="order in $ctrl.orderFood.news.data track by $index"
- class="right-content">
- <order-food order="order" index="$index" abandon="$ctrl.setOrderStatus(id, status, index, type)"></order-food>
- </div>
- <pg-server ng-if="$ctrl.orderFood.news.data.length > 0" model="$ctrl.orderFood.news"></pg-server>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment