sign up country selection settings added

This commit is contained in:
Muammer Top 2020-10-13 17:41:27 +03:00
parent 1c61e59130
commit e5f5ea0b62
4 changed files with 25 additions and 3 deletions

View File

@ -9,7 +9,7 @@ return [
'fields' => [
'home_page_sub_categories_limit', 'navigation_title', 'navigation_action', 'date_fields',
'price_fields', 'breadcrumbs', 'ad_details', 'ad_details_tab', 'latest_and_view_all_btn',
'register_page_instruction_logo', 'register_page_alert_link'
'register_page_instruction_logo', 'register_page_alert_link', 'enabled_countries'
],
],
'template' => [

View File

@ -1,5 +1,5 @@
<?php
use Visiosoft\LocationModule\Country\CountryRepository;
return [
'navigation_title' => [
'type' => 'anomaly.field_type.boolean',
@ -71,4 +71,24 @@ return [
'style' => [
'type' => 'anomaly.field_type.editor',
],
'enabled_countries' => [
'bind' => 'visiosoft.theme.base::countries.enabled',
'env' => 'ADV_ENABLED_COUNTRIES',
'type' => 'anomaly.field_type.select',
'required' => false,
'config' => [
'default_value' => function () {
return [config('visiosoft.theme.base::countries.default')];
},
'options' => function () {
$array = \Visiosoft\LocationModule\Country\CountryModel::query()->get();
$cur = array();
foreach ($array as $key => $value) {
$cur[$value['abv']] = $value['name'];
}
return $cur;
},
],
],
];

View File

@ -1,4 +1,5 @@
function phoneMask(fields) {
var country = document.getElementById('country').innerText;
var inputQueries = document.querySelectorAll(fields);
inputQueries.forEach(function (inputQuery, key) {
var iti = intlTelInput(inputQuery, {
@ -8,7 +9,7 @@ function phoneMask(fields) {
geoIpLookup: function (success, failure) {
$.get("https://ipinfo.io", function () {
}, "jsonp").always(function (resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
var countryCode = country ? country : (resp && resp.country) ? resp.country : "";
success(countryCode);
})
}

View File

@ -56,6 +56,7 @@
<div class="input-wrapper validate-phone">
{{ form.fields.phone.setValue(form.fields.phone.value).input|raw }}
<div id="country" class="hidden">{{ setting_value('visiosoft.theme.base::enabled_countries') }}</div>
</div>
</div>
</div>