Commit d174a410cafb15cf5dc8e1e863807e67e1264909

Authored by Birendra Kumar
1 parent adc5afdd

CA Pending to complete

400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js
1 1 AIA.controller("CAController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "pages", "BodyRegions", "BodySystems", "MedicalSpecialties", "DataService",
2 2 function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout, pages, BodyRegions, BodySystems, MedicalSpecialties, DataService) {
3   - // $rootScope.currentActiveModuleTitle = pages[4].name;
  3 +
4 4 $scope.showTabButton = true;
5 5 $scope.AnimationData;
6 6 $scope.CAAllBodyRegion = [];
... ... @@ -26,8 +26,131 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
26 26 localStorage.setItem("currentCATabView", $scope.activeTab);
27 27 };
28 28  
29   - $scope.$on('$viewContentLoaded', function (event) {
  29 + $scope.initializeCAWindowData = function (windowviewid, isOpenWithExistsModule, cbwindowid) {
  30 + if (isOpenWithExistsModule || cbwindowid == 0) {
  31 + if ($rootScope.CAWindowData != undefined) {
  32 + $rootScope.CAWindowData.length = 0;
  33 + }
  34 + else {
  35 + $rootScope.CAWindowData = [];
  36 + }
  37 +
  38 + $rootScope.CAWindowData.push(
  39 + {
  40 + 'multiwinid': windowviewid,
  41 + 'AnimationData': [],
  42 + 'searchCAListViewData': [],
  43 + 'CAImagePath': '',
  44 + 'ImageSummary': '',
  45 + 'moduleName': '',
  46 + 'currentViewTitle': '',
  47 + 'parentSlugName': '',
  48 + 'currentSlug': '',
  49 + 'imageId': '',
  50 + 'imageName': '',
  51 + 'isShowBodyWithCBData': false
  52 + });
  53 +
  54 + }
  55 + else {
  56 + var isNewWindow = true;
  57 + for (var k = 0; k < $rootScope.CAWindowData.length; k++) {
  58 + if ($rootScope.CAWindowData[k].multiwinid == windowviewid) {
  59 + isNewWindow = false;
  60 + break;
  61 + }
  62 + }
  63 +
  64 + if (isNewWindow) {
  65 + $rootScope.CAWindowData.push(
  66 + {
  67 + 'multiwinid': windowviewid,
  68 + 'AnimationData': [],
  69 + 'searchCAListViewData': [],
  70 + 'CAImagePath': '',
  71 + 'ImageSummary': '',
  72 + 'moduleName': '',
  73 + 'currentViewTitle': '',
  74 + 'parentSlugName': '',
  75 + 'currentSlug': '',
  76 + 'imageId': '',
  77 + 'imageName': '',
  78 + 'isShowBodyWithCBData': false
  79 + });
  80 +
  81 + }
  82 + }
  83 + }
  84 +
  85 + $scope.GetCAwindowStoreData = function (windowviewid, keyname) {
  86 + for (var x = 0 ; x < $rootScope.CAWindowData.length; x++) {
  87 +
  88 + if ($rootScope.CAWindowData[x].multiwinid == windowviewid) {
  89 + return $rootScope.CAWindowData[x][keyname];
  90 + }
  91 + }
  92 + }
  93 +
  94 + $scope.SetCAwindowStoreData = function (windowviewid, keyname, value) {
  95 + for (var x = 0 ; x < $rootScope.CAWindowData.length; x++) {
  96 +
  97 + if ($rootScope.CAWindowData[x].multiwinid == windowviewid) {
  98 + $rootScope.CAWindowData[x][keyname] = value;
  99 + }
  100 + }
  101 + }
  102 +
  103 + $rootScope.GetCAWindowId = function () {
  104 + // handle for single window
  105 + if ($rootScope.CAWindowData.length > 0) {
  106 + for (var x = 0 ; x < $rootScope.CAWindowData.length; x++) {
  107 +
  108 + return $rootScope.CAWindowData[x].multiwinid;
  109 + }
  110 + }
  111 + else return 0;
  112 + }
  113 +
  114 + $scope.DisableUI = function () {
  115 +
  116 + var caImagePanelConetent = document.getElementsByClassName("jsPanel-content");
  117 + for (var i = 0; i < caImagePanelConetent.length; i++) {
  118 + caImagePanelConetent[i].style.pointerEvents = "none";
  119 + caImagePanelConetent[i].style.opacity = "0.7";
  120 +
  121 + }
  122 + $rootScope.isLoading = true;
  123 + $('#spinner').css('visibility', 'visible');
  124 +
  125 + // CB module disable all
  126 + $('#CBDetailPageDiv').css('pointer-events', 'none');
  127 + $('#CBDetailPageDiv').css('opacity', '0.7');
  128 + }
  129 +
  130 + $scope.EnableUI = function () {
  131 +
  132 + var caImagePanelConetent = document.getElementsByClassName("jsPanel-content");
  133 + for (var i = 0; i < caImagePanelConetent.length; i++) {
  134 + caImagePanelConetent[i].style.pointerEvents = "auto";
  135 + caImagePanelConetent[i].style.opacity = "1";
  136 + }
  137 +
  138 + $rootScope.isLoading = false;
  139 + $('#spinner').css('visibility', 'hidden');
  140 + // CB module enable all
  141 + $('#CBDetailPageDiv').css('pointer-events', 'auto');
  142 + $('#CBDetailPageDiv').css('opacity', '1');
  143 + }
  144 +
  145 + $scope.loadAIModuleById = function (moduleId) {
30 146  
  147 + $rootScope.isCallFromOtherModule = undefined;
  148 +
  149 + $rootScope.MULTI_VIEW_ID += 1
  150 +
  151 + $scope.initializeCAWindowData($rootScope.MULTI_VIEW_ID, true, undefined);
  152 +
  153 + $scope.DisableUI();
31 154  
32 155 if ($rootScope.refreshcheck == null) {
33 156 $location.path('/');
... ... @@ -46,8 +169,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
46 169 $rootScope.currentActiveModuleTitle = selectedModuleName;
47 170 })
48 171  
  172 + $scope.SetCAwindowStoreData($rootScope.MULTI_VIEW_ID, 'moduleName', "Clinical Illustrations");
49 173  
50   - $scope.LoadCAJsonData();
  174 + $scope.LoadCAJsonData($rootScope.MULTI_VIEW_ID);
51 175  
52 176 $scope.CAAllBodyRegion = BodyRegions;
53 177 $scope.CAAllBodySystem = BodySystems;
... ... @@ -57,34 +181,34 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
57 181 $rootScope.openModules.push({ "ModuleId": 5 });
58 182 //set the local storage
59 183  
  184 + setTimeout(function () {
60 185 var curtab = $rootScope.getLocalStorageValue("currentCATabView");
61   - //if (curtab == 2) {
62   - // $scope.setActiveTab(2);
63   - //}
  186 +
64 187 if (curtab == 2) {
65 188 $scope.setActiveTab(2);
66 189 var curSelectedRowId = $rootScope.getLocalStorageValue("CASelectedRowId");
67 190 if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') {
68   - $scope.reRunSearchOnLoad();
  191 + $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID);
69 192 $scope.idSelected = curSelectedRowId;
70   - $scope.ReloadListViewImageDiv($scope.idSelected);
  193 + $scope.ReloadListViewImageDiv($scope.idSelected, $rootScope.MULTI_VIEW_ID);
71 194 }
72 195 else {
73   - $scope.reRunSearchOnLoad()
  196 + $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID)
74 197 $scope.idSelected = '';
75 198 }
76 199 }
77 200 else {
78 201 $scope.setActiveTab(1);
79   - $scope.reRunSearchOnLoad();
  202 + $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID);
80 203  
81 204 }
82 205  
  206 + }, 200);
