TileViewListController.js 4.48 KB
/// <reference path="../views/atlas-anatomy-detail.html" />
/// <reference path="../views/atlas-anatomy-detail.html" />
'use strict';

AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "$timeout", "Modules", "$routeParams", "DataService","ModuleService" ,
function ($scope, $rootScope, $compile, $http, $log, $location, BodyRegions, BodySystems, ViewOrientations, ImageTypes, $timeout, Modules, $routeParam, DataService,ModuleService)
{
    var ATLAS_ANATOMY = 'Atlas Anatomy';
    var CLINICAL_ILLUSTRATION ='Clinical Illustrations';
    var CLINICAL_ANIMATION='Clinical Animations';

    var moduleData = [];

    $scope.AllBodyRegion = [];
    $scope.AllBodySystem = [];
    $scope.AllOrientation = [];
    $scope.AllImageType = [];
    $scope.moduleData = [];
    $rootScope.moduleName;
    $rootScope.OpenItemImageName;

    $scope.test;

    $scope.loadForModuleById = function (moduleId) {

        $scope.moduleId = moduleId;

        console.log('loadForModuleById is called')
        $rootScope.moduleName = Modules[moduleId].Name;
        var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
      
            .then(
              function (result) {
                  $scope.moduleLandingData = result;             

                  console.log(JSON.stringify(result, null, 4));
              },
               function (error) {
                   // handle errors here
                   console.log(' error: ' + error.statusText);
               }
              )
    },    

   
    

    $scope.scroll = function () {
        $("html,body").scrollTop(0);
    }
    
    $scope.openModuleItem11 = function (event) {

        alert('hi');
       //// debugger;
        var moduleItemDataToBeSaved = event.target.id;
            
        var OpendTileData = [];

        OpendTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
       
     
        $location.url('/atlas-anatomy-detail');

    }

    $scope.openModuleItemView = function(event)
    {
        //alert('openModuleItemView is called')
        var moduleItemDataToBeSaved = event.target.id;

        var OpendTileData = [];

        OpendTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);

        $rootScope.OpenItemImageName = "../../../content/images/aa/images/" + OpendTileData[3];
        //alert('img Name: ' +$scope.OpenItemImageName);

        var u = $location.url();
        $location.url('/module-item-view');
    }

    

    $scope.getImgUrl = function () {

        alert('called...')
       // $scope.myImgUrl = $rootScope.OpenItemImageName;
        //alert('getImgurl: ' + $scope.myImgUrl);


    }

    $scope.openModuleItem = function (event)
    {
        alert($rootScope.OpenItemImageName);

        var OpendTileData = [];

      //  var moduleItemDataToBeSaved = event.target.id;
        //OpendTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);


        ////// debugger;
        //var moduleItemDataToBeSaved = event.target.id;

        //var OpendTileData = [];

        //OpendTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);

       // alert('img name before page: ' + $rootScope.OpenItemImageName);

        var url;

        

        if ($rootScope.moduleName == ATLAS_ANATOMY) {
            url = 'app/views/aa/atlas-anatomy-detail.html';
            $scope.test = url;
        }
        else if ($rootScope.moduleName == CLINICAL_ANIMATION) {
            //to do, in next phase of project 

        }
        else if ($rootScope.moduleName == CLINICAL_ILLUSTRATION) {
            //to do, in next phase of project

        }

        $.jsPanel({
            id: 'ImagePanel',
            selector: '.JsPannelContainer',
            theme: 'success',
            currentController: 'TileViewListController',
            parentSlug: 'tile-view-list',
            ajax: {
                url: url
            },

            title: localStorage.getItem("currentViewTitle"),

            position: {
                top: 70,
                left: 1,
            },

            size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },

        });


    }
   
}]);