import Ember from 'ember';

export default Ember.Controller.extend({
  session: Ember.inject.service(),
  notifications: Ember.inject.service(),

  actions: {
    addToOrder(order, account, attrs) {
      const isManager = (this.get('session.account.id') === order.get('manager.id'));
      const portion = this.store.createRecord('portion', attrs);
      portion.set('order', order);
      portion.set('owner', account);

      if (isManager) {
        portion.set('paid', true);
      }

      portion.save().then(() => {
        order.addPortion(portion);
        if (isManager) {
          portion.updateOrderMoney();
        }
        order.save();
      });

      this.get('notifications').subscribeOrderNotification(order.id);
      this.transitionToRoute('orders');
    }
  }
});

@@ -763,18 +763,27 @@
 e('order
-s
 '
+, order.id
 );%0A    %7D

Change transition route to exact order