diff --git a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php index 49193a5af..dfb48c899 100644 --- a/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php +++ b/addons/default/visiosoft/advs-module/migrations/2018_09_25_211039_visiosoft.module.advs__create_advs_stream.php @@ -12,11 +12,11 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration */ protected $stream = [ 'slug' => 'advs', - 'title_column' => 'name', - 'translatable' => true, - 'trashable' => true, - 'searchable' => false, - 'sortable' => false, + 'title_column' => 'name', + 'translatable' => true, + 'trashable' => true, + 'searchable' => false, + 'sortable' => false, ]; /** @@ -55,12 +55,8 @@ class VisiosoftModuleAdvsCreateAdvsStream extends Migration 'online_payment', 'is_get_adv', 'stock', - 'country' => [ - 'required' => true - ], - 'city' => [ - 'required' => true - ], + 'country', + 'city', 'district', 'neighborhood', 'village', diff --git a/addons/default/visiosoft/advs-module/resources/js/location.js b/addons/default/visiosoft/advs-module/resources/js/location.js index e3cc50610..81c45f9fb 100644 --- a/addons/default/visiosoft/advs-module/resources/js/location.js +++ b/addons/default/visiosoft/advs-module/resources/js/location.js @@ -69,15 +69,11 @@ function Locations(cat, level, name){ data: "cat=" + cat + "&level=" + level, url: "/class/ajax", success: function(msg){ - hideLoader() $('select[name="'+name+'"]').find('option').remove(); $('select[name="'+name+'"]').append(''); $.each(msg, function(key, value){ $('select[name="'+name+'"]').append(''); }); - }, - beforeSend: function () { - showLoader() } }).promise().done(function() { setLocation(level); diff --git a/addons/default/visiosoft/advs-module/resources/js/new-create.js b/addons/default/visiosoft/advs-module/resources/js/new-create.js index afdca1b92..fb3a28e88 100644 --- a/addons/default/visiosoft/advs-module/resources/js/new-create.js +++ b/addons/default/visiosoft/advs-module/resources/js/new-create.js @@ -73,7 +73,29 @@ $('input[name="price"]').on('click', function () { } }) -$(document).on('ajaxComplete ready shown.bs.tab', function () { +$(document).ready(function () { + + $('input[data-provides="anomaly.field_type.slug"]:not([data-initialized])').each(function () { + + $(this).attr('data-initialized', ''); + + var config = { + slug: this, + lowercase: $(this).data('lowercase') + }; + + /** + * Only slugify other fields if + * value is empty OR configured + * to always slugify field values. + */ + if (!$(this).val() || $(this).data('always_slugify')) { + config.slugify = '[data-field="' + $(this).data('slugify') + '"]:visible:first'; + } + + // Slugify slug inputs. + $(this).slugify(config); + }); // Initialize WYSIWYG editors. $('textarea[data-field="advs_desc"]:not(.hasEditor)').each(function () { 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 907915612..664ae6094 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 @@ -107,7 +107,6 @@ {{ form.close|raw }} - - {{ asset_add("scripts.js", "visiosoft.module.advs::js/new-create.js") }} - {{ asset_add("scripts.js", "visiosoft.module.advs::js/location.js") }} {{ asset_add("scripts.js", "streams::js/form/form.js") }} {{ asset_add("scripts.js", "streams::js/form/translations.js") }} diff --git a/addons/default/visiosoft/location-module/resources/config/settings.php b/addons/default/visiosoft/location-module/resources/config/settings.php index 6a8e70214..c80e24d65 100644 --- a/addons/default/visiosoft/location-module/resources/config/settings.php +++ b/addons/default/visiosoft/location-module/resources/config/settings.php @@ -19,7 +19,12 @@ return [ 'default_value' => true, ], ], - 'default_country' => [ + 'create_ad_page_location' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => true, + ], + ], 'default_country' => [ 'type' => 'anomaly.field_type.relationship', "config" => [ "related" => \Visiosoft\LocationModule\Country\CountryModel::class, 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 bdc74a511..154c07c69 100644 --- a/addons/default/visiosoft/location-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/location-module/resources/lang/en/setting.php @@ -16,4 +16,7 @@ return [ 'default_country' => [ 'name' => 'Default Country', ], + 'create_ad_page_location' => [ + 'name' => 'Create Ad Page Location', + ], ]; 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 84eb0ae6e..142905922 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 @@ -1,27 +1,32 @@ -