Commit 57f1d8c2 authored by Alex Felippe Chiozo's avatar Alex Felippe Chiozo
Browse files

corrige suporte a telefone global na inscrição

parent a4fb64a0
......@@ -14,8 +14,9 @@ services:
- ../docker-data/private-files:/var/www/private-files
# - ../docker-data/pcache-cron.log:/var/www/scripts/nohup.out
- ../themes/IberCulturaViva/agent-types.php:/var/www/html/protected/application/conf/agent-types.php
- ../themes/IberCulturaViva/space-types.php:/var/www/html/protected/application/conf/space-types.php
- ../../ibermapas/src/protected/application/lib:/var/www/html/protected/application/lib
- ../../ibermapas/src/protected/application/themes:/var/www/html/protected/application/themes
- ../../ibermapas/src/protected/db-updates.php:/var/www/html/protected/db-updates.php
- ../compose/common/config.d:/var/www/html/protected/application/conf/conf-common.d
- ../compose/local/config.d:/var/www/html/protected/application/conf/config.d
......
......@@ -95,6 +95,13 @@ class Theme extends BaseV1\Theme{
return;
}
function includeCommonAssets()
{
parent::includeCommonAssets();
$this->enqueueScript("app", "registration-phone", "js/registration-phone.js");
return;
}
function includeVendorAssets()
{
parent::includeVendorAssets();
......@@ -223,6 +230,17 @@ class Theme extends BaseV1\Theme{
'Não' => i::__('Não')
]
]);
// international phone type for registrations
$app->registerRegistrationFieldType(new \MapasCulturais\Definitions\RegistrationFieldType([
"slug" => "phone",
"name" => \MapasCulturais\i::__("Campo de telefone internacional"),
"viewTemplate" => "registration-field-types/phone",
"configTemplate" => "registration-field-types/phone-config",
"validations" => [
"v::phone()" => \MapasCulturais\i::__("O valor não é um telefone válido")
]
]));
return;
}
......
$(function () {
if (libphonenumber !== undefined) {
$(".phone-input").keypress(function (ev) {
var $target = $(ev.target);
var current = $target.val().replace(/\s/g, "");
if (!current.startsWith("+")) {
current = `+${current}`;
}
$target.val(new libphonenumber.AsYouType().input(current));
return;
});
}
return;
});
\ No newline at end of file
<input class="phone-input" ng-required="requiredField(field)" ng-model="entity[fieldName]" ng-blur="saveField(field, entity[fieldName])" type="string">
\ No newline at end of file
<div ng-if="field.fieldType === 'phone'">
</div>
\ No newline at end of file
<div ng-class="field.error ? 'invalidField': '' " ng-if="::field.fieldType === 'phone'" id="field_{{::field.id}}">
<div class="label">
{{field.title}}
<span ng-if="requiredField(field) "><?= \MapasCulturais\i::__("obrigatório") ?></span>
</div>
<div ng-if="::field.description" class="attachment-description">{{::fieldfield.description}}</div>
<span ng-if="requiredField(field) "><?= \MapasCulturais\i::__("obrigatório") ?></span>
<div><?php $this->part("registration-field-types/fields/phone"); ?></div>
</div>
\ No newline at end of file
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