From ddabcf035efdfd9af2d8cb74e36c8262d98934c4 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 10:28:32 +0300 Subject: [PATCH 1/8] #2177 emlak24 Yorum-Rating completed --- .../views/ad-detail/partials/content.twig | 4 +- .../src/AdvsModuleServiceProvider.php | 5 ++ .../src/Http/Controller/advsController.php | 77 ++++++++++--------- 3 files changed, 50 insertions(+), 36 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig index db2d38bbe..94c4c62f2 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig @@ -37,7 +37,9 @@ - {{ addBlock('ad-detail/content',{'features':features,'adv':adv, 'profile': profile})|raw }} + diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index 42ffeda6c..e55610d51 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -209,6 +209,11 @@ class AdvsModuleServiceProvider extends AddonServiceProvider // Others 'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser', + + 'advs/comments/save/{id}' => [ + 'as' => 'advs::saveComment', + 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@saveComment' + ] ]; /** 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 f9c5bc7b2..5eada1208 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -2,47 +2,46 @@ use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface; use Anomaly\Streams\Platform\Http\Controller\PublicController; +use Anomaly\Streams\Platform\Message\MessageBag; use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel; use Anomaly\Streams\Platform\Model\Advs\PurchasePurchaseEntryModel; use Anomaly\Streams\Platform\Model\Complaints\ComplaintsComplainTypesEntryModel; use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel; use Anomaly\UsersModule\User\Contract\UserRepositoryInterface; -use Visiosoft\AdvsModule\Adv\Command\appendRequestURL; -use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd; -use Visiosoft\AdvsModule\Adv\Event\CreatedAd; -use Visiosoft\AdvsModule\Adv\Event\showAdPhone; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cookie; -use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface; -use Visiosoft\LocationModule\City\CityRepository; -use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface; -use function PMA\Util\get; use Visiosoft\AdvsModule\Adv\AdvModel; +use Visiosoft\AdvsModule\Adv\Command\appendRequestURL; +use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface; +use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd; +use Visiosoft\AdvsModule\Adv\Event\CreatedAd; use Visiosoft\AdvsModule\Adv\Event\priceChange; +use Visiosoft\AdvsModule\Adv\Event\showAdPhone; use Visiosoft\AdvsModule\Adv\Event\UpdateAd; use Visiosoft\AdvsModule\Adv\Event\viewAd; use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder; -use Visiosoft\CatsModule\Category\CategoryModel; -use Visiosoft\CommentsModule\Comment\CommentModel; -use Visiosoft\LocationModule\City\CityModel; +use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface; use Visiosoft\AlgoliaModule\Search\SearchModel; use Visiosoft\AlgoliatestModule\Http\Controller\Admin\IndexController; +use Visiosoft\CatsModule\Category\CategoryModel; +use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface; use Visiosoft\CloudinaryModule\Video\VideoModel; +use Visiosoft\CommentsModule\Comment\Events\CreateNewComment; use Visiosoft\FavsModule\Http\Controller\FavsController; +use Visiosoft\LocationModule\City\CityModel; +use Visiosoft\LocationModule\City\CityRepository; +use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface; use Visiosoft\LocationModule\District\DistrictModel; use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel; use Visiosoft\LocationModule\Village\VillageModel; use Visiosoft\PackagesModule\Http\Controller\PackageFEController; -use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface; -use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface; -use Visiosoft\LocationModule\Country\Contract\CountryRepositoryInterface; -use Anomaly\Streams\Platform\Message\MessageBag; use Visiosoft\PackagesModule\Package\PackageModel; - -use Illuminate\Contracts\Events\Dispatcher; +use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface; use Visiosoft\QrcontactModule\Qr\QrModel; use Visiosoft\StoreModule\Ad\AdModel; +use function PMA\Util\get; class AdvsController extends PublicController @@ -405,10 +404,6 @@ class AdvsController extends PublicController $options = $this->optionRepository->findAllBy('adv_id', $id); - if ($this->adv_model->is_enabled('comments')) { - $CommentModel = new CommentModel(); - $comments = $CommentModel->getComments($adv->id)->get(); - } $this->event->dispatch(new viewAd($adv));//view ad $this->template->set('meta_keywords', implode(',', explode(' ', $adv->name))); @@ -429,7 +424,7 @@ class AdvsController extends PublicController } $this->template->set('meta_image', $coverPhoto); - if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") { + if ($adv->created_by_id == isset(auth()->user()->id) or $adv->status == "approved") { return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints', 'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options')); } else { @@ -511,11 +506,6 @@ class AdvsController extends PublicController return back(); } - public function getCats($id) - { - return $this->category_repository->getSubCatById($id); - } - public function getCatsForNewAd($id) { @@ -763,7 +753,7 @@ class AdvsController extends PublicController $auto_approved = $settings->value('visiosoft.module.advs::auto_approve'); $default_published_time = $settings->value('visiosoft.module.advs::default_published_time'); - if ($auto_approved == true AND $type == 'pending_admin') { + if ($auto_approved == true and $type == 'pending_admin') { $type = "approved"; } if ($type == "approved" and $auto_approved != true) { @@ -772,7 +762,7 @@ class AdvsController extends PublicController if ($type == "approved") { $this->adv_model->publish_at_Ads($id); - if ($ad->finish_at == NULL AND $type == "approved") { + if ($ad->finish_at == NULL and $type == "approved") { if ($this->adv_model->is_enabled('packages')) { $packageModel = new PackageModel(); $published_time = $packageModel->reduceTimeLimit($ad->cat1); @@ -949,6 +939,12 @@ class AdvsController extends PublicController return "false"; } + public function isActiveJson($slug) + { + $isActive = $this->isActive($slug); + return response()->json(array('isActive' => $isActive)); + } + public function isActive($slug) { $query = new AdvModel(); @@ -956,12 +952,6 @@ class AdvsController extends PublicController return $query->is_enabled($slug); } - public function isActiveJson($slug) - { - $isActive = $this->isActive($slug); - return response()->json(array('isActive' => $isActive)); - } - public function checkParentCat($id) { $option = new CategoryModel(); @@ -1075,4 +1065,21 @@ class AdvsController extends PublicController $this->messages->success(trans('visiosoft.module.advs::message.extended', ['number' => $adsExtended])); return $this->redirect->back(); } + + public function saveComment($id) + { + $comment = $this->request->validate([ + 'rating' => 'required', + 'username' => 'required', + 'title' => 'required', + 'detail' => 'required', + ]); + + if ($adv = $this->adv_repository->find($id)) { + event(new CreateNewComment($adv, $comment)); + $this->messages->success(trans('visiosoft.module.comments::message.comment_success')); + } else { + $this->messages->error(trans('visiosoft.module.comments::message.comment_error')); + } + } } \ No newline at end of file From c4cc60bc205ac9131b1deec9f81526aff45e7868 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 11:43:12 +0300 Subject: [PATCH 2/8] #2177 emlak24 Yorum-Rating completed --- .../advs-module/src/Http/Controller/advsController.php | 5 +++++ 1 file changed, 5 insertions(+) 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 5eada1208..7a2f7af0e 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -506,6 +506,11 @@ class AdvsController extends PublicController return back(); } + public function getCats($id) + { + return $this->category_repository->getSubCatById($id); + } + public function getCatsForNewAd($id) { From bbf0b7870d52432bd2f2375ef483809b7447025c Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 15:00:52 +0300 Subject: [PATCH 3/8] #2177 emlak24 Yorum-Rating completed --- .../views/ad-detail/partials/content.twig | 2 +- .../src/Http/Controller/advsController.php | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig index 94c4c62f2..21b078018 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig @@ -38,7 +38,7 @@ 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 7a2f7af0e..051e0b5db 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -1070,21 +1070,4 @@ class AdvsController extends PublicController $this->messages->success(trans('visiosoft.module.advs::message.extended', ['number' => $adsExtended])); return $this->redirect->back(); } - - public function saveComment($id) - { - $comment = $this->request->validate([ - 'rating' => 'required', - 'username' => 'required', - 'title' => 'required', - 'detail' => 'required', - ]); - - if ($adv = $this->adv_repository->find($id)) { - event(new CreateNewComment($adv, $comment)); - $this->messages->success(trans('visiosoft.module.comments::message.comment_success')); - } else { - $this->messages->error(trans('visiosoft.module.comments::message.comment_error')); - } - } } \ No newline at end of file From 88d16f65ffd6139b76db56e3f04586c78e66ee4b Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 15:53:04 +0300 Subject: [PATCH 4/8] #2177 emlak24 Yorum-Rating completed --- .../visiosoft/advs-module/src/AdvsModuleServiceProvider.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php index e55610d51..42ffeda6c 100644 --- a/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php +++ b/addons/default/visiosoft/advs-module/src/AdvsModuleServiceProvider.php @@ -209,11 +209,6 @@ class AdvsModuleServiceProvider extends AddonServiceProvider // Others 'advs/ttr/{id}' => 'Visiosoft\PackagesModule\Http\Controller\packageFEController@advsStatusbyUser', - - 'advs/comments/save/{id}' => [ - 'as' => 'advs::saveComment', - 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@saveComment' - ] ]; /** From 236d8b194c8856ee767656b9352cbe4992e3a29e Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 17:25:25 +0300 Subject: [PATCH 5/8] #2177 emlak24 Yorum-Rating completed --- .../resources/views/ad-detail/partials/content.twig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig index 21b078018..496327820 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig @@ -38,7 +38,8 @@ From 836780c8888d2573aba94029ffff2d23a531892f Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 17:37:03 +0300 Subject: [PATCH 6/8] #2177 emlak24 Yorum-Rating completed --- .../resources/views/ad-detail/partials/content.twig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig index 496327820..b1ffb8425 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig @@ -37,10 +37,8 @@ - From 78f332cb55e4bf9cac795de00764c5bbc84ec1e8 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 18:00:47 +0300 Subject: [PATCH 7/8] #2177 emlak24 Yorum-Rating completed --- .../resources/views/ad-detail/partials/content.twig | 3 +-- .../advs-module/src/Http/Controller/advsController.php | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig index b1ffb8425..cc4d985f0 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig @@ -37,8 +37,7 @@ - {{ addBlock('ad-detail/content',{'features':features,'adv': adv, 'type': 'adv', 'profile': profile, - 'commenturl': 'comments::save_comment'})|raw }} + {{ addBlock('ad-detail/content',{'features':features,'adv': adv, 'type': 'adv', 'profile': profile})|raw }} 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 051e0b5db..343649673 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -41,8 +41,6 @@ use Visiosoft\PackagesModule\Package\PackageModel; use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface; use Visiosoft\QrcontactModule\Qr\QrModel; use Visiosoft\StoreModule\Ad\AdModel; -use function PMA\Util\get; - class AdvsController extends PublicController { From 1327860df6311d54c3c4cc330363449743333ce4 Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Tue, 22 Sep 2020 18:08:58 +0300 Subject: [PATCH 8/8] #2177 emlak24 Yorum-Rating completed --- .../advs-module/resources/views/ad-detail/partials/content.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig index cc4d985f0..b133c5ae8 100644 --- a/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig +++ b/addons/default/visiosoft/advs-module/resources/views/ad-detail/partials/content.twig @@ -37,7 +37,7 @@ - {{ addBlock('ad-detail/content',{'features':features,'adv': adv, 'type': 'adv', 'profile': profile})|raw }} + {{ addBlock('ad-detail/content',{'features':features,'adv': adv, 'profile': profile})|raw }}