Commit 1b477aaeb0d99618e17407a12e6b8b872d21480c
1 parent
54efb26a
Exists in
master
Ajuste modal termo de referencia
Showing
1 changed file
with
15 additions
and
5 deletions
Show diff stats
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/TermoReferenciaController.js
@@ -363,6 +363,16 @@ citApp.controller('TermoReferenciaController', ['$scope', | @@ -363,6 +363,16 @@ citApp.controller('TermoReferenciaController', ['$scope', | ||
363 | } | 363 | } |
364 | $scope.setLoadingSalva(true); | 364 | $scope.setLoadingSalva(true); |
365 | var isDuplicado = false; | 365 | var isDuplicado = false; |
366 | + | ||
367 | + if($scope.edicao && $scope.bemServicoSolucaoValidatorId != $scope.termoReferenciaDetalhamentoSolucao.bemServicoSolucao.id){ | ||
368 | + angular.forEach($scope.termoReferencia.detalhamentosSolucoes, function (item, idx) { | ||
369 | + if (item.bemServicoSolucao.id === detalhe.bemServicoSolucao.id) { | ||
370 | + isDuplicado = true; | ||
371 | + $scope.showAlert('error', $translate.instant('CONTRATOS.VALIDACAO.BENS_E_SERVICOS_JA_ADD'), " ", false); | ||
372 | + return; | ||
373 | + } | ||
374 | + }); | ||
375 | + } | ||
366 | if(!$scope.edicao){ | 376 | if(!$scope.edicao){ |
367 | angular.forEach($scope.termoReferencia.detalhamentosSolucoes, function (item, idx) { | 377 | angular.forEach($scope.termoReferencia.detalhamentosSolucoes, function (item, idx) { |
368 | if (item.bemServicoSolucao.id === detalhe.bemServicoSolucao.id) { | 378 | if (item.bemServicoSolucao.id === detalhe.bemServicoSolucao.id) { |
@@ -382,6 +392,8 @@ citApp.controller('TermoReferenciaController', ['$scope', | @@ -382,6 +392,8 @@ citApp.controller('TermoReferenciaController', ['$scope', | ||
382 | } | 392 | } |
383 | 393 | ||
384 | if(continuarEditando){ | 394 | if(continuarEditando){ |
395 | + $scope.edicao = false; | ||
396 | + delete $scope.bemServicoSolucaoValidatorId; | ||
385 | formDetalhamento.$submitted = false; | 397 | formDetalhamento.$submitted = false; |
386 | formDetalhamento.$setPristine(); | 398 | formDetalhamento.$setPristine(); |
387 | $scope.termoReferenciaDetalhamentoSolucao = {}; | 399 | $scope.termoReferenciaDetalhamentoSolucao = {}; |
@@ -679,13 +691,8 @@ citApp.controller('TermoReferenciaController', ['$scope', | @@ -679,13 +691,8 @@ citApp.controller('TermoReferenciaController', ['$scope', | ||
679 | }; | 691 | }; |
680 | 692 | ||
681 | $scope.editar = function () { | 693 | $scope.editar = function () { |
682 | - if ($scope.termoReferencia.dataTermoGerado){ | ||
683 | - $scope.showAlert('warning', $translate.instant('MSG.TERMO_REFERENCIA_JA_GERADO')); | ||
684 | - $scope.setLoadingGet(false); | ||
685 | - } else { | ||
686 | $scope.edit = true; | 694 | $scope.edit = true; |
687 | $scope.pgEdit = true; | 695 | $scope.pgEdit = true; |
688 | - } | ||
689 | }; | 696 | }; |
690 | 697 | ||
691 | // Consulta entidade e mostra no formulario | 698 | // Consulta entidade e mostra no formulario |
@@ -725,9 +732,12 @@ citApp.controller('TermoReferenciaController', ['$scope', | @@ -725,9 +732,12 @@ citApp.controller('TermoReferenciaController', ['$scope', | ||
725 | 732 | ||
726 | $scope.abrirDetalhamentoSolucao = function(edit) { | 733 | $scope.abrirDetalhamentoSolucao = function(edit) { |
727 | 734 | ||
735 | + $scope.listEtBensServicos = $scope.termoReferencia.estudoTecnico.etBensServicosSolucoes; | ||
728 | $scope.termoReferenciaDetalhamentoSolucao = clone($scope.getDetalhamentoSolucaoChecked()); | 736 | $scope.termoReferenciaDetalhamentoSolucao = clone($scope.getDetalhamentoSolucaoChecked()); |
729 | $scope.edicao = true; | 737 | $scope.edicao = true; |
730 | $scope.editDetalhamento = edit; | 738 | $scope.editDetalhamento = edit; |
739 | + | ||
740 | + $scope.bemServicoSolucaoValidatorId = $scope.termoReferenciaDetalhamentoSolucao.bemServicoSolucao.id; | ||
731 | 741 | ||
732 | if(!edit && !$scope.termoReferenciaDetalhamentoSolucao) {//DetalhamentoSolucao | 742 | if(!edit && !$scope.termoReferenciaDetalhamentoSolucao) {//DetalhamentoSolucao |
733 | $scope.showAlert('warning', $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_VISUALIZACAO')); | 743 | $scope.showAlert('warning', $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_VISUALIZACAO')); |