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 | 363 | } |
364 | 364 | $scope.setLoadingSalva(true); |
365 | 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 | 376 | if(!$scope.edicao){ |
367 | 377 | angular.forEach($scope.termoReferencia.detalhamentosSolucoes, function (item, idx) { |
368 | 378 | if (item.bemServicoSolucao.id === detalhe.bemServicoSolucao.id) { |
... | ... | @@ -382,6 +392,8 @@ citApp.controller('TermoReferenciaController', ['$scope', |
382 | 392 | } |
383 | 393 | |
384 | 394 | if(continuarEditando){ |
395 | + $scope.edicao = false; | |
396 | + delete $scope.bemServicoSolucaoValidatorId; | |
385 | 397 | formDetalhamento.$submitted = false; |
386 | 398 | formDetalhamento.$setPristine(); |
387 | 399 | $scope.termoReferenciaDetalhamentoSolucao = {}; |
... | ... | @@ -679,13 +691,8 @@ citApp.controller('TermoReferenciaController', ['$scope', |
679 | 691 | }; |
680 | 692 | |
681 | 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 | 694 | $scope.edit = true; |
687 | 695 | $scope.pgEdit = true; |
688 | - } | |
689 | 696 | }; |
690 | 697 | |
691 | 698 | // Consulta entidade e mostra no formulario |
... | ... | @@ -725,9 +732,12 @@ citApp.controller('TermoReferenciaController', ['$scope', |
725 | 732 | |
726 | 733 | $scope.abrirDetalhamentoSolucao = function(edit) { |
727 | 734 | |
735 | + $scope.listEtBensServicos = $scope.termoReferencia.estudoTecnico.etBensServicosSolucoes; | |
728 | 736 | $scope.termoReferenciaDetalhamentoSolucao = clone($scope.getDetalhamentoSolucaoChecked()); |
729 | 737 | $scope.edicao = true; |
730 | 738 | $scope.editDetalhamento = edit; |
739 | + | |
740 | + $scope.bemServicoSolucaoValidatorId = $scope.termoReferenciaDetalhamentoSolucao.bemServicoSolucao.id; | |
731 | 741 | |
732 | 742 | if(!edit && !$scope.termoReferenciaDetalhamentoSolucao) {//DetalhamentoSolucao |
733 | 743 | $scope.showAlert('warning', $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_VISUALIZACAO')); | ... | ... |