Commit c6b9d853542e8dd0443e434bb4760e29569e3db7
1 parent
dfbcb199
Exists in
master
campo qtde sempre visivel
Showing
1 changed file
with
20 additions
and
20 deletions
Show diff stats
cit-tabelas-corp-web/src/main/webapp/assets/js/angular/custom/controller/UnidadeMedidaController.js
@@ -3,10 +3,7 @@ | @@ -3,10 +3,7 @@ | ||
3 | citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository', '$translate', '$timeout', 'DominioRepository', | 3 | citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository', '$translate', '$timeout', 'DominioRepository', |
4 | function UnidadeMedidaController($scope, UnidadeMedidaRepository, $translate, $timeout, DominioRepository) { | 4 | function UnidadeMedidaController($scope, UnidadeMedidaRepository, $translate, $timeout, DominioRepository) { |
5 | 5 | ||
6 | - $scope.unidadeMedida = { | ||
7 | - showDecimal: false, | ||
8 | - showInteiro: false | ||
9 | - }; | 6 | + $scope.showInteiro= true; |
10 | 7 | ||
11 | // Limpa formulário para novo cadastro | 8 | // Limpa formulário para novo cadastro |
12 | $scope.resetForm = function() { | 9 | $scope.resetForm = function() { |
@@ -75,7 +72,9 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository | @@ -75,7 +72,9 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository | ||
75 | $scope.unidadeMedida = result.originalElement; | 72 | $scope.unidadeMedida = result.originalElement; |
76 | $scope.edit = edit; | 73 | $scope.edit = edit; |
77 | $scope.setLoading(false); | 74 | $scope.setLoading(false); |
75 | + $scope.alternaTipoNumerico(); | ||
78 | }); | 76 | }); |
77 | + | ||
79 | }; | 78 | }; |
80 | 79 | ||
81 | DominioRepository.findAllDominio('tipoNumerico').then(function(result) { | 80 | DominioRepository.findAllDominio('tipoNumerico').then(function(result) { |
@@ -89,26 +88,27 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository | @@ -89,26 +88,27 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository | ||
89 | $scope.alternaTipoNumerico = function(){ | 88 | $scope.alternaTipoNumerico = function(){ |
90 | $timeout(function(){ | 89 | $timeout(function(){ |
91 | if($scope.unidadeMedida.tipoNumerico){ | 90 | if($scope.unidadeMedida.tipoNumerico){ |
92 | - switch($scope.unidadeMedida.tipoNumerico.codigo){ | ||
93 | - case 1: | ||
94 | - $scope.showInteiro= true; | ||
95 | - $scope.showDecimal = false; | ||
96 | - $scope.unidadeMedida.quantidadeDecimal = ''; | ||
97 | - break; | ||
98 | - | ||
99 | - case 2: | ||
100 | - $scope.showDecimal = true; | ||
101 | - $scope.showInteiro= false; | ||
102 | - $scope.unidadeMedida.quantidadeInteiro = ''; | ||
103 | - break; | ||
104 | - | ||
105 | - } | 91 | + $scope.defineTipoNumerico(); |
106 | }else{ | 92 | }else{ |
107 | - $scope.showDecimal = false; | ||
108 | - $scope.showInteiro= false; | 93 | + $scope.showInteiro= true; |
109 | $scope.unidadeMedida.quantidadeInteiro = ''; | 94 | $scope.unidadeMedida.quantidadeInteiro = ''; |
110 | $scope.unidadeMedida.quantidadeDecimal = ''; | 95 | $scope.unidadeMedida.quantidadeDecimal = ''; |
111 | } | 96 | } |
112 | }); | 97 | }); |
113 | }; | 98 | }; |
99 | + $scope.defineTipoNumerico = function(){ | ||
100 | + switch($scope.unidadeMedida.tipoNumerico.codigo){ | ||
101 | + case 1: | ||
102 | + $scope.showInteiro= true; | ||
103 | + $scope.showDecimal = false; | ||
104 | + $scope.unidadeMedida.quantidadeDecimal = ''; | ||
105 | + break; | ||
106 | + | ||
107 | + case 2: | ||
108 | + $scope.showDecimal = true; | ||
109 | + $scope.showInteiro= false; | ||
110 | + $scope.unidadeMedida.quantidadeInteiro = ''; | ||
111 | + break; | ||
112 | + } | ||
113 | + }; | ||
114 | }]); | 114 | }]); |
115 | \ No newline at end of file | 115 | \ No newline at end of file |