Commit 0a0d1fdb3a0b5e504afde8b204542f25fb3f704a

Authored by unknown
1 parent 912e60ff

Implemented List Manager Functionality

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -424,7 +424,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
424 424 if (posbodyregion > -1) {
425 425 selectimg = true;
426 426 count = count + 1;
427   -
428 427 }
429 428 else {
430 429 selectimg = false;
... ... @@ -575,12 +574,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
575 574 else {
576 575 $scope.showAllPins();
577 576 }
578   - }
  577 + }
579 578 else {
580 579  
581 580 $scope.selectedSystemName = event.currentTarget.title;
582   -
583   -
584 581 // get termText info
585 582 var promise = ModuleService.getTermTextDataForPin($scope.moduleName)
586 583 .then(
... ... @@ -1176,6 +1173,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1176 1173 function (response) {
1177 1174  
1178 1175 $scope.AAPinTermData = response.data.PinTermData.TermData;
  1176 +
1179 1177 $rootScope.isLoading = false;
1180 1178 $('#setting-spinner').css('visibility', 'hidden');
1181 1179  
... ... @@ -1185,10 +1183,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1185 1183 .from($scope.AAPinTermData)
1186 1184 .where('_LanguageId == ' + primaryLexicon)
1187 1185 .select();
1188   -
  1186 +
1189 1187 for (var i = 0; i < $scope.matchedLanguageTermData.length; i++) {
1190   - $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[i]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[i]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[i]._TermText });
1191   - // console.log($scope.pinTermData);
  1188 + $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[i]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[i]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[i]._TermText});
1192 1189 }
1193 1190 $scope.$watch('$scope.pinTermData', function (newValue, oldValue, scope) {
1194 1191 if ($('#termlistfilter').html() != "")
... ... @@ -1202,8 +1199,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1202 1199 $compile($el)($scope);
1203 1200 var $selectOptions = $('<option id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
1204 1201 $compile($selectOptions)($scope);
  1202 + $("#bodySystems").empty();
  1203 + $("#bodySystemList li a").each(function (key, value) {
  1204 + var $systemOptions = $('<option id=' + $(this).attr('id') + '>' + $(this).text() + '</option>').appendTo("#bodySystems")
  1205 + $compile($systemOptions)($scope);
  1206 + });
1205 1207 }
1206   -
1207 1208 }, 500);
1208 1209 }
1209 1210 })
... ... @@ -1214,19 +1215,66 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1214 1215 console.log(' error: ' + error.statusText);
1215 1216 }
1216 1217 )
1217   -
1218 1218 }
  1219 +
  1220 +
  1221 +
  1222 +
