Refactor: user in dashboard topbar and fix binding
- Centralized user data retrieval in `dashboard-topbar.blade.php` by introducing `$user` variable. - Enhanced topbar dropdown with user details (name, email) and improved styling. - Fixed Livewire binding in roles-and-apps view by replacing `model` with `wire:model`.
This commit is contained in:
parent
8079b878a1
commit
ec26c0a205
@ -1,7 +1,9 @@
|
|||||||
@php use App\Enums\DefaultUserRole; @endphp
|
@php use App\Enums\DefaultUserRole;
|
||||||
|
$user = auth()->user();
|
||||||
|
@endphp
|
||||||
<div class="w-full py-4 px-10 border-b border-gray-200 flex justify-center">
|
<div class="w-full py-4 px-10 border-b border-gray-200 flex justify-center">
|
||||||
<div class="flex-1 py-2">
|
<div class="flex-1 py-2">
|
||||||
@if(auth()->user()?->hasRole(DefaultUserRole::Admin->value))
|
@if($user?->hasRole(DefaultUserRole::Admin->value))
|
||||||
<p class="text-xl font-medium">Admin Panel</p>
|
<p class="text-xl font-medium">Admin Panel</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@ -14,10 +16,16 @@
|
|||||||
<x-slot:trigger>
|
<x-slot:trigger>
|
||||||
<div
|
<div
|
||||||
class="rounded-full w-12 h-12 bg-blue-200 flex items-center justify-center font-semibold text-blue-800 cursor-pointer">
|
class="rounded-full w-12 h-12 bg-blue-200 flex items-center justify-center font-semibold text-blue-800 cursor-pointer">
|
||||||
{{ auth()->user()->initials() }}
|
{{ $user->initials() }}
|
||||||
</div>
|
</div>
|
||||||
</x-slot:trigger>
|
</x-slot:trigger>
|
||||||
|
<x-mary-menu-item>
|
||||||
|
<div class="">
|
||||||
|
<p class="font-semibold font-lg ">{{$user->name}}</p>
|
||||||
|
<p class="text-sm text-base-content/50 ">{{$user->email}}</p>
|
||||||
|
</div>
|
||||||
|
</x-mary-menu-item>
|
||||||
|
<div class="h-[0.5px] bg-gray-100"></div>
|
||||||
<form method="POST" action="{{ route('logout') }}">
|
<form method="POST" action="{{ route('logout') }}">
|
||||||
@csrf
|
@csrf
|
||||||
<x-mary-menu-item
|
<x-mary-menu-item
|
||||||
|
|||||||
@ -174,7 +174,7 @@ class="btn-sm btn-circle btn-error btn-soft"
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<x-shared.choices
|
<x-shared.choices
|
||||||
model="form.appIds"
|
wire:model="form.appIds"
|
||||||
:options="$appsSearchable"
|
:options="$appsSearchable"
|
||||||
search-function="searchApps"
|
search-function="searchApps"
|
||||||
select-all-action="selectAllApps"
|
select-all-action="selectAllApps"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user