83 207  
84 208  
85   - });
  209 + };
86 210  
87   - $scope.reRunSearchOnLoad = function () {
  211 + $scope.reRunSearchOnLoad = function (windowviewid) {
88 212 var curBodyRegion = $rootScope.getLocalStorageValue("CACurBodyRegion");
89 213 if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') {
90 214 $scope.query.selectedbodyregion = curBodyRegion;
... ... @@ -111,7 +235,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
111 235  
112 236  
113 237 if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedspecialty == "") {
114   - $scope.loadAllCA();
  238 + $scope.loadAllCA(windowviewid);
115 239 }
116 240 else {
117 241 $scope.ApplySearch($scope.query);
... ... @@ -119,23 +243,25 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
119 243 }
120 244 }
121 245  
122   - $scope.LoadCAJsonData = function () {
  246 + $scope.LoadCAJsonData = function (windowviewid) {
123 247  
124 248 var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
125 249 promise.then(
126 250 function (result) {
127   - $scope.AnimationData = result;
128   - //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
  251 +
  252 + var AnimationData = new jinqJs()
  253 + .from(result.root.CAData)
  254 + .orderBy([{ field: '_Title', sort: 'asc' }])
  255 + .select();
129 256  
130   - $scope.selectedCAListViewData = new jinqJs()
131   - .from($scope.AnimationData.root.CAData)
132   - .orderBy([{ field: '_Title', sort: 'asc' }])
133   - .select();
  257 + $scope.SetCAwindowStoreData(windowviewid, 'AnimationData', AnimationData);
  258 +
  259 + $scope.selectedCAListViewData = IllustrationData;
134 260  
135   - //console.log($scope.selectedCAListViewData);
136 261  
137 262 },
138 263 function (error) {
  264 + $scope.EnableUI();
139 265 // handle errors here
140 266 console.log(' $scope.AnimationData = ' + error.statusText);
141 267 }
... ... @@ -144,59 +270,40 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
144 270  
145 271 };
146 272  
147   - $scope.loadAllCA = function () {
  273 + $scope.loadAllCA = function (windowviewid) {
148 274  
149   - var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
150   - promise.then(
151   - function (result) {
152   - $scope.AnimationData = result;
153   - //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
154   -
155   - $scope.selectedCAListViewData = new jinqJs()
156   - .from($scope.AnimationData.root.CAData)
157   - .orderBy([{ field: '_Title', sort: 'asc' }])
158   - .select();
  275 + $scope.selectedCAListViewData = $scope.GetCIwindowStoreData(windowviewid, 'AnimationData');
159 276  
160   - //console.log($scope.selectedCAListViewData);
  277 + $('#grid-view').empty();
161 278  
162   - $('#grid-view').empty();
  279 + angular.forEach($scope.selectedCAListViewData, function (value, key) {
  280 + var imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
163 281  
164   - angular.forEach($scope.selectedCAListViewData, function (value, key) {
165   - $scope.imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
166 282  
  283 + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="openView($event)">'
  284 + + '<div class="thumbnail" >'
  285 + + '<img id="' + value._Title + '" class="img-responsive" style="width:100%;height:100%;" ng-src="' + imagePath + '" alt="" title="" >'
  286 + + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
167 287  
168   - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="openView($event)">'
169   - + '<div class="thumbnail" >'
170   - + '<img id="' + value._Title + '" class="img-responsive" style="width:100%;height:100%;" ng-src="' + $scope.imagePath + '" alt="" title="" >'
171   - + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
  288 + $compile($el)($scope);
172 289  
  290 + $(".sidebar").mCustomScrollbar({
  291 + autoHideScrollbar: true,
  292 + //theme:"rounded"
  293 + });
173 294  
174   - $compile($el)($scope);
  295 + });
  296 + $('#' + $rootScope.getLocalStorageValue("currentBodyViewId")).find('.thumbnail').addClass('HightLightThumbnail');
  297 + $timeout(function () {
  298 + if ($rootScope.getLocalStorageValue('CAGridViewScroll') !== null && $location.url() == "/clinical-animations") {
175 299  
176   - $(".sidebar").mCustomScrollbar({
177   - autoHideScrollbar: true,
178   - //theme:"rounded"
179   - });
  300 + $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('CAGridViewScroll') }, 'slow');
  301 + }
  302 + },
  303 + 200);
180 304  
181   - });
182   - $('#' + $rootScope.getLocalStorageValue("currentBodyViewId")).find('.thumbnail').addClass('HightLightThumbnail');
183   - $timeout(function ()
184   - {
185   - if ($rootScope.getLocalStorageValue('CAGridViewScroll') !== null && $location.url() == "/clinical-animations")
186   - {
187   -
188   - $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('CAGridViewScroll') }, 'slow');
189   - }
190   - },
191   - 300);
192   -
193   - },
194   - function (error) {
195   - // handle errors here
196   - console.log(' $scope.AnimationData = ' + error.statusText);
197   - }
198   - );
199 305  
  306 + $timeout(function () { $scope.EnableUI(); }, 400);
