mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
4c9ebda75d
@ -55,6 +55,7 @@ return [
|
|||||||
'hide_options_field',
|
'hide_options_field',
|
||||||
'hide_village_field',
|
'hide_village_field',
|
||||||
'hide_configurations',
|
'hide_configurations',
|
||||||
|
'make_all_fields_required',
|
||||||
'make_map_required',
|
'make_map_required',
|
||||||
'show_breadcrumb_when_creating_ad',
|
'show_breadcrumb_when_creating_ad',
|
||||||
'show_post_ad_agreement',
|
'show_post_ad_agreement',
|
||||||
|
|||||||
@ -147,6 +147,13 @@ return [
|
|||||||
'mode' => 'checkbox'
|
'mode' => 'checkbox'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'make_all_fields_required' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'config' => [
|
||||||
|
'default_value' => false,
|
||||||
|
'mode' => 'checkbox'
|
||||||
|
]
|
||||||
|
],
|
||||||
'make_map_required' => [
|
'make_map_required' => [
|
||||||
'type' => 'anomaly.field_type.boolean',
|
'type' => 'anomaly.field_type.boolean',
|
||||||
'config' => [
|
'config' => [
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
.upper-list-banner {
|
.upper-list-banner {
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upper-list-banner img {
|
.upper-list-banner img {
|
||||||
|
|||||||
@ -111,6 +111,10 @@ return [
|
|||||||
'name' => 'Hide the Configurations Button',
|
'name' => 'Hide the Configurations Button',
|
||||||
'instructions' => 'Hide the Configurations Button in the Ad Preview Page',
|
'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' => [
|
'make_map_required' => [
|
||||||
'name' => 'Make Map Required',
|
'name' => 'Make Map Required',
|
||||||
'instructions' => 'Require the user to place a pin on the map when creating an ad',
|
'instructions' => 'Require the user to place a pin on the map when creating an ad',
|
||||||
|
|||||||
@ -20,6 +20,8 @@
|
|||||||
<div class="adpost-details">
|
<div class="adpost-details">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
{% set requiredFields = setting_value('visiosoft.module.advs::make_all_fields_required') %}
|
||||||
|
|
||||||
{% set form = form('advs', 'advs').entry(id).actions({'update': {
|
{% set form = form('advs', 'advs').entry(id).actions({'update': {
|
||||||
'text': trans('visiosoft.module.advs::button.publish')
|
'text': trans('visiosoft.module.advs::button.publish')
|
||||||
}}).get() %}
|
}}).get() %}
|
||||||
|
|||||||
@ -1,63 +1,11 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Adv\Form;
|
<?php namespace Visiosoft\AdvsModule\Adv\Form;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Form\Form;
|
||||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
|
|
||||||
class AdvFormBuilder extends FormBuilder
|
class AdvFormBuilder extends FormBuilder
|
||||||
{
|
{
|
||||||
protected $fields = [
|
protected $fields;
|
||||||
'name' => [
|
|
||||||
'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 $category = null;
|
protected $category = null;
|
||||||
|
|
||||||
@ -78,4 +26,73 @@ class AdvFormBuilder extends FormBuilder
|
|||||||
protected $sections = [];
|
protected $sections = [];
|
||||||
|
|
||||||
protected $assets = [];
|
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'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ use Visiosoft\AdvsModule\Adv\Event\viewAd;
|
|||||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
||||||
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
|
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
||||||
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
use Visiosoft\AlgoliaModule\Search\SearchModel;
|
use Visiosoft\AlgoliaModule\Search\SearchModel;
|
||||||
@ -622,6 +623,10 @@ class AdvsController extends PublicController
|
|||||||
|
|
||||||
$adv = $this->adv_repository->getListItemAdv($id);
|
$adv = $this->adv_repository->getListItemAdv($id);
|
||||||
|
|
||||||
|
if (!Auth::check() or ($adv['created_by_id'] != auth()->id() and !Auth::user()->isAdmin())) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$cat = "cat" . $i;
|
$cat = "cat" . $i;
|
||||||
if ($adv->$cat != null) {
|
if ($adv->$cat != null) {
|
||||||
@ -1240,10 +1245,15 @@ class AdvsController extends PublicController
|
|||||||
$quantity = $request->quantity;
|
$quantity = $request->quantity;
|
||||||
$id = $request->id;
|
$id = $request->id;
|
||||||
$type = $request->type;
|
$type = $request->type;
|
||||||
$advmodel = new AdvModel();
|
if ($request->dataType === 'ad-configuration') {
|
||||||
$adv = $advmodel->getAdv($id);
|
$optionConf = new OptionConfigurationModel();
|
||||||
|
$adv = $optionConf->newQuery()->find($id);
|
||||||
$status = $advmodel->stockControl($id, $quantity);
|
$status = $adv->stockControl($id, $quantity);
|
||||||
|
} else {
|
||||||
|
$advmodel = new AdvModel();
|
||||||
|
$adv = $advmodel->getAdv($id);
|
||||||
|
$status = $advmodel->stockControl($id, $quantity);
|
||||||
|
}
|
||||||
|
|
||||||
$response = array();
|
$response = array();
|
||||||
if ($status == 1) {
|
if ($status == 1) {
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
<?php namespace Visiosoft\AdvsModule\OptionConfiguration;
|
||||||
|
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
|
||||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationInterface;
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationInterface;
|
||||||
use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
|
use Anomaly\Streams\Platform\Model\Advs\AdvsOptionConfigurationEntryModel;
|
||||||
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
|
||||||
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
|
|
||||||
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel implements OptionConfigurationInterface
|
||||||
@ -24,4 +22,20 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
|
|||||||
return $adv->name . ' | ' . trim($option_group_value, ' ');
|
return $adv->name . ' | ' . trim($option_group_value, ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function stockControl($id, $quantity)
|
||||||
|
{
|
||||||
|
$conf = $this->newQuery()->find($id);
|
||||||
|
$stock = $conf->stock;
|
||||||
|
|
||||||
|
if ($stock === NULL || $stock === 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stock < $quantity) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,17 +19,26 @@
|
|||||||
<ul style="padding: 0" class="list-unstyled">
|
<ul style="padding: 0" class="list-unstyled">
|
||||||
<li class="country-data" data-content="{{ adv['country_id'] }}"
|
<li class="country-data" data-content="{{ adv['country_id'] }}"
|
||||||
data-default="{{ setting_value('visiosoft.module.location::default_country') }}"
|
data-default="{{ setting_value('visiosoft.module.location::default_country') }}"
|
||||||
class="location-field country-data">{{ form.fields.country.setOptions({})|raw }}</li>
|
class="location-field country-data">
|
||||||
|
{{ form.fields.country.setAttributes({'required': true}).setOptions({})|raw }}
|
||||||
|
</li>
|
||||||
<li class="city-data" data-content="{{ adv['city'] }}"
|
<li class="city-data" data-content="{{ adv['city'] }}"
|
||||||
data-default="{{ setting_value('visiosoft.module.location::default_city') }}"
|
data-default="{{ setting_value('visiosoft.module.location::default_city') }}"
|
||||||
class="location-field city-data">{{ form.fields.city|raw }}</li>
|
class="location-field city-data">
|
||||||
|
{{ form.fields.city.setAttributes({'required': true})|raw }}
|
||||||
|
</li>
|
||||||
<li class="district-data" data-content="{{ adv['district'] }}"
|
<li class="district-data" data-content="{{ adv['district'] }}"
|
||||||
class="location-field district-data">{{ form.fields.district|raw }}</li>
|
class="location-field district-data">
|
||||||
|
{{ form.fields.district.setAttributes({'required': true})|raw }}
|
||||||
|
</li>
|
||||||
<li class="neighborhood-data" data-content="{{ adv['neighborhood'] }}"
|
<li class="neighborhood-data" data-content="{{ adv['neighborhood'] }}"
|
||||||
class="location-field neighborhood-data">{{ form.fields.neighborhood|raw }}</li>
|
class="location-field neighborhood-data">
|
||||||
|
{{ form.fields.neighborhood.setAttributes({'required': true})|raw }}
|
||||||
|
</li>
|
||||||
{% if not setting_value('visiosoft.module.advs::hide_village_field') %}
|
{% if not setting_value('visiosoft.module.advs::hide_village_field') %}
|
||||||
<li class="village-data" data-content="{{ adv['village'] }}"
|
<li class="village-data" data-content="{{ adv['village'] }}" class="location-field">
|
||||||
class="location-field">{{ form.fields.village|raw }}</li>
|
{{ form.fields.village.setAttributes({'required': true})|raw }}
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
z-index: 1040;
|
z-index: 1040;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a, span {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 1.25rem;
|
margin-bottom: 1.25rem;
|
||||||
|
|||||||
@ -3,10 +3,13 @@
|
|||||||
class="ml-2">
|
class="ml-2">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-10 col-sm-6 col-md-3 profile-navigation border rounded navbar-side bg-white" id="navbarSide">
|
<div class="col-10 col-sm-6 col-md-3 profile-navigation border rounded navbar-side bg-white" id="navbarSide">
|
||||||
<a href="{{ url_route('profile::profile') }}" class="px-3 mb-2 link-unstyled">
|
<span class="px-3 mb-2 link-unstyled">
|
||||||
{{ img('visiosoft.module.profile::images/interface.svg').data|raw }}
|
{{ img('visiosoft.module.profile::images/interface.svg').data|raw }}
|
||||||
<p>{{ auth_user().name }}</p>
|
<p>
|
||||||
</a>
|
<a href="{{ url_route('profile::profile') }}" class="link-unstyled mb-0">{{ auth_user().name }}</a>
|
||||||
|
{{ addBlock('profile/navigation/username')|raw }}
|
||||||
|
</p>
|
||||||
|
</span>
|
||||||
<hr class="mt-2">
|
<hr class="mt-2">
|
||||||
<a href="{{ url_route('profile::profile') }}"
|
<a href="{{ url_route('profile::profile') }}"
|
||||||
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile' ? ' active' : '' }}">
|
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile' ? ' active' : '' }}">
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
<?php namespace Visiosoft\ProfileModule\Events;
|
||||||
|
|
||||||
|
class PasswordChanged
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ use Anomaly\UsersModule\User\User;
|
|||||||
use Anomaly\UsersModule\User\UserPassword;
|
use Anomaly\UsersModule\User\UserPassword;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Visiosoft\ProfileModule\Events\PasswordChanged;
|
||||||
|
|
||||||
class PasswordFormHandler
|
class PasswordFormHandler
|
||||||
{
|
{
|
||||||
@ -43,6 +44,9 @@ class PasswordFormHandler
|
|||||||
$user = User::query()->find(Auth::id());
|
$user = User::query()->find(Auth::id());
|
||||||
$user->setAttribute('password', $builder->getPostValue('new_password'));
|
$user->setAttribute('password', $builder->getPostValue('new_password'));
|
||||||
$user->save($user->toArray());
|
$user->save($user->toArray());
|
||||||
|
|
||||||
|
event(new PasswordChanged());
|
||||||
|
|
||||||
$messages->success(trans('visiosoft.module.profile::message.your_password_changed'));
|
$messages->success(trans('visiosoft.module.profile::message.your_password_changed'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
resources/streams/config/httpcache.php
Normal file
57
resources/streams/config/httpcache.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTP CACHE ENABLED
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Do you want to enable HTTP caching?
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'enabled' => env('HTTP_CACHE', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEFAULT TTL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| What is the default TTL value (seconds)?
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'ttl' => env('HTTP_CACHE_TTL', 3600),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| EXCLUDED PATHS
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Specify cache-excluded paths.
|
||||||
|
| Use * for partial matching.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'excluded' => [
|
||||||
|
'/advs/create_adv',
|
||||||
|
'/advs/edit_advs/*',
|
||||||
|
'/profile',
|
||||||
|
'/profile/*',
|
||||||
|
'/ajax/*',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| TIMEOUT RULES
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Specify timeout rules per path.
|
||||||
|
| Use * for partial matching.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'rules' => explode(',', env('HTTP_CACHE_RULES', '')),
|
||||||
|
|
||||||
|
];
|
||||||
Loading…
Reference in New Issue
Block a user