Commit 203d693e1d57e621a0c6d4660615800d1eb0ee70
Exists in
master
Merge branch 'master' of http://ferramentasgo.centralit.com.br:8080/scm/git/cit-grp-corporativo
# Conflicts: # cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/html/listView.html
Showing
6 changed files
with
38 additions
and
10 deletions
Show diff stats
cit-core/src/main/java/br/com/centralit/framework/util/UtilString.java
1 | 1 | package br.com.centralit.framework.util; |
2 | 2 | |
3 | 3 | import java.io.UnsupportedEncodingException; |
4 | +import java.text.ParseException; | |
5 | + | |
6 | +import javax.swing.text.MaskFormatter; | |
4 | 7 | |
5 | 8 | |
6 | 9 | /** |
... | ... | @@ -209,4 +212,16 @@ public class UtilString { |
209 | 212 | else |
210 | 213 | return str.substring(0, 1).toLowerCase() + str.substring(1); |
211 | 214 | } |
215 | + | |
216 | + public static String formatarString(String texto, String mascara){ | |
217 | + String result = texto; | |
218 | + try { | |
219 | + MaskFormatter mf = new MaskFormatter(mascara); | |
220 | + mf.setValueContainsLiteralCharacters(false); | |
221 | + result = mf.valueToString(texto); | |
222 | + } catch (ParseException e) { | |
223 | + e.printStackTrace(); | |
224 | + } | |
225 | + return result; | |
226 | + } | |
212 | 227 | } | ... | ... |
cit-portal-web/src/main/java/br/com/centralit/listener/StartupListener.java
... | ... | @@ -1466,6 +1466,8 @@ public class StartupListener extends UtilStartup implements ApplicationListener< |
1466 | 1466 | internacionalizacaoList.add(new Internacionalizacao("LABEL.DETALHES_AUDITORIA", "Detalhes Auditoria", dominio, modulo)); |
1467 | 1467 | internacionalizacaoList.add(new Internacionalizacao("LABEL.DOCUMENTOS", "Documentos", dominio, modulo)); |
1468 | 1468 | |
1469 | + internacionalizacaoList.add(new Internacionalizacao("LABEL.CPF_CNPJ", "CPF/CNPJ", dominio, modulo)); | |
1470 | + | |
1469 | 1471 | } |
1470 | 1472 | |
1471 | 1473 | /** | ... | ... |
cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js
... | ... | @@ -1561,5 +1561,13 @@ citApp.controller('AppController', ['$scope', '$routeParams', '$timeout', '$loca |
1561 | 1561 | $scope.limparUsernameRascunho = function(){ |
1562 | 1562 | $scope.editorRascunho = null; |
1563 | 1563 | }; |
1564 | + | |
1565 | + $scope.aplicarValidacaoDecimal = function(element){ | |
1566 | + if(element.precisao && element.precisao == 'decimal') | |
1567 | + if(element.model) | |
1568 | + element.model = parseFloat(element.model).toFixed(2); | |
1569 | + else | |
1570 | + element.model = ''; | |
1571 | + }; | |
1564 | 1572 | |
1565 | 1573 | }]); | ... | ... |
cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/LabelInputDecimalDirective.js
... | ... | @@ -24,7 +24,7 @@ citApp.directive("labelInputDecimal", ["$translate", function($translate) { |
24 | 24 | restrict : 'E', |
25 | 25 | template : "<div class='form-group' ng-class=\"{'has-error': form[id].$error.required && (!form[id].$pristine || form.$submitted)}\">" + |
26 | 26 | " <label for='{{id}}' class='control-label' ng-if='labelRender'><translate>{{label}}</translate> <span class='red' ng-show='obrigatorio'>*</span> <i ng-if='obrigatorio' ng-show='form[id].$error.required && (!form[id].$pristine || form.$submitted)' class='fa fa-warning red' tooltip='{{labelAlertTooltipCopy}}' tooltip-placement='top'></i> <i ng-if='labelInfoTooltipRender' class='fa fa-info-circle blue' tooltip='{{labelInfoTooltip}}' tooltip-placement='top'></i> <i ng-if='labelQuestionTooltipRender' class='fa fa-question-circle green' tooltip='{{labelQuestionTooltip}}' tooltip-placement='top'></i></label>"+ |
27 | - " <input type='text' class='form-control' ng-change='eventoChange()' ng-blur='eventoBlur()' ng-keydown='removeModel($event)' id='{{id}}' name='{{id}}' ng-model='model' ng-disabled='disabled' maxlength='{{maxlength ? maxlength : 23}}' ng-required='obrigatorio' ui-number-mask='{{precisao}}'/>" + | |
27 | + " <input type='text' class='form-control' ng-change='eventoChange()' ng-blur='eventoBlur(this)' ng-keydown='removeModel($event)' id='{{id}}' name='{{id}}' ng-model='model' ng-disabled='disabled' maxlength='{{maxlength ? maxlength : 23}}' ng-required='obrigatorio' ui-number-mask='{{precisao}}'/>" + | |
28 | 28 | "</div>", |
29 | 29 | |
30 | 30 | controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) { |
... | ... | @@ -58,7 +58,6 @@ citApp.directive("labelInputDecimal", ["$translate", function($translate) { |
58 | 58 | } |
59 | 59 | }], |
60 | 60 | link : function($scope, $element, attibutes){ |
61 | - | |
62 | 61 | $scope.removeModel = function(event){ |
63 | 62 | if((event.keyCode === 8 || event.keyCode === 46) && $scope.model === 0.0){ |
64 | 63 | $scope.model = null; | ... | ... |
cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/MasksDirective.js
... | ... | @@ -1571,14 +1571,20 @@ angular.module('ui.utils.masks.number', []) |
1571 | 1571 | |
1572 | 1572 | var pos = value.indexOf(","); |
1573 | 1573 | var result; |
1574 | + //se não ouver maxlength, 9 eh padrão... | |
1575 | + var maxLength = attrs.maxlength ? attrs.maxlength : 9; | |
1576 | + // -3 conta virgula e 2 casa decimais | |
1577 | + var digitos = maxLength - 3; | |
1578 | + var part1 = ''; | |
1579 | + var part2 = ''; | |
1574 | 1580 | if (pos !== -1) { |
1575 | - var part1 = value.substr(0, pos > 6 ? 6 : pos); | |
1576 | - var part2 = value.substr(pos > 6 ? 6 : pos + 1); | |
1581 | + part1 = value.substr(0, pos > digitos ? digitos : pos); | |
1582 | + part2 = value.substr(pos > digitos ? digitos : pos + 1); | |
1577 | 1583 | //2 casas decimais...... |
1578 | 1584 | part2 = part2.substr(0,2); |
1579 | 1585 | result = cleanForDecimal(part1) + "," + cleanForDecimal(part2); |
1580 | 1586 | } else { |
1581 | - result = cleanForDecimal(value).substr(0,6); | |
1587 | + result = cleanForDecimal(value).substr(0,digitos); | |
1582 | 1588 | } |
1583 | 1589 | |
1584 | 1590 | result = result ==',' ? '' : result; | ... | ... |
cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/html/listView.html
... | ... | @@ -28,11 +28,9 @@ |
28 | 28 | <th ng-if="isCheckBox != undefined && isCheckBox" class="text-center"><input type="checkbox" ng-model="$parent.selectedAll" ng-checked="selectedAll" ng-click="checkAll();" /></th> |
29 | 29 | <th ng-if="(isCheckBox == undefined || !isCheckBox) && exibirColunaSelecao" class="text-center" style="width: 5%"></th> |
30 | 30 | <th ng-if="exibirExpandir" class="text-center" style="width: 5%"></th> |
31 | - <th class="text-center" ng-repeat="header in headers" style="width: {{header.tamanho ? header.tamanho : divisaoColunas}}%" ng-if="!header.notSort"> | |
32 | - <sort-by onsort="onSort" sortdir="filterCriteria.dir" sortedby="filterCriteria.sort" sortvalue="{{ header.value }}">{{ header.title }}</sort-by> | |
33 | - </th> | |
34 | - <th class="text-center" ng-repeat="header in headers" style="width: {{header.tamanho ? header.tamanho : divisaoColunas}}%" ng-if="header.notSort"> | |
35 | - {{ header.title }} | |
31 | + <th class="text-center" ng-repeat="header in headers" style="width: {{header.tamanho ? header.tamanho : divisaoColunas}}%"> | |
32 | + <div ng-if="!header.notSort"><sort-by onsort="onSort" sortdir="filterCriteria.dir" sortedby="filterCriteria.sort" sortvalue="{{ header.value }}">{{ header.title }}</sort-by></div> | |
33 | + <div ng-if="header.notSort">{{ header.title }}</div> | |
36 | 34 | </th> |
37 | 35 | </tr> |
38 | 36 | </thead> | ... | ... |