fix: display correct resolved user department in sidebar profile card
This commit is contained in:
@@ -58,12 +58,23 @@
|
|||||||
: (Auth::check() && Auth::user()->name
|
: (Auth::check() && Auth::user()->name
|
||||||
? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode(Auth::user()->name) . '&backgroundColor=e2e8f0'
|
? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode(Auth::user()->name) . '&backgroundColor=e2e8f0'
|
||||||
: asset('images/avatar.png'));
|
: asset('images/avatar.png'));
|
||||||
|
|
||||||
|
$deptName = 'Product Team';
|
||||||
|
if (Auth::check()) {
|
||||||
|
$deptVal = Auth::user()->departments;
|
||||||
|
if (is_numeric($deptVal)) {
|
||||||
|
$idx = ((int)$deptVal) - 1;
|
||||||
|
$deptName = config('constants.DEPARTMENTS')[$idx] ?? 'Team';
|
||||||
|
} else {
|
||||||
|
$deptName = $deptVal ?? 'Team';
|
||||||
|
}
|
||||||
|
}
|
||||||
@endphp
|
@endphp
|
||||||
<img src="{{ $avatarUrl }}" alt="Avatar" class="w-full h-full object-cover">
|
<img src="{{ $avatarUrl }}" alt="Avatar" class="w-full h-full object-cover">
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<span class="text-[14px] font-bold text-[#1e293b] leading-tight truncate max-w-[130px]">{{ Auth::check() ? (Auth::user()->name ?? 'Nguyễn Minh Anh') : 'Nguyễn Minh Anh' }}</span>
|
<span class="text-[14px] font-bold text-[#1e293b] leading-tight truncate max-w-[130px]">{{ Auth::check() ? (Auth::user()->name ?? 'Nguyễn Minh Anh') : 'Nguyễn Minh Anh' }}</span>
|
||||||
<span class="text-[12px] text-gray-500 font-medium">{{ Auth::check() ? (Auth::user()->role == config('constants.ROLE_ADMIN') ? 'Administrator' : 'Product Team') : 'Product Team' }}</span>
|
<span class="text-[12px] text-gray-500 font-medium truncate max-w-[130px]" title="{{ $deptName }}">{{ $deptName }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<svg class="w-4 h-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" /></svg>
|
<svg class="w-4 h-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" /></svg>
|
||||||
|
|||||||
Reference in New Issue
Block a user