TileViewListController.js 6.06 KB
'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 = [];

    $scope.loadForModuleById = function (moduleId) {

        $scope.moduleId = moduleId;

        console.log('loadForModuleById is called')
        $scope.moduleName = Modules[moduleId].Name;

        //$scope.loadDataForModule($scope.moduleName);

        var data = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName);

       // alert(data);
    }

    $scope.$on('SendTileDataEvent', function (event, data) {


        alert($rootScope.tileHTML);
      
    })

    //  var abc=  ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
    //       abc.then(
    //        function (result) {
    //            var data = result;
    //            alert('returned data: ' + data);
              
    //        },
    //         function (error) {
    //              alert('returned error: ' + abc);
    //             console.log(' $rootScope.TermNumberData= ' + error.statusText);
    //         }
    //        )
    //};
    
    //$scope.loadDataForModule = function (moduleName)
    //{

    //    //0. load filter static data

    //    $scope.AllBodyRegion = BodyRegions;
    //    $scope.AllBodySystem = BodySystems;
    //    $scope.AllOrientation = ViewOrientations;
    //    $scope.AllImageType = ImageTypes;

    //    //1. load dynamic data for module specific images
    //    var jsonPath;
    //    if(moduleName==ATLAS_ANATOMY)
    //    {
    //        jsonPath ='~/../content/data/json/aa/aa_dat_contentlist.json';
    //    }
    //    else if(moduleName == CLINICAL_ANIMATION)
    //    {
    //        //to do, in next phase of project 
    //        jsonPath ='~/../content/data/json/ca/ca_dat_contentlist.json';           
    //    }
    //    else if(moduleName == CLINICAL_ILLUSTRATION)
    //    {
    //        //to do, in next phase of project
    //        jsonPath ='~/../content/data/json/ci/ci_dat_contentlist.json';
    //    }

    //     var  promise  = DataService.getJson(jsonPath)
    //        promise.then(
    //                  function (result) {
    //                      $scope.AtlasAnatomyData = result;
                         
    //                      $scope.data = new jinqJs()
    //                          .from($scope.AtlasAnatomyData.root.Item)
    //                                                      .orderBy([{ field: '_Title', sort: 'asc' }])
    //                                                      .select();

    //                      //console.log($scope.selectedCIListViewData);
    //                      //$('#grid-view').empty();
    //                      angular.forEach($scope.data, function (value, key)
    //                      {
    //                         // $rootScope.moduleData = [];
    //                          $scope.moduleData.push({ "id": value._Id, "imageID": value._ImageId, "TileName": value._TileImageName, "DivImageTitle": value._Title });
    //                      //    $scope.moduleData.push(value._ImageId);
    //                     //     $scope.moduleData.push(value._TileImageName);
                                        
    //                          $scope.ImageName = value._TileImageName;
    //                          $scope.imagePath = "~/../content/images/aa/thumbnails/" + value._TileImageName;
    //                          $scope.TileViewId = value._Id;

    //                          var $el = $('<div id="' + value._Id + '" class="col-sm-3 col-md-3" title = "' + value._Title + '" data-ng-click="openModuleItem()">'
    //                              + '<div class="thumbnail" >'
    //                                         + '<img class="tinyImg" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
    //                                         + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');


    //                          $compile($el)($scope);

    //                          //$(".sidebar").mCustomScrollbar({
    //                          //    autoHideScrollbar: true,
    //                          //    //theme:"rounded"
    //                          //});


    //                      });

    //                      $scope.scroll();

    //                  },
    //                  function (error) {
    //                      // handle errors here
    //                      console.log(' $scope.IllustrationData = ' + error.statusText);
    //                  }
    //               );
        
      
    //}

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

    //    var moduleItemDataToBeSaved = [];
     

    //    for(var i=0;i<=$scope.moduleData.length-1;i++)
    //    {        

    //        if ($scope.moduleData[i].DivImageTitle == event.target.id)
    //        {
                
    //            alert($scope.moduleData[i].imageID);

    //            moduleItemDataToBeSaved.push($scope.moduleData[i].imageID, $scope.moduleData[i].id,$scope.moduleName);
    //        }

    //    }
    

    //    ModuleService.SaveOpenedModules(moduleItemDataToBeSaved);
        
    //  //var isSaved=  ModuleService.SaveOpenedModules(moduleDetails);
    //  //alert(isSaved);

    //}

}]);