Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DrhDocumentFactory.getCategoryList(hierarchyPermission, drhPermission).then(function success(categoryList) {
  2.           vm.categoryList = categoryList;
  3.  
  4.           angular.forEach(domainIdList, function (domainId) {
  5.             domainId = parseInt(domainId);
  6.             DrhDocumentFactory.getDocumentList(hierarchyId, vm.noeudId, domainId).then(function success(response) {
  7.               domainIdCounter++;
  8.               if (domainIdCounter === domainIdList.length) {
  9.                 $ionicLoading.hide();
  10.               }
  11.               if (response.success) {
  12.                 angular.forEach(vm.categoryList, function (category, categoryId) {
  13.                   angular.forEach(category.topDocList, function (categoryTopDoc) {
  14.                     angular.forEach(response.documentList, function (document) {
  15.                       if (categoryTopDoc.code === document.topDoc) {
  16.                         if (vm.owlItemsList[categoryId] === undefined) {
  17.                           vm.owlItemsList[categoryId] = [];
  18.                         }
  19.                         if (drhPermission === 'ALL') {
  20.                           if (categoryId === 'SANTE' || categoryId === 'PREVOYANCE') {
  21.                             if (categoryId === 'SANTE' && domainId === 11) {
  22.                               vm.owlItemsList[categoryId].push(document);
  23.                             } else if (categoryId === 'PREVOYANCE' && domainId === 12) {
  24.                               vm.owlItemsList[categoryId].push(document);
  25.                             }
  26.                           } else {
  27.                             vm.owlItemsList[categoryId].push(document);
  28.                           }
  29.                         } else {
  30.                           vm.owlItemsList[categoryId].push(document);
  31.                         }
  32.                         vm.noResult = false;
  33.                       }
  34.                     });
  35.                   });
  36.                 });
  37.               } else {
  38.                 ErrorService.httpError(response.data);
  39.               }
  40.               vm.documentListIsLoaded = true;
  41.             }, function error(response) {
  42.               ErrorService.httpError(response.data);
  43.               vm.documentListIsLoaded = true;
  44.               $ionicLoading.hide();
  45.             });
  46.           });
  47.         });
  48.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement