From d8677df547dcde567165f6d22f92572950fff9f6 Mon Sep 17 00:00:00 2001 From: joyfas.silva Date: Thu, 12 May 2016 10:17:14 -0300 Subject: [PATCH] {Redmine tarefa-3943} --- cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js b/cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js index 9e71d64..c0b9817 100644 --- a/cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js +++ b/cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js @@ -10,6 +10,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp var CODIGO_DOMINIO_TIPO_RECEBIMENTO_COMPRA_ORCAMENTARIA = 1; $scope.entradaAlmoxarifado = {}; + $scope.showInteiro= true; $scope.entradaAlmoxarifadoOriginal = {}; @@ -143,6 +144,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp $scope.edit = edit; $scope.stopTimerIntervalDraft($scope.workspace); $scope.setLoading(false); + $scope.defineTipoNumerico(); }); MovimentoEstoqueRepository.buscarMovimentosSaidaComMateriaisDaEntrada(entradaAlmoxarifado.id).then(function(result) { @@ -369,6 +371,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp $scope.newEntrada = false; $scope.editEntrada = editar; $scope.entradaItem = itensSelecionados[0]; + $scope.defineTipoNumerico(); $scope.entradaItem.$quantidadeEntrada = $scope.entradaItem.quantidade / $scope.entradaItem.unidadeMedidaEntrada.quantidadePadrao; $scope.unidadesMedidasEntrada = $scope.entradaItem.material.tiposUnidadeMedidaEntrada.map(function(item){ return item.unidadeMedida; @@ -768,6 +771,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp }; } $scope.entradaItem.quantidade = null; + $scope.entradaItem.$quantidadeEntrada = null; $scope.entradaItem.valorTotal = null; $scope.entradaItem.valorUnitario = null; $scope.entradaItem.unidadeMedidaEntrada = null; @@ -776,10 +780,11 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp $scope.enderecosMaterial = []; } - if ($scope.entradaItem && $scope.entradaItem.material) { + if ($scope.entradaItem && $scope.entradaItem.material) { $scope.unidadesMedidasEntrada = $scope.entradaItem.material.tiposUnidadeMedidaEntrada.map(function(item){ if (item.isPadrao && !$scope.entradaItem.unidadeMedidaEntrada) { - $scope.entradaItem.unidadeMedidaEntrada = item.unidadeMedida; + $scope.entradaItem.unidadeMedidaEntrada = item.unidadeMedida; + $scope.defineTipoNumerico(); } return item.unidadeMedida; }); @@ -1135,22 +1140,29 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp $scope.entradaItem.$quantidadeEntrada = ''; $timeout(function(){ if($scope.entradaItem.unidadeMedidaEntrada && $scope.entradaItem.unidadeMedidaEntrada.tipoNumerico){ - switch($scope.entradaItem.unidadeMedidaEntrada.tipoNumerico.codigo){ - case 1: - $scope.showInteiro= true; - $scope.showDecimal = false; - break; - - case 2: - $scope.showDecimal = true; - $scope.showInteiro= false; - break; - } + $scope.defineTipoNumerico(); }else{ - $scope.showInteiro= false; - $scope.showDecimal = false; + $scope.showInteiro= true; + $scope.showDecimal= false; } }); }; + + $scope.defineTipoNumerico = function(){ + $scope.showInteiro= false; + $scope.showDecimal= false; + switch($scope.entradaItem.unidadeMedidaEntrada.tipoNumerico.codigo){ + case 1: + $scope.showInteiro= true; + $scope.showDecimal = false; + break; + + case 2: + $scope.showDecimal = true; + $scope.showInteiro= false; + break; + } + }; }]); + \ No newline at end of file -- libgit2 0.21.2