mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
Merge pull request #927 from openclassify/dia
#3133 fast add user select
This commit is contained in:
commit
bc6fc0c08a
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
.upper-list-banner {
|
.upper-list-banner {
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upper-list-banner img {
|
.upper-list-banner img {
|
||||||
|
|||||||
@ -322,6 +322,8 @@ return [
|
|||||||
'upload_files' => 'Upload Files',
|
'upload_files' => 'Upload Files',
|
||||||
'additional_fields' => 'Additional Fields',
|
'additional_fields' => 'Additional Fields',
|
||||||
'ad_location' => 'Ad Location',
|
'ad_location' => 'Ad Location',
|
||||||
|
'owner' => 'Owner',
|
||||||
|
'default_owner_instruction' => 'The owner will default to the current user if no user is selected',
|
||||||
|
|
||||||
'free' => 'Free',
|
'free' => 'Free',
|
||||||
'ad_date' => 'Ad Date',
|
'ad_date' => 'Ad Date',
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Adv;
|
<?php namespace Visiosoft\AdvsModule\Adv;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Container\Container;
|
use Illuminate\Container\Container;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Pagination\Paginator;
|
use Illuminate\Pagination\Paginator;
|
||||||
@ -26,4 +27,13 @@ class AdvCollection extends EntryCollection
|
|||||||
'items', 'total', 'perPage', 'currentPage', 'options'
|
'items', 'total', 'perPage', 'currentPage', 'options'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function nonExpired()
|
||||||
|
{
|
||||||
|
return $this->filter(
|
||||||
|
function ($ad) {
|
||||||
|
return $ad->finish_at->gt(Carbon::now());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -475,15 +475,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
{
|
{
|
||||||
$ads = $this
|
$ads = $this
|
||||||
->newQuery()
|
->newQuery()
|
||||||
->whereIn('advs_advs.created_by_id', $usersIDs)
|
->whereIn('advs_advs.created_by_id', $usersIDs);
|
||||||
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
|
||||||
|
|
||||||
if ($status) {
|
if ($status) {
|
||||||
$ads = $ads->where('advs_advs.status', 'approved');
|
$ads = $ads->where('advs_advs.status', 'approved');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$withDraft) {
|
if (!$withDraft) {
|
||||||
$ads = $ads->where('advs_advs.slug', '!=', "");
|
$ads = $ads
|
||||||
|
->where('advs_advs.slug', '!=', "")
|
||||||
|
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ads;
|
return $ads;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Adv\Form;
|
<?php namespace Visiosoft\AdvsModule\Adv\Form;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
|
use Anomaly\UsersModule\User\UserModel;
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
|
|
||||||
class SimpleAdvFormBuilder extends FormBuilder
|
class SimpleAdvFormBuilder extends FormBuilder
|
||||||
@ -8,6 +9,15 @@ class SimpleAdvFormBuilder extends FormBuilder
|
|||||||
protected $model = AdvModel::class;
|
protected $model = AdvModel::class;
|
||||||
|
|
||||||
protected $fields = [
|
protected $fields = [
|
||||||
|
"created_by_id" => [
|
||||||
|
'label' => 'visiosoft.module.advs::field.owner',
|
||||||
|
'instructions' => 'visiosoft.module.advs::field.default_owner_instruction',
|
||||||
|
"type" => "anomaly.field_type.relationship",
|
||||||
|
"config" => [
|
||||||
|
"related" => UserModel::class,
|
||||||
|
"mode" => "lookup",
|
||||||
|
]
|
||||||
|
],
|
||||||
'name',
|
'name',
|
||||||
'price',
|
'price',
|
||||||
'currency',
|
'currency',
|
||||||
|
|||||||
@ -11,6 +11,10 @@ class SimpleAdvFormHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$builder->getFormValue('created_by_id')) {
|
||||||
|
$builder->setFormValue('created_by_id', auth()->id());
|
||||||
|
}
|
||||||
|
|
||||||
$builder->saveForm();
|
$builder->saveForm();
|
||||||
|
|
||||||
$ad = $advRepository->find($builder->getFormEntryId());
|
$ad = $advRepository->find($builder->getFormEntryId());
|
||||||
|
|||||||
@ -991,7 +991,7 @@ class AdvsController extends PublicController
|
|||||||
} elseif ($type === 'sold') {
|
} elseif ($type === 'sold') {
|
||||||
$message = trans('visiosoft.module.advs::message.sold_status_change');
|
$message = trans('visiosoft.module.advs::message.sold_status_change');
|
||||||
} else {
|
} else {
|
||||||
trans('visiosoft.module.advs::message.passive_status_change');
|
$message = trans('visiosoft.module.advs::message.passive_status_change');
|
||||||
}
|
}
|
||||||
$this->messages->success($message);
|
$this->messages->success($message);
|
||||||
return back();
|
return back();
|
||||||
|
|||||||
@ -4,10 +4,12 @@ class UserUpdated
|
|||||||
{
|
{
|
||||||
public $oldCustomerInfo;
|
public $oldCustomerInfo;
|
||||||
public $changes;
|
public $changes;
|
||||||
|
public $builder;
|
||||||
|
|
||||||
public function __construct($oldCustomerInfo, $changes)
|
public function __construct($oldCustomerInfo, $changes, $builder = null)
|
||||||
{
|
{
|
||||||
$this->oldCustomerInfo = $oldCustomerInfo;
|
$this->oldCustomerInfo = $oldCustomerInfo;
|
||||||
$this->changes = $changes;
|
$this->changes = $changes;
|
||||||
|
$this->builder = $builder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,11 +2,7 @@
|
|||||||
|
|
||||||
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
|
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
|
||||||
use Anomaly\Streams\Platform\Message\MessageBag;
|
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||||
use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterface;
|
|
||||||
use Anomaly\UsersModule\User\Contract\UserInterface;
|
|
||||||
use Anomaly\UsersModule\User\UserModel;
|
use Anomaly\UsersModule\User\UserModel;
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Support\Facades\Redirect;
|
|
||||||
use Visiosoft\ProfileModule\Events\UserUpdated;
|
use Visiosoft\ProfileModule\Events\UserUpdated;
|
||||||
|
|
||||||
class ProfileFormHandler
|
class ProfileFormHandler
|
||||||
@ -72,7 +68,7 @@ class ProfileFormHandler
|
|||||||
|
|
||||||
$changes = $this->change($user, $parameters);
|
$changes = $this->change($user, $parameters);
|
||||||
|
|
||||||
event(new UserUpdated($oldCustomerInfo, $changes));
|
event(new UserUpdated($oldCustomerInfo, $changes, $builder));
|
||||||
|
|
||||||
$messages->success(trans('visiosoft.module.profile::message.success_update'));
|
$messages->success(trans('visiosoft.module.profile::message.success_update'));
|
||||||
}
|
}
|
||||||
@ -97,7 +93,7 @@ class ProfileFormHandler
|
|||||||
foreach ($validators as $validator) {
|
foreach ($validators as $validator) {
|
||||||
$valid = $validator->validate($fields);
|
$valid = $validator->validate($fields);
|
||||||
|
|
||||||
if ($valid['error']) {
|
if (isset($valid['error']) && $valid['error']) {
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user