Commit 921c1cb2f3d2de3a62f4726594283fefa3a293c5

Authored by THIAGO VIEIRA DI COIMBRA ROCHA
1 parent 9127246b
Exists in master

redmine #4125 Adicionada validacao das entradas de materias para permitir a gera…

…cao dos relatorios analitico e sintetico das entradas
citgrp-patrimonio-web/src/main/webapp/assets/js/angular/custom/controller/EntradaListController.js
... ... @@ -130,11 +130,15 @@ citApp.controller('EntradaListController', ['$scope', 'EntradaRepository', '$tra
130 130 $scope.showAlert("warning", $translate.instant("MSG.SELECIONE_UM_ITEM_PARA_RELATORIO") + " ", false );
131 131  
132 132 } else{
133   -
134   - $scope.url = '/citgrp-patrimonio-web/rest/relatorioEntrada/relEntradaMaterialAnalitico?idEntrada='+ $scope.entradaChecked.id;
135   -
136   - $scope.visualizarRelatorio($scope.url, $translate.instant("PATRIMONIO.LABEL.TITULO_ENTRADA_PATRIMONIO_ANALITICO"));
137   -
  133 + EntradaRepository.validaExistenciaBemMaterialEntrada($scope.entradaChecked.id).then(function(result){
  134 + if (result == true){
  135 + $scope.url = '/citgrp-patrimonio-web/rest/relatorioEntrada/relEntradaMaterialAnalitico?idEntrada='+ $scope.entradaChecked.id;
  136 +
  137 + $scope.visualizarRelatorio($scope.url, $translate.instant("PATRIMONIO.LABEL.TITULO_ENTRADA_PATRIMONIO_ANALITICO"));
  138 + } else {
  139 + $scope.showAlert('warning', $translate.instant('PATRIMONIO.MSG.VALIDACAO_RELATORIO_ENTRADA'));
  140 + }
  141 + });
138 142 }
139 143 };
140 144  
... ... @@ -145,10 +149,16 @@ citApp.controller('EntradaListController', ['$scope', 'EntradaRepository', '$tra
145 149 $scope.showAlert("warning", $translate.instant("MSG.SELECIONE_UM_ITEM_PARA_RELATORIO") + " ", false );
146 150  
147 151 } else{
148   -
149   - $scope.url = '/citgrp-patrimonio-web/rest/relatorioEntrada/relEntradaMaterialSintetico?idEntrada='+ $scope.entradaChecked.id;
150   -
151   - $scope.visualizarRelatorio($scope.url, $translate.instant("PATRIMONIO.LABEL.TITULO_ENTRADA_PATRIMONIO_SINTETICO"));
  152 +
  153 + EntradaRepository.validaExistenciaBemMaterialEntrada($scope.entradaChecked.id).then(function(result){
  154 + if (result == true){
  155 + $scope.url = '/citgrp-patrimonio-web/rest/relatorioEntrada/relEntradaMaterialSintetico?idEntrada='+ $scope.entradaChecked.id;
  156 +
  157 + $scope.visualizarRelatorio($scope.url, $translate.instant("PATRIMONIO.LABEL.TITULO_ENTRADA_PATRIMONIO_SINTETICO"));
  158 + } else {
  159 + $scope.showAlert('warning', $translate.instant('PATRIMONIO.MSG.VALIDACAO_RELATORIO_ENTRADA'));
  160 + }
  161 + });
152 162  
153 163 }
154 164 };
... ...
citgrp-patrimonio-web/src/main/webapp/assets/js/angular/custom/repository/EntradaRepository.js
... ... @@ -33,6 +33,10 @@ citApp.factory('EntradaRepository', ['RestangularPatrimonio', 'AbstractRepositor
33 33 this.existemBemSemDataContabil = function(idEntrada) {
34 34 return restangularPatrimonio.one(this.route + "/existemBemSemDataContabil").get({"idEntrada" : idEntrada}).then();
35 35 };
  36 +
  37 + this.validaExistenciaBemMaterialEntrada = function(idEntrada) {
  38 + return restangularPatrimonio.one(this.route + "/validaExistenciaBemMaterialEntrada").get({"idEntrada" : idEntrada}).then();
  39 + };
36 40  
37 41 }
38 42  
... ...