Blame view

app/scripts/config.js 9.79 KB
e4e496d13   Rishav   setup admin acufu...
1
  /**
9835dbe3e   Rishav   module name changes
2
   * Acuefuel - Responsive Admin Theme
e4e496d13   Rishav   setup admin acufu...
3
   *
9835dbe3e   Rishav   module name changes
4
   * Acuefuel theme use AngularUI Router to manage routing and views
e4e496d13   Rishav   setup admin acufu...
5
6
7
8
9
   * Each view are defined as state.
   * Initial there are written stat for all view in theme.
   *
   */
  function config($stateProvider, $urlRouterProvider) {
5c6477d3d   Rishav   Admin Acufuel set...
10
      $urlRouterProvider.otherwise("/login");
e4e496d13   Rishav   setup admin acufu...
11
12
13
  
      $stateProvider
  
5c6477d3d   Rishav   Admin Acufuel set...
14
15
16
17
18
19
20
          .state('login', {
              //abstract: true,
              url: "/login",
              templateUrl: "views/login/login.html",
              controller: 'LoginController'
          })
  
e4e496d13   Rishav   setup admin acufu...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
          .state('index', {
              abstract: true,
              url: "/index",
              templateUrl: "views/common/content.html",
          })
          .state('index.dashboard', {
              url: "/dashboard",
              templateUrl: "views/fbo-admin/dashboard.html",
              controller: 'DashboardController'
          })
          .state('index.flight', {
              url: "/flight",
              templateUrl: "views/fbo-flight/flight.html",
              controller: 'FlightDeptController'
          })
5c6477d3d   Rishav   Admin Acufuel set...
36
37
38
39
40
          .state('index.updateAirports', {
              url: "/updateAirports",
              templateUrl: "views/update-airports/update-airports.html",
              controller: 'updateAirportController'
          })
e4e496d13   Rishav   setup admin acufu...
41
42
43
44
45
          .state('index.minor', {
              url: "/minor",
              templateUrl: "views/minor.html",
              data: { pageTitle: 'Example view' }
          })
7379f005b   Rishav   FBO client page d...
46
47
48
49
50
          .state('index.updateFBO', {
              url: "/updateFBO/:id",
              templateUrl: "views/updateAllFBO/updateAllFBO.html",
              controller: 'updateAllFBOController'
          })
a80703599   Rishav   FBO department fu...
51
52
53
54
55
          .state('index.updateFBODept', {
              url: "/updateFBODept/:id",
              templateUrl: "views/updateFBODept/updateFBODept.html",
              controller: 'updateFBODeptController'
          })
20857569f   Rishav   update pages as r...
56
57
58
59
60
61
62
          // .state('index.fboClients', {
          //     url: "/fboClients",
          //     templateUrl: "views/fbo-Clients/fboClients.html",
          //     controller: 'fboClientsController'
          // })
          .state('index.fboAdmin', {
              url: "/fboAdmin",
7379f005b   Rishav   FBO client page d...
63
64
65
              templateUrl: "views/fbo-Clients/fboClients.html",
              controller: 'fboClientsController'
          })
20857569f   Rishav   update pages as r...
66
67
68
69
70
          .state('index.flightDept', {
              url: "/flightDept",
              templateUrl: "views/flightDept/flightDept.html",
              controller: 'flightDeptController'
          })
e4e496d13   Rishav   setup admin acufu...
71
72
  }
  angular
9835dbe3e   Rishav   module name changes
73
      .module('acuefuel')
e4e496d13   Rishav   setup admin acufu...
74
      .config(config)
