From 1569ac2d903bfeac086f52488c8457e7e14fabaa Mon Sep 17 00:00:00 2001 From: Diatrex Date: Fri, 26 Mar 2021 16:47:26 +0300 Subject: [PATCH] =?UTF-8?q?#3567=20emlak24=20bug=20ve=20d=C3=BCzenlemeler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/config/settings/sections.php | 1 + .../resources/config/settings/settings.php | 7 + .../advs-module/resources/css/list.css | 1 + .../advs-module/resources/lang/en/setting.php | 4 + .../resources/views/new-ad/new-create.twig | 2 + .../src/Adv/Form/AdvFormBuilder.php | 125 ++++++++++-------- .../resources/views/new-ad/map.twig | 21 ++- .../resources/assets/css/profile-nav.scss | 2 +- .../views/profile/partials/navigation.twig | 9 +- 9 files changed, 108 insertions(+), 64 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php index 1336af80b..350650d03 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php @@ -55,6 +55,7 @@ return [ 'hide_options_field', 'hide_village_field', 'hide_configurations', + 'make_all_fields_required', 'make_map_required', 'show_breadcrumb_when_creating_ad', 'show_post_ad_agreement', diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php index 563d68e07..f0cb1dbf0 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php @@ -147,6 +147,13 @@ return [ 'mode' => 'checkbox' ] ], + 'make_all_fields_required' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => false, + 'mode' => 'checkbox' + ] + ], 'make_map_required' => [ 'type' => 'anomaly.field_type.boolean', 'config' => [ diff --git a/addons/default/visiosoft/advs-module/resources/css/list.css b/addons/default/visiosoft/advs-module/resources/css/list.css index 9fdad75ab..0693c4ff8 100644 --- a/addons/default/visiosoft/advs-module/resources/css/list.css +++ b/addons/default/visiosoft/advs-module/resources/css/list.css @@ -24,6 +24,7 @@ .upper-list-banner { min-height: 300px; background-size: cover; + background-position: center; } .upper-list-banner img { diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php index 2bf5e9497..af8303b94 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php @@ -111,6 +111,10 @@ return [ 'name' => 'Hide the Configurations Button', 'instructions' => 'Hide the Configurations Button in the Ad Preview Page', ], + 'make_all_fields_required' => [ + 'name' => 'Make All Fields Required', + 'instructions' => 'Require the user to fill the Price, Description and Location fields when creating an ad', + ], 'make_map_required' => [ 'name' => 'Make Map Required', 'instructions' => 'Require the user to place a pin on the map when creating an ad', 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 17e8aadd8..cc8e97809 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 @@ -20,6 +20,8 @@
+ {% set requiredFields = setting_value('visiosoft.module.advs::make_all_fields_required') %} + {% set form = form('advs', 'advs').entry(id).actions({'update': { 'text': trans('visiosoft.module.advs::button.publish') }}).get() %} diff --git a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php index 99ff60fc1..7bcb93053 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php @@ -1,63 +1,11 @@ [ - 'translatable' => true, - 'required' => true, - ], - 'slug' => [ - 'unique' => true, - 'required' => true, - ], - 'price' => [ - 'type' => 'anomaly.field_type.text' - ], - 'standard_price' => [ - 'type' => 'anomaly.field_type.text' - ], - 'advs_desc', - 'cat1', - 'cat2', - 'cat3', - 'cat4', - 'cat5', - 'cat6', - 'cat7', - 'cat8', - 'cat9', - 'cat10', - 'currency', - 'online_payment', - 'stock', - 'country' => [ - 'class' => 'form-control countryselect' - ], - 'city' => [ - 'class' => 'form-control cityselect' - ], - 'district' => [ - 'class' => 'form-control districtselect' - ], - 'neighborhood' => [ - 'class' => 'form-control neighborhoodselect' - ], - 'village' => [ - 'class' => 'form-control villageselect' - ], - 'map_Val' => [ - 'label' => false, - 'class' => 'hidden d-none mapVal' - ], - 'files', - 'doc_files', - 'popular_adv', - 'adv_day', - 'product_options_value' - ]; + protected $fields; protected $category = null; @@ -78,4 +26,73 @@ class AdvFormBuilder extends FormBuilder protected $sections = []; protected $assets = []; + + public function __construct(Form $form) + { + parent::__construct($form); + $this->fields = $this->settingFields(); + } + + private function settingFields() + { + $requiredFields = setting_value('visiosoft.module.advs::make_all_fields_required'); + + return [ + 'name' => [ + 'translatable' => true, + 'required' => true, + ], + 'slug' => [ + 'unique' => true, + 'required' => true, + ], + 'price' => [ + 'type' => 'anomaly.field_type.text', + 'required' => $requiredFields + ], + 'standard_price' => [ + 'type' => 'anomaly.field_type.text' + ], + 'advs_desc' => [ + 'required' => $requiredFields + ], + 'cat1', + 'cat2', + 'cat3', + 'cat4', + 'cat5', + 'cat6', + 'cat7', + 'cat8', + 'cat9', + 'cat10', + 'currency', + 'online_payment', + 'stock', + 'country' => [ + 'class' => 'form-control countryselect' + ], + 'city' => [ + 'class' => 'form-control cityselect' + ], + 'district' => [ + 'class' => 'form-control districtselect' + ], + 'neighborhood' => [ + 'class' => 'form-control neighborhoodselect' + ], + 'village' => [ + 'class' => 'form-control villageselect' + ], + 'map_Val' => [ + 'label' => false, + 'class' => 'hidden d-none mapVal' + ], + 'files', + 'doc_files', + 'popular_adv', + 'adv_day', + 'product_options_value' + ]; + } } 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 9b94af55e..0f9518645 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,17 +19,26 @@
  • {{ form.fields.country.setOptions({})|raw }}
  • + class="location-field country-data"> + {{ form.fields.country.setAttributes({'required': true}).setOptions({})|raw }} +
  • {{ form.fields.city|raw }}
  • + class="location-field city-data"> + {{ form.fields.city.setAttributes({'required': true})|raw }} +
  • {{ form.fields.district|raw }}
  • + class="location-field district-data"> + {{ form.fields.district.setAttributes({'required': true})|raw }} +
  • {{ form.fields.neighborhood|raw }}
  • + class="location-field neighborhood-data"> + {{ form.fields.neighborhood.setAttributes({'required': true})|raw }} + {% if not setting_value('visiosoft.module.advs::hide_village_field') %} -
  • {{ form.fields.village|raw }}
  • +
  • + {{ form.fields.village.setAttributes({'required': true})|raw }} +
  • {% endif %}
diff --git a/addons/default/visiosoft/profile-module/resources/assets/css/profile-nav.scss b/addons/default/visiosoft/profile-module/resources/assets/css/profile-nav.scss index 23affb0bd..1fcbcb37a 100644 --- a/addons/default/visiosoft/profile-module/resources/assets/css/profile-nav.scss +++ b/addons/default/visiosoft/profile-module/resources/assets/css/profile-nav.scss @@ -41,7 +41,7 @@ z-index: 1040; } - a { + a, span { display: flex; align-items: center; margin-bottom: 1.25rem; diff --git a/addons/default/visiosoft/profile-module/resources/views/profile/partials/navigation.twig b/addons/default/visiosoft/profile-module/resources/views/profile/partials/navigation.twig index 29b052248..6feed3884 100644 --- a/addons/default/visiosoft/profile-module/resources/views/profile/partials/navigation.twig +++ b/addons/default/visiosoft/profile-module/resources/views/profile/partials/navigation.twig @@ -3,10 +3,13 @@ class="ml-2">