mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#3390 Show selected cities in listing
This commit is contained in:
parent
7868661eba
commit
0f9d2fa6ed
@ -49,7 +49,7 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="d-flex align-items-center">
|
||||
<a href="{{ app.request.pathinfo }}"
|
||||
<a href="{{ url_route('adv_list_seo', [category.slug]) }}"
|
||||
class="text-truncate d-flex align-items-center mr-1">
|
||||
{{ trans('visiosoft.module.advs::field.clear_all') }}
|
||||
</a>
|
||||
|
||||
@ -360,6 +360,38 @@ class AdvsController extends PublicController
|
||||
];
|
||||
}
|
||||
|
||||
if (($cities = \request()->city) && $cities = $cities[0]) {
|
||||
$citiesIDs = $cityId ? [$cityId->id] : explode(',', $cities);
|
||||
$cities = $this->cityRepository->findAllByIDs($citiesIDs);
|
||||
|
||||
$value = array();
|
||||
foreach ($cities as $city) {
|
||||
$removalLink = array_filter($param, function ($singleParam) {
|
||||
return $singleParam !== 'city';
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
$removalLink = fullLink(
|
||||
$removalLink,
|
||||
\request()->url(),
|
||||
['city[]' => implode(
|
||||
',',
|
||||
array_filter($citiesIDs, function ($singleCity) use ($city) {
|
||||
return $singleCity != $city->id;
|
||||
})
|
||||
)]
|
||||
);
|
||||
|
||||
$value[] = [
|
||||
'name' => $city->name,
|
||||
'removalLink' => $removalLink
|
||||
];
|
||||
}
|
||||
|
||||
$cFArray[] = [
|
||||
'name' => trans('visiosoft.module.advs::field.address'),
|
||||
'value' => $value
|
||||
];
|
||||
}
|
||||
|
||||
Cookie::queue(Cookie::make('last_search', $this->requestHttp->getRequestUri(), 84000));
|
||||
|
||||
$viewType = $this->requestHttp->cookie('viewType');
|
||||
|
||||
@ -50,4 +50,10 @@ class CityRepository extends EntryRepository implements CityRepositoryInterface
|
||||
->orderBy('order','ASC')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function findAllByIDs($citiesIDs) {
|
||||
return $this->newQuery()
|
||||
->whereIn('location_cities.id', $citiesIDs)
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,4 +7,6 @@ interface CityRepositoryInterface extends EntryRepositoryInterface
|
||||
public function getByEntryIDsAndOrderByTransCol($entryIDs, $orderBy, $direction = 'asc');
|
||||
|
||||
public function getCitiesByCountryId($country_id);
|
||||
|
||||
public function findAllByIDs($citiesIDs);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user