mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #689 from openclassify/dia
#1760 [core] Listing show parameters
This commit is contained in:
commit
2dad3118a1
@ -2,6 +2,9 @@
|
||||
"name": "visiosoft/advs-module",
|
||||
"type": "streams-addon",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Visiosoft\\AdvsModule\\": "src/"
|
||||
}
|
||||
|
||||
@ -115,8 +115,11 @@
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.result-text span:first-child {
|
||||
font-weight: 500;
|
||||
.result-text h1 {
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
max-width: 330px;
|
||||
}
|
||||
|
||||
.result-text span:last-child {
|
||||
@ -124,6 +127,68 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs > div {
|
||||
margin: 3px 16px 4px 0;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs div > span {
|
||||
color: #292d2e;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a {
|
||||
background-color: #eee;
|
||||
font-size: 12px;
|
||||
padding: 4px 7px;
|
||||
border-radius: 2px;
|
||||
text-decoration: none;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs div:last-child a {
|
||||
background-color: unset;
|
||||
font-size: 10px;
|
||||
padding: 4px 7px;
|
||||
text-decoration: none;
|
||||
color: #039;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs div:last-child a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a:hover {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a span {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a:hover span {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a:hover button {
|
||||
background-color: #CD7D22;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a button {
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
background-color: #EC9C4A;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.result-text .filter-tabs a svg {
|
||||
flex-shrink: 0;
|
||||
height: 6px;
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
a.sort-by-open-dropdown:hover {
|
||||
color: #8598AA !important;
|
||||
}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" width="512" height="512" x="0" y="0" viewBox="0 0 512.001 512.001" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><g xmlns="http://www.w3.org/2000/svg"><path d="m512.001 84.853-84.853-84.853-171.147 171.147-171.148-171.147-84.853 84.853 171.148 171.147-171.148 171.148 84.853 84.853 171.148-171.147 171.147 171.147 84.853-84.853-171.148-171.148z" fill="#ffffff" data-original="#000000" style="" class=""/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 604 B |
@ -248,6 +248,9 @@ return [
|
||||
'in_the_last_24_hours' => [
|
||||
'name' => 'In The Last 24 Hours'
|
||||
],
|
||||
'in_the_last_day' => [
|
||||
'name' => 'In The Last 24 Hours'
|
||||
],
|
||||
'in_the_last_week' => [
|
||||
'name' => 'In The Last Week'
|
||||
],
|
||||
@ -297,5 +300,10 @@ return [
|
||||
// New create page
|
||||
'options' => 'Options',
|
||||
|
||||
'free' => 'Free'
|
||||
'free' => 'Free',
|
||||
'ad_date' => 'Ad Date',
|
||||
'photo_video' => 'Photo, Video',
|
||||
'and_above' => 'and above',
|
||||
'and_below' => 'and below',
|
||||
'clear_all' => 'Clear All',
|
||||
];
|
||||
|
||||
@ -19,15 +19,45 @@
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="section recommended-classified">
|
||||
{% if catText %}
|
||||
<div class="result-text border py-2 px-3 mb-3 d-none d-sm-block">
|
||||
<p class="mb-0">
|
||||
<span>"{{ catText }}"</span>
|
||||
<span>{{ advs.total }} {{ trans('visiosoft.module.advs::field.ads')|lower }}</span>
|
||||
{{ trans('visiosoft.module.advs::field.were_found') }}
|
||||
</p>
|
||||
<div class="result-text border d-none d-sm-block">
|
||||
<div class="mx-3 py-2">
|
||||
{% if catText %}
|
||||
<h1 class="d-inline text-truncate">
|
||||
"{{ catText }}"
|
||||
</h1>
|
||||
{% endif %}
|
||||
<span>
|
||||
{{ advs.total }} {{ trans('visiosoft.module.advs::field.ads')|lower }}
|
||||
</span>
|
||||
{{ trans('visiosoft.module.advs::field.were_found') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if count(cFArray) %}
|
||||
<div class="mx-3 border-top py-2 filter-tabs d-flex flex-wrap">
|
||||
{% for customParam in cFArray %}
|
||||
<div class="d-flex align-items-center">
|
||||
<span class="mr-1">{{ customParam['name'] }}</span>
|
||||
{% for customValue in customParam['value'] %}
|
||||
<a href="{{ customValue['removalLink'] }}"
|
||||
class="text-truncate d-flex align-items-center mr-1">
|
||||
<span class="mr-2">{{ customValue['name'] }}</span>
|
||||
<button class="border-0 d-flex align-items-center justify-content-center">
|
||||
{{ img('visiosoft.module.advs::images/close.svg').data|raw }}
|
||||
</button>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="d-flex align-items-center">
|
||||
<a href="{{ app.request.pathinfo }}"
|
||||
class="text-truncate d-flex align-items-center mr-1">
|
||||
{{ trans('visiosoft.module.advs::field.clear_all') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="row breadcrumb list-header">
|
||||
|
||||
<div class="col-md-6 my-2 d-none d-sm-block">
|
||||
|
||||
@ -100,17 +100,19 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
if (!empty($param['user'])) {
|
||||
$query = $query->where('advs_advs.created_by_id', $param['user']);
|
||||
}
|
||||
if (!empty($param['min_price'])) {
|
||||
$num = $param['min_price'];
|
||||
$int = (int)$num;
|
||||
$column = "JSON_EXTRACT(foreign_currencies, '$." . $param['currency'] . "') >=" . $int;
|
||||
$query = $query->whereRaw($column);
|
||||
}
|
||||
if (!empty($param['max_price'])) {
|
||||
$num = $param['max_price'];
|
||||
$int = (int)$num;
|
||||
$column = "JSON_EXTRACT(foreign_currencies, '$." . $param['currency'] . "') <=" . $int;
|
||||
$query = $query->whereRaw($column);
|
||||
if (!empty($param['currency'])) {
|
||||
if (!empty($param['min_price'])) {
|
||||
$num = $param['min_price'];
|
||||
$int = (int)$num;
|
||||
$column = "JSON_EXTRACT(foreign_currencies, '$." . $param['currency'] . "') >=" . $int;
|
||||
$query = $query->whereRaw($column);
|
||||
}
|
||||
if (!empty($param['max_price'])) {
|
||||
$num = $param['max_price'];
|
||||
$int = (int)$num;
|
||||
$column = "JSON_EXTRACT(foreign_currencies, '$." . $param['currency'] . "') <=" . $int;
|
||||
$query = $query->whereRaw($column);
|
||||
}
|
||||
}
|
||||
if (!empty($param['date'])) {
|
||||
if ($param['date'] === 'day') {
|
||||
@ -147,22 +149,6 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
$query = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->filterSearch($customParameters, $param, $query);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($param['max_price'])) {
|
||||
$num = $param['max_price'];
|
||||
$int = (int)$num;
|
||||
$column = "JSON_EXTRACT(foreign_currencies, '$." . $param['currency'] . "') <=" . $int;
|
||||
$query = $query->whereRaw($column);
|
||||
}
|
||||
|
||||
if (!empty($param['max_price'])) {
|
||||
$num = $param['max_price'];
|
||||
$int = (int)$num;
|
||||
$column = "JSON_EXTRACT(foreign_currencies, '$." . $param['currency'] . "') <=" . $int;
|
||||
$query = $query->whereRaw($column);
|
||||
}
|
||||
|
||||
|
||||
// //UPDATE `default_advs_advs` SET `coor` = (PointFromText('POINT(41.085022 28.804754)')) WHERE `default_advs_advs`.`id` = 8
|
||||
// //SELECT * FROM `default_advs_advs` WHERE ST_DISTANCE(ST_GeomFromText('POINT(41.0709052 28.829627)'), coor) < 20
|
||||
|
||||
|
||||
@ -4,31 +4,25 @@ 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 Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
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\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;
|
||||
@ -36,11 +30,8 @@ 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\PackagesModule\Package\PackageModel;
|
||||
use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
|
||||
use Visiosoft\QrcontactModule\Qr\QrModel;
|
||||
use Visiosoft\StoreModule\Ad\AdModel;
|
||||
|
||||
class AdvsController extends PublicController
|
||||
{
|
||||
@ -123,8 +114,8 @@ class AdvsController extends PublicController
|
||||
|
||||
$this->requestHttp = $request;
|
||||
|
||||
parent::__construct();
|
||||
$this->optionRepository = $optionRepository;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
@ -153,10 +144,9 @@ class AdvsController extends PublicController
|
||||
}
|
||||
if (isset($param['cat'])) {
|
||||
unset($param['cat']);
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
route('adv_list_seo', [$categoryId->slug])
|
||||
));
|
||||
}
|
||||
} elseif (isset($param['cat']) && !empty($param['cat'])) { // Only Param
|
||||
@ -166,10 +156,9 @@ class AdvsController extends PublicController
|
||||
return redirect('/');
|
||||
}
|
||||
unset($param['cat']);
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
route('adv_list_seo', [$categoryId->slug])
|
||||
));
|
||||
}
|
||||
|
||||
@ -186,23 +175,21 @@ class AdvsController extends PublicController
|
||||
if (is_null($city) && $isOneCity) { // Param and no slug
|
||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
||||
unset($param['city']);
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||
array()
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug])
|
||||
));
|
||||
} elseif ($isOneCity) { // Param and slug
|
||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
||||
if ($city !== $cityId->slug) {
|
||||
unset($param['city']);
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||
array()
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug])
|
||||
));
|
||||
}
|
||||
} elseif ($city && $isMultipleCity) { // Slug and multiple param cities
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
@ -210,18 +197,16 @@ class AdvsController extends PublicController
|
||||
} elseif ($city) {
|
||||
if (isset($param['city'][0]) && empty($param['city'][0])) { // Slug and empty param
|
||||
unset($param['city']);
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
route('adv_list_seo', [$categoryId->slug])
|
||||
));
|
||||
} else { // Only slug
|
||||
$cityId = $this->cityRepository->findBy('slug', $city);
|
||||
if (!$cityId) {
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
route('adv_list_seo', [$categoryId->slug])
|
||||
), 301);
|
||||
}
|
||||
}
|
||||
@ -244,10 +229,9 @@ class AdvsController extends PublicController
|
||||
|
||||
if ($advs->currentPage() > $advs->lastPage()) {
|
||||
unset($param['page']);
|
||||
return redirect($this->fullLink(
|
||||
return redirect(fullLink(
|
||||
$param,
|
||||
\request()->url(),
|
||||
array()
|
||||
\request()->url()
|
||||
), 301);
|
||||
}
|
||||
|
||||
@ -289,6 +273,7 @@ class AdvsController extends PublicController
|
||||
$allCats = true;
|
||||
}
|
||||
|
||||
$cFArray = array();
|
||||
if ($isActiveCustomFields) {
|
||||
$returnvalues = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->index($mainCats, $subCats);
|
||||
$checkboxes = $returnvalues['checkboxes'];
|
||||
@ -298,6 +283,82 @@ class AdvsController extends PublicController
|
||||
$selectImage = $returnvalues['selectImage'];
|
||||
$ranges = $returnvalues['ranges'];
|
||||
$radio = $returnvalues['radio'];
|
||||
|
||||
$cFArray = app('Visiosoft\CustomfieldsModule\CustomField\Contract\CustomFieldRepositoryInterface')
|
||||
->getCFParamValues($param);
|
||||
}
|
||||
|
||||
$photoVideoParams = ['photo', 'video'];
|
||||
$photoExists = false;
|
||||
foreach ($photoVideoParams as $pV) {
|
||||
if (\request()->{$pV} === 'true') {
|
||||
$removalLink = array_filter($param, function ($singleParam) use ($pV) {
|
||||
return $singleParam !== $pV;
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
$removalLink = fullLink($removalLink, \request()->url());
|
||||
|
||||
if ($photoExists) {
|
||||
$cFArray['photoVideo']['value'][] = [
|
||||
'name' => trans('visiosoft.module.advs::field.ads_with_' . $pV . '.name'),
|
||||
'removalLink' => $removalLink
|
||||
];
|
||||
} else {
|
||||
$cFArray['photoVideo'] = [
|
||||
'name' => trans('visiosoft.module.advs::field.photo_video'),
|
||||
'value' => [
|
||||
[
|
||||
'name' => trans('visiosoft.module.advs::field.ads_with_' . $pV . '.name'),
|
||||
'removalLink' => $removalLink
|
||||
]
|
||||
]
|
||||
];
|
||||
$photoExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($dateParam = \request()->date) {
|
||||
$removalLink = array_filter($param, function ($singleParam) {
|
||||
return $singleParam !== 'date';
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
$removalLink = fullLink($removalLink, \request()->url());
|
||||
|
||||
$cFArray[] = [
|
||||
'name' => trans('visiosoft.module.advs::field.ad_date'),
|
||||
'value' => [
|
||||
[
|
||||
'name' => trans('visiosoft.module.advs::field.in_the_last_' . $dateParam . '.name'),
|
||||
'removalLink' => $removalLink
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$minPrice = \request()->min_price;
|
||||
$maxPrice = \request()->max_price;
|
||||
if ($minPrice || $maxPrice) {
|
||||
$removalLink = array_filter($param, function ($singleParam) {
|
||||
return $singleParam !== 'min_price' && $singleParam !== 'max_price' && $singleParam !== 'currency';
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
$removalLink = fullLink($removalLink, \request()->url());
|
||||
|
||||
if ($minPrice && $maxPrice) {
|
||||
$name = "$minPrice - $maxPrice";
|
||||
} elseif ($minPrice) {
|
||||
$name = "$minPrice " . trans('visiosoft.module.advs::field.and_above');
|
||||
} elseif ($maxPrice) {
|
||||
$name = "$maxPrice " . trans('visiosoft.module.advs::field.and_below');
|
||||
}
|
||||
|
||||
$cFArray[] = [
|
||||
'name' => trans('visiosoft.module.advs::field.price.name'),
|
||||
'value' => [
|
||||
[
|
||||
'name' => $name,
|
||||
'removalLink' => $removalLink
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
Cookie::queue(Cookie::make('last_search', $this->requestHttp->getRequestUri(), 84000));
|
||||
@ -335,16 +396,11 @@ class AdvsController extends PublicController
|
||||
|
||||
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'param',
|
||||
'user', 'featured_advs', 'viewType', 'topfields', 'selectDropdown', 'selectRange', 'selectImage', 'ranges',
|
||||
'seenList', 'radio', 'categoryId', 'cityId', 'allCats', 'catText');
|
||||
'seenList', 'radio', 'categoryId', 'cityId', 'allCats', 'catText', 'cFArray');
|
||||
|
||||
return $this->viewTypeBasedRedirect($viewType, $compact);
|
||||
}
|
||||
|
||||
public function fullLink($request, $url, $newParameters)
|
||||
{
|
||||
return $this->dispatch(new appendRequestURL($request, $url, $newParameters));
|
||||
}
|
||||
|
||||
public function viewTypeBasedRedirect($viewType, $compact)
|
||||
{
|
||||
if (!$viewType) {
|
||||
|
||||
8
addons/default/visiosoft/advs-module/src/helpers.php
Normal file
8
addons/default/visiosoft/advs-module/src/helpers.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Bus\Dispatcher;
|
||||
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
||||
|
||||
function fullLink($request, $url, $newParameters = array()) {
|
||||
return app(Dispatcher::class)->dispatch(new appendRequestURL($request, $url, $newParameters));
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user