Commit f7f214f9adc2c5b591e7624deeaa164892ebeeac
1 parent
d1059282
Exists in
master
{Redmine tarefa-4530}
Showing
2 changed files
with
70 additions
and
33 deletions
Show diff stats
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js
... | ... | @@ -29,7 +29,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
29 | 29 | }; |
30 | 30 | |
31 | 31 | $scope.estruturaAlmoxarifadoPadrao = {}; |
32 | - | |
32 | + | |
33 | 33 | // Limpa formulário para novo cadastro |
34 | 34 | $scope.resetForm = function() { |
35 | 35 | $scope.limparEntradaAlmoxarifado(); |
... | ... | @@ -37,14 +37,14 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
37 | 37 | $timeout(function(){ |
38 | 38 | $scope.entradaAlmoxarifadoForm.$submitted = false; |
39 | 39 | $scope.entradaAlmoxarifadoForm.$setPristine(); |
40 | - | |
40 | + | |
41 | 41 | // limpar observações |
42 | 42 | if($scope.entradaObservacaoForm['observacao.descricao']) { |
43 | 43 | $scope.entradaObservacaoForm['observacao.descricao'].$setViewValue(''); |
44 | 44 | $scope.entradaObservacaoForm['observacao.descricao'].$render(); |
45 | 45 | } |
46 | 46 | }); |
47 | - | |
47 | + | |
48 | 48 | }; |
49 | 49 | |
50 | 50 | // Limpa o formulario preenchido |
... | ... | @@ -63,14 +63,14 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
63 | 63 | }; |
64 | 64 | $scope.entradaItemSelecionado = null; |
65 | 65 | $scope.valorTotalMateriais = 0.0; |
66 | - | |
66 | + | |
67 | 67 | DominioRepository.findAllDominio('tipoFinalidadeMaterial').then(function(result) { |
68 | 68 | $scope.dominiosTipoFinalidade = []; |
69 | - if(result && result.length >0) | |
69 | + if(result && result.length >0) | |
70 | 70 | result.forEach(function(r){ |
71 | - | |
71 | + | |
72 | 72 | $scope.dominiosTipoFinalidade.push(r.originalElement); |
73 | - | |
73 | + | |
74 | 74 | if(r.originalElement.codigo === 1){ |
75 | 75 | $scope.entradaAlmoxarifado.dominioFinalidade = r.originalElement; |
76 | 76 | } |
... | ... | @@ -123,12 +123,12 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
123 | 123 | if($scope.entradaAlmoxarifado.fornecedor){ |
124 | 124 | $scope.entradaAlmoxarifado.fornecedor['pessoa.nome'] = $scope.entradaAlmoxarifado.fornecedor.pessoa.nome; |
125 | 125 | } |
126 | - | |
126 | + | |
127 | 127 | $scope.dominiosTipoRecebimento.forEach(function(item){ |
128 | 128 | if(item.originalElement.id === $scope.entradaAlmoxarifado.dominioTipoRecebimento.id) |
129 | 129 | $scope.entradaAlmoxarifado.dominioTipoRecebimento = item.originalElement; |
130 | 130 | }); |
131 | - | |
131 | + | |
132 | 132 | $scope.calcularValorTotalMateriais(); |
133 | 133 | $scope.edit = edit; |
134 | 134 | $scope.setLoading(false); |
... | ... | @@ -174,17 +174,18 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
174 | 174 | } |
175 | 175 | }); |
176 | 176 | }); |
177 | - | |
177 | + | |
178 | 178 | DominioRepository.findAllDominio('tipoFinalidadeMaterial').then(function(result) { |
179 | 179 | $scope.dominiosTipoFinalidade = []; |
180 | - if(result && result.length >0) | |
180 | + if(result && result.length >0) | |
181 | 181 | result.forEach(function(r){ |
182 | 182 | $scope.dominiosTipoFinalidade.push(r.originalElement); |
183 | 183 | }); |
184 | 184 | $scope.dominiosTipoFinalidade.reverse(); |
185 | 185 | }); |
186 | - | |
186 | + | |
187 | 187 | $scope.inicializarModalMateriais = function(){ |
188 | + $scope.unidadeMedidaEntrada = {}; | |
188 | 189 | $scope.editEntrada = true; |
189 | 190 | $scope.limparModalMateriais(); |
190 | 191 | $scope.$openModal('modal-materiais-consumo.html', 'lg'); |
... | ... | @@ -204,7 +205,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
204 | 205 | }; |
205 | 206 | |
206 | 207 | $scope.carregarItensMaterial = function(item){ |
207 | - | |
208 | + | |
208 | 209 | $scope.entradaItem.quantidade = null; |
209 | 210 | $scope.entradaItem.quantidadeDominioTipoUnidadeEntrada = null; |
210 | 211 | $scope.entradaItem.valorTotal = null; |
... | ... | @@ -214,11 +215,11 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
214 | 215 | $scope.caracteristicas = []; |
215 | 216 | $scope.validaAnexo = false; |
216 | 217 | $scope.unidadesFixa = false; |
217 | - | |
218 | + | |
218 | 219 | $scope.unidadesMedidasEntrada = item.tiposUnidadeMedidaEntrada.map(function(item){ |
219 | 220 | return item.unidadeMedida; |
220 | 221 | }); |
221 | - | |
222 | + | |
222 | 223 | $scope.carregarCaracteristicasGenericas(item); |
223 | 224 | |
224 | 225 | }; |
... | ... | @@ -256,6 +257,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
256 | 257 | }; |
257 | 258 | |
258 | 259 | $scope.definirTipoNumerico = function(){ |
260 | + $scope.alternaTipoNumericoUnidadeMedida(); | |
259 | 261 | $scope.unidadesFixa = false; |
260 | 262 | $timeout(function(){ |
261 | 263 | if($scope.entradaItem.unidadeMedidaEntrada){ |
... | ... | @@ -287,7 +289,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
287 | 289 | } |
288 | 290 | }); |
289 | 291 | }; |
290 | - | |
292 | + | |
291 | 293 | $scope.addEntradaItem = function(formDialogMateriais) { |
292 | 294 | formDialogMateriais.$submitted = true; |
293 | 295 | $scope.validaAnexo = false; |
... | ... | @@ -374,7 +376,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
374 | 376 | $scope.uploaderCaracteristica.queue = clone(bemPatrimonialCaracteristica.uploadAnexo); |
375 | 377 | } |
376 | 378 | }); |
377 | - | |
379 | + | |
378 | 380 | if($scope.entradaItem.dataValidade && !$scope.entradaItem.id){ |
379 | 381 | $scope.entradaItem.dataValidade = $filter('date')($scope.entradaItem.dataValidade, "dd/MM/yyyy"); |
380 | 382 | } |
... | ... | @@ -545,7 +547,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
545 | 547 | |
546 | 548 | return formularioValido; |
547 | 549 | }; |
548 | - | |
550 | + | |
549 | 551 | // LISTA ESTRUTURAS ORGANIZACIONAIS QUE SAO UNIDADES REQUISITANTES |
550 | 552 | $scope.findEstruturaOrganizacionalUR = function(value){ |
551 | 553 | |
... | ... | @@ -557,7 +559,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
557 | 559 | }); |
558 | 560 | |
559 | 561 | }; |
560 | - | |
562 | + | |
561 | 563 | //#### INICIO METODOS RELACIONADOS AO RELATORIO ### |
562 | 564 | |
563 | 565 | //FUNCAO QUE BUSCA MATERIAL DE CONSUMO PARA FILTRO DE RELATORIO DE ENTRADAS POR PERIODO |
... | ... | @@ -686,4 +688,35 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
686 | 688 | }; |
687 | 689 | //### FIM METODOS RELACIONADOS AOS RELATORIOS DE INVENTARIO ### |
688 | 690 | |
691 | + $scope.alternaTipoNumericoUnidadeMedida = function(){ | |
692 | + $scope.entradaItem.$quantidadeEntrada = ''; | |
693 | + $timeout(function(){ | |
694 | + if($scope.entradaItem.unidadeMedidaEntrada && $scope.entradaItem.unidadeMedidaEntrada.tipoNumerico){ | |
695 | + switch($scope.entradaItem.unidadeMedidaEntrada.tipoNumerico.codigo){ | |
696 | + case 1: | |
697 | + $scope.showInteiro= true; | |
698 | + $scope.showDecimal = false; | |
699 | + break; | |
700 | + | |
701 | + case 2: | |
702 | + $scope.showDecimal = true; | |
703 | + $scope.showInteiro= false; | |
704 | + break; | |
705 | + | |
706 | + } | |
707 | + }else{ | |
708 | + $scope.showInteiro= false; | |
709 | + $scope.showDecimal = false; | |
710 | + } | |
711 | + }); | |
712 | + }; | |
713 | + | |
714 | + $scope.aplicarValidacaoDecimal = function(){ | |
715 | + if($scope.entradaItem.$quantidadeEntrada){ | |
716 | + $scope.entradaItem.$quantidadeEntrada = parseFloat($scope.entradaItem.$quantidadeEntrada).toFixed(2); | |
717 | + }else{ | |
718 | + $scope.entradaItem.$quantidadeEntrada = ''; | |
719 | + } | |
720 | + }; | |
721 | + | |
689 | 722 | }]); | ... | ... |
cit-almoxarifado-web/src/main/webapp/html/entradaAlmoxarifado/dialog_add_materiais.html
... | ... | @@ -29,14 +29,18 @@ |
29 | 29 | </label> |
30 | 30 | </div> |
31 | 31 | </div> |
32 | - | |
32 | + | |
33 | 33 | <div class="row"> |
34 | - <div class="col-sm-3"> | |
35 | - <label-input-decimal ng-id="entradaItem.$quantidadeEntrada" ng-label="ALMOXARIFADO.LABEL.QUANTIDADE" ng-evento-change="calcularQuantidadeEValores()" ng-obrigatorio="editEntrada" ng-disabled="!editEntrada" form="formDialogMateriais" | |
36 | - ng-model="entradaItem.$quantidadeEntrada" ng-precisao="tipoNumerico" ng-custom-maxlength="11"/> | |
34 | + <div class="col-sm-3" ng-show="showDecimal"> | |
35 | + <label-input-decimal ng-precisao="decimal" ng-evento-blur="aplicarValidacaoDecimal" ng-custom-maxlength="11" ng-id="entradaItem.$quantidadeEntrada" ng-label="ALMOXARIFADO.LABEL.QUANTIDADE" ng-evento-change="calcularQuantidadeEValores()" ng-obrigatorio="editEntrada" ng-disabled="!editEntrada" form="formDialogMateriais" | |
36 | + ng-model="entradaItem.$quantidadeEntrada"/> | |
37 | + </div> | |
38 | + <div class="col-sm-3" ng-show="showInteiro"> | |
39 | + <label-input-number ng-custom-maxlength="4" ng-id="entradaItem.$quantidadeEntrada" ng-label="ALMOXARIFADO.LABEL.QUANTIDADE" ng-evento-change="calcularQuantidadeEValores()" ng-obrigatorio="editEntrada" ng-disabled="!editEntrada" form="formDialogMateriais" | |
40 | + ng-model="entradaItem.$quantidadeEntrada"/> | |
37 | 41 | </div> |
38 | 42 | <div class="col-sm-3"> |
39 | - <label-select ng-id="entradaItem.unidadeMedidaEntrada" ng-custom-change="definirTipoNumerico()" ng-label="LABEL.UNIDADE_MEDIDA" ng-model="entradaItem.unidadeMedidaEntrada" form="formDialogMateriais" ng-obrigatorio="editEntrada" ng-disabled="!editEntrada" | |
43 | + <label-select ng-id="entradaItem.unidadeMedidaEntrada" ng-custom-change="definirTipoNumerico()" ng-label="LABEL.UNIDADE_MEDIDA" ng-model="entradaItem.unidadeMedidaEntrada" form="formDialogMateriais" ng-obrigatorio="editEntrada" ng-disabled="!editEntrada" | |
40 | 44 | ng-custom-options="unidadeMedida as unidadeMedida.sigla for unidadeMedida" track-by="track by unidadeMedida.id" ng-list="unidadesMedidasEntrada"/> |
41 | 45 | </div> |
42 | 46 | <div class="col-sm-3"> |
... | ... | @@ -47,7 +51,7 @@ |
47 | 51 | <label-input-money ng-id="entradaItem.valorTotal" ng-evento-change="calcularQuantidadeEValores()" ng-label="ALMOXARIFADO.LABEL.SUBTOTAL" ng-obrigatorio="editEntrada" ng-disabled="!editEntrada" form="formDialogMateriais" ng-model="entradaItem.valorTotal" ng-custom-maxlength="19"/> |
48 | 52 | </div> |
49 | 53 | </div> |
50 | - | |
54 | + | |
51 | 55 | <div class="row"> |
52 | 56 | <div class="col-sm-4"> |
53 | 57 | <label-input ng-id="entradaItem.numeroLote" ng-label="ALMOXARIFADO.LABEL.NUMERO_LOTE" ng-obrigatorio="false" ng-disabled="!editEntrada" form="formDialogMateriais" ng-model="entradaItem.numeroLote" /> |
... | ... | @@ -65,7 +69,7 @@ |
65 | 69 | <label>{{entradaItem.material.unidadeArmazenamento.tipoUnidadeMedida.descricao}}</label> |
66 | 70 | </div> |
67 | 71 | </div> |
68 | - | |
72 | + | |
69 | 73 | <fieldset ng-show="caracteristicas.length > 0 || (entradaItem.caracteristicas.length > 0 && !editEntrada)"> |
70 | 74 | <legend> |
71 | 75 | <translate>LABEL.CARACTERISTICAS</translate> |
... | ... | @@ -127,22 +131,22 @@ |
127 | 131 | <div class="row" ng-if="bemAlmoxarifadoCaracteristica.materialCaracteristica.caracteristica.dominioTipoDado.nome == 'ARQUIVO'"> |
128 | 132 | <div class="col-sm-12"> |
129 | 133 | <div class="form-group"> |
130 | - | |
134 | + | |
131 | 135 | <label ng-class="{'has-error': validaAnexo}" for='bemAlmoxarifadoCaracteristica.valorCaracteristica-arquivo-{{$index}}' class='control-label'>{{bemAlmoxarifadoCaracteristica.materialCaracteristica.caracteristica.descricao}} |
132 | 136 | <span class='red' ng-show='bemAlmoxarifadoCaracteristica.materialCaracteristica.obrigatorio'>*</span> |
133 | 137 | <i ng-if='bemAlmoxarifadoCaracteristica.materialCaracteristica.obrigatorio' ng-show='validaAnexo' class='fa fa-warning red' tooltip="{{bemAlmoxarifadoCaracteristica.materialCaracteristica.caracteristica.descricao + ' ' +$translate.instant('LABEL.CAMPO_OBRIGATORIO')}}" tooltip-placement='top'></i> |
134 | - </label> | |
135 | - | |
138 | + </label> | |
139 | + | |
136 | 140 | <div class="col-sm-12" ng-show="editEntrada && uploaderCaracteristica.queue < 1"> |
137 | 141 | <div nv-file-drop="" uploader="uploaderCaracteristica" id="actionUploadArquivos-{{workspace.id}}" onclick="acionarInputFile(this);"> |
138 | 142 | <div nv-file-over="" uploader="uploaderCaracteristica" over-class="another-file-over-class"> |
139 | - <label class="file-input file-multiple"> | |
140 | - <span class="file-container"> | |
143 | + <label class="file-input file-multiple"> | |
144 | + <span class="file-container"> | |
141 | 145 | <label class="uploadMsg"><translate>LABEL.UPLOAD_MSG_ARRASTE</translate></label> |
142 | - <span class="file-name" data-title="..."> | |
146 | + <span class="file-name" data-title="..."> | |
143 | 147 | <i class="icon icon fa fa-cloud-upload"></i> |
144 | 148 | </span> |
145 | - </span> | |
149 | + </span> | |
146 | 150 | </label> |
147 | 151 | </div> |
148 | 152 | </div> | ... | ... |