mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-13 23:56:47 +00:00
🌐 Add 'all-meetups' route and update sidebar to include global meetup view
- Introduced `all-meetups` route (`meetups.index-all`) for accessing meetups globally. - Updated sidebar with a new navigation item for global meetups, including icon and dynamic badge count. - Enhanced backend logic to handle country-specific and global meetup filtering based on the current route.
This commit is contained in:
@@ -26,7 +26,21 @@
|
||||
:current="request()->routeIs('meetups.index')"
|
||||
wire:navigate
|
||||
badge="{{ \App\Models\Meetup::query()->whereHas('city.country', fn($query) => $query->where('countries.code', request()->route('country')))->count() }}">
|
||||
{{ __('Meetups') }}
|
||||
<div class="flex items-center space-x-2">
|
||||
<span>{{ __('Meetups') }}</span>
|
||||
<img alt="{{ request()->route('country') }}"
|
||||
src="{{ asset('vendor/blade-flags/country-'.request()->route('country').'.svg') }}"
|
||||
width="24" height="12"/>
|
||||
</div>
|
||||
</flux:navlist.item>
|
||||
<flux:navlist.item icon="user-group" :href="route_with_country('meetups.index-all')"
|
||||
:current="request()->routeIs('meetups.index-all')"
|
||||
wire:navigate
|
||||
badge="{{ \App\Models\Meetup::query()->count() }}">
|
||||
<div class="flex items-center space-x-2">
|
||||
<span>{{ __('Alle Meetups') }}</span>
|
||||
<flux:icon name="globe-europe-africa"/>
|
||||
</div>
|
||||
</flux:navlist.item>
|
||||
<flux:navlist.item icon="map" :href="route_with_country('meetups.map')"
|
||||
:current="request()->routeIs('meetups.map')"
|
||||
|
||||
@@ -14,9 +14,11 @@ class extends Component {
|
||||
|
||||
public $country = 'de';
|
||||
public $search = '';
|
||||
public string $currentRouteName = '';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->currentRouteName = request()->route()->getName();
|
||||
$this->country = request()->route('country', config('app.domain_country'));
|
||||
}
|
||||
|
||||
@@ -34,7 +36,9 @@ class extends Component {
|
||||
})
|
||||
->selectRaw('meetups.*, MIN(meetup_events.start) as next_event_start')
|
||||
->groupBy('meetups.id')
|
||||
->whereHas('city.country', fn($query) => $query->where('countries.code', $this->country))
|
||||
->when($this->currentRouteName === 'meetups.index', fn($query) =>
|
||||
$query->whereHas('city.country', fn($query) => $query->where('countries.code', $this->country))
|
||||
)
|
||||
->when($this->search, fn($query)
|
||||
=> $query->where('meetups.name', 'ilike', '%'.$this->search.'%'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user