@php
$user = filament()->auth()->user();
$items = filament()->getUserMenuItems();
$profileItem = $items['profile'] ?? $items['account'] ?? null;
$profileItemUrl = $profileItem?->getUrl();
$profilePage = filament()->getProfilePage();
$hasProfileItem = filament()->hasProfile() || filled($profileItemUrl);
$logoutItem = $items['logout'] ?? null;
$items = \Illuminate\Support\Arr::except($items, ['account', 'logout', 'profile']);
$itemsMensajes = collect($items)->filter(fn ($item) => !str_contains((string) $item->getUrl(), '/locale/'));
$itemsLocale = collect($items)->filter(fn ($item) => str_contains((string) $item->getUrl(), '/locale/'));
@endphp
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::USER_MENU_BEFORE) }}
@php
$unreadMessagesCount = auth()->check()
? \App\Models\DirectMessage::where('receiver_id', auth()->id())->whereNull('read_at')->count()
: 0;
@endphp
@if ($profileItem?->isVisible() ?? true)
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::USER_MENU_PROFILE_BEFORE) }}
@if ($hasProfileItem)
{{ $profileItem?->getLabel() ?? ($profilePage ? $profilePage::getLabel() : null) ?? filament()->getUserName($user) }}
@else
{{ $profileItem?->getLabel() ?? filament()->getUserName($user) }}
@endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::USER_MENU_PROFILE_AFTER) }}
@endif
@if (filament()->hasDarkMode() && (! filament()->hasDarkModeForced()))
@endif
{{-- Grupo 1: Mensajes --}}
@if ($itemsMensajes->isNotEmpty())
@foreach ($itemsMensajes as $key => $item)
@php $itemPostAction = $item->getPostAction(); @endphp
{{ $item->getLabel() }}
@endforeach
@endif
{{-- Grupo 2: Idioma --}}
@if ($itemsLocale->isNotEmpty())
{{ __('Idioma') }}
@foreach ($itemsLocale as $key => $item)
@php $itemPostAction = $item->getPostAction(); @endphp
{{ $item->getLabel() }}
@endforeach
@endif
{{ $logoutItem?->getLabel() ?? __('filament-panels::layout.actions.logout.label') }}
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::USER_MENU_AFTER) }}