diff --git a/app/Support/UserProfileMenu.php b/app/Support/UserProfileMenu.php index 2806cdb..9461caf 100644 --- a/app/Support/UserProfileMenu.php +++ b/app/Support/UserProfileMenu.php @@ -43,9 +43,8 @@ class UserProfileMenu ]; } - - if (Route::has((string) config("billing.wallet_balance_route", "wallet.balance"))) { - $items[] = ["type" => "wallet"]; + if (Route::has((string) config('billing.wallet_balance_route', 'wallet.balance'))) { + $items[] = ['type' => 'wallet']; } if (self::userIsAdmin($user)) { diff --git a/resources/views/components/app-layout.blade.php b/resources/views/components/app-layout.blade.php index 018c1cc..d93ea6e 100644 --- a/resources/views/components/app-layout.blade.php +++ b/resources/views/components/app-layout.blade.php @@ -27,6 +27,33 @@ + @auth + @php + $navUser = auth()->user(); + $navInitials = collect(explode(' ', trim((string) $navUser?->name))) + ->filter()->take(2) + ->map(fn ($part) => strtoupper(substr($part, 0, 1))) + ->implode(''); + $navAvatarUrl = $navUser && method_exists($navUser, 'avatarUrl') + ? $navUser->avatarUrl() + : ($navUser?->avatar_url ?? null); + @endphp + @include('partials.mobile-bottom-nav', [ + 'homeUrl' => route('pos.dashboard'), + 'homeActive' => request()->routeIs('pos.dashboard'), + 'searchUrl' => route('pos.products.index'), + 'searchActive' => request()->routeIs('pos.products.*'), + 'notificationsUrl' => route('notifications.index'), + 'notificationsActive' => request()->routeIs('notifications.*'), + 'unreadUrl' => route('notifications.unread'), + 'profileActive' => false, + 'profileName' => $navUser?->name ?? '', + 'profileSubtitle' => $navUser?->email ?? '', + 'profileMenuItems' => \App\Support\UserProfileMenu::items($navUser), + 'avatarUrl' => $navAvatarUrl, + 'initials' => $navInitials !== '' ? $navInitials : 'U', + ]) + @endauth @include('partials.afia') @include('partials.confirm-prompt') diff --git a/resources/views/partials/mobile-bottom-nav.blade.php b/resources/views/partials/mobile-bottom-nav.blade.php new file mode 100644 index 0000000..499483f --- /dev/null +++ b/resources/views/partials/mobile-bottom-nav.blade.php @@ -0,0 +1,129 @@ +@php + $showSearch = isset($searchUrl) && $searchUrl !== null && $searchUrl !== '#'; + $gridCols = match (true) { + ! empty($centerCompose) => $showSearch ? 'grid-cols-5' : 'grid-cols-4', + default => $showSearch ? 'grid-cols-4' : 'grid-cols-3', + }; + $avatarUrl = $avatarUrl ?? null; + $initials = $initials ?? 'U'; + $notificationsUrl = $notificationsUrl ?? '#'; + $unreadUrl = $unreadUrl ?? null; + $profileUrl = $profileUrl ?? '#'; + $profileName = trim((string) ($profileName ?? '')); + $profileSubtitle = trim((string) ($profileSubtitle ?? '')); + $profileMenuItems = $profileMenuItems ?? []; + if ($profileMenuItems === [] && $profileUrl !== '#') { + $profileMenuItems = [['type' => 'link', 'label' => 'Profile', 'href' => $profileUrl]]; + } + $navActive = fn (bool $active) => $active ? 'text-indigo-600' : 'text-slate-600'; +@endphp +
+ + + {{-- Profile menu bottom sheet (matches desktop avatar dropdown) --}} +
+
+ +
+
+ +
+ + @if ($profileName !== '' || $profileSubtitle !== '') +
+ @if ($avatarUrl) + + @else + {{ $initials }} + @endif +
+ @if ($profileName !== '') +

{{ $profileName }}

+ @endif + @if ($profileSubtitle !== '') +

{{ $profileSubtitle }}

+ @endif +
+
+ @endif + + @include('partials.user-profile-menu', [ + 'items' => $profileMenuItems, + 'variant' => 'sheet', + 'onNavigate' => 'profileOpen = false', + ]) +
+
+
diff --git a/resources/views/partials/mobile-topbar-title.blade.php b/resources/views/partials/mobile-topbar-title.blade.php new file mode 100644 index 0000000..ff10b4a --- /dev/null +++ b/resources/views/partials/mobile-topbar-title.blade.php @@ -0,0 +1,6 @@ +@php + $title = $mobileTopbarTitle ?? 'Ladill'; +@endphp +
+

{{ $title }}

+
diff --git a/resources/views/partials/topbar-account-switcher.blade.php b/resources/views/partials/topbar-account-switcher.blade.php new file mode 100644 index 0000000..dfcaf02 --- /dev/null +++ b/resources/views/partials/topbar-account-switcher.blade.php @@ -0,0 +1,24 @@ +{{-- Account switcher (desktop) — only when the user belongs to more than one account. --}} +@if (isset($accessibleAccounts) && $accessibleAccounts->count() > 1) + +@endif diff --git a/resources/views/partials/topbar-desktop-widgets.blade.php b/resources/views/partials/topbar-desktop-widgets.blade.php index f6d950c..5e00826 100644 --- a/resources/views/partials/topbar-desktop-widgets.blade.php +++ b/resources/views/partials/topbar-desktop-widgets.blade.php @@ -1,6 +1,7 @@ {{-- - Standard desktop top-right widgets: - AI → notifications → launcher → divider → avatar dropdown. + Top-right header widgets: + Mobile — Afia + launcher only (profile/notifications live in bottom nav). + Desktop — Afia → notifications → launcher → divider → avatar dropdown. --}} @php $topbarUser = $user ?? auth()->user(); @@ -22,7 +23,7 @@ -
+