(function () {
    'use strict';

    /**
     * @param Base
     * @param {Waves} waves
     * @param {User} user
     * @param createPoll
     * @param {NotificationManager} notificationManager
     * @return {DexMyOrders}
     */
    const controller = function (Base, waves, user, createPoll, notificationManager) {

        class DexMyOrders extends Base {

            constructor() {
                super();

                /**
                 * @type {string}
                 * @private
                 */
                this._amountAssetId = null;
                /**
                 * @type {string}
                 * @private
                 */
                this._priceAssetId = null;

                this.syncSettings({
                    _amountAssetId: 'dex.amountAssetId',
                    _priceAssetId: 'dex.priceAssetId'
                });

                const poll = createPoll(this, this._getOrders, 'orders', 5000);
                this.observe(['_amountAssetId', '_priceAssetId'], () => poll.restart());
            }

            dropOrder(order) {
                user.getSeed().then((seed) => {
                    waves.matcher.cancelOrder(order.amount.asset.id, order.price.asset.id, order.id, seed.keyPair)
                        .then(() => {
                            const canceledOrder = tsUtils.find(this.orders, { id: order.id });
                            canceledOrder.state = 'Canceled';
                            notificationManager.info({
                                ns: 'app.dex',
                                title: { literal: 'directives.myOrders.notifications.isCanceled' }
                            });
                        })
                        .catch(() => {
                            notificationManager.error({
                                ns: 'app.dex',
                                title: { literal: 'directives.myOrders.notifications.somethingWentWrong' }
                            });
                        });
                });
            }

            /**
             * @returns {Promise}
             * @private
             */
            _getOrders() {
                return user.getSeed()
                    .then((seed) => waves.matcher.getOrders(seed.keyPair))
                    .then((orders) => {
                        const active = orders.filter(({ status }) => status === 'Accepted');
                        const filled = orders.filter(({ status }) => status === 'Filled');
                        const others = orders.filter(({ status }) => status !== 'Accepted' && status !== 'Filled');
                        return active.concat(filled).concat(others);
                    });
            }

        }

        return new DexMyOrders();
    };

    controller.$inject = ['Base', 'waves', 'user', 'createPoll', 'notificationManager'];

    angular.module('app.dex').component('wDexMyOrders', {
        bindings: {},
        templateUrl: 'modules/dex/directives/dexMyOrders/myOrders.html',
        controller
    });
})();

@@ -189,16 +189,48 @@
 Manager%0A
+     * @param %7Bapp.utils%7D utils%0A
      * @
@@ -341,16 +341,23 @@
 nManager
+, utils
 ) %7B%0A%0A   
@@ -2399,269 +2399,950 @@
 e = 
-orders.filter((%7B status %7D) =%3E status === 'Accepted');%0A                        const filled = orders.filter((%7B status %7D) =%3E status === 'Filled');%0A                        const others = orders.filter((%7B status %7D) =%3E status !== 'Accepted' && status !== 'Filled'
+%5B%5D;%0A                        const filled = %5B%5D;%0A                        const others = %5B%5D;%0A                        orders.forEach((order) =%3E %7B%0A                            switch (order.status) %7B%0A                                case 'Accepted':%0A                                    active.push(order);%0A                                    break;%0A                                case 'Filled':%0A                                    filled.push(order);%0A                                    break;%0A                                default:%0A                                    others.push(order);%0A                            %7D%0A                        %7D);%0A%0A                        active.sort(utils.comparators.process((%7B timestamp %7D) =%3E timestamp).desc);%0A                        filled.sort(utils.comparators.process((%7B timestamp %7D) =%3E timestamp).desc);%0A                        others.sort(utils.comparators.process((%7B timestamp %7D) =%3E timestamp).desc
 );%0A
+%0A
     
@@ -3498,16 +3498,16 @@
     %7D;%0A%0A
-
     cont
@@ -3584,16 +3584,25 @@
 Manager'
+, 'utils'
 %5D;%0A%0A    

fix myOrders