diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js
index befa8c7..af95a8c 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js
@@ -13,62 +13,128 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, pages, B
$scope.SelectedCASummary = [];
$scope.filterstring = false;
$scope.query = {
- selectedbodyregion: null,
- selectedbodysystem: null,
- selectedspecialty: null,
+ selectedbodyregion: '',
+ selectedbodysystem: '',
+ selectedspecialty: '',
};
$scope.$on('$viewContentLoaded', function (event) {
// code that will be executed ...
// every time this view is loaded
+ $scope.LoadCAJsonData();
+
$scope.CAAllBodyRegion = BodyRegions;
$scope.CAAllBodySystem = BodySystems;
$scope.CAAllSpeciality = MedicalSpecialties;
$scope.scroll();
+ //set the local storage
+ var curBodyRegion = localStorage.getItem("CACurBodyRegion");
+ if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null) {
+ $scope.query.selectedbodyregion = curBodyRegion;
+ }
+ else {
+ $scope.query.selectedbodyregion = "";
+ }
+
+ var curBodySystem = localStorage.getItem("CACurBodySystem");
+ if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null) {
+ $scope.query.selectedbodysystem = curBodySystem;
+ }
+ else {
+ $scope.query.selectedbodysystem = "";
+ }
+
+ var curSpeciality = localStorage.getItem("CACurSpeciality");
+ if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null) {
+ $scope.query.selectedspecialty = curSpeciality;
+ }
+ else {
+ $scope.query.selectedspecialty = "";
+ }
+
+
+ if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedspecialty == "") {
+ $scope.loadAllCA();
+ }
+ else {
+ $scope.ApplySearch($scope.query);
+ }
+
+
});
- var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
- promise.then(
- function (result) {
- $scope.AnimationData = result;
- //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
+ $scope.LoadCAJsonData = function () {
+
+ var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
+ promise.then(
+ function (result) {
+ $scope.AnimationData = result;
+ //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
+
+ $scope.selectedCAListViewData = new jinqJs()
+ .from($scope.AnimationData.root.CAData)
+ .orderBy([{ field: '_Title', sort: 'asc' }])
+ .select();
- $scope.selectedCAListViewData = new jinqJs()
- .from($scope.AnimationData.root.CAData)
- .orderBy([{ field: '_Title', sort: 'asc' }])
- .select();
+ //console.log($scope.selectedCAListViewData);
- //console.log($scope.selectedCAListViewData);
+ },
+ function (error) {
+ // handle errors here
+ console.log(' $scope.AnimationData = ' + error.statusText);
+ }
+ );
- $('#grid-view').empty();
- angular.forEach($scope.selectedCAListViewData, function (value, key) {
- $scope.imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
+ };
+ $scope.loadAllCA = function () {
- var $el = $('
'
- + '
'
- + '
![]()
'
- + '
').appendTo('#grid-view');
+ var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
+ promise.then(
+ function (result) {
+ $scope.AnimationData = result;
+ //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
+
+ $scope.selectedCAListViewData = new jinqJs()
+ .from($scope.AnimationData.root.CAData)
+ .orderBy([{ field: '_Title', sort: 'asc' }])
+ .select();
+
+ //console.log($scope.selectedCAListViewData);
+
+ $('#grid-view').empty();
+ angular.forEach($scope.selectedCAListViewData, function (value, key) {
+ $scope.imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
- $compile($el)($scope);
- $(".sidebar").mCustomScrollbar({
- autoHideScrollbar: true,
- //theme:"rounded"
+ var $el = $(''
+ + '
'
+ + '
![]()
'
+ + '
').appendTo('#grid-view');
+
+
+ $compile($el)($scope);
+
+ $(".sidebar").mCustomScrollbar({
+ autoHideScrollbar: true,
+ //theme:"rounded"
+ });
+
});
- });
+ },
+ function (error) {
+ // handle errors here
+ console.log(' $scope.AnimationData = ' + error.statusText);
+ }
+ );
- },
- function (error) {
- // handle errors here
- console.log(' $scope.AnimationData = ' + error.statusText);
- }
- );
+
+ }
$scope.IsVisible = function () {
$scope.scroll();
@@ -113,32 +179,21 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, pages, B
$scope.Reset = function (query) {
- query.selectedbodyregion = null;
- query.selectedbodysystem = null;
- query.selectedspecialty = null;
+ query.selectedbodyregion = "";
+ query.selectedbodysystem = "";
+ query.selectedspecialty = "";
+
+ //set localstorage values
+ localStorage.setItem("CACurBodyRegion", query.selectedbodyregion);
+ localStorage.setItem("CACurBodySystem", query.selectedbodysystem);
+ localStorage.setItem("CACurSpeciality", query.selectedspecialty);
+
$scope.filterstring = false;
while ($scope.searchCAListViewData.length) {
$scope.searchCAListViewData.pop();
}
- $('#grid-view').empty();
-
- angular.forEach($scope.selectedCAListViewData, function (value, key) {
- $scope.imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
-
- var $el = $(''
- + '
'
- + '
![]()
'
- + '
').appendTo('#grid-view');
-
-
- $compile($el)($scope);
-
- $(".sidebar").mCustomScrollbar({
- autoHideScrollbar: true,
- //theme:"rounded"
- });
-
- });
+
+ $scope.loadAllCA();
}
@@ -150,106 +205,132 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, pages, B
$scope.searchCAListViewData.pop();
}
- $('#grid-view').empty();
+ //$('#grid-view').empty();
filtercount = 0;
if (typeof (query.selectedbodyregion) !== "undefined" && query.selectedbodyregion !== null) {
filtercount = filtercount + 1;
+ localStorage.setItem("CACurBodyRegion", query.selectedbodyregion);
}
if (typeof (query.selectedbodysystem) !== "undefined" && query.selectedbodysystem !== null) {
filtercount = filtercount + 1;
+ localStorage.setItem("CACurBodySystem", query.selectedbodysystem);
}
if (typeof (query.selectedspecialty) !== "undefined" && query.selectedspecialty !== null) {
filtercount = filtercount + 1;
+ localStorage.setItem("CACurSpeciality", query.selectedspecialty);
}
- angular.forEach($scope.selectedCAListViewData, function (value, key) {
+ var promise = DataService.getJson('~/../content/data/json/ca/ca_dat_contentlist.json')
+ promise.then(
+ function (result) {
+ $scope.AnimationData = result;
+ //$scope.selectedCAListViewData = $scope.AnimationData.root.CAData;
- var selectimg = true;
- var count = 0;
+ $scope.selectedCAListViewData = new jinqJs()
+ .from($scope.AnimationData.root.CAData)
+ .orderBy([{ field: '_Title', sort: 'asc' }])
+ .select();
+ //console.log($scope.selectedCAListViewData);
- if (typeof (query.selectedbodyregion) !== "undefined" && query.selectedbodyregion !== null) {
- var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim()));
- if (posbodyregion > -1) {
- selectimg = true;
- count = count + 1;
+ $('#grid-view').empty();
- }
- else {
- selectimg = false;
- count = count - 1;
- }
+ angular.forEach($scope.selectedCAListViewData, function (value, key) {
- }
+ var selectimg = true;
+ var count = 0;
- if (typeof (query.selectedbodysystem) !== "undefined" && query.selectedbodysystem !== null) {
- var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem);
- if (posbodysystem > -1) {
- count = count + 1;
- selectimg = true;
- } else {
- selectimg = false;
- count = count - 1;
- }
- }
- if (typeof (query.selectedspecialty) !== "undefined" && query.selectedspecialty !== null) {
- var posspeciality = value._MedicalSpecialty.indexOf(query.selectedspecialty);
- if (posspeciality > -1) {
- count = count + 1;
- selectimg = true;
- } else {
- selectimg = false;
- count = count - 1;
- }
+ if (typeof (query.selectedbodyregion) !== "undefined" && query.selectedbodyregion !== null) {
+ var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim()));
+ if (posbodyregion > -1) {
+ selectimg = true;
+ count = count + 1;
- }
+ }
+ else {
+ selectimg = false;
+ count = count - 1;
+ }
- if (selectimg === true && count >= filtercount) {
+ }
+ if (typeof (query.selectedbodysystem) !== "undefined" && query.selectedbodysystem !== null) {
+ var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem);
+ if (posbodysystem > -1) {
+ count = count + 1;
+ selectimg = true;
+ } else {
+ selectimg = false;
+ count = count - 1;
+ }
+ }
- $scope.imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
+ if (typeof (query.selectedspecialty) !== "undefined" && query.selectedspecialty !== null) {
+ var posspeciality = value._MedicalSpecialty.indexOf(query.selectedspecialty);
+ if (posspeciality > -1) {
+ count = count + 1;
+ selectimg = true;
+ } else {
+ selectimg = false;
+ count = count - 1;
+ }
- var $el = $(''
- + '
'
- + '
![]()
'
- + '
').appendTo('#grid-view');
+ }
+ if (selectimg === true && count >= filtercount) {
- $compile($el)($scope);
- $(".sidebar").mCustomScrollbar({
- autoHideScrollbar: true,
- //theme:"rounded"
- });
+ $scope.imagePath = "~/../content/images/ca/thumbnails/" + value._ThumbnailImage;
+ var $el = $(''
+ + '
'
+ + '
![]()
'
+ + '
').appendTo('#grid-view');
- $scope.searchCAListViewData.push(
- {
- "_id": value._id,
- "_ImageId": value._ImageId,
- "_Title": value._Title,
- "_Video": value._Video,
- "_ThumbnailImage": value._ThumbnailImage,
- "_BodySystem": value._BodySystem,
- "_BodyRegion": value._BodyRegion,
- "_MedicalSpecialty": value._MedicalSpecialty,
- "_Summary": value._Summary,
- "_LowerSummary": value._LowerSummary
- });
- }
+ $compile($el)($scope);
+ $(".sidebar").mCustomScrollbar({
+ autoHideScrollbar: true,
+ //theme:"rounded"
+ });
- });
- //Show Error Message in case of gridview if no data is found
- if ($scope.searchCAListViewData.length == 0) {
+ $scope.searchCAListViewData.push(
+ {
+ "_id": value._id,
+ "_ImageId": value._ImageId,
+ "_Title": value._Title,
+ "_Video": value._Video,
+ "_ThumbnailImage": value._ThumbnailImage,
+ "_BodySystem": value._BodySystem,
+ "_BodyRegion": value._BodyRegion,
+ "_MedicalSpecialty": value._MedicalSpecialty,
+ "_Summary": value._Summary,
+ "_LowerSummary": value._LowerSummary
+ });
+
+ }
+
+
+ });
+
+ //Show Error Message in case of gridview if no data is found
+ if ($scope.searchCAListViewData.length == 0) {
+
+ var $el = $('No animation found for the selected search criteria!
').appendTo('#grid-view');
+ $compile($el)($scope);
+ }
+
+ },
+ function (error) {
+ // handle errors here
+ console.log(' $scope.AnimationData = ' + error.statusText);
+ }
+ );
- var $el = $('No animation found for the selected search criteria!
').appendTo('#grid-view');
- $compile($el)($scope);
- }
}