Commit 2b6c58777e0ba149fa98984e0c4c6cebeaa0e690

Authored by thiago.coimbra
1 parent 05217b71
Exists in master

redmine #4738 Adicionado gerenciamento dos atributos 'quantidadeDecimal' e 'quantidadeInteiro'.

cit-tabelas-corp-web/src/main/webapp/assets/js/angular/custom/controller/UnidadeMedidaController.js
... ... @@ -3,7 +3,10 @@
3 3 citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository', '$translate', '$timeout', 'DominioRepository',
4 4 function UnidadeMedidaController($scope, UnidadeMedidaRepository, $translate, $timeout, DominioRepository) {
5 5  
6   - $scope.unidadeMedida = {};
  6 + $scope.unidadeMedida = {
  7 + showDecimal: false,
  8 + showInteiro: false
  9 + };
7 10  
8 11 // Limpa formulário para novo cadastro
9 12 $scope.resetForm = function() {
... ... @@ -79,4 +82,41 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository
79 82 $scope.tipoNumericoList = result;
80 83 });
81 84  
82   -}]);
  85 + $scope.atualizaCampoQTDEPadrao = function(){
  86 + $scope.unidadeMedida.quantidadePadrao;
  87 + };
  88 +
  89 + $scope.alternaTipoNumerico = function(){
  90 + $timeout(function(){
  91 + 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 + }
  106 + }else{
  107 + $scope.showDecimal = false;
  108 + $scope.showInteiro= false;
  109 + $scope.unidadeMedida.quantidadeInteiro = '';
  110 + $scope.unidadeMedida.quantidadeDecimal = '';
  111 + }
  112 + });
  113 + };
  114 +
  115 + $scope.aplicarValidacaoDecimal = function(){
  116 + if($scope.unidadeMedida.quantidadeDecimal){
  117 + $scope.unidadeMedida.quantidadeDecimal = parseFloat($scope.unidadeMedida.quantidadeDecimal).toFixed(2);
  118 + }else{
  119 + $scope.unidadeMedida.quantidadeDecimal = '';
  120 + }
  121 + };
  122 +}]);
83 123 \ No newline at end of file
... ...