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 | 3 | citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository', '$translate', '$timeout', 'DominioRepository', |
4 | 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 | 8 | // Limpa formulário para novo cadastro |
12 | 9 | $scope.resetForm = function() { |
... | ... | @@ -75,7 +72,9 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository |
75 | 72 | $scope.unidadeMedida = result.originalElement; |
76 | 73 | $scope.edit = edit; |
77 | 74 | $scope.setLoading(false); |
75 | + $scope.alternaTipoNumerico(); | |
78 | 76 | }); |
77 | + | |
79 | 78 | }; |
80 | 79 | |
81 | 80 | DominioRepository.findAllDominio('tipoNumerico').then(function(result) { |
... | ... | @@ -89,26 +88,27 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository |
89 | 88 | $scope.alternaTipoNumerico = function(){ |
90 | 89 | $timeout(function(){ |
91 | 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 | 92 | }else{ |
107 | - $scope.showDecimal = false; | |
108 | - $scope.showInteiro= false; | |
93 | + $scope.showInteiro= true; | |
109 | 94 | $scope.unidadeMedida.quantidadeInteiro = ''; |
110 | 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 | 115 | \ No newline at end of file | ... | ... |