CIController.js 2.85 KB
AIA.controller("CIController", ["$scope", "$window", "$rootScope", "$compile", "$http",  "$log", "pages",
function ($scope, $window, $rootScope, $compile,$http,log,pages) {

    $rootScope.currentActiveModuleTitle = pages[3].name;

    $scope.showme = true;
    $scope.IllustrationData;
    $scope.selectedCIlistViewData;
    $scope.IsVisible = function () {
        $scope.scroll();
       
    }

    $scope.scroll = function () {
        // $window.scrollTo(0, 0);
        $("html,body").scrollTop(0);
        //alert("scroll");
    }

    $scope.getDAViewList = function ($event) {

        //debugger;

        $scope.selectedCIlistViewData = new jinqJs()
       .from($scope.IllustrationData.root.CIData)
       .select();

        angular.forEach($scope.selectedCIlistViewData, function (value, key) {
            $('#grid-view').empty();
            $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage;

           // alert("ImagePath");
            //   debugger;

            var $el = $('<div id=' + value._id + ' class="col-sm-3 col-lg-2"><div class="thumbnail" ><a href="clinical-illustrations-detail.html">'
                                      + '<img src="' + $scope.imagePath + '" alt="" title="" >'
                                      + '<div class="caption"><p>' + value._title + '</p></div></a></div></div>').appendTo('#grid-view');


            //<div class="col-sm-3 col-lg-2">
            //        <div class="thumbnail">
            //            <a href="clinical-illustrations-detail.html">
            //                <img src="~/../content/images/clinical-illustrations-2.jpg" alt="" title="">
            //                <div class="caption">
            //                    <p>16-week fetus</p>
            //                </div>
            //            </a>
            //        </div>
            //    </div>


            $compile($el)($scope);

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

        });

    };

    //
    $scope.loadClinicalIllustrationData = function () {

        $rootScope.ClearIframe();

        //load bodyView data
        alert("getting data");
        $http({ method: 'GET', url: '~/../content/data/json/ci/ci_dat_content_without_summary.json' })
            .success(function (data) {

                  // debugger;
                $scope.IllustrationData = data;

                
                //load default body view list for male
                $scope.getDAViewList();


               // var value = $scope.IllustrationData[4]._Title;
            //load default body view list for male
            // $scope.getDAViewList();
               // alert("Done");

        })
       .error(function (data, status, headers, config) {
           console.log(data);
       }
       );

    }

   
 
  
}]


);