Commit 86fd5ccd3fadca6c29825c0ac737e6afb564f1da
1 parent
4e8c3211
Pin Issue
Showing
1 changed file
with
228 additions
and
10 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
1 | - | ||
2 | -'use strict'; | 1 | +'use strict'; |
3 | 2 | ||
4 | -AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService", "ModuleService", | ||
5 | -function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService, ModuleService) { | 3 | +AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "DataService", "ModuleService", |
4 | +function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, BodyRegions, BodySystems, ViewOrientations, ImageTypes, DataService, ModuleService) { | ||
6 | 5 | ||
7 | 6 | ||
8 | $rootScope.OpenedTileData = []; | 7 | $rootScope.OpenedTileData = []; |
9 | var ATLAS_ANATOMY = 'Atlas Anatomy'; | 8 | var ATLAS_ANATOMY = 'Atlas Anatomy'; |
10 | var CLINICAL_ILLUSTRATION = 'Clinical Illustrations'; | 9 | var CLINICAL_ILLUSTRATION = 'Clinical Illustrations'; |
11 | var CLINICAL_ANIMATION = 'Clinical Animations'; | 10 | var CLINICAL_ANIMATION = 'Clinical Animations'; |
12 | - | 11 | + //variables to bind Filter by Controls |
12 | + $scope.searchAAListViewData = []; | ||
13 | + $scope.SelectedAAthumbImage = []; | ||
14 | + $scope.SelectedAAImage = []; | ||
15 | + $scope.SelectedAASummary = []; | ||
16 | + $scope.SelectedAAId = []; | ||
17 | + $scope.SelectedAATitle = []; | ||
18 | + $scope.selectedAAListViewData = []; | ||
19 | + $scope.filterstring = false; | ||
20 | + $scope.AllBodyRegion = []; | ||
21 | + $scope.AllBodySystem = []; | ||
22 | + $scope.AllOrientation = []; | ||
23 | + $scope.AllImageType = []; | ||
24 | + $scope.query = { | ||
25 | + selectedbodyregion: '', | ||
26 | + selectedbodysystem: '', | ||
27 | + selectedorientation: '', | ||
28 | + selectedimagetype: '', | ||
29 | + }; | ||
13 | $scope.loadForModuleById = function (moduleId) { | 30 | $scope.loadForModuleById = function (moduleId) { |
14 | 31 | ||
15 | $scope.moduleId = moduleId; | 32 | $scope.moduleId = moduleId; |
@@ -17,19 +34,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -17,19 +34,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
17 | console.log('loadForModuleById is called') | 34 | console.log('loadForModuleById is called') |
18 | $rootScope.moduleName = Modules[moduleId].Name; | 35 | $rootScope.moduleName = Modules[moduleId].Name; |
19 | 36 | ||
37 | + $scope.AllBodyRegion = BodyRegions; | ||
38 | + $scope.AllBodySystem = BodySystems; | ||
39 | + $scope.AllOrientation = ViewOrientations; | ||
40 | + $scope.AllImageType = ImageTypes; | ||
20 | var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName) | 41 | var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName) |
21 | - | ||
22 | .then( | 42 | .then( |
23 | function (result) { | 43 | function (result) { |
44 | + | ||
24 | $scope.moduleLandingData = result; | 45 | $scope.moduleLandingData = result; |
25 | 46 | ||
26 | - console.log(JSON.stringify(result, null, 4)); | 47 | + //console.log(JSON.stringify(result, null, 4)); |
27 | }, | 48 | }, |
28 | function (error) { | 49 | function (error) { |
29 | // handle errors here | 50 | // handle errors here |
30 | console.log(' error: ' + error.statusText); | 51 | console.log(' error: ' + error.statusText); |
31 | } | 52 | } |
32 | ) | 53 | ) |
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
33 | } | 58 | } |
34 | 59 | ||
35 | $scope.openModuleItemView = function (event) { | 60 | $scope.openModuleItemView = function (event) { |
@@ -54,9 +79,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -54,9 +79,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
54 | $location.url('/module-item-view'); | 79 | $location.url('/module-item-view'); |
55 | } | 80 | } |
56 | 81 | ||
57 | - | ||
58 | $scope.openModuleItem = function () { | 82 | $scope.openModuleItem = function () { |
59 | - debugger; | ||
60 | var jsContentURL; | 83 | var jsContentURL; |
61 | var moduleItemViewDivId; | 84 | var moduleItemViewDivId; |
62 | 85 | ||
@@ -190,8 +213,203 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -190,8 +213,203 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
190 | } | 213 | } |
191 | 214 | ||
192 | 215 | ||
216 | + $scope.FilterByImage = function (moduleId, query) { | ||
217 | + //alert(JSON.stringify(query)); | ||
218 | + $scope.moduleId = moduleId; | ||
219 | + | ||
220 | + console.log('loadForModuleById is called') | ||
221 | + $rootScope.moduleName = Modules[moduleId].Name; | ||
222 | + while ($scope.searchAAListViewData.length) { | ||
223 | + $scope.searchAAListViewData.pop(); | ||
224 | + } | ||
193 | 225 | ||
194 | -}]); | 226 | + var filtercount = 0; |
227 | + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { | ||
228 | + filtercount = filtercount + 1; | ||
229 | + localStorage.setItem("CurrentBodyRegion", query.selectedbodyregion); | ||
230 | + } | ||
231 | + else { | ||
232 | + localStorage.setItem("CurrentBodyRegion", ''); | ||
233 | + } | ||
234 | + | ||
235 | + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { | ||
236 | + filtercount = filtercount + 1; | ||
237 | + localStorage.setItem("CurrentBodySystem", query.selectedbodysystem); | ||
238 | + } | ||
239 | + else { | ||
240 | + localStorage.setItem("CurrentBodySystem", ''); | ||
241 | + } | ||
195 | 242 | ||
243 | + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) { | ||
244 | + filtercount = filtercount + 1; | ||
245 | + localStorage.setItem("CurrentOrientation", query.selectedorientation); | ||
246 | + } | ||
247 | + else { | ||
248 | + localStorage.setItem("CurrentOrientation", ''); | ||
249 | + } | ||
250 | + | ||
251 | + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) { | ||
252 | + filtercount = filtercount + 1; | ||
253 | + localStorage.setItem("CurrentImageType", query.selectedimagetype); | ||
254 | + } | ||
255 | + else { | ||
256 | + localStorage.setItem("CurrentImageType", ''); | ||
257 | + } | ||
258 | + | ||
259 | + var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName) | ||
260 | + .then( | ||
261 | + function (result) { | ||
262 | + alert("mukul"); | ||
263 | + // alert(JSON.stringify($scope.moduleLandingData)); | ||
264 | + $scope.moduleLandingData = result; | ||
265 | + $scope.selectedAAListViewData = new jinqJs() | ||
266 | + .from($scope.moduleLandingData.data.root.Item) | ||
267 | + //.orderBy([{ field: '_Title', sort: 'asc' }]) | ||
268 | + .select(); | ||
269 | + | ||
270 | + $('#grid-view').empty(); | ||
271 | + //alert(JSON.stringify($scope.selectedAAListViewData)) | ||
272 | + angular.forEach($scope.selectedAAListViewData, function (value, key) { | ||
273 | + | ||
274 | + var selectimg = true; | ||
275 | + var count = 0; | ||
276 | + | ||
277 | + | ||
278 | + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { | ||
279 | + var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim())); | ||
280 | + if (posbodyregion > -1) { | ||
281 | + selectimg = true; | ||
282 | + count = count + 1; | ||
283 | + | ||
284 | + } | ||
285 | + else { | ||
286 | + selectimg = false; | ||
287 | + count = count - 1; | ||
288 | + } | ||
289 | + | ||
290 | + } | ||
291 | + | ||
292 | + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { | ||
293 | + var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem); | ||
294 | + if (posbodysystem > -1) { | ||
295 | + count = count + 1; | ||
296 | + selectimg = true; | ||
297 | + } else { | ||
298 | + selectimg = false; | ||
299 | + count = count - 1; | ||
300 | + } | ||
301 | + } | ||
302 | + | ||
303 | + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) { | ||
304 | + var posorientation = value._ViewOrientation.indexOf(query.selectedorientation); | ||
305 | + if (posorientation > -1) { | ||
306 | + count = count + 1; | ||
307 | + selectimg = true; | ||
308 | + | ||
309 | + } else { | ||
310 | + selectimg = false; | ||
311 | + count = count - 1; | ||
312 | + } | ||
313 | + | ||
314 | + } | ||
315 | + | ||
316 | + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) { | ||
317 | + var posimagetype = value._ImageType.indexOf(query.selectedimagetype); | ||
318 | + if (posimagetype > -1) { | ||
319 | + count = count + 1; | ||
320 | + selectimg = true; | ||
321 | + | ||
322 | + } else { | ||
323 | + selectimg = false; | ||
324 | + count = count - 1; | ||
325 | + } | ||
326 | + | ||
327 | + } | ||
328 | + | ||
329 | + if (selectimg === true && count >= filtercount) { | ||
330 | + | ||
331 | + | ||
332 | + $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName; | ||
333 | + | ||
334 | + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-3" title = "' + value._Title + '" data-ng-click="openModuleItemView($event)">' | ||
335 | + + '<div class="thumbnail" >' | ||
336 | + + '<img class="tinyImg" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >' | ||
337 | + + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view'); | ||
338 | + | ||
339 | + | ||
340 | + $compile($el)($scope); | ||
341 | + | ||
342 | + $(".sidebar").mCustomScrollbar({ | ||
343 | + autoHideScrollbar: true, | ||
344 | + //theme:"rounded" | ||
345 | + }); | ||
346 | + | ||
347 | + | ||
348 | + $scope.searchAAListViewData.push( | ||
349 | + { | ||
350 | + "_id": value._id, | ||
351 | + "_ImageId": value._ImageId, | ||
352 | + "_Title": value._Title, | ||
353 | + "_ImageName": value._contentImage, | ||
354 | + "_TileImageName": value._ThumbnailImage, | ||
355 | + "_BodySystem": value._BodySystem, | ||
356 | + "_BodyRegion": value._BodyRegion, | ||
357 | + "_ViewOrientation": value._ViewOrientation, | ||
358 | + "_ImageType": value._ImageType | ||
359 | + //"$$hashKey": value._Summary | ||
360 | + | ||
361 | + }); | ||
362 | + | ||
363 | + } | ||
364 | + | ||
365 | + | ||
366 | + }); | ||
367 | + | ||
368 | + //Show Error Message in case of gridview if no data is found | ||
369 | + if ($scope.searchCIListViewData.length == 0) { | ||
370 | + | ||
371 | + var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view'); | ||
372 | + $compile($el)($scope); | ||
373 | + } | ||
374 | + console.log(JSON.stringify(result, null, 4)); | ||
375 | + }, | ||
376 | + function (error) { | ||
377 | + // handle errors here | ||
378 | + console.log(' error: ' + error.statusText); | ||
379 | + } | ||
380 | + ) | ||
381 | + | ||
382 | + } | ||
196 | 383 | ||
384 | + $scope.Reset = function (moduleId, query) { | ||
197 | 385 | ||
386 | + query.selectedbodyregion = ""; | ||
387 | + query.selectedbodysystem = ""; | ||
388 | + query.selectedorientation = ""; | ||
389 | + query.selectedimagetype = ""; | ||
390 | + query.selectedspecialty = ""; | ||
391 | + | ||
392 | + | ||
393 | + //set localstorage values | ||
394 | + localStorage.setItem("CurrentBodyRegion", ''); | ||
395 | + localStorage.setItem("CurrentBodySystem", ''); | ||
396 | + localStorage.setItem("CurrentOrientation", ''); | ||
397 | + localStorage.setItem("CurrentImageType", ''); | ||
398 | + //localStorage.setItem("CISelectedRowId", ""); | ||
399 | + //localStorage.setItem("CIListViewScroll", ''); | ||
400 | + | ||
401 | + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } | ||
402 | + | ||
403 | + $('#ListViewDiv').scrollTop(0); | ||
404 | + | ||
405 | + // $scope.HideListViewDiv(); | ||
406 | + | ||
407 | + $scope.filterstring = false; | ||
408 | + //while ($scope.searchCIListViewData.length) { | ||
409 | + // $scope.searchCIListViewData.pop(); | ||
410 | + //} | ||
411 | + | ||
412 | + $scope.FilterByImage(1, query); | ||
413 | + | ||
414 | + } | ||
415 | +}]); |