Files
thankcard-system/resources/views/user/partials/ranking_list.blade.php
T
2026-07-08 15:29:13 +07:00

56 lines
2.4 KiB
PHP

<div class="flex-1 flex flex-col justify-between min-h-[340px]">
@if(count($rankers) > 0)
<div class="flex flex-col">
@foreach($rankers as $item)
@php
$deptVal = $item->departments;
if (is_numeric($deptVal)) {
$idx = ((int)$deptVal) - 1;
$teamName = config('constants.DEPARTMENTS')[$idx] ?? 'Team';
} else {
$teamName = $deptVal ?? 'Team';
}
@endphp
<x-ranking-item
rank="{{ $item->rank }}"
name="{{ $item->name }}"
team="{{ $teamName }}"
avatar="{{ $item->avatar ?? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode($item->name) . '&backgroundColor=bfdbfe' }}"
score="{{ $item->score }}"
unit="thẻ"
:isCurrent="$item->msnv == Auth::user()->msnv"
/>
@endforeach
</div>
@else
<div class="flex-1 flex flex-col justify-center items-center py-6 text-center">
<span class="text-[36px]">🏆</span>
<p class="text-gray-400 font-medium text-[13px] mt-2">Chưa xếp hạng cho tháng này</p>
</div>
@endif
@if($currentUserRankItem)
<div class="mt-auto">
<div class="my-3 border-t border-dashed border-gray-100 mx-2"></div>
@php
$currDeptVal = $currentUserRankItem->departments;
if (is_numeric($currDeptVal)) {
$idx = ((int)$currDeptVal) - 1;
$currTeamName = config('constants.DEPARTMENTS')[$idx] ?? 'Team';
} else {
$currTeamName = $currDeptVal ?? 'Team';
}
@endphp
<x-ranking-item
rank="{{ $currentUserRankItem->rank > 0 ? $currentUserRankItem->rank : '-' }}"
name="{{ $currentUserRankItem->name }}"
team="{{ $currTeamName }}"
avatar="{{ $currentUserRankItem->avatar ?? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode($currentUserRankItem->name) . '&backgroundColor=bfdbfe' }}"
score="{{ $currentUserRankItem->score }}"
unit="thẻ"
:isCurrent="true"
/>
</div>
@endif
</div>