From 9290c9951f7470b261b0dcf4c82b407a8873348b Mon Sep 17 00:00:00 2001 From: vedatakd Date: Mon, 10 May 2021 13:02:06 +0300 Subject: [PATCH 1/5] bid developments --- .../resources/config/settings/settings.php | 7 ++ .../advs-module/resources/lang/en/setting.php | 60 +++++++------ .../resources/views/new-ad/new-create.twig | 89 +++++++++++++++++++ .../src/Adv/Form/AdvFormBuilder.php | 15 +++- .../src/Adv/Table/Handler/Approve.php | 15 +++- .../src/Http/Controller/AdvsController.php | 16 +++- 6 files changed, 165 insertions(+), 37 deletions(-) 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 d0419b05c..dd64714e4 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php @@ -455,4 +455,11 @@ return [ 'default_value' => false, ] ], + + 'show_finish_and_publish_date' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => false, + ], + ], ]; 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 58201c5c2..eea84435b 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php @@ -27,7 +27,7 @@ return [ 'favicon' => [ 'name' => 'Favicon', ] - ,'map_coordinates_long' => [ + , 'map_coordinates_long' => [ 'name' => 'Map Long Coordinate', ], 'map_coordinates_lat' => [ @@ -41,7 +41,7 @@ return [ ], 'ogImage' => [ 'name' => 'Social Share Logo', - 'warning' => 'It should be at a resolution of 1200 x 630. ', + 'warning' => 'It should be at a resolution of 1200 x 630. ', ], 'currencies' => [ @@ -52,7 +52,7 @@ return [ ], 'site_address' => [ 'name' => 'Site address', - 'warning' => 'Auto added www. www.sitename.com ', + 'warning' => 'Auto added www. www.sitename.com ', ], 'google_map_key' => [ 'name' => 'Google Map Api Key', @@ -134,9 +134,9 @@ return [ 'market_place' => [ 'name' => 'Market Place', ], - 'price_area_hidden' => [ - 'name' => 'Price Area Hidden', - ], + 'price_area_hidden' => [ + 'name' => 'Price Area Hidden', + ], 'hide_price_filter' => [ 'name' => 'Hide Price Filter', ], @@ -215,18 +215,18 @@ return [ 'name' => 'Hide Created Date', 'instructions' => 'Hide created date in ads detail page', ], - 'hide_listing_header' => [ - 'name' => 'Hide Listing Header', - 'instructions' => 'Hiding to ordering and view types', - ], - 'hide_filter_section' => [ - 'name' => 'Hide Filter Section', - 'instructions' => 'Hiding to left filter area in listing page', - ], - 'hide_seller_info' => [ - 'name' => 'Hide Seller Information', - 'instructions' => 'Hiding to seller infos in ads detail page', - ], + 'hide_listing_header' => [ + 'name' => 'Hide Listing Header', + 'instructions' => 'Hiding to ordering and view types', + ], + 'hide_filter_section' => [ + 'name' => 'Hide Filter Section', + 'instructions' => 'Hiding to left filter area in listing page', + ], + 'hide_seller_info' => [ + 'name' => 'Hide Seller Information', + 'instructions' => 'Hiding to seller infos in ads detail page', + ], 'show_post_ad_agreement' => [ 'name' => 'Show Post Ad Agreement', 'instructions' => 'Turn this on if you want to display a privacy policy agreement on the ad creation page', @@ -251,9 +251,9 @@ return [ 'name' => 'GET Categories', 'instructions' => 'It represents the categories in which the GET property will be valid.' ], - 'disable_sentry' => [ - 'name' => 'Disable Sentry' - ], + 'disable_sentry' => [ + 'name' => 'Disable Sentry' + ], 'watermark' => [ 'name' => 'Watermark', 'instructions' => 'Is watermark active?' @@ -265,11 +265,15 @@ return [ 'show_subcats_mobile' => [ 'name' => 'Show subcategories on mobile view', ], - 'show_price_to_members_only' => [ - 'name' => 'Show Price To Members Only', - ], - 'hide_ad_cat' => [ - 'name' => 'Hide Categories', - 'instructions' => 'Hide categories in ads list' - ] + 'show_price_to_members_only' => [ + 'name' => 'Show Price To Members Only', + ], + 'hide_ad_cat' => [ + 'name' => 'Hide Categories', + 'instructions' => 'Hide categories in ads list' + ], + 'show_finish_and_publish_date' => [ + 'name' => 'Show Finish Date And Publish Date For Create', + 'instructions' => 'Displays the publish_at and finish_at fields on the ad creation page.' + ], ]; 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 ae4e1403f..105e9585d 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 @@ -135,6 +135,95 @@ +
+
+ + +
+ {{ form.fields.publish_at.input|raw }} +
+
+
+ + +
+ {{ form.fields.finish_at.input|raw }} +
+
+ +
+ + {% if not setting_value('visiosoft.module.advs::hide_options_field') %} {% if not setting_value('visiosoft.module.advs::detailed_product_options') %}
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 f14c1aadb..0e1352e7c 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Form/AdvFormBuilder.php @@ -27,7 +27,7 @@ class AdvFormBuilder extends FormBuilder { $requiredFields = setting_value('visiosoft.module.advs::make_all_fields_required'); - return [ + $fields = [ 'name' => [ 'translatable' => true, 'required' => true, @@ -84,5 +84,18 @@ class AdvFormBuilder extends FormBuilder 'adv_day', 'product_options_value' ]; + + if (setting_value('visiosoft.module.advs::show_finish_and_publish_date')) { + $fields = array_merge($fields, [ + 'finish_at' => [ + 'required' => true, + ], + 'publish_at' => [ + 'required' => true, + ], + ]); + } + + return $fields; } } diff --git a/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/Approve.php b/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/Approve.php index 199f9ae84..78b88175e 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/Approve.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Table/Handler/Approve.php @@ -17,11 +17,18 @@ class Approve extends ActionHandler if ($ad = $model->newQuery()->find($id)) { - $ad->update([ + $update = [ 'status' => 'approved', - 'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')), - 'publish_at' => date('Y-m-d H:i:s') - ]); + ]; + + if (!setting_value('visiosoft.module.advs::show_finish_and_publish_date')) { + $update = array_merge($update, [ + 'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')), + 'publish_at' => date('Y-m-d H:i:s') + ]); + } + + $ad->update($update); event(new ChangedStatusAd($ad));//Create Notify } diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php index 5bebc56bb..b22c817c9 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php @@ -844,11 +844,19 @@ class AdvsController extends PublicController if (setting_value('visiosoft.module.advs::auto_approve') && $autoApprove) { $defaultAdPublishTime = setting_value('visiosoft.module.advs::default_published_time'); - $adv->update([ + + $update = [ 'status' => 'approved', - 'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')), - 'publish_at' => date('Y-m-d H:i:s') - ]); + ]; + + if (!setting_value('visiosoft.module.advs::show_finish_and_publish_date')) { + $update = array_merge($update, [ + 'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')), + 'publish_at' => date('Y-m-d H:i:s') + ]); + } + + $adv->update($update); } $form->render($this->request->update_id); From ae29380e83243a14fc52f6c60d79f52a68d4274d Mon Sep 17 00:00:00 2001 From: vedatakd Date: Mon, 10 May 2021 14:14:31 +0300 Subject: [PATCH 2/5] education sortable --- ...oft.module.profile__education_sortable.php | 24 ++++++++++++++++ .../Http/Controller/MyProfileController.php | 28 ++++++++++++++----- 2 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 addons/default/visiosoft/profile-module/migrations/2021_05_10_105458_visiosoft.module.profile__education_sortable.php diff --git a/addons/default/visiosoft/profile-module/migrations/2021_05_10_105458_visiosoft.module.profile__education_sortable.php b/addons/default/visiosoft/profile-module/migrations/2021_05_10_105458_visiosoft.module.profile__education_sortable.php new file mode 100644 index 000000000..36c6e0866 --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2021_05_10_105458_visiosoft.module.profile__education_sortable.php @@ -0,0 +1,24 @@ +streams() + ->findBySlugAndNamespace('education', 'profile') + ->setAttribute('sortable', true) + ->save(); + } + + public function down() + { + $this->streams() + ->findBySlugAndNamespace('education', 'profile') + ->setAttribute('sortable', false) + ->save(); + } +} diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php index 02b277336..f04312281 100644 --- a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php @@ -6,6 +6,7 @@ use Anomaly\Streams\Platform\Model\Users\UsersUsersEntryModel; use Anomaly\UsersModule\User\Contract\UserRepositoryInterface; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\DB; use Visiosoft\AdvsModule\Adv\AdvModel; use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd; use Visiosoft\AdvsModule\Status\Contract\StatusRepositoryInterface; @@ -56,14 +57,16 @@ class MyProfileController extends PublicController compact('user', 'country', 'form', 'advs_count')); } - public function detail(ProfileFormBuilder $form){ - $user = $this->userRepository->find(Auth::id()); - $country = CountryModel::all(); - return $this->view->make('visiosoft.module.profile::profile.detail', compact('user', 'country', 'form')); + public function detail(ProfileFormBuilder $form) + { + $user = $this->userRepository->find(Auth::id()); + $country = CountryModel::all(); + return $this->view->make('visiosoft.module.profile::profile.detail', compact('user', 'country', 'form')); } - public function password(){ - return $this->view->make('visiosoft.module.profile::profile.password'); + public function password() + { + return $this->view->make('visiosoft.module.profile::profile.password'); } public function extendAds($id, $type, SettingRepositoryInterface $settings) @@ -272,7 +275,18 @@ class MyProfileController extends PublicController public function changeEducation(Request $request) { if ($request->info == 'education') { - $education = EducationPartModel::query()->where('education_id', $request->education)->get(); + $education = DB::table('profile_education_part') + ->leftJoin( + 'profile_education_part_translations', + 'profile_education_part.id', + '=', + 'profile_education_part_translations.entry_id' + ) + ->where('profile_education_part_translations.locale', '=', Request()->session()->get('_locale', setting_value('streams::default_locale'))) + ->where('education_id', $request->education) + ->selectRaw('default_profile_education_part.*, default_profile_education_part_translations.name as name') + ->orderBy('name', 'ASC') + ->get(); } return response()->json(['data' => $education], 200); } From fb8d2dca1aadbc6922a5d942fbda09cf20e2d01b Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 12 May 2021 02:57:38 +0300 Subject: [PATCH 3/5] fixed finish and publish date --- .../resources/config/settings/sections.php | 1 + .../advs-module/resources/lang/en/field.php | 5 +- .../advs-module/resources/lang/tr/field.php | 5 +- .../resources/views/new-ad/new-create.twig | 176 +++++++++--------- 4 files changed, 99 insertions(+), 88 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 fa22e92a1..4ce7e632f 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php @@ -24,6 +24,7 @@ return [ 'ads' => [ 'title' => 'visiosoft.module.advs::section.ads', 'fields' => [ + 'show_finish_and_publish_date', 'latest-limit', 'popular_ads_limit', 'ads_image_limit', diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/field.php b/addons/default/visiosoft/advs-module/resources/lang/en/field.php index 6719a34bf..b362df662 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/field.php @@ -108,7 +108,7 @@ return [ 'name' => 'Unpublished' ], 'finish_at' => [ - 'name' => 'Finish At' + 'name' => 'Finish Date' ], 'cover_photo' => [ 'name' => 'Cover Photo' @@ -370,4 +370,7 @@ return [ 'name' => 'Old Price' ], 'save_search' => 'Save Search', + 'publish_at' => [ + 'name' => 'Publish Date' + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/field.php b/addons/default/visiosoft/advs-module/resources/lang/tr/field.php index 66bf10dae..7f299bba1 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/field.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/field.php @@ -108,7 +108,7 @@ return [ 'name' => 'Yayınlanmamış' ], 'finish_at' => [ - 'name' => 'Bitiş Saati' + 'name' => 'Bitiş Tarihi' ], 'cover_photo' => [ 'name' => 'Kapak Fotoğrafı' @@ -371,4 +371,7 @@ return [ 'name' => 'Eski fiyat' ], 'save_search' => 'Aramayı Kaydet', + 'publish_at' => [ + 'name' => 'Publish Date' + ], ]; 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 105e9585d..08d8ab12c 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 @@ -2,7 +2,8 @@ {% block styles %} - +
- - + {% endif %} {% if not setting_value('visiosoft.module.advs::hide_options_field') %} From 05012d64b99fd4aaf6679357ff58c7540dc6bdb8 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 12 May 2021 12:52:12 +0300 Subject: [PATCH 4/5] moved css --- .../advs-module/resources/css/new-create.css | 63 ++++++++++++++++++ .../resources/views/new-ad/new-create.twig | 65 ------------------- 2 files changed, 63 insertions(+), 65 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/css/new-create.css b/addons/default/visiosoft/advs-module/resources/css/new-create.css index a61a3beef..1ab14a941 100644 --- a/addons/default/visiosoft/advs-module/resources/css/new-create.css +++ b/addons/default/visiosoft/advs-module/resources/css/new-create.css @@ -1,3 +1,66 @@ .editContact { font-size: 13px; +} + +.input-group { + position: relative; + width: 100%; + display: flex; +} + +.input-group .form-control { + position: relative; + z-index: 2; + flex: 1; + margin-bottom: 0; +} + +.input-group .form-control:focus, .input-group .form-control:active, .input-group .form-control:hover { + z-index: 3; +} + +.input-group-addon:not(:first-child):not(:last-child), +.input-group-btn:not(:first-child):not(:last-child), +.input-group .form-control:not(:first-child):not(:last-child) { + border-radius: 0; +} + +.input-group-addon, +.input-group-btn { + white-space: nowrap; + vertical-align: middle; +} + +.input-group-addon { + padding: 0.5rem 0.75rem; + margin-bottom: 0; + font-size: 1rem; + font-weight: normal; + line-height: 1.25; + color: #55595c; + text-align: center; + background-color: #eceeef; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0.1rem; +} + +.input-group-addon.form-control-sm, +.input-group-sm > .input-group-addon, +.input-group-sm > .input-group-btn > .input-group-addon.btn { + padding: 0.25rem 0.5rem; + font-size: 0.875rem; + border-radius: 0.1rem; +} + +.input-group-addon.form-control-lg, +.input-group-lg > .input-group-addon, +.input-group-lg > .input-group-btn > .input-group-addon.btn { + padding: 0.75rem 1.5rem; + font-size: 1.25rem; + border-radius: 0.25rem; +} + +.input-group-addon input[type=radio], +.input-group-addon input[type=checkbox] { + margin-top: 0; } \ No newline at end of file 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 08d8ab12c..5c6c057c5 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 @@ -159,71 +159,6 @@ {{ form.fields.finish_at.input|raw }} - {% endif %} From 3f355b1ea7f9b2b4268d3ca64a9b8c2541b4b08b Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 12 May 2021 13:36:59 +0300 Subject: [PATCH 5/5] used sortBy --- .../src/Http/Controller/MyProfileController.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php index f04312281..5eaf1f233 100644 --- a/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/MyProfileController.php @@ -275,18 +275,7 @@ class MyProfileController extends PublicController public function changeEducation(Request $request) { if ($request->info == 'education') { - $education = DB::table('profile_education_part') - ->leftJoin( - 'profile_education_part_translations', - 'profile_education_part.id', - '=', - 'profile_education_part_translations.entry_id' - ) - ->where('profile_education_part_translations.locale', '=', Request()->session()->get('_locale', setting_value('streams::default_locale'))) - ->where('education_id', $request->education) - ->selectRaw('default_profile_education_part.*, default_profile_education_part_translations.name as name') - ->orderBy('name', 'ASC') - ->get(); + $education = EducationPartModel::query()->where('education_id', $request->education)->get()->sortBy('name'); } return response()->json(['data' => $education], 200); }