Merge pull request #1072 from openclassify/vedat

Sortable Education && publish and finish ad optional
This commit is contained in:
Dia Shalabi 2021-05-12 13:46:15 +03:00 committed by GitHub
commit 9a67de3c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 213 additions and 49 deletions

View File

@ -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',

View File

@ -455,4 +455,11 @@ return [
'default_value' => false,
]
],
'show_finish_and_publish_date' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => false,
],
],
];

View File

@ -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;
}

View File

@ -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'
],
];

View File

@ -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.<strong>sitename.com</strong> ',
'warning' => 'Auto added www. www.<strong>sitename.com</strong> ',
],
'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.'
],
];

View File

@ -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'
],
];

View File

@ -2,7 +2,8 @@
{% block styles %}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet">
<style>
{{ asset_inline("visiosoft.module.advs::css/new-create.css") }}
@ -96,7 +97,8 @@
<div class="d-flex">
{% set PriceValue = form.fields.price.value|split('.') %}
<input type="text" class="mt-3 border-0 text-right priceField whole-price flex-fill"
<input type="text"
class="mt-3 border-0 text-right priceField whole-price flex-fill"
placeholder="0" value="{{ PriceValue|first }}">
{% if setting_value('visiosoft.field_type.decimal::showDecimal') %}
<input class="mt-3 border-0 ml-2 text-center priceDecimalField decimal-price"
@ -122,7 +124,8 @@
placeholder="0" value="{{ standardPriceValue|first }}" type="text">
{% if setting_value('visiosoft.field_type.decimal::showDecimal') %}
<input class="mt-3 border-0 ml-2 text-center standard-price-decimal decimal-price"
placeholder="00" type="text" value="{{ standardPriceValue[1] }}" maxlength="2">
placeholder="00" type="text" value="{{ standardPriceValue[1] }}"
maxlength="2">
{% endif %}
<select name="currency" class="mt-3 border-0 ml-2" id="currency" required>
{% for currency in config_get('streams::currencies.enabled') %}
@ -134,6 +137,31 @@
</div>
</div>
</div>
{% if setting_value("visiosoft.module.advs::show_finish_and_publish_date") %}
<div class="row mx-0 my-3">
<div class="col-6 px-0">
<label>
{{ form.fields.publish_at.label|raw }}
<span class="required">*</span>
</label>
<div class="py-2 pr-3">
{{ form.fields.publish_at.input|raw }}
</div>
</div>
<div class="col-6 px-0">
<label>
{{ form.fields.finish_at.label|raw }}
<span class="required">*</span>
</label>
<div class="py-2 pr-2">
{{ form.fields.finish_at.input|raw }}
</div>
</div>
</div>
{% endif %}
{% if not setting_value('visiosoft.module.advs::hide_options_field') %}
{% if not setting_value('visiosoft.module.advs::detailed_product_options') %}

View File

@ -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;
}
}

View File

@ -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
}

View File

@ -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);

View File

@ -0,0 +1,24 @@
<?php
use Anomaly\Streams\Platform\Database\Migration\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class VisiosoftModuleProfileEducationSortable extends Migration
{
public function up()
{
$this->streams()
->findBySlugAndNamespace('education', 'profile')
->setAttribute('sortable', true)
->save();
}
public function down()
{
$this->streams()
->findBySlugAndNamespace('education', 'profile')
->setAttribute('sortable', false)
->save();
}
}

View File

@ -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,7 @@ class MyProfileController extends PublicController
public function changeEducation(Request $request)
{
if ($request->info == 'education') {
$education = EducationPartModel::query()->where('education_id', $request->education)->get();
$education = EducationPartModel::query()->where('education_id', $request->education)->get()->sortBy('name');
}
return response()->json(['data' => $education], 200);
}