diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/message.php b/addons/default/visiosoft/advs-module/resources/lang/en/message.php index c60c9eeab..6fbadb7b5 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/message.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/message.php @@ -32,4 +32,6 @@ return [ 'sold_status_change' => "Your Ad's Status Has Been Set to Sold!", 'status_change' => "Your Ad's Status Has Been Set to :status!", 'disabled_detailed_options_for_admin_role' => "Detailed product options are disabled.", + 'permission_error' => 'You do not have permission for this action', + 'currency_converter_not_available' => 'The currency converter is not available.', ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/tr/message.php b/addons/default/visiosoft/advs-module/resources/lang/tr/message.php index 5f6db9514..3c59de32d 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/tr/message.php +++ b/addons/default/visiosoft/advs-module/resources/lang/tr/message.php @@ -32,4 +32,6 @@ return [ 'sold_status_change' => "İlanın Durumu Satıldı Olarak Ayarlanmıştır!", 'status_change' => "İlanın durumu Ayarland :status !", 'disabled_detailed_options_for_admin_role' => "Ayrıntılı ürün seçenekleri devre dışı bırakıldı.", + 'permission_error' => 'Bu işlem için yetkiniz bulunmamaktadır', + 'currency_converter_not_available' => 'Para birimi çevirici kullanılamıyor.', ]; diff --git a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig index 760e4c697..59c5044cf 100644 --- a/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig +++ b/addons/default/visiosoft/advs-module/resources/views/new-ad/new-create.twig @@ -287,7 +287,7 @@
{{ trans('visiosoft.module.advs::field.ad_location') }}
-
+
{% include "visiosoft.module.location::new-ad/map" %} model->userAdv() + ->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s')); + } + + public function createNewAd(array $params) + { + return $this->newQuery()->create($params); + } + + public function deleteAd(array $params) + { + $this->dispatch(new CheckRequiredParams(['ad_id'], $params)); + + + $ad = $this->checkAd($params['ad_id']); + + $this->checkOwner($ad); + + return $ad->delete(); + } + + public function updateAd(array $params) + { + $this->dispatch(new CheckRequiredParams(['ad_id'], $params)); + + $ad = $this->checkAd($params['ad_id']); + + $this->checkOwner($ad); + + unset($params['ad_id'],$params['id'], $params['created_at'], $params['updated_at'], + $params['deleted_at'], $params['created_by_id'], $params['updated_by_id']); + + + $update_params = [ + 'updated_by_id' => Auth::id(), + 'updated_at' => Carbon::now() + ]; + + $ad->update(array_merge($update_params,$params)); + + return $ad; + } + + public function getAds() + { + return $this->currentAds(); + } + + public function checkAd($id) + { + if (!$ad = $this->newQuery()->find($id)) { + throw new \Exception(trans('visiosoft.module.advs::message.ad_doesnt_exist'), 404); + die; + } + return $ad; + } + + public function checkOwner($ad) + { + if ($ad->created_by_id != Auth::id()) { + throw new \Exception(trans('visiosoft.module.advs::message.permission_error'), 403); + die; + } + } +} diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index 81148d09f..faf106f2f 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -436,13 +436,6 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface return null; } - public function authControl() - { - if (!Auth::user()) { - redirect('/login?redirect=' . url()->current())->send(); - } - } - public function currentAds() { return $this->whereDate('finish_at', '>=', date("Y-m-d H:i:s")) ->where('status', '=', 'approved') diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index 70abc6a69..54b48aff2 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -311,7 +311,15 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface if (!$thumbnail AND $ext[1] != 'svg') { // Create thumbnail image - $image = Image::make(file_get_contents($adv->files[0]->make()->url())); + + $arrContextOptions=array( + "ssl"=>array( + "verify_peer"=>false, + "verify_peer_name"=>false, + ), + ); + + $image = Image::make(file_get_contents($adv->files[0]->make()->url(), false, stream_context_create($arrContextOptions))); $image->resize( null, setting_value('visiosoft.module.advs::thumbnail_height'), diff --git a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php index 4db2bd4f3..693d69980 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php @@ -70,8 +70,6 @@ interface AdvInterface extends EntryInterface public function getRecommended($id); - public function authControl(); - public function inStock(); public function getCity(); diff --git a/addons/default/visiosoft/advs-module/src/Adv/Form/SimpleAdvFormHandler.php b/addons/default/visiosoft/advs-module/src/Adv/Form/SimpleAdvFormHandler.php index 176bc5632..aae52965a 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Form/SimpleAdvFormHandler.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Form/SimpleAdvFormHandler.php @@ -2,6 +2,8 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder; use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface; +use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface; +use Visiosoft\LocationModule\Country\CountryModel; class SimpleAdvFormHandler { @@ -11,12 +13,14 @@ class SimpleAdvFormHandler return; } - if (!$builder->getFormValue('created_by_id')) { - $builder->setFormValue('created_by_id', auth()->id()); - } - $builder->saveForm(); + if (!$builder->getFormValue('country_id')) { + $entry = $builder->getFormEntry(); + $entry->setAttribute('country_id', setting_value('visiosoft.module.location::default_country')); + $entry->save(); + } + $ad = $advRepository->find($builder->getFormEntryId()); if (!$builder->getFormValue('status') && $ad->status !== 'approved') { $ad->approve(); diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index 2c0fcdb63..e0aedcb40 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -114,10 +114,12 @@ class AdvsModuleServiceProvider extends AddonServiceProvider ], 'advs/create_adv' => [ 'as' => "advs::create_adv", + 'middleware' => 'auth', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@cats', ], 'advs/create_adv/post_cat' => [ 'as' => 'post_adv', + 'middleware' => 'auth', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@create', ], 'advs/save_adv' => [ @@ -135,6 +137,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider ], 'advs/delete/{id}' => [ 'as' => 'advs::delete', + 'middleware' => 'auth', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@deleteAd', ], 'adv/addCart/{id}' => [ @@ -205,6 +208,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider //Configurations Admin Controller 'admin/advs/option_configuration/create' => [ + 'middleware' => 'auth', 'as' => 'visiosoft.module.advs::configrations.create', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@create', ], @@ -215,6 +219,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider //Configuration Controller 'advs/option_configuration/create' => [ + 'middleware' => 'auth', 'as' => 'visiosoft.module.advs::user.configrations.create', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@create', ], 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 b8046c2ed..1ace493e0 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/AdvsController.php @@ -711,9 +711,6 @@ class AdvsController extends PublicController public function deleteAd(AdvRepositoryInterface $advs, $id) { $ad = $this->adv_model->find($id); - if (!Auth::user()) { - redirect('/login?redirect=' . url()->current())->send(); - } if ($ad->created_by_id != Auth::id()) { $this->messages->error(trans('visiosoft.module.advs::message.delete_author_error')); @@ -745,10 +742,6 @@ class AdvsController extends PublicController public function create(AdvFormBuilder $formBuilder, CategoryRepositoryInterface $repository) { - if (!Auth::user()) { - redirect('/login?redirect=' . url()->current())->send(); - } - $isActive = new AdvModel(); $cats = $this->request->toArray(); unset($cats['_token']); @@ -928,7 +921,11 @@ class AdvsController extends PublicController if ($is_new_create) { event(new CreatedAd($adv)); } else { - $this->adv_model->foreignCurrency($this->request->currency, $this->request->price, $this->request->update_id, $this->settings_repository, false); + try { + $this->adv_model->foreignCurrency($this->request->currency, $this->request->price, $this->request->update_id, $this->settings_repository, false); + } catch (\Exception $exception) { + $this->messages->error(trans('visiosoft.module.advs::message.currency_converter_not_available')); + } event(new EditedAd($before_editing, $adv)); } @@ -1068,9 +1065,6 @@ class AdvsController extends PublicController public function cats() { - if (!Auth::user()) { - redirect('/login?redirect=' . url()->current())->send(); - } $main_cats = $this->category_repository->getMainCategories(); return $this->view->make('visiosoft.module.advs::new-ad/post-cat', compact('main_cats')); diff --git a/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css b/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css index 68a2dbc48..ecb8f02a3 100644 --- a/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css +++ b/addons/default/visiosoft/base-theme/resources/css/bootstrap-notify-visio.css @@ -1,7 +1,6 @@ .swal2-container { display: grid; position: fixed; - z-index: 1060; top: 0; right: 0; bottom: 0; @@ -53,4 +52,8 @@ body.swal2-toast-shown .swal2-container.swal2-top-end, body.swal2-toast-shown .s grid-column: 3; align-self: start; justify-self: end; +} + +.swal2-title { + max-width: 14rem; } \ No newline at end of file diff --git a/addons/default/visiosoft/base-theme/resources/views/partials/metadata.twig b/addons/default/visiosoft/base-theme/resources/views/partials/metadata.twig index 2ad8eb479..9be755125 100644 --- a/addons/default/visiosoft/base-theme/resources/views/partials/metadata.twig +++ b/addons/default/visiosoft/base-theme/resources/views/partials/metadata.twig @@ -19,7 +19,7 @@ {{ asset_add("theme.css", "visiosoft.theme.base::css/select2.css") }} {{ asset_add("theme.css", "visiosoft.theme.base::css/font-awesome.min.css") }} {{ asset_add("theme.css", "visiosoft.theme.base::css/intlTelInput.css") }} -{{ asset_style("visiosoft.theme.base::css/offline.scss") }} +{{ asset_add("theme.css", "visiosoft.theme.base::css/offline.scss") }} {{ asset_script('visiosoft.theme.base::js/visiosoft.js') }} diff --git a/addons/default/visiosoft/base-theme/resources/views/partials/metatags.twig b/addons/default/visiosoft/base-theme/resources/views/partials/metatags.twig index 017843463..dc63e9255 100644 --- a/addons/default/visiosoft/base-theme/resources/views/partials/metatags.twig +++ b/addons/default/visiosoft/base-theme/resources/views/partials/metatags.twig @@ -1,6 +1,5 @@ - icon === null) { - return $this->dispatch(new MakeImageInstance('visiosoft.module.advs::images/listing/sample-cat-icon.svg', 'img'))->url(); - } - - return url($this->icon); + return $this->dispatch( + new MakeImageInstance($this->icon ?? 'visiosoft.module.advs::images/listing/sample-cat-icon.svg', 'img') + )->url(); } public function getCat($id) diff --git a/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css b/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css index 1157324b0..142fa6a55 100644 --- a/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css +++ b/addons/default/visiosoft/defaultadmin-theme/resources/css/theme.css @@ -2628,8 +2628,8 @@ body { display: none; } #login .login-container .logo svg, #login .login-container .logo img { - width: 45px; - max-height: 82px; + /*width: 45px;*/ + /*max-height: 82px;*/ fill: #ffffff; margin-top: -30px; vertical-align: middle; @@ -2668,8 +2668,8 @@ body { font-family: "Montserrat", sans-serif; } #login .logo svg, #login .logo img { - width: 45px; - max-height: 82px; + width: 8rem; + height: 8rem; margin-top: -30px; vertical-align: middle; object-fit: contain; @@ -2724,8 +2724,8 @@ body { margin-bottom: 2rem; } #login .login-container .logo svg, #login .login-container .logo img { - width: 55px; - max-height: 100px; + width: 8rem; + height: auto; } } @media (max-width: 767px) { diff --git a/addons/default/visiosoft/location-module/resources/css/map.css b/addons/default/visiosoft/location-module/resources/css/map.css new file mode 100644 index 000000000..1e0890d49 --- /dev/null +++ b/addons/default/visiosoft/location-module/resources/css/map.css @@ -0,0 +1,20 @@ +.location-map .nav-tabs .active { + text-decoration: underline; + color: lightskyblue !important; +} + +.location-map .nav-tabs { + top: -30px; + right: 0; + font-size: 12px; +} + +.location-map .tab-content label { + font-size: 13px; + font-weight: bold; +} + +.location-map .tab-content select { + border-color: #e8e8e8; + border-radius: 3px; +} diff --git a/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig b/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig index c1d32a90f..d56f21222 100644 --- a/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig +++ b/addons/default/visiosoft/location-module/resources/views/new-ad/map.twig @@ -1,48 +1,48 @@ {% if setting_value('visiosoft.module.location::create_ad_page_location') %} -
+
-