mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
phone fields
This commit is contained in:
parent
a513b8201e
commit
db20767ce3
@ -1,29 +1,35 @@
|
||||
// Personal Registration
|
||||
var inputQueries = document.querySelectorAll("input[name=\"phone\"],input[name='land_phone']");
|
||||
inputQueries.forEach(function (inputQuery, key) {
|
||||
var iti = intlTelInput(inputQuery, {
|
||||
hiddenInput: "full_phone_"+inputQuery.getAttribute('name'),
|
||||
class: "form-control",
|
||||
initialCountry: "auto",
|
||||
geoIpLookup: function (success, failure) {
|
||||
$.get("https://ipinfo.io", function () {
|
||||
}, "jsonp").always(function (resp) {
|
||||
var countryCode = (resp && resp.country) ? resp.country : "";
|
||||
success(countryCode);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$("input[name='phone'],input[name='land_phone']").on('countrychange', function (e) {
|
||||
maskPhone($(this).attr('name'))
|
||||
});
|
||||
|
||||
function maskPhone(name) {
|
||||
var currentMask = $("input[name='" + name + "']").attr('placeholder');
|
||||
$("input[name='" + name + "']").mask(currentMask.replace(/[0-9+]/ig, '9'), {
|
||||
autoclear: true,
|
||||
clearIncomplete: true
|
||||
function phoneMask(fields) {
|
||||
var inputQueries = document.querySelectorAll(fields);
|
||||
inputQueries.forEach(function (inputQuery, key) {
|
||||
var iti = intlTelInput(inputQuery, {
|
||||
hiddenInput: inputQuery.getAttribute('name'),
|
||||
class: "form-control",
|
||||
initialCountry: "auto",
|
||||
geoIpLookup: function (success, failure) {
|
||||
$.get("https://ipinfo.io", function () {
|
||||
}, "jsonp").always(function (resp) {
|
||||
var countryCode = (resp && resp.country) ? resp.country : "";
|
||||
success(countryCode);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
var fields_arr = fields.split(',');
|
||||
$.each(fields_arr, function (index, value) {
|
||||
maskPhone($(value).attr('name'))
|
||||
});
|
||||
|
||||
|
||||
$(fields).on('countrychange', function (e) {
|
||||
maskPhone($(this).attr('name'))
|
||||
});
|
||||
|
||||
function maskPhone(name) {
|
||||
var currentMask = $("input[name='" + name + "']").attr('placeholder');
|
||||
$("input[name='" + name + "']").mask(currentMask.replace(/[0-9+]/ig, '9'), {
|
||||
autoclear: true,
|
||||
clearIncomplete: true
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
phoneMask("input[name='phone'],input[name='land_phone']");
|
||||
@ -67,7 +67,7 @@
|
||||
</label>
|
||||
|
||||
<div class="input-wrapper">
|
||||
{{ form.fields.phone.setValue(form.fields.full_phone.value).input|raw }}
|
||||
{{ form.fields.phone.setValue(form.fields.phone.value).input|raw }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -72,11 +72,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/intlTelInput.min.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/utils.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/phonefield.js") }}
|
||||
{{ asset_add("styles.css", "visiosoft.theme.base::css/intlTelInput.css") }}
|
||||
{{ asset_add("styles.css", "visiosoft.theme.base::css/register.css") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/register.js") }}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -9,6 +9,10 @@
|
||||
{{ asset_add("theme.js", "theme::js/select2.js") }}
|
||||
{{ asset_add("theme.js", "theme::js/params.js") }}
|
||||
{{ asset_add("theme.js", "theme::js/jquery.maskedinput.js") }}
|
||||
{{ asset_add("theme.js", "visiosoft.theme.base::js/intlTelInput.min.js") }}
|
||||
{{ asset_add("theme.js", "visiosoft.theme.base::js/utils.js") }}
|
||||
{{ asset_add("theme.js", "theme::js/phoneField.js") }}
|
||||
|
||||
|
||||
{# Theme Scripts #}
|
||||
{#{{ asset_add("theme.js", "theme::js/plugins/*") }}#}
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
{{ asset_add("theme.css", "theme::css/theme.css") }}
|
||||
{{ asset_add("theme.css", "theme::css/select2.css") }}
|
||||
{{ asset_add("theme.css", "theme::css/font-awesome.min.css") }}
|
||||
{{ asset_add("theme.css", "visiosoft.theme.base::css/intlTelInput.css") }}
|
||||
|
||||
<script src="{{ asset_path('theme::js/vendor/jquery.min.js') }}"></script>
|
||||
|
||||
{{ asset_style("theme.css") }}
|
||||
|
||||
@ -1,31 +1 @@
|
||||
// Personal Registration
|
||||
var inputQueries = document.querySelectorAll("input[name='adress_gsm_phone']");
|
||||
inputQueries.forEach(function (inputQuery, key) {
|
||||
var iti = intlTelInput(inputQuery, {
|
||||
hiddenInput: "full_phone_"+inputQuery.getAttribute('name'),
|
||||
class: "form-control",
|
||||
initialCountry: "auto",
|
||||
geoIpLookup: function (success, failure) {
|
||||
$.get("https://ipinfo.io", function () {
|
||||
}, "jsonp").always(function (resp) {
|
||||
var countryCode = (resp && resp.country) ? resp.country : "";
|
||||
success(countryCode);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
maskPhone()
|
||||
|
||||
$("input[name='adress_gsm_phone']").on('countrychange', function (e) {
|
||||
maskPhone()
|
||||
});
|
||||
|
||||
function maskPhone(name) {
|
||||
var currentMask = $("input[name='adress_gsm_phone']").attr('placeholder');
|
||||
$("input[name='adress_gsm_phone']").mask(currentMask.replace(/[0-9+]/ig, '9'), {
|
||||
autoclear: true,
|
||||
clearIncomplete: true
|
||||
});
|
||||
|
||||
}
|
||||
phoneMask("input[name='adress_gsm_phone']")
|
||||
@ -1,32 +1 @@
|
||||
// Personal Registration
|
||||
var inputQueries = document.querySelectorAll("input[name='gsm_phone'],input[name='office_phone'],input[name='land_phone']");
|
||||
inputQueries.forEach(function (inputQuery, key) {
|
||||
var iti = intlTelInput(inputQuery, {
|
||||
hiddenInput: "full_phone_" + inputQuery.getAttribute('name'),
|
||||
class: "form-control",
|
||||
initialCountry: "auto",
|
||||
geoIpLookup: function (success, failure) {
|
||||
$.get("https://ipinfo.io", function () {
|
||||
}, "jsonp").always(function (resp) {
|
||||
var countryCode = (resp && resp.country) ? resp.country : "";
|
||||
success(countryCode);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
maskPhone('gsm_phone')
|
||||
maskPhone('land_phone')
|
||||
maskPhone('office_phone')
|
||||
$("input[name='gsm_phone'],input[name='office_phone'],input[name='land_phone']").on('countrychange', function (e) {
|
||||
maskPhone($(this).attr('name'))
|
||||
});
|
||||
|
||||
function maskPhone(name) {
|
||||
var currentMask = $("input[name='" + name + "']").attr('placeholder');
|
||||
$("input[name='" + name + "']").mask(currentMask.replace(/[0-9+]/ig, '9'), {
|
||||
autoclear: true,
|
||||
clearIncomplete: true
|
||||
});
|
||||
|
||||
}
|
||||
phoneMask("input[name='gsm_phone'],input[name='office_phone'],input[name='land_phone']")
|
||||
@ -79,9 +79,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/country.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/intlTelInput.min.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/utils.js") }}
|
||||
{{ asset_add("styles.css", "visiosoft.theme.base::css/intlTelInput.css") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/address.js") }}
|
||||
|
||||
{% endblock %}
|
||||
@ -80,8 +80,5 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/country.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/intlTelInput.min.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/utils.js") }}
|
||||
{{ asset_add("styles.css", "visiosoft.theme.base::css/intlTelInput.css") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/address.js") }}
|
||||
{% endblock %}
|
||||
@ -176,9 +176,6 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/intlTelInput.min.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/utils.js") }}
|
||||
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/profile.js") }}
|
||||
{{ asset_add("styles.css", "visiosoft.theme.base::css/intlTelInput.css") }}
|
||||
{{ asset_add("styles.css", "visiosoft.module.profile::assets/css/profile.css") }}
|
||||
{% endblock %}
|
||||
@ -199,8 +199,7 @@ class MyProfileController extends PublicController
|
||||
|
||||
$New_value = $request->all();
|
||||
$New_value['country_id'] = $New_value['country'];
|
||||
$New_value['adress_gsm_phone'] = $New_value['full_phone_adress_gsm_phone'];
|
||||
unset($New_value['_token'], $New_value['action'], $New_value['country'], $New_value['full_phone_adress_gsm_phone']);
|
||||
unset($New_value['_token'], $New_value['action'], $New_value['country']);
|
||||
$adressModel->getAdress($id)->update($New_value);
|
||||
|
||||
$message = [];
|
||||
@ -242,8 +241,7 @@ class MyProfileController extends PublicController
|
||||
return $message;
|
||||
}
|
||||
$new_adress = $request->request->all();
|
||||
$new_adress['adress_gsm_phone'] = $new_adress['full_phone_adress_gsm_phone'];
|
||||
unset($new_adress['_token'], $new_adress['full_phone_adress_gsm_phone']);
|
||||
unset($new_adress['_token']);
|
||||
$new_adress['user_id'] = Auth::id();
|
||||
|
||||
$adressModel = new AdressModel();
|
||||
@ -266,8 +264,7 @@ class MyProfileController extends PublicController
|
||||
return $message;
|
||||
}
|
||||
$new_adress = $this->request->all();
|
||||
$new_adress['adress_gsm_phone'] = $new_adress['full_phone_adress_gsm_phone'];
|
||||
unset($new_adress['_token'], $new_adress['full_phone_adress_gsm_phone']);
|
||||
unset($new_adress['_token']);
|
||||
|
||||
$address->update($new_adress);
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@ class ProfileFormHandler
|
||||
}
|
||||
|
||||
$parameters = [
|
||||
'gsm_phone' => $builder->getPostValue('full_phone_gsm_phone'),
|
||||
'office_phone' => $builder->getPostValue('full_phone_office_phone'),
|
||||
'land_phone' => $builder->getPostValue('full_phone_land_phone'),
|
||||
'gsm_phone' => $builder->getPostValue('gsm_phone'),
|
||||
'office_phone' => $builder->getPostValue('office_phone'),
|
||||
'land_phone' => $builder->getPostValue('land_phone'),
|
||||
'identification_number' => $builder->getPostValue('identification_number'),
|
||||
'register_type' => $builder->getPostValue('register_type'),
|
||||
'adv_listing_banner_id' => $builder->getPostValue('adv_listing_banner'),
|
||||
|
||||
@ -41,7 +41,7 @@ class Register2FormBuilder extends FormBuilder
|
||||
'username' => [
|
||||
'required' => true,
|
||||
],
|
||||
'full_phone' => [
|
||||
'phone' => [
|
||||
'type' => 'anomaly.field_type.text',
|
||||
],
|
||||
'first_name' => [
|
||||
|
||||
@ -51,7 +51,7 @@ class Register2FormHandler
|
||||
$domain = str_replace('/', '', $domain);
|
||||
$domain = str_replace('www', '', $domain);
|
||||
|
||||
$profile_parameters['gsm_phone'] = $builder->getPostValue('full_phone_phone');
|
||||
$profile_parameters['gsm_phone'] = $builder->getPostValue('phone');
|
||||
if (!setting_value('visiosoft.module.advs::register_email_field')) {
|
||||
$builder->setFormValue('email', $builder->getPostValue('username') . "@" . $domain);
|
||||
}
|
||||
@ -59,7 +59,7 @@ class Register2FormHandler
|
||||
$fields = $builder->getPostData();
|
||||
$fields['display_name'] = $fields['first_name'] . " " . $fields['last_name'];
|
||||
unset($fields['phone']);
|
||||
unset($fields['full_phone_phone']);
|
||||
unset($fields['phone']);
|
||||
|
||||
|
||||
$register = $users->create($fields);
|
||||
|
||||
@ -7,11 +7,11 @@ class ValidateRegister
|
||||
{
|
||||
public function handle(FormBuilder $builder, ProfileRepositoryInterface $profileRepository, $attribute, $value)
|
||||
{
|
||||
if (!is_numeric($builder->getPostValue('full_phone'))) {
|
||||
$builder->addFormError('full_phone', trans('visiosoft.module.profile::message.error_valid_phone'));
|
||||
if (!is_numeric($builder->getPostValue('phone'))) {
|
||||
$builder->addFormError('phone', trans('visiosoft.module.profile::message.error_valid_phone'));
|
||||
return false;
|
||||
} elseif (!is_null($profileRepository->findPhoneNumber($builder->getPostValue('full_phone')))) {
|
||||
$builder->addFormError('full_phone', trans('visiosoft.module.profile::message.registered_phone'));
|
||||
} elseif (!is_null($profileRepository->findPhoneNumber($builder->getPostValue('phone')))) {
|
||||
$builder->addFormError('phone', trans('visiosoft.module.profile::message.registered_phone'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user