var productsApp = angular.module('productsApp',
    [
        'ngRoute',
        'ngSanitize',
        'ngAnimate',
        'angularUtils.directives.dirPagination',
        angularDragula(angular),
        'layoutModule',
        'productsMainModule',
        'productsSearchModule',
        'dashboardModule',
        'paymentModule',
        'angular-md5',
        'toastr',
        'hl.sticky'
    ]).run(function($rootScope, $location) {
        $rootScope.location = $location;
    });

productsApp.config(function($routeProvider) {
    $routeProvider
      .when('/TYPE-:type,HP-:hp,DEPT-:department_id,SEARCH-:search', {
        controller: 'productsMainController'
      });
});

productsApp.config(function(toastrConfig) {
  angular.extend(toastrConfig, {
    timeOut: 0,
    extendedTimeOut: 0,
    showDelay: 200,
    hideDelay: 200,
    positionClass: 'toast-top-right toast-container-wide',
    toastClass: 'toast toast-dark',
    closeHtml: '<button><svg class="mt-4" style="fill: #fff;"  width="20" height="20" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd"><path d="M12 11.293l10.293-10.293.707.707-10.293 10.293 10.293 10.293-.707.707-10.293-10.293-10.293 10.293-.707-.707 10.293-10.293-10.293-10.293.707-.707 10.293 10.293z"/></svg></button>',
    closeButton: true,
    maxOpened: 1,
    autoDismiss: true
    // containerId: 'toast-container',
    // newestOnTop: true,
    // positionClass: 'toast-top-right',
    // preventDuplicates: false,
    // preventOpenDuplicates: false,
    // target: 'body'
  });
});

productsApp.config(['$httpProvider', function($httpProvider) {
  if (!$httpProvider.defaults.headers.get) {
      $httpProvider.defaults.headers.get = {};    
  }    

  // disable IE ajax request caching
  $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
  // other browsers
  $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
  $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';

  // Firefox & Android browser: enable communication between HTTP front-end & HTTPS back-end
  $httpProvider.defaults.useXDomain = true;
  // $httpProvider.defaults.withCredentials = true;
}]);