47541162e   Mr. Hot Foods   airport upload pr...
75
      .run(['$rootScope', '$state', 'UpdateAirportService', function($rootScope, $state, UpdateAirportService) {
e4e496d13   Rishav   setup admin acufu...
76
          $rootScope.$state = $state;
47541162e   Mr. Hot Foods   airport upload pr...
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
          $rootScope.record = {}
          
  
          // var progress1 = "";
          // $(document).ready(function() {
          //     progress1 = setInterval(function(){ 
          //         progressBar();
          //     }, 3000);
  
          //     function progressBar(){
          //         setInterval (function(){
          //             $('.progress .progress-bar').progressbar({
          //                 display_text: 'none'
          //             });
          //         },1)   
          //     }
          // });
  
          getAllUploadProgress();
          function getAllUploadProgress() {
  		UpdateAirportService.getAllUploadProgress().then(function(result) {
  			console.log("all results ",result)
  			for(var i =0 ; i<result.length; i++){
  				if(result[i].filetype == 'Airports'){
  					$rootScope.record.AirportCount = result[i].progress
  					$rootScope.record.AirportStatus = result[i].status
  				}
  				else if(result[i].filetype == 'Countries'){
  					$rootScope.record.CountriesCount = result[i].progress
  					$rootScope.record.CountriesStatus = result[i].status
  				}
  				else if(result[i].filetype == 'SubdivisionStates'){
  					$rootScope.record.SubdivisionStatesCount = result[i].progress
  					$rootScope.record.SubdivisionStatesStatus = result[i].status
  				}
  				else if(result[i].filetype == 'FBOHandlerDetail'){
  					$rootScope.record.FBOHandlerDetailCount = result[i].progress
  					$rootScope.record.FBOHandlerDetailStatus = result[i].status
  				}
  				else if(result[i].filetype == 'SupplierDetail'){
  					$rootScope.record.SupplierDetailCount = result[i].progress
  					$rootScope.record.SupplierDetailStatus = result[i].status
  
  				}
  			}
  			
  		})
  
  	}	
  	
  
  
          var filetypeA = localStorage.getItem('filetypeA')
          var filetypeC = localStorage.getItem('filetypeC')
          var filetypeSS = localStorage.getItem('filetypeSS')
          var filetypeFBO = localStorage.getItem('filetypeFBO')
          var filetypeSD = localStorage.getItem('filetypeSD')
          
          if(filetypeA != null)
          var uploadStatusA =filetypeA.split(",")[1];
          if(filetypeC != null)
          var uploadStatusC =filetypeC.split(",")[1];
          if(filetypeSS != null)
          var uploadStatusSS =filetypeSS.split(",")[1];
          if(filetypeFBO != null)
          var uploadStatusFBO =filetypeFBO.split(",")[1];
          if(filetypeSD != null)
          var uploadStatusSD =filetypeSD.split(",")[1];
  
          
  
          if(uploadStatusA != 'Completed' || uploadStatusC != 'Completed' || uploadStatusSS != 'Completed' || uploadStatusFBO != 'Completed' || uploadStatusSD != 'Completed'){
              var uploadProgress = setInterval(function(){ 
                  uploadData();
              }, 500);
          
              function uploadData() {
                  if(filetypeA != null &&  filetypeA.split(",")[0] == 'Airports'){
                  UpdateAirportService.getUploadProgress(filetypeA.split(",")[0]).then(function(result) {
                          if(result != null){
                            $rootScope.record.AirportCount = result.progress
                            $rootScope.record.AirportStatus = result.status
                                  if($rootScope.record.AirportStatus == 'Completed' || $rootScope.record.AirportStatus == 'Error'){
                                  $rootScope.showAirports = true;
                                  localStorage.removeItem('filetypeA');
                                  localStorage.removeItem('airportLoader');
                              }
                          }
                      })
                  }
                  if(filetypeC != null && filetypeC.split(",")[0] == 'Countries'){
                  UpdateAirportService.getUploadProgress(filetypeC.split(",")[0]).then(function(result) {
                          if(result != null){
                            $rootScope.record.CountriesCount = result.progress
                            $rootScope.record.CountriesStatus = result.status
                                  if($rootScope.record.CountriesStatus == 'Completed' || $rootScope.record.CountriesStatus == 'Error'){
                                  $rootScope.showCountries = true;
                                  localStorage.removeItem('filetypeC');
                                  localStorage.removeItem('countryLoader');
                                   }
                                   
                               }
                      })
                  }
                  if(filetypeSS != null &&  filetypeSS.split(",")[0] == 'SubdivisionStates'){
                  UpdateAirportService.getUploadProgress(filetypeSS.split(",")[0]).then(function(result) {
                          if(result != null){
                            $rootScope.record.SubdivisionStatesCount = result.progress
  	 				      $rootScope.record.SubdivisionStatesStatus = result.status
                                  if($rootScope.record.SubdivisionStatesStatus == 'Completed' || $rootScope.record.SubdivisionStatesStatus == 'Error'){
                                  $rootScope.subDivState = true;
                                  localStorage.removeItem('filetypeSS');
                                  localStorage.removeItem('subDivStateLoader');
                              }
                          }
                      })
                  }
                  if(filetypeFBO != null &&  filetypeFBO.split(",")[0] == 'FBOHandlerDetail'){
                  UpdateAirportService.getUploadProgress(filetypeFBO.split(",")[0] ).then(function(result) {
                          if(result != null){
                             $rootScope.record.FBOHandlerDetailCount = result.progress
  	  			           $rootScope.record.FBOHandlerDetailStatus = result.status
                                  if($rootScope.record.FBOHandlerDetailStatus == 'Completed' || $rootScope.record.FBOHandlerDetailStatus == 'Error'){
                                  $rootScope.fboHandlerDetail = true;
                                  localStorage.removeItem('filetypeFBO');
                                  localStorage.removeItem('fboHandleLoader');
                              }
                          }
                      })
                  }
                  if(filetypeSD != null &&  filetypeSD.split(",")[0] == 'SupplierDetail'){
                  UpdateAirportService.getUploadProgress(filetypeSD.split(",")[0]).then(function(result) {
                          if(result != null){
                            $rootScope.record.SupplierDetailCount = result.progress
  					      $rootScope.record.SupplierDetailStatus = result.status
                                  if($rootScope.record.SupplierDetailStatus == 'Completed' || $rootScope.record.SupplierDetailStatus == 'Error'){
                                  $rootScope.suppDetail = true;
                                  localStorage.removeItem('filetypeSD');
                                  localStorage.removeItem('suppDetailLoader');
                              }
                          }
                      })
                  }
              }
          }else if(uploadStatusA == 'Completed' || uploadStatusC == 'Completed' || uploadStatusSS == 'Completed' || uploadStatusFBO == 'Completed' || uploadStatusSD == 'Completed'){
              clearInterval(uploadProgress);
          }
          
      }]);