From 76b8c97fa2b35dcb0cb1c1374d0e5c6f37a9be7c Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 4 Nov 2020 13:41:31 +0300 Subject: [PATCH] added sorting optional for location --- .../advs-module/resources/js/location.js | 10 ++++ .../resources/views/new-ad/new-create.twig | 1 + .../resources/config/settings/sections.php | 5 +- .../resources/config/settings/settings.php | 46 +++++++++++++------ .../resources/lang/en/setting.php | 8 +++- .../resources/views/new-ad/map.twig | 2 +- .../src/Http/Controller/AjaxController.php | 41 ++++++++++++++--- .../resources/assets/js/create.js | 15 +++++- .../views/address/partials/fields.twig | 7 ++- 9 files changed, 109 insertions(+), 26 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/js/location.js b/addons/default/visiosoft/advs-module/resources/js/location.js index e82653051..01f383464 100644 --- a/addons/default/visiosoft/advs-module/resources/js/location.js +++ b/addons/default/visiosoft/advs-module/resources/js/location.js @@ -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(""); + }); + }) +} diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig index 514a44bd2..52c8200fe 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig @@ -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') }}" {{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }} diff --git a/addons/default/visiosoft/location-module/resources/config/settings/sections.php b/addons/default/visiosoft/location-module/resources/config/settings/sections.php index 01994dcc0..628454140 100644 --- a/addons/default/visiosoft/location-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/location-module/resources/config/settings/sections.php @@ -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' => [ diff --git a/addons/default/visiosoft/location-module/resources/config/settings/settings.php b/addons/default/visiosoft/location-module/resources/config/settings/settings.php index 3d9a797a6..97c4c0e51 100644 --- a/addons/default/visiosoft/location-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/location-module/resources/config/settings/settings.php @@ -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' + ], + ], + ], ]; \ No newline at end of file diff --git a/addons/default/visiosoft/location-module/resources/lang/en/setting.php b/addons/default/visiosoft/location-module/resources/lang/en/setting.php index 459166207..f9a05154c 100644 --- a/addons/default/visiosoft/location-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/location-module/resources/lang/en/setting.php @@ -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', + ], ]; diff --git a/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig b/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig index ed0e32682..77a332555 100644 --- a/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig +++ b/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig @@ -19,7 +19,7 @@