Merge pull request #674 from openclassify/muammer

Reordering?
This commit is contained in:
Dia Shalabi 2020-09-22 18:10:47 +03:00 committed by GitHub
commit b0e0f63522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 32 deletions

View File

@ -37,7 +37,7 @@
</div> </div>
<!-- Content With Block --> <!-- Content With Block -->
{{ addBlock('ad-detail/content',{'features':features,'adv':adv, 'profile': profile})|raw }} {{ addBlock('ad-detail/content',{'features':features,'adv': adv, 'profile': profile})|raw }}
<!-- Content With Block --> <!-- Content With Block -->
</div> </div>
</div> </div>

View File

@ -2,49 +2,46 @@
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface; use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
use Anomaly\Streams\Platform\Http\Controller\PublicController; 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\AdvsAdvsEntryModel;
use Anomaly\Streams\Platform\Model\Advs\PurchasePurchaseEntryModel; use Anomaly\Streams\Platform\Model\Advs\PurchasePurchaseEntryModel;
use Anomaly\Streams\Platform\Model\Complaints\ComplaintsComplainTypesEntryModel; use Anomaly\Streams\Platform\Model\Complaints\ComplaintsComplainTypesEntryModel;
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel; use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface; use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL; use Illuminate\Contracts\Events\Dispatcher;
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
use Visiosoft\AdvsModule\Adv\Event\CreatedAd;
use Visiosoft\AdvsModule\Adv\Event\showAdPhone;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie; 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\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\priceChange;
use Visiosoft\AdvsModule\Adv\Event\showAdPhone;
use Visiosoft\AdvsModule\Adv\Event\UpdateAd; use Visiosoft\AdvsModule\Adv\Event\UpdateAd;
use Visiosoft\AdvsModule\Adv\Event\viewAd; use Visiosoft\AdvsModule\Adv\Event\viewAd;
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder; use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
use Visiosoft\CatsModule\Category\CategoryModel; use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
use Visiosoft\CommentsModule\Comment\CommentModel;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\AlgoliaModule\Search\SearchModel; use Visiosoft\AlgoliaModule\Search\SearchModel;
use Visiosoft\AlgoliatestModule\Http\Controller\Admin\IndexController; 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\CloudinaryModule\Video\VideoModel;
use Visiosoft\CommentsModule\Comment\Events\CreateNewComment;
use Visiosoft\FavsModule\Http\Controller\FavsController; 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\District\DistrictModel;
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel; use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
use Visiosoft\LocationModule\Village\VillageModel; use Visiosoft\LocationModule\Village\VillageModel;
use Visiosoft\PackagesModule\Http\Controller\PackageFEController; 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 Visiosoft\PackagesModule\Package\PackageModel;
use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use Visiosoft\QrcontactModule\Qr\QrModel; use Visiosoft\QrcontactModule\Qr\QrModel;
use Visiosoft\StoreModule\Ad\AdModel; use Visiosoft\StoreModule\Ad\AdModel;
class AdvsController extends PublicController class AdvsController extends PublicController
{ {
private $userRepository; private $userRepository;
@ -405,10 +402,6 @@ class AdvsController extends PublicController
$options = $this->optionRepository->findAllBy('adv_id', $id); $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->event->dispatch(new viewAd($adv));//view ad
$this->template->set('meta_keywords', implode(',', explode(' ', $adv->name))); $this->template->set('meta_keywords', implode(',', explode(' ', $adv->name)));
@ -429,7 +422,7 @@ class AdvsController extends PublicController
} }
$this->template->set('meta_image', $coverPhoto); $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', return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options')); 'recommended_advs', 'categories', 'features', 'comments', 'qrSRC', 'options'));
} else { } else {
@ -763,7 +756,7 @@ class AdvsController extends PublicController
$auto_approved = $settings->value('visiosoft.module.advs::auto_approve'); $auto_approved = $settings->value('visiosoft.module.advs::auto_approve');
$default_published_time = $settings->value('visiosoft.module.advs::default_published_time'); $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"; $type = "approved";
} }
if ($type == "approved" and $auto_approved != true) { if ($type == "approved" and $auto_approved != true) {
@ -772,7 +765,7 @@ class AdvsController extends PublicController
if ($type == "approved") { if ($type == "approved") {
$this->adv_model->publish_at_Ads($id); $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')) { if ($this->adv_model->is_enabled('packages')) {
$packageModel = new PackageModel(); $packageModel = new PackageModel();
$published_time = $packageModel->reduceTimeLimit($ad->cat1); $published_time = $packageModel->reduceTimeLimit($ad->cat1);
@ -949,6 +942,12 @@ class AdvsController extends PublicController
return "false"; return "false";
} }
public function isActiveJson($slug)
{
$isActive = $this->isActive($slug);
return response()->json(array('isActive' => $isActive));
}
public function isActive($slug) public function isActive($slug)
{ {
$query = new AdvModel(); $query = new AdvModel();
@ -956,12 +955,6 @@ class AdvsController extends PublicController
return $query->is_enabled($slug); return $query->is_enabled($slug);
} }
public function isActiveJson($slug)
{
$isActive = $this->isActive($slug);
return response()->json(array('isActive' => $isActive));
}
public function checkParentCat($id) public function checkParentCat($id)
{ {
$option = new CategoryModel(); $option = new CategoryModel();