200 307  
201 308 }
202 309  
... ... @@ -640,55 +747,38 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
640 747 $scope.videoNumber = vidNumber;
641 748 };
642 749  
643   - $scope.ReloadListViewImageDiv = function (id) {
  750 + $scope.ReloadListViewImageDiv = function (id, windowviewid) {
644 751 //console.log(id);
645 752 $scope.idSelected = id;
646 753 $scope.hiderow = true;
  754 + var AnimationData = $scope.GetCIwindowStoreData(windowviewid, 'AnimationData');
647 755  
648   - var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
649   - promise.then(
650   - function (result) {
651   - $scope.AnimationData = result;
652   - //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
653   -
654   - var SelectedCAthumbImage = [];
655   - SelectedCAthumbImage = new jinqJs()
656   - .from($scope.AnimationData.root.CAData)
657   - .where('_id = ' + id)
658   - .select('_ThumbnailImage', '_Summary', '_id', '_Title');
659   -
660   - //console.log($scope.selectedCAListViewData);
  756 + var SelectedCAthumbImage = [];
  757 + SelectedCAthumbImage = new jinqJs()
  758 + .from(AnimationData)
  759 + .where('_id = ' + id)
  760 + .select('_ThumbnailImage', '_Summary', '_id', '_Title');
661 761  
662   - $scope.SelectedCAthumbImage = "~/../content/images/ca/thumbnails/" + SelectedCAthumbImage[0]._ThumbnailImage;
  762 + $scope.SelectedCAthumbImage = "~/../content/images/ca/thumbnails/" + SelectedCAthumbImage[0]._ThumbnailImage;
663 763  
664   - $scope.SelectedCASummary = SelectedCAthumbImage[0]._Summary;
665   - $scope.SelectedCAId = SelectedCAthumbImage[0]._id;
666   - $scope.SelectedCATitle = SelectedCAthumbImage[0]._Title;
  764 + $scope.SelectedCASummary = SelectedCAthumbImage[0]._Summary;
  765 + $scope.SelectedCAId = SelectedCAthumbImage[0]._id;
  766 + $scope.SelectedCATitle = SelectedCAthumbImage[0]._Title;
667 767  
668   - //Set the scroll position of the tablebody to show selected row.
  768 +
  769 + //Set the scroll position of the tablebody to show selected row.
  770 + var curCAListViewScroll = $rootScope.getLocalStorageValue("CAListViewScroll");
  771 + if (typeof (curCAListViewScroll) !== "undefined" && curCAListViewScroll !== null && curCAListViewScroll !== '') {
  772 + if (typeof InstallTrigger !== 'undefined') {
669 773  
670   - var curCAListViewScroll = $rootScope.getLocalStorageValue("CAListViewScroll");
671   - if (typeof (curCAListViewScroll) !== "undefined" && curCAListViewScroll !== null && curCAListViewScroll !== '') {
672   - if (typeof InstallTrigger !== 'undefined') {
673   -
674   - $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("CAListViewScroll") });
  774 + $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("CAListViewScroll") });
675 775  
676   - }
677   - else
678   - {
679   - $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("CAListViewScroll"));
680   - }
681   - }
682   - //else {
683   - // $('#ListViewDiv').scrollTop(0);
684   - //}
685   -
686   - },
687   - function (error) {
688   - // handle errors here
689   - console.log(' $scope.AnimationData = ' + error.statusText);
690   - }
691   - );
  776 + }
  777 + else {
  778 + $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("CAListViewScroll"));
  779 + }
  780 + }
  781 +
692 782 };
693 783  
694 784 $scope.hideListViewDiv = function () {
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/ca/ca-view.html
1 1 
2 2 <div class="bodyWrap row ">
3 3 <div ng-include="'app/widget/MainMenu.html'" />
4   - <div class="main">
  4 + <div class="main" ng-init="loadAIModuleById(5)">
5 5 <div class="col-sm-12 stickey-area clsstickydiv">
6 6 <div class="breadcrumb">
7 7 <div class="row center-block">
... ...