Commit cc2a365517731161e0cc27c2bf0f518a0102ea13
1 parent
203d693e
Exists in
master
Redmine #4783 Validações na página 1 de entrada de almoxarifado
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
cit-portal-web/src/main/webapp/assets/js/angular/custom/utils/functions.js
... | ... | @@ -21,6 +21,25 @@ function aplicarMascara(valor, mascara){ |
21 | 21 | return result; |
22 | 22 | }; |
23 | 23 | |
24 | +function aplicarCpfCnpj(input) { | |
25 | + if (input.length == 11) { | |
26 | + var t = input.split(''); | |
27 | + t.splice(3, 0, '.'); | |
28 | + t.splice(7, 0, '.'); | |
29 | + t.splice(11, 0, '-'); | |
30 | + return t.join(''); | |
31 | + } | |
32 | + if (input.length == 14) { | |
33 | + var t = input.split(''); | |
34 | + t.splice(2, 0, '.'); | |
35 | + t.splice(6, 0, '.'); | |
36 | + t.splice(10, 0, '/'); | |
37 | + t.splice(15, 0, '-'); | |
38 | + return t.join(''); | |
39 | + } | |
40 | + return input; | |
41 | +} | |
42 | + | |
24 | 43 | // serve para converter strings com o formato > yyyy ou mm/yyyy ou dd/mm/yyyy ou dd-mm-yyyy em date |
25 | 44 | function converterStringEmDate(str) { |
26 | 45 | if (str) { | ... | ... |