1219 1223 $scope.$on('listManagerEvent', function (event, data) {
1220 1224 $("#viewName").empty();
1221   - $("#viewName").append("<option>"+$rootScope.listArray[0].text+"</option>");
  1225 + $("#viewName").append("<option>" + $rootScope.listArray[0].text + "</option>");
  1226 +
1222 1227 $rootScope.isLoading = false;
1223 1228 $('#spinner').css('visibility', 'hidden');
1224 1229  
1225 1230 });
1226 1231  
1227   - $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {
1228 1232  
1229 1233  
  1234 + $scope.refreshTermListOnSystemSelection = function (bodySystemId) {
  1235 + var bodySystemText = $("#bodySystems #" + bodySystemId).val();
  1236 + alert(bodySystemText);
  1237 + if (bodySystemText == "All") {
  1238 + for (var j = 0; j <= $scope.pinTermData.length - 1; j++) {
  1239 + var $selectOptions = $('<option id= "' + $scope.pinTermData[j].TermNumber + '" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
  1240 + $compile($selectOptions)($scope);
  1241 + }
  1242 + }
  1243 + else {
  1244 + var imageId = $rootScope.imageId;
  1245 + $scope.pinDataUrl = "aa_dat_pinterm_" + imageId;
  1246 + $rootScope.bodySystemTermArray = [];
  1247 + $('#termList').empty();
  1248 + $.ajax({
  1249 + url: '~/../content/data/json/aa/aa_pinterm/' + $scope.pinDataUrl + '.json',
  1250 + type: 'GET',
  1251 + dataType: "json",
  1252 + async: false,
  1253 + success: function (result) {
  1254 + $(result.PinTermData.TermData).each(function (key, value) {
  1255 + $rootScope.bodySystemTermArray.push({ "termNumbr": result.PinTermData.TermData[key]._TermNumber, "text": result.PinTermData.TermData[key]._TermText, "language": result.PinTermData.TermData[key]._LanguageId });
  1256 + });
  1257 + for (var i = 0; i <= $scope.aaPinData.length - 1; i++) {
  1258 + if ($scope.aaPinData[i]._BodySystemName.toLowerCase() == bodySystemText.toLowerCase()) {
  1259 + for (var j = 0 ; j <= $rootScope.bodySystemTermArray.length - 1; j++) {
  1260 + if ($scope.aaPinData[i]._TermId == $rootScope.bodySystemTermArray[j].termNumbr) {
  1261 + if ($rootScope.bodySystemTermArray[j].language == "1") {
  1262 + console.log($rootScope.bodySystemTermArray[j].text);
  1263 + var $selectOptions = $('<option id= "' + $rootScope.bodySystemTermArray[j].termNumbr + '" >' + $rootScope.bodySystemTermArray[j].text + '</option>').appendTo("#termList")
  1264 + $compile($selectOptions)($scope);
  1265 + }
  1266 + }
  1267 + }
  1268 + }
  1269 + }
  1270 + }
  1271 +
  1272 + });
  1273 + }
  1274 + }
  1275 + $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {
  1276 +
  1277 +
1230 1278 var languageArray = $rootScope.lexiconLanguageArray;
1231 1279  
1232 1280 if ($scope.AAPinTermData != null || $scope.AAPinTermData != undefined) {
... ... @@ -1235,34 +1283,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1235 1283 .from($scope.AAPinTermData)
1236 1284 .where('_TermNumber == ' + actualTermNo)
1237 1285 .select();
1238   -
  1286 +
1239 1287 if ($scope.matchedTermNoData != null || $scope.matchedTermNoData != undefined) {
1240   -
  1288 +
1241 1289 for (var j = 0; j <= languageArray.length - 1; j++) {
1242   -
  1290 +
1243 1291 $scope.matchedLanguageTermNoData = new jinqJs()
1244 1292 .from($scope.matchedTermNoData)
1245 1293 .where('_LanguageId == ' + languageArray[j].id)
1246 1294 .select();
1247   -
1248 1295 var termText = $scope.matchedLanguageTermNoData[0]._TermText;
1249   -
1250 1296 $scope.MultiLanguageAnnationArray.push(termText);
1251   -
1252   -
1253 1297 };
1254   -
1255   -
1256   -
1257 1298 }
1258   -
1259 1299 }
1260 1300 }
1261 1301  
1262   -
1263   -
1264   -
1265   -
1266 1302 $scope.hidePins = function () {
1267 1303  
1268 1304 $rootScope.isLoading = true;
... ... @@ -1444,16 +1480,32 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1444 1480 }
1445 1481  
1446 1482 $scope.highlightPinBasedOnSerachItem = function (event) {
  1483 +
  1484 + if ($scope.isTermListOptionClicked == true) {
  1485 + $scope.searchItemId = event;
  1486 + $scope.searchItemText = event.innerHTML;
  1487 + $('#termList option[selected="selected"]').prop("selected", false);
  1488 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true);
  1489 + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
  1490 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
  1491 + $scope.searchFilter = event.innerHTML;
  1492 + selectedTermName.placeholder = event.innerHTML;
  1493 + $scope.isTermListOptionClicked = false;
  1494 + }
  1495 + else
  1496 + {
  1497 + $scope.searchItemId = event.currentTarget.id;
  1498 + $scope.searchItemText = event.currentTarget.innerHTML;
  1499 + $('#termList option[selected="selected"]').prop("selected", false);
  1500 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true);
  1501 + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
  1502 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
1447 1503  
1448   - $scope.searchItemId = event.currentTarget.id;
1449   - $scope.searchItemText = event.currentTarget.innerHTML;
1450   - $('#termList option[selected="selected"]').prop("selected", false);
1451   - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true);
1452   - $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
1453   - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
  1504 + $scope.searchFilter = event.currentTarget.innerHTML;
  1505 + selectedTermName.placeholder = event.currentTarget.innerHTML;
  1506 +
  1507 + }
1454 1508  
1455   - $scope.searchFilter = event.currentTarget.innerHTML;
1456   - selectedTermName.placeholder = event.currentTarget.innerHTML;
1457 1509  
1458 1510 //get data from pindata for this trem
1459 1511  
... ... @@ -1500,8 +1552,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1500 1552 }
1501 1553 }
1502 1554  
  1555 +
  1556 +
1503 1557 }]);
1504 1558  
  1559 +
  1560 +function refreshTermListOnSystem(bodySystemId) {
  1561 + // alert('refreshTermListOnSystem is called outside');
  1562 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1563 + scope.$apply(function () {
  1564 + scope.refreshTermListOnSystemSelection(bodySystemId);
  1565 + });
  1566 +}
  1567 +
1505 1568 function showSelectedSystemPins(event) {
1506 1569 console.log('OnBodySystem chnaged is called outside ');
1507 1570 var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
... ... @@ -1550,6 +1613,16 @@ function onSearchItemSelection(event) {
1550 1613 });
1551 1614 }
1552 1615  
  1616 +function onListManagerTermSelection(event) {
  1617 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1618 + scope.isTermListOptionClicked = true;
  1619 + scope.$apply(function () {
  1620 + scope.highlightPinBasedOnSerachItem(event);
  1621 + });
  1622 +
  1623 +}
  1624 +
  1625 +
1553 1626 function showHideAnnotation(event) {
1554 1627  
1555 1628 var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
... ...