mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
8883913666
@ -1,6 +1,8 @@
|
||||
/* Location Data */
|
||||
var boundsAction = false;
|
||||
|
||||
getCountries();
|
||||
|
||||
var getCountry = $('.country-data').data('content');
|
||||
if (getCountry == "") {
|
||||
getCountry = default_country;
|
||||
@ -206,3 +208,11 @@ function editMarket() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCountries() {
|
||||
crud('', '/ajax/getCountry', 'GET', function (callback) {
|
||||
$.each(callback, function (index, value) {
|
||||
$('select[name="country"]').append("<option value='" + value.id + "'>" + value.name + "</option>");
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@ -201,6 +201,7 @@
|
||||
var default_currency = "{{ setting_value('streams::currency') }}";
|
||||
var default_GET = "{{ setting_value('visiosoft.module.advs::default_GET') }}";
|
||||
var adv_id = "{{ id }}";
|
||||
var pick_option = "{{ trans('visiosoft.module.location::field.pick_option.name') }}"
|
||||
</script>
|
||||
|
||||
{{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }}
|
||||
|
||||
@ -7,7 +7,10 @@ return [
|
||||
'general' => [
|
||||
'title' => 'visiosoft.module.location::section.general',
|
||||
'fields' => [
|
||||
'home_page_location', 'list_page_location', 'detail_page_location', 'create_ad_page_location', 'country_for_phone_field'
|
||||
'sorting_column','sorting_type',
|
||||
'home_page_location', 'list_page_location',
|
||||
'detail_page_location', 'create_ad_page_location',
|
||||
'country_for_phone_field'
|
||||
],
|
||||
],
|
||||
'map' => [
|
||||
|
||||
@ -33,19 +33,19 @@ return [
|
||||
'default_value' => 212,
|
||||
]
|
||||
],
|
||||
'country_for_phone_field' => [
|
||||
'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()->pluck('name', 'abv')->toArray();
|
||||
return $array;
|
||||
},
|
||||
],
|
||||
],
|
||||
'country_for_phone_field' => [
|
||||
'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()->pluck('name', 'abv')->toArray();
|
||||
return $array;
|
||||
},
|
||||
],
|
||||
],
|
||||
'default_city' => [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
],
|
||||
@ -88,4 +88,24 @@ return [
|
||||
'default_value' => false,
|
||||
],
|
||||
],
|
||||
'sorting_column' => [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
'config' => [
|
||||
'default_value' => 'slug',
|
||||
'options' => [
|
||||
'slug' => 'slug',
|
||||
'id' => 'id',
|
||||
'order' => 'order'
|
||||
],
|
||||
],
|
||||
],
|
||||
'sorting_type' => [
|
||||
'type' => 'anomaly.field_type.select',
|
||||
'config' => [
|
||||
'default_value' => 'ASC',
|
||||
'options' => [
|
||||
'ASC' => 'ASC', 'DESC' => 'DESC'
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@ -46,5 +46,11 @@ return [
|
||||
],
|
||||
'country_for_phone_field' => [
|
||||
'name' => 'Default Country For Register Phone Field'
|
||||
]
|
||||
],
|
||||
'sorting_column' => [
|
||||
'name' => 'Sorting Column',
|
||||
],
|
||||
'sorting_type' => [
|
||||
'name' => 'Sorting Type',
|
||||
],
|
||||
];
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<ul style="padding: 0" class="list-unstyled">
|
||||
<li class="country-data" data-content="{{ adv['country_id'] }}"
|
||||
data-default="{{ setting_value('visiosoft.module.location::default_country') }}"
|
||||
class="location-field country-data">{{ form.fields.country|raw }}</li>
|
||||
class="location-field country-data">{{ form.fields.country.setOptions({})|raw }}</li>
|
||||
<li class="city-data" data-content="{{ adv['city'] }}"
|
||||
data-default="{{ setting_value('visiosoft.module.location::default_city') }}"
|
||||
class="location-field city-data">{{ form.fields.city|raw }}</li>
|
||||
|
||||
@ -57,8 +57,10 @@ class AjaxController extends PublicController
|
||||
{
|
||||
if ($this->request->id)
|
||||
return $this->country_model->find($this->request->id);
|
||||
else
|
||||
return $this->country_model->orderBy('order', 'ASC')->get();
|
||||
else {
|
||||
$query = $this->country_model;
|
||||
return $this->queryOrder($query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +70,9 @@ class AjaxController extends PublicController
|
||||
{
|
||||
if ($this->request->id) {
|
||||
$id = explode(',', $this->request->id);
|
||||
return $this->city_model->whereIn('parent_country_id', $id)->orderBy('order', 'ASC')->get();
|
||||
$query = $this->city_model->whereIn('parent_country_id', $id);
|
||||
|
||||
return $this->queryOrder($query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +83,10 @@ class AjaxController extends PublicController
|
||||
{
|
||||
if ($this->request->id) {
|
||||
$id = explode(',', $this->request->id);
|
||||
return $this->district_model->whereIn('parent_city_id', $id)->orderBy('order', 'ASC')->get();
|
||||
|
||||
$query = $this->district_model->whereIn('parent_city_id', $id);
|
||||
|
||||
return $this->queryOrder($query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +97,10 @@ class AjaxController extends PublicController
|
||||
{
|
||||
if ($this->request->id) {
|
||||
$id = explode(',', $this->request->id);
|
||||
return $this->neighborhood_model->whereIn('parent_district_id', $id)->orderBy('order', 'ASC')->get();
|
||||
|
||||
$query = $this->neighborhood_model->whereIn('parent_district_id', $id);
|
||||
|
||||
return $this->queryOrder($query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +111,10 @@ class AjaxController extends PublicController
|
||||
{
|
||||
if ($this->request->id) {
|
||||
$id = explode(',', $this->request->id);
|
||||
return $this->village_model->whereIn('parent_neighborhood_id', $id)->orderBy('order', 'ASC')->get();
|
||||
|
||||
$query = $this->village_model->whereIn('parent_neighborhood_id', $id);
|
||||
|
||||
return $this->queryOrder($query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,11 +125,19 @@ class AjaxController extends PublicController
|
||||
{
|
||||
if ($this->request->name) {
|
||||
$slug = Str::slug($this->request->name, '_');
|
||||
if ($city = $this-> city_model->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
|
||||
if ($city = $this->city_model->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
|
||||
return ['success' => true, 'city' => $city];
|
||||
} else {
|
||||
return ['success' => false];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function queryOrder($query)
|
||||
{
|
||||
$sorting_type = setting_value('visiosoft.module.location::sorting_type');
|
||||
$sorting_column = setting_value('visiosoft.module.location::sorting_column');
|
||||
|
||||
return $query->orderBy($sorting_column, $sorting_type)->get();
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,8 @@ $(document).on('change', 'select[name="city"]', function () {
|
||||
Locations($(this).val(), 2, "district")
|
||||
});
|
||||
|
||||
getCountries();
|
||||
|
||||
function Locations(cat, level, name) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@ -48,4 +50,15 @@ if (country != "") {
|
||||
}
|
||||
}
|
||||
|
||||
phoneMask("input[name='adress_gsm_phone']");
|
||||
phoneMask("input[name='adress_gsm_phone']");
|
||||
|
||||
|
||||
function getCountries() {
|
||||
crud('', '/ajax/getCountry', 'GET', function (callback) {
|
||||
$('select[name="country"]').html("<option>" + pick_option + "</option>");
|
||||
$.each(callback, function (index, value) {
|
||||
$('select[name="country"]').append("<option value='" + value.id + "'>" + value.name + "</option>");
|
||||
});
|
||||
$('select[name="country"]').val(country);
|
||||
})
|
||||
}
|
||||
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="row form-group location-map">
|
||||
<div class="col-sm-4 font-weight-bold">
|
||||
{{ form.fields.country|raw }}
|
||||
{{ form.fields.country.setOptions({})|raw }}
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 location-field city-data font-weight-bold"
|
||||
@ -33,4 +33,7 @@
|
||||
{{ form.fields.adress_content.input|raw }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var pick_option = "{{ trans('visiosoft.module.location::field.pick_option.name') }}"
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user