Commit f4688c92be58ba4b609a54d1ebe4b8b8ea7cc6ee

Authored by Mukul Rajput
1 parent 9c3f0aab

this is list view search filter

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -36,10 +36,11 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
36 36 $scope.activePinArray = [];
37 37 $scope.showTabButton = true;
38 38 $scope.isListViewDataLoaded = true;
39   -
  39 + $rootScope.myModuleId = 1;
40 40 $scope.setActiveTab = function (tabToSet) {
41   -
  41 +
42 42 $scope.activeTab = tabToSet;
  43 + $rootScope.myModuleId = $scope.activeTab;
43 44 localStorage.setItem("activeTab", $scope.activeTab);
44 45 if ($scope.activeTab == 1) {
45 46 $('#grid-view').css("display","block");
... ... @@ -52,7 +53,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
52 53 $('#grid-view').css("display", "none");
53 54 if ($scope.isListViewDataLoaded == true) {
54 55 var htm = '';
55   - htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  56 + htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Titlemukul</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
56 57 $.ajax({
57 58 url: '~/../content/data/json/aa/aa_dat_contentlist.json',
58 59 dataType: "json",
... ... @@ -389,14 +390,131 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
389 390 }
390 391  
391 392 }
  393 + //$scope.FilterByImage = function (query) {
  394 + // alert("$rootScope.moduleId" + $rootScope.myModuleId);
  395 + // //alert(JSON.stringify(query));
  396 + // // $scope.moduleId = moduleId;
  397 + // if ($rootScope.myModuleId == 2) {
  398 + // $('#grid-view').css("display", "none");
  399 +
  400 + // if ($scope.isListViewDataLoaded == false) {
  401 + // $rootScope.selectedbodyregion = query.selectedbodyregion;
  402 + // $rootScope.selectedbodysystem = query.selectedbodysystem;
  403 + // alert($rootScope.selectedbodyregion);
  404 + // alert($rootScope.selectedbodysystem);
  405 + // var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
  406 + // .then(
  407 + // function (result) {
  408 + // // alert(JSON.stringify($scope.moduleLandingData));
  409 + // $scope.moduleLandingData = result;
  410 + // $scope.selectedAAListViewData = new jinqJs()
  411 + // .from($scope.moduleLandingData.data.root.Item)
  412 + // .where('_BodyRegion = ' + $rootScope.selectedbodyregion, '_BodySystem = ' + $rootScope.selectedbodysystem)
  413 + // .orderBy([{ field: '_Title', sort: 'asc' }])
  414 + // .select();
  415 + // var htm = '';
  416 + // htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  417 + // angular.forEach($scope.selectedAAListViewData, function (value, key) {
  418 + // htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  419 + // htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  420 + // htm += "</tr>"
  421 + // });
  422 + // htm += "</tbody></table>";
  423 + // $("#list-view").html(htm);
  424 + // $compile(htm)($scope);
  425 +
  426 +
  427 +
  428 + // // $(result.root.Item).each(function (key, value) {
  429 + // // console.log(key + " " + value);
  430 + // // htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  431 + // // htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  432 + // // htm += "</tr>"
  433 + // // });
  434 + // // htm += "</tbody></table>";
  435 + // // $("#list-view").html(htm);
  436 + // // $compile(htm)($scope);
  437 + // });
  438 +
  439 + // $('#list-view').css("display", "block");
  440 + // $scope.isListViewDataLoaded = false;
  441 + // }
  442 + // }
  443 + //}
  444 + $scope.FilterByImage = function (query) {
  445 + alert("$rootScope.moduleId" + $rootScope.myModuleId);
  446 + //alert(JSON.stringify(query));
  447 + // $scope.moduleId = moduleId;
  448 + if ($rootScope.myModuleId == 2) {
  449 + $('#grid-view').css("display", "none");
  450 +
  451 + if ($scope.isListViewDataLoaded == false) {
  452 + $rootScope.selectedbodyregion = query.selectedbodyregion;
  453 + $rootScope.selectedbodysystem = query.selectedbodysystem;
  454 + alert($rootScope.selectedbodyregion);
  455 + alert($rootScope.selectedbodysystem);
  456 + var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
  457 + .then(
  458 + function (result) {
  459 + // alert(JSON.stringify($scope.moduleLandingData));
  460 + $scope.moduleLandingData = result;
  461 + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {
  462 + }
  463 + else {
392 464  
  465 + }
  466 + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) {
  467 + }
  468 + else {
393 469  
394   - $scope.FilterByImage = function (moduleId, query) {
395   - //alert(JSON.stringify(query));
396   - $scope.moduleId = moduleId;
  470 + } if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) {
  471 + }
  472 + else
  473 + {
397 474  
  475 + }
  476 + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) {
  477 + }
  478 + else
  479 + {
  480 +
  481 + }
  482 + $scope.selectedAAListViewData = new jinqJs()
  483 + .from($scope.moduleLandingData.data.root.Item)
  484 + .where('_BodyRegion = ' + $rootScope.selectedbodyregion, '_BodySystem = ' + $rootScope.selectedbodysystem)
  485 + .orderBy([{ field: '_Title', sort: 'asc' }])
  486 + .select();
  487 +
  488 + var htm = '';
  489 + htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  490 + angular.forEach($scope.selectedAAListViewData, function (value, key) {
  491 + htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  492 + htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  493 + htm += "</tr>"
  494 + });
  495 + htm += "</tbody></table>";
  496 + $("#list-view").html(htm);
  497 + $compile(htm)($scope);
  498 +
  499 +
  500 +
  501 + // $(result.root.Item).each(function (key, value) {
  502 + // console.log(key + " " + value);
  503 + // htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  504 + // htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  505 + // htm += "</tr>"
  506 + // });
  507 + // htm += "</tbody></table>";
  508 + // $("#list-view").html(htm);
  509 + // $compile(htm)($scope);
  510 + });
  511 +
  512 + $('#list-view').css("display", "block");
  513 + $scope.isListViewDataLoaded = false;
  514 + }
  515 + }
398 516 console.log('loadForModuleById is called')
399   - $rootScope.moduleName = Modules[moduleId].Name;
  517 + $rootScope.moduleName = Modules[$rootScope.myModuleId].Name;
400 518 while ($scope.searchAAListViewData.length) {
401 519 $scope.searchAAListViewData.pop();
402 520 }
... ... @@ -558,7 +676,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
558 676  
559 677 }
560 678  
561   - $scope.Reset = function (moduleId, query) {
  679 + $scope.Reset = function (query) {
562 680  
563 681 query.selectedbodyregion = "";
564 682 query.selectedbodysystem = "";
... ... @@ -586,7 +704,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
586 704 // $scope.searchCIListViewData.pop();
587 705 //}
588 706  
589   - $scope.FilterByImage(1, query);
  707 + $scope.FilterByImage(query);
590 708  
591 709 }
592 710  
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/tile-view.html
... ... @@ -55,8 +55,8 @@
55 55 <h6 class="text-center text-primary txt-white f11">Search</h6>
56 56  
57 57 <div class="btn-group col-xs-12" style="padding:0;">
58   - <button type="button" class="btn btn-primary btn-sm col-xs-9" ng-click="Reset(1,query)"><i class="fa fa-eye"></i> Show All</button>
59   - <button type="button" class="btn btn-primary btn-sm col-xs-3" ng-click="FilterByImage(1,query)">
  58 + <button type="button" class="btn btn-primary btn-sm col-xs-9" ng-click="Reset(query)"><i class="fa fa-eye"></i> Show All</button>
  59 + <button type="button" class="btn btn-primary btn-sm col-xs-3" ng-click="FilterByImage(query)">
60 60 <i class="fa fa-search"></i>
61 61 </button>
62 62  
... ...