text: (function () {
    'use strict';
  
    angular
      .module('orders')
      .config(routeConfig);
  
    routeConfig.$inject = ['$stateProvider'];
  
    function routeConfig($stateProvider) {
      $stateProvider
        .state('orders', {
          abstract: true,
          url: '/orders',
          template: '<ui-view/>'
        })
        .state('orders.list', {
          url: '',
          templateUrl: 'modules/orders/views/list-orders.client.view.html',
          controller: 'OrdersListController',
          controllerAs: 'vm',
          data: {
            pageTitle: 'Orders List'
          }
        })
        .state('orders.create', {
          url: '/create',
          templateUrl: 'modules/orders/views/form-order.client.view.html',
          controller: 'OrdersController',
          controllerAs: 'vm',
          resolve: {
            orderResolve: newOrder
          },
          data: {
            roles: ['user', 'admin'],
            pageTitle: 'Orders Create'
          }
        })
        .state('orders.edit', {
          url: '/:orderId/edit',
          templateUrl: 'modules/orders/views/form-order.client.view.html',
          controller: 'OrdersController',
          controllerAs: 'vm',
          resolve: {
            orderResolve: getOrder
          },
          data: {
            roles: ['user', 'admin'],
            pageTitle: 'Edit Order {{ orderResolve.name }}'
          }
        })
        .state('orders.view', {
          url: '/:orderId',
          templateUrl: 'modules/orders/views/view-order.client.view.html',
          controller: 'OrdersController',
          controllerAs: 'vm',
          resolve: {
            orderResolve: getOrder
          },
          data: {
            pageTitle: 'Order {{ orderResolve.name }}'
          }
        });
    }
  
    getOrder.$inject = ['$stateParams', 'OrdersService'];
  
    function getOrder($stateParams, OrdersService) {
      return OrdersService.get({
        orderId: $stateParams.orderId
      }).$promise;
    }
  
    newOrder.$inject = ['OrdersService'];
  
    function newOrder(OrdersService) {
      return new OrdersService();
    }
  }());
  