diff --git a/cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js b/cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js
index d49fa47..1969eaa 100644
--- a/cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js
+++ b/cit-portal-web/src/main/webapp/assets/js/angular/custom/controller/AppController.js
@@ -1561,5 +1561,13 @@ citApp.controller('AppController', ['$scope', '$routeParams', '$timeout', '$loca
$scope.limparUsernameRascunho = function(){
$scope.editorRascunho = null;
};
+
+ $scope.aplicarValidacaoDecimal = function(element){
+ if(element.model){
+ element.model = parseFloat(element.model).toFixed(2);
+ }else{
+ element.model = '';
+ }
+ };
}]);
diff --git a/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/LabelInputDecimalDirective.js b/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/LabelInputDecimalDirective.js
index 86adab7..f6582ec 100644
--- a/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/LabelInputDecimalDirective.js
+++ b/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/LabelInputDecimalDirective.js
@@ -24,7 +24,7 @@ citApp.directive("labelInputDecimal", ["$translate", function($translate) {
restrict : 'E',
template : "
" +
" "+
- " " +
+ " " +
"
",
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
@@ -58,7 +58,6 @@ citApp.directive("labelInputDecimal", ["$translate", function($translate) {
}
}],
link : function($scope, $element, attibutes){
-
$scope.removeModel = function(event){
if((event.keyCode === 8 || event.keyCode === 46) && $scope.model === 0.0){
$scope.model = null;
diff --git a/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/MasksDirective.js b/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/MasksDirective.js
index 0e5d4da..21fdd50 100644
--- a/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/MasksDirective.js
+++ b/cit-portal-web/src/main/webapp/assets/js/angular/custom/directive/MasksDirective.js
@@ -1571,14 +1571,20 @@ angular.module('ui.utils.masks.number', [])
var pos = value.indexOf(",");
var result;
+ //se não ouver maxlength, 9 eh padrão...
+ var maxLength = attrs.maxlength ? attrs.maxlength : 9;
+ // -3 conta virgula e 2 casa decimais
+ var digitos = maxLength - 3;
+ var part1 = '';
+ var part2 = '';
if (pos !== -1) {
- var part1 = value.substr(0, pos > 6 ? 6 : pos);
- var part2 = value.substr(pos > 6 ? 6 : pos + 1);
+ part1 = value.substr(0, pos > digitos ? digitos : pos);
+ part2 = value.substr(pos > digitos ? digitos : pos + 1);
//2 casas decimais......
part2 = part2.substr(0,2);
result = cleanForDecimal(part1) + "," + cleanForDecimal(part2);
} else {
- result = cleanForDecimal(value).substr(0,6);
+ result = cleanForDecimal(value).substr(0,digitos);
}
result = result ==',' ? '' : result;
--
libgit2 0.21.2