Commit f174ddbc8371cf844641219c49de2add377e7411

Authored by unknown
1 parent 481837ee

Commit Changes

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -1171,8 +1171,9 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1171 1171 $rootScope.onDrawingCanvasClick();
1172 1172 $rootScope.FreeStylePaint();
1173 1173 });
1174   -
  1174 +
1175 1175 $rootScope.loadSearchData = function () {
  1176 +
1176 1177 //$("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
1177 1178 var imageId = $rootScope.imageId;
1178 1179 var promise = ModuleService.getTermTextDataForAAImage(imageId)
... ... @@ -1190,22 +1191,38 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1190 1191 .from($scope.AAPinTermData)
1191 1192 .where('_LanguageId == ' + primaryLexicon)
1192 1193 .select();
1193   -
  1194 + var sortedTermTextArray = [];
1194 1195 for (var i = 0; i < $scope.matchedLanguageTermData.length; i++) {
1195   - $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[i]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[i]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[i]._TermText});
  1196 + sortedTermTextArray.push($scope.matchedLanguageTermData[i]._TermText);
  1197 + sortedTermTextArray.sort();
1196 1198 }
  1199 +
  1200 + for (var i = 0; i <= sortedTermTextArray.length - 1; i++) {
  1201 + for (var j = 0; j <= $scope.matchedLanguageTermData.length - 1; j++) {
  1202 + if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) {
  1203 + $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[j]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[j]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[j]._TermText });
  1204 + break;
  1205 + }
  1206 + }
  1207 + }
  1208 +
  1209 +
1197 1210 $scope.$watch('$scope.pinTermData', function (newValue, oldValue, scope) {
1198   - if ($('#termlistfilter').html() != "")
1199   - // $('#termList').empty();
1200   - $('#termlistfilter').empty()
  1211 +
  1212 + if (($('#termlistfilter').html() != ""))
  1213 +
  1214 + $('#termlistfilter').empty();
1201 1215 if ($scope.pinTermData.length > 0) {
1202 1216 $timeout(function () {
1203 1217 console.log('pinTermData= ' + $scope.pinTermData.length);
  1218 + $('#termList').empty();
1204 1219 for (var j = 0; j < $scope.pinTermData.length; j++) {
1205 1220 var $el = $('<li><a id= "' + $scope.pinTermData[j].TermNumber + '" href="" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</a></li>').appendTo('#termlistfilter')
1206 1221 $compile($el)($scope);
1207   - var $selectedOptions = $('<option id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
  1222 + var $selectedOptions = $('<option title= "' + $scope.pinTermData[j].TermTxt + '" id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
  1223 +
1208 1224 $compile($selectedOptions)($scope);
  1225 +
1209 1226 $("#AABodySystems").empty();
1210 1227 $("#bodySystems").css("display","none");
1211 1228 $("#AABodySystems").css("display","block");
... ... @@ -1229,37 +1246,46 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1229 1246  
1230 1247  
1231 1248 $scope.$on('listManagerEvent', function (event, data) {
  1249 +
1232 1250 $("#viewName").empty();
1233 1251 $("#viewName").append("<option>" + $rootScope.listArray[0].text + "</option>");
1234 1252 $rootScope.isLoading = false;
1235 1253 $('#spinner').css('visibility', 'hidden');
1236 1254  
1237 1255 if ($rootScope.bodySystemSeletedId == null) {
  1256 +
1238 1257 $rootScope.loadSearchData();
1239 1258 }
1240 1259 else
1241 1260 {
  1261 +
1242 1262 $scope.refreshTermListOnAASystemSelection($rootScope.bodySystemSeletedId);
1243 1263 }
1244   -
  1264 + $timeout(function () {
  1265 + $("#totalTerms").empty();
  1266 + $("#totalTerms").html("<span class='pull-left marginTop5'>" + $("#termList option").length + " Structures</span>");
  1267 + }, 1000);
1245 1268 });
1246 1269  
1247 1270  
1248 1271  
1249 1272 $scope.refreshTermListOnAASystemSelection = function (bodySystemId) {
1250 1273 $rootScope.bodySystemSeletedId = bodySystemId;
  1274 + $('#termList').empty();
1251 1275 var bodySystemName = $("#AABodySystems #" + bodySystemId).val();
1252 1276 if (bodySystemName == "All") {
1253 1277 for (var j = 0; j <= $scope.pinTermData.length - 1; j++) {
1254   - var $selectedOptions = $('<option id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)">' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
  1278 + var $selectedOptions = $('<option title= "' + $scope.pinTermData[j].TermTxt + '" id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)">' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
1255 1279 $compile($selectedOptions)($scope);
1256 1280 }
  1281 + $("#totalTerms").empty();
  1282 + $("#totalTerms").html("<span class='pull-left marginTop5'>" + $("#termList option").length + " Structures</span>");
1257 1283 }
1258 1284 else {
1259 1285 var imageId = $rootScope.imageId;
1260 1286 $scope.pinDataUrl = "aa_dat_pinterm_" + imageId;
1261 1287 $rootScope.bodySystemTermArray = [];
1262   - $('#termList').empty();
  1288 +
1263 1289 $.ajax({
1264 1290 url: '~/../content/data/json/aa/aa_pinterm/' + $scope.pinDataUrl + '.json',
1265 1291 type: 'GET',
... ... @@ -1275,7 +1301,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1275 1301 if ($scope.aaPinData[i]._TermId == $rootScope.bodySystemTermArray[j].termNumbr) {
1276 1302 if ($rootScope.bodySystemTermArray[j].language == "1") {
1277 1303 console.log($rootScope.bodySystemTermArray[j].text);
1278   - var $selectedOptions = $('<option id= "' + $rootScope.bodySystemTermArray[j].termNumbr + '" onclick="onSearchItemSelection(event)">' + $rootScope.bodySystemTermArray[j].text + '</option>').appendTo("#termList")
  1304 + var $selectedOptions = $('<option title= "' + $rootScope.bodySystemTermArray[j].text + '" id= "' + $rootScope.bodySystemTermArray[j].termNumbr + '" onclick="onSearchItemSelection(event)">' + $rootScope.bodySystemTermArray[j].text + '</option>').appendTo("#termList")
1279 1305 $compile($selectedOptions)($scope);
1280 1306 }
1281 1307 }
... ... @@ -1284,6 +1310,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1284 1310 }
1285 1311 }
1286 1312 });
  1313 + $("#totalTerms").empty();
  1314 + $("#totalTerms").html("<span class='pull-left marginTop5'>" + $("#termList option").length + " Structures</span>");
1287 1315 }
1288 1316 }
1289 1317 $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {
... ... @@ -1502,7 +1530,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1502 1530 }
1503 1531  
1504 1532 $scope.highlightPinBasedOnSerachItem = function (event) {
1505   -
  1533 +
1506 1534 $scope.searchItemId = event.currentTarget.id;
1507 1535 $scope.searchItemText = event.currentTarget.innerHTML;
1508 1536 $rootScope.searchSelectedText = $("#" + event.currentTarget.id).text();
... ...