Merge pull request #931 from openclassify/vedat3.8

Vedat3.8
This commit is contained in:
Fatih Alp 2021-01-30 16:57:58 +03:00 committed by GitHub
commit 538894f9d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 338 additions and 15 deletions

View File

@ -0,0 +1,43 @@
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
use Visiosoft\AdvsModule\Status\Form\StatusFormBuilder;
use Visiosoft\AdvsModule\Status\Table\StatusTableBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
class StatusController extends AdminController
{
/**
* Display an index of existing entries.
*
* @param StatusTableBuilder $table
* @return \Symfony\Component\HttpFoundation\Response
*/
public function index(StatusTableBuilder $table)
{
return $table->render();
}
/**
* Create a new entry.
*
* @param StatusFormBuilder $form
* @return \Symfony\Component\HttpFoundation\Response
*/
public function create(StatusFormBuilder $form)
{
return $form->render();
}
/**
* Edit an existing entry.
*
* @param StatusFormBuilder $form
* @param $id
* @return \Symfony\Component\HttpFoundation\Response
*/
public function edit(StatusFormBuilder $form, $id)
{
return $form->render($id);
}
}

View File

@ -277,7 +277,7 @@ class AdvsController extends PublicController
$subCats = $this->category_repository->getCategoryById($category->id);
//if there is no subcategory
if (count($subCats) < 1) {
if (count($subCats) < 1 and count($mainCats) > 1) {
//fetch subcategories of the last category
$subCats = $this->category_repository->getCategoryById($mainCats[1]['id']);
unset($mainCats[0]);//remove last category
@ -291,7 +291,7 @@ class AdvsController extends PublicController
$cFArray = $checkboxes = $topfields = $selectDropdown = $selectRange = $selectImage = $ranges = $radio = array();
if ($isActiveCustomFields) {
$returnvalues = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->index($mainCats, $subCats, $categoryId);
$returnvalues = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->index($mainCats, $subCats, $category);
$checkboxes = $returnvalues['checkboxes'];
$topfields = $returnvalues['topfields'];
$selectDropdown = $returnvalues['selectDropdown'];
@ -875,9 +875,6 @@ class AdvsController extends PublicController
->packageAddCart(\request()->pack_id, $adv->id);
}
}
$this->event->dispatch(new EditAd($adv));
return redirect('/advs/edit_advs/' . $adv->id);
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status\Contract;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface StatusInterface extends EntryInterface
{
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status\Contract;
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface StatusRepositoryInterface extends EntryRepositoryInterface
{
}

View File

@ -0,0 +1,66 @@
<?php namespace Visiosoft\AdvsModule\Status\Form;
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
class StatusFormBuilder extends FormBuilder
{
/**
* The form fields.
*
* @var array|string
*/
protected $fields = [];
/**
* Additional validation rules.
*
* @var array|string
*/
protected $rules = [];
/**
* Fields to skip.
*
* @var array|string
*/
protected $skips = [];
/**
* The form actions.
*
* @var array|string
*/
protected $actions = [];
/**
* The form buttons.
*
* @var array|string
*/
protected $buttons = [
'cancel',
];
/**
* The form options.
*
* @var array
*/
protected $options = [];
/**
* The form sections.
*
* @var array
*/
protected $sections = [];
/**
* The form assets.
*
* @var array
*/
protected $assets = [];
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Anomaly\Streams\Platform\Entry\EntryCollection;
class StatusCollection extends EntryCollection
{
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Anomaly\Streams\Platform\Entry\EntryCriteria;
class StatusCriteria extends EntryCriteria
{
}

View File

@ -0,0 +1,9 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Visiosoft\AdvsModule\Status\Contract\StatusInterface;
use Anomaly\Streams\Platform\Model\Advs\AdvsStatusEntryModel;
class StatusModel extends AdvsStatusEntryModel implements StatusInterface
{
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Anomaly\Streams\Platform\Entry\EntryObserver;
class StatusObserver extends EntryObserver
{
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
class StatusPresenter extends EntryPresenter
{
}

View File

@ -0,0 +1,25 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Visiosoft\AdvsModule\Status\Contract\StatusRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
class StatusRepository extends EntryRepository implements StatusRepositoryInterface
{
/**
* The entry model.
*
* @var StatusModel
*/
protected $model;
/**
* Create a new StatusRepository instance.
*
* @param StatusModel $model
*/
public function __construct(StatusModel $model)
{
$this->model = $model;
}
}

View File

@ -0,0 +1,8 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Anomaly\Streams\Platform\Entry\EntryRouter;
class StatusRouter extends EntryRouter
{
}

View File

@ -0,0 +1,15 @@
<?php namespace Visiosoft\AdvsModule\Status;
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
class StatusSeeder extends Seeder
{
/**
* Run the seeder.
*/
public function run()
{
//
}
}

View File

@ -0,0 +1,63 @@
<?php namespace Visiosoft\AdvsModule\Status\Table;
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
class StatusTableBuilder extends TableBuilder
{
/**
* The table views.
*
* @var array|string
*/
protected $views = [];
/**
* The table filters.
*
* @var array|string
*/
protected $filters = [];
/**
* The table columns.
*
* @var array|string
*/
protected $columns = [
'name',
];
/**
* The table buttons.
*
* @var array|string
*/
protected $buttons = [
'edit'
];
/**
* The table actions.
*
* @var array|string
*/
protected $actions = [
'delete'
];
/**
* The table options.
*
* @var array
*/
protected $options = [];
/**
* The table assets.
*
* @var array
*/
protected $assets = [];
}

View File

@ -2,4 +2,6 @@
return [
'clean_subcategories' => 'Clean Subcategories',
'ad_count_calculate' => 'Ad Count Calculate',
'cat_level_calculate' => 'Category Level Calculate',
];

View File

@ -18,9 +18,11 @@ class CategoryTableBuilder extends TableBuilder
'href' => '/admin/cats/clean_subcats',
],
'adcountcalc' => [
'text' => 'visiosoft.module.cats::view.ad_count_calculate',
'href' => '/admin/cats/adcountcalc',
],
'catLevelCalc' => [
'text' => 'visiosoft.module.cats::view.cat_level_calculate',
'href' => '/admin/cats/catlevelcalc',
],
];

View File

@ -1,7 +1,7 @@
{% set adv = params.adv %}
{% if setting_value('visiosoft.module.location::detail_page_location') %}
{% if setting_value('visiosoft.module.location::detail_page_location') and adv.country_name %}
<div class="col-md-12 m-2 location-container">
<i class="fas fa-location-arrow text-primary"></i>
{{ adv.city_name }}, {{ adv.country_name }}
{{ (adv.city_name) ? adv.city_name~',' : '' }} {{ adv.country_name }}
</div>
{% endif %}

View File

@ -6,20 +6,13 @@ use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterf
use Anomaly\UsersModule\User\Contract\UserInterface;
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Anomaly\UsersModule\User\Event\UserWasLoggedIn;
use Anomaly\UsersModule\User\User;
use Anomaly\UsersModule\User\UserPassword;
use http\Env\Response;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Http\Controller\AdvsController;
use Visiosoft\CartsModule\Saleitem\Command\ProcessSaleitem;
use Visiosoft\CartsModule\Saleitem\SaleitemModel;
use Visiosoft\CloudsiteModule\Site\Event\CreateSite;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redirect;
use Visiosoft\CloudsiteModule\Site\SiteModel;
use Visiosoft\ProfileModule\Profile\ProfileRepository;

View File

@ -1,11 +1,23 @@
<?php namespace Visiosoft\ProfileModule\Profile\Profile;
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
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 Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Redirect;
use Visiosoft\ProfileModule\Events\UserUpdated;
class ProfileFormHandler
{
protected $extensions;
public function __construct(ExtensionCollection $extensions)
{
$this->extensions = $extensions;
}
public function handle(
ProfileFormBuilder $builder,
MessageBag $messages,
@ -27,6 +39,11 @@ class ProfileFormHandler
'google_address' => $builder->getPostValue('google_address') ?: null,
];
if (($valid = $this->validate($parameters)) !== true) {
$messages->error($valid['msg']);
return;
}
if (setting_value('visiosoft.module.profile::show_education_profession')) {
$parameters = array_merge($parameters, [
'education' => $builder->getPostValue('education'),
@ -70,4 +87,21 @@ class ProfileFormHandler
}
return $changes;
}
public function validate(array $fields)
{
$validators = $this->extensions
->search('visiosoft.module.profile::validation.*')
->enabled();
foreach ($validators as $validator) {
$valid = $validator->validate($fields);
if ($valid['error']) {
return $valid;
}
}
return true;
}
}

View File

@ -0,0 +1,6 @@
<?php namespace Visiosoft\ProfileModule\Profile\Validator\Contract;
interface ValidatorExtensionInterface
{
public function validate(array $fields);
}

View File

@ -0,0 +1,12 @@
<?php namespace Visiosoft\ProfileModule\Profile\Validator;
use Anomaly\Streams\Platform\Addon\Extension\Extension;
use Visiosoft\ProfileModule\Profile\Validator\Contract\ValidatorExtensionInterface;
class ValidatorExtension extends Extension implements ValidatorExtensionInterface
{
public function validate(array $fields)
{
return null;
}
}

View File

@ -391,7 +391,7 @@ return [
'direction' => 'ltr',
],
'ku' => [
'direction' => 'ltr',
'direction' => 'rtl',
],
'kv' => [
'direction' => 'ltr',