Commit 1a5b4558 authored by Alex Felippe Chiozo's avatar Alex Felippe Chiozo
Browse files

formata número de telefone no padrão internacional

parent b072bcff
......@@ -58,6 +58,13 @@ class Theme extends BaseV1\Theme{
});
}
function includeVendorAssets()
{
parent::includeVendorAssets();
$this->enqueueScript("vendor", "libphonenumber-min", "vendor/libphonenumber-min.js");
return;
}
protected function _publishAssets() {
$this->asset('img/home--agents.jpg', false);
$this->asset('img/home--developers.jpg', false);
......
......@@ -92,6 +92,17 @@ jQuery(function(){
* Example: ['00-0009', '000-009', '0000-000']
*
*/
if (libphonenumber !== undefined) {
editable.input.$input.keypress(function (ev) {
current = editable.input.$input.val().replace(/\s/g, "");
if (!current.startsWith("+")) {
current = `+${current}`;
}
editable.input.$input.val(new libphonenumber.AsYouType().input(current));
return;
});
return;
}
if (MapasCulturais.phoneMasks === false) return;
var masks = MapasCulturais.phoneMasks ? MapasCulturais.phoneMasks : ['(00) 0000-00009', '(00) 00000-0000'];
editable.input.$input.mask(masks[0], {onKeyPress:
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment