Commit 62a9b91421a07387184b902ec7ee0252ae04d8dc

Authored by erick.sato
1 parent 3de32588
Exists in master

[Redmine #5011]Validação close aba

cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js
@@ -565,14 +565,25 @@ citApp.controller('AppController', ['$scope', '$routeParams', '$timeout', '$loca @@ -565,14 +565,25 @@ citApp.controller('AppController', ['$scope', '$routeParams', '$timeout', '$loca
565 if($scope.validarFecharAba && $scope.validarFecharAba != 'true'){ 565 if($scope.validarFecharAba && $scope.validarFecharAba != 'true'){
566 $scope.closeWorkspace(id); 566 $scope.closeWorkspace(id);
567 }else{ 567 }else{
568 - $scope.$openModalConfirm({  
569 - message: $translate.instant("PORTAL.MSG.CONFIRMA_CLOSE_WORKSPACE"),  
570 - callback: function () {  
571 - $scope.closeWorkspace(id);  
572 - $scope.$modalConfirmInstance.dismiss('cancel'); 568 + var workspaces = $scope.workspaces, workspaceTarget, i;
  569 + for (i = 0; i < workspaces.length; i = i + 1) {
  570 + if (id === workspaces[i].id) {
  571 + workspaceTarget = workspaces[i];
573 } 572 }
  573 + }
  574 + if(workspaceTarget.$showSearch || workspaceTarget.idRelatorio){
  575 + $scope.closeWorkspace(id);
  576 + }else{
  577 + $scope.$openModalConfirm({
  578 + message: $translate.instant("PORTAL.MSG.CONFIRMA_CLOSE_WORKSPACE"),
  579 + callback: function () {
  580 + $scope.closeWorkspace(id);
  581 + $scope.$modalConfirmInstance.dismiss('cancel');
  582 + }
  583 +
  584 + });
  585 + }
574 586
575 - });  
576 } 587 }
577 }; 588 };
578 589