From 86fd5ccd3fadca6c29825c0ac737e6afb564f1da Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 May 2017 10:37:48 +0530 Subject: [PATCH] Pin Issue --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js | 238 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 228 insertions(+), 10 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index 03faead..7e48a14 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -1,15 +1,32 @@ - -'use strict'; +'use strict'; -AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService", "ModuleService", -function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService, ModuleService) { +AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "DataService", "ModuleService", +function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, BodyRegions, BodySystems, ViewOrientations, ImageTypes, DataService, ModuleService) { $rootScope.OpenedTileData = []; var ATLAS_ANATOMY = 'Atlas Anatomy'; var CLINICAL_ILLUSTRATION = 'Clinical Illustrations'; var CLINICAL_ANIMATION = 'Clinical Animations'; - + //variables to bind Filter by Controls + $scope.searchAAListViewData = []; + $scope.SelectedAAthumbImage = []; + $scope.SelectedAAImage = []; + $scope.SelectedAASummary = []; + $scope.SelectedAAId = []; + $scope.SelectedAATitle = []; + $scope.selectedAAListViewData = []; + $scope.filterstring = false; + $scope.AllBodyRegion = []; + $scope.AllBodySystem = []; + $scope.AllOrientation = []; + $scope.AllImageType = []; + $scope.query = { + selectedbodyregion: '', + selectedbodysystem: '', + selectedorientation: '', + selectedimagetype: '', + }; $scope.loadForModuleById = function (moduleId) { $scope.moduleId = moduleId; @@ -17,19 +34,27 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log('loadForModuleById is called') $rootScope.moduleName = Modules[moduleId].Name; + $scope.AllBodyRegion = BodyRegions; + $scope.AllBodySystem = BodySystems; + $scope.AllOrientation = ViewOrientations; + $scope.AllImageType = ImageTypes; var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName) - .then( function (result) { + $scope.moduleLandingData = result; - console.log(JSON.stringify(result, null, 4)); + //console.log(JSON.stringify(result, null, 4)); }, function (error) { // handle errors here console.log(' error: ' + error.statusText); } ) + + + + } $scope.openModuleItemView = function (event) { @@ -54,9 +79,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $location.url('/module-item-view'); } - $scope.openModuleItem = function () { - debugger; var jsContentURL; var moduleItemViewDivId; @@ -190,8 +213,203 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + $scope.FilterByImage = function (moduleId, query) { + //alert(JSON.stringify(query)); + $scope.moduleId = moduleId; + + console.log('loadForModuleById is called') + $rootScope.moduleName = Modules[moduleId].Name; + while ($scope.searchAAListViewData.length) { + $scope.searchAAListViewData.pop(); + } -}]); + var filtercount = 0; + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { + filtercount = filtercount + 1; + localStorage.setItem("CurrentBodyRegion", query.selectedbodyregion); + } + else { + localStorage.setItem("CurrentBodyRegion", ''); + } + + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { + filtercount = filtercount + 1; + localStorage.setItem("CurrentBodySystem", query.selectedbodysystem); + } + else { + localStorage.setItem("CurrentBodySystem", ''); + } + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) { + filtercount = filtercount + 1; + localStorage.setItem("CurrentOrientation", query.selectedorientation); + } + else { + localStorage.setItem("CurrentOrientation", ''); + } + + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) { + filtercount = filtercount + 1; + localStorage.setItem("CurrentImageType", query.selectedimagetype); + } + else { + localStorage.setItem("CurrentImageType", ''); + } + + var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName) + .then( + function (result) { + alert("mukul"); + // alert(JSON.stringify($scope.moduleLandingData)); + $scope.moduleLandingData = result; + $scope.selectedAAListViewData = new jinqJs() + .from($scope.moduleLandingData.data.root.Item) + //.orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); + + $('#grid-view').empty(); + //alert(JSON.stringify($scope.selectedAAListViewData)) + angular.forEach($scope.selectedAAListViewData, function (value, key) { + + var selectimg = true; + var count = 0; + + + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { + var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim())); + if (posbodyregion > -1) { + selectimg = true; + count = count + 1; + + } + else { + selectimg = false; + count = count - 1; + } + + } + + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { + var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem); + if (posbodysystem > -1) { + count = count + 1; + selectimg = true; + } else { + selectimg = false; + count = count - 1; + } + } + + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) { + var posorientation = value._ViewOrientation.indexOf(query.selectedorientation); + if (posorientation > -1) { + count = count + 1; + selectimg = true; + + } else { + selectimg = false; + count = count - 1; + } + + } + + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) { + var posimagetype = value._ImageType.indexOf(query.selectedimagetype); + if (posimagetype > -1) { + count = count + 1; + selectimg = true; + + } else { + selectimg = false; + count = count - 1; + } + + } + + if (selectimg === true && count >= filtercount) { + + + $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName; + + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); + + + $compile($el)($scope); + + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); + + + $scope.searchAAListViewData.push( + { + "_id": value._id, + "_ImageId": value._ImageId, + "_Title": value._Title, + "_ImageName": value._contentImage, + "_TileImageName": value._ThumbnailImage, + "_BodySystem": value._BodySystem, + "_BodyRegion": value._BodyRegion, + "_ViewOrientation": value._ViewOrientation, + "_ImageType": value._ImageType + //"$$hashKey": value._Summary + + }); + + } + + + }); + + //Show Error Message in case of gridview if no data is found + if ($scope.searchCIListViewData.length == 0) { + + var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); + $compile($el)($scope); + } + console.log(JSON.stringify(result, null, 4)); + }, + function (error) { + // handle errors here + console.log(' error: ' + error.statusText); + } + ) + + } + $scope.Reset = function (moduleId, query) { + query.selectedbodyregion = ""; + query.selectedbodysystem = ""; + query.selectedorientation = ""; + query.selectedimagetype = ""; + query.selectedspecialty = ""; + + + //set localstorage values + localStorage.setItem("CurrentBodyRegion", ''); + localStorage.setItem("CurrentBodySystem", ''); + localStorage.setItem("CurrentOrientation", ''); + localStorage.setItem("CurrentImageType", ''); + //localStorage.setItem("CISelectedRowId", ""); + //localStorage.setItem("CIListViewScroll", ''); + + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } + + $('#ListViewDiv').scrollTop(0); + + // $scope.HideListViewDiv(); + + $scope.filterstring = false; + //while ($scope.searchCIListViewData.length) { + // $scope.searchCIListViewData.pop(); + //} + + $scope.FilterByImage(1, query); + + } +}]); -- libgit2 0.21.4