var page = "order.html";
var orderApp = angular.module('orderApp', ['menuController', 'ordersService', 'orderstatusesService', 'ordertypesService', 'servicesService', 'tabSlideBox',//
    'notifiesCtrl','soundsService','AppointmentsController','customertypesService','jobsitesService','listviewusersService','flagsService',
    'chatApp', 'leadsourcesService','groupsService','tasksService','ivh.treeview','customerfilesService',
    'chatsettingsService','appointmentchecklistsService','callaheadsService','flexiblecustomersService','opportunitiesService',
    'userchatstatusesService','appointmentsService','appointmentstatusesService','checklistsService','checklistController',
    'pricebooksService', 'usersService', 'estimateCtrl', 'invoiceCtrl', 'dynamicNumber','customersService','ngTagsInput','saleorderService']);

orderApp.run(function ($ionicPlatform) {
    $ionicPlatform.ready(function () {
        var devicePlatform = "";
        try {
            devicePlatform = device.platform;
        } catch (err) {
            console.log(err)
        }
        if (devicePlatform != "iPhone" && devicePlatform != "iOS") {
            // $scope.deviceLoading = "ios";
            isiOs = false;
        }
        //ionic.Platform.fullScreen();
        // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
        // for form inputs)
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
            cordova.plugins.Keyboard.disableScroll(true);
        }
        if (window.StatusBar) {
            // org.apache.cordova.statusbar required
            // StatusBar.styleDefault();
            StatusBar.show();
            StatusBar.backgroundColorByHexString("#327EBB");
            StatusBar.styleLightContent();
            //StatusBar.hide();
            StatusBar.overlaysWebView(false);
        }
    });
});

orderApp.config(function ($stateProvider, $urlRouterProvider) {
    $stateProvider

        /*/////////////////////// USERS ///////////////////////////*/

      .state('dashboard', {
          url: '/board',
          abstract: true,
          templateUrl: 'templates/dashboard/general/menu.html',
          controller: 'menuCtrl'
      })
            // .state('dashboard.order', {
            //     url: '/order',
            //     views: {
            //         'menuContent': {
            //             templateUrl: 'templates/dashboard/order/order.tpl',
            //             controller: 'orderCtrl'
            //         }
            //     }
            // })
            .state('dashboard.order-tranform', {
                url: '/order/:customersID/:orderID/:style/:backPage/:appID',
                views: {
                    'menuContent': {
                        templateUrl: 'templates/dashboard/order/order.tpl',
                        controller: 'orderCtrl'
                    }
                }
            })
    // if none of the above states are matched, use this as the fallback
    $urlRouterProvider.otherwise('/board/order');
});
