diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/StatusController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/StatusController.php new file mode 100644 index 000000000..e61072dd4 --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/Admin/StatusController.php @@ -0,0 +1,43 @@ +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); + } +} 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 0def40984..00f241ac1 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -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); } diff --git a/addons/default/visiosoft/advs-module/src/Status/Contract/StatusInterface.php b/addons/default/visiosoft/advs-module/src/Status/Contract/StatusInterface.php new file mode 100644 index 000000000..f0e95990e --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Status/Contract/StatusInterface.php @@ -0,0 +1,8 @@ +model = $model; + } +} diff --git a/addons/default/visiosoft/advs-module/src/Status/StatusRouter.php b/addons/default/visiosoft/advs-module/src/Status/StatusRouter.php new file mode 100644 index 000000000..7e5726d99 --- /dev/null +++ b/addons/default/visiosoft/advs-module/src/Status/StatusRouter.php @@ -0,0 +1,8 @@ + 'Clean Subcategories', + 'ad_count_calculate' => 'Ad Count Calculate', + 'cat_level_calculate' => 'Category Level Calculate', ]; diff --git a/addons/default/visiosoft/cats-module/src/Category/Table/CategoryTableBuilder.php b/addons/default/visiosoft/cats-module/src/Category/Table/CategoryTableBuilder.php index 595b5c978..7bdc602c0 100644 --- a/addons/default/visiosoft/cats-module/src/Category/Table/CategoryTableBuilder.php +++ b/addons/default/visiosoft/cats-module/src/Category/Table/CategoryTableBuilder.php @@ -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', ], ]; diff --git a/addons/default/visiosoft/location-module/resources/views/ad-detail/details.twig b/addons/default/visiosoft/location-module/resources/views/ad-detail/details.twig index 10053f49d..c408941a0 100644 --- a/addons/default/visiosoft/location-module/resources/views/ad-detail/details.twig +++ b/addons/default/visiosoft/location-module/resources/views/ad-detail/details.twig @@ -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 %}
- {{ adv.city_name }}, {{ adv.country_name }} + {{ (adv.city_name) ? adv.city_name~',' : '' }} {{ adv.country_name }}
{% endif %} \ No newline at end of file diff --git a/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php b/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php index d6df4e5d6..18f16a4e4 100644 --- a/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php +++ b/addons/default/visiosoft/profile-module/src/Http/Controller/UserAuthenticator.php @@ -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; diff --git a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php index 15e0e832c..d17c67562 100644 --- a/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php +++ b/addons/default/visiosoft/profile-module/src/Profile/Profile/ProfileFormHandler.php @@ -1,11 +1,23 @@ 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; + } } diff --git a/addons/default/visiosoft/profile-module/src/Profile/Validator/Contract/ValidatorExtensionInterface.php b/addons/default/visiosoft/profile-module/src/Profile/Validator/Contract/ValidatorExtensionInterface.php new file mode 100644 index 000000000..d918ba98a --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Profile/Validator/Contract/ValidatorExtensionInterface.php @@ -0,0 +1,6 @@ + 'ltr', ], 'ku' => [ - 'direction' => 'ltr', + 'direction' => 'rtl', ], 'kv' => [ 'direction' => 'ltr',