AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile",
function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) {
$rootScope.currentActiveModuleTitle = pages[5].name;
$scope.showTabButton = false;
$scope.threeDAnatomyData;
$scope.Id;
$scope.$on('$viewContentLoaded', function (event) {
if ($rootScope.refreshcheck == null) {
$location.path('/');
}
$scope.scroll();
var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')
promise.then(
function (result) {
$scope.threeDAnatomyData = result;
// $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData;
$scope.selectedThreeDAdata = new jinqJs()
.from($scope.threeDAnatomyData.root.ThreeDAData)
.orderBy([{ field: '_Title', sort: 'asc' }])
.select();
// console.log($scope.selectedCIListViewData);
$('#grid-view').empty();
angular.forEach($scope.selectedThreeDAdata, function (value, key) {
$scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage;
var $el = $('
'
+ '
'
+ '
![' + value._Title + ']()
'
+ '
').appendTo('#grid-view');
$compile($el)($scope);
$(".sidebar").mCustomScrollbar({
autoHideScrollbar: true,
//theme:"rounded"
});
});
},
function (error) {
// handle errors here
console.log(' $scope.threeDAnatomyData = ' + error.statusText);
}
);
});
$scope.scroll = function () {
// $window.scrollTo(0, 0);
$("html,body").scrollTop(0);
//alert("scroll");
}
$scope.IsVisible = function () {
//$scope.scroll();
$location.url("/3dAnatomy");
}
$scope.Open3DModel = function ($event) {
$rootScope.currentBodyViewId = $event.currentTarget.id;
if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") {
var ThreeDTitle = [];
ThreeDTitle = new jinqJs()
.from($scope.selectedThreeDAdata)
.where('_id = ' + $event.currentTarget.id)
.select('_Title');
$rootScope.ViewTitle = ThreeDTitle[0]._Title;
}
else {
$rootScope.ViewTitle = $event.currentTarget.textContent;
}
localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle);
localStorage.setItem("currentBodyViewId", $event.currentTarget.id);
var u = $location.url();
$location.url('/3d-anatomy-details');
}
$scope.Open3DModelBody = function () {
if ($rootScope.refreshcheck == null) {
$location.path('/');
}
$rootScope.isLoading = true;
$('#spinner').css('visibility', 'visible');
//alert($rootScope.getLocalStorageValue("currentBodyViewId"));
$scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId");
//alert($scope.voId3D);
//once you get id in scope push detail in jspanel content
var openViews;
if ($rootScope.openViews.length > 0) {
openViews = new jinqJs()
.from($rootScope.openViews)
.where("BodyViewId==" + $scope.voId3D)
.select();
}
var counter = 1;
var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson");
if (openViews != null && openViews.length > 0) {
angular.forEach(openViews, function (value, key) {
if (value.body - views == tittle) {
tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++;
$rootScope.currentActiveViewTitle = tittle;
localStorage.setItem("currentViewTitle", tittle);
}
});
}
else {
localStorage.setItem("currentViewTitle", tittle);
}
// alert($rootScope.getLocalStorageValue("currentViewTitle"));
var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')
promise.then(
function (result) {
$scope.threeDAnatomyData = result;
var clicked3dAview = [];
clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData)
.where('_id == ' + $scope.voId3D)
.select('_Title', '_3dimagepath');
$scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath;
$scope.threeDBodySystemTitle = clicked3dAview[0]._Title;
if (clicked3dAview.length > 0) {
$rootScope.isLoading = false;
$('#spinner').css('visibility', 'hidden');
$.jsPanel({
id: '3DImagePanel',
selector: '.threeDView',
theme: 'success',
currentController: '3dAController',
parentSlug: '3d-anatomy-list',
content: '' +
'' +
'
',
title: $rootScope.getLocalStorageValue("currentViewTitle"),
position: {
top: 70,
left: 1,
},
size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 },
});
$rootScope.currentSlug = '3d-anatomy-details';
$rootScope.openViews.push(
{
"module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,
"slug": $rootScope.currentSlug
});zz
}
},
function (error) {
// handle errors here
console.log(' $scope.CIllustrationData = ' + error.statusText);
}
);
$('#ThreeDView').css("height", $(window).outerHeight());
$('#ThreeDView').css("width", $(window).outerWidth());
}
}]
);