@if($employees->isEmpty())

No Employees Record to Show

@else @php $emp1 = $employees->get(0); $emp2 = $employees->get(1); $emp3 = $employees->get(2); $placeholderImg = asset('assets/img/placeholder-img-2.png'); $leaderboardImageUrl = function($emp) use ($placeholderImg) { if (!$emp) return $placeholderImg; $img = $emp->image ?? null; if ($img === null || $img === '' || trim((string)$img) === '') return $placeholderImg; $path = trim((string)$img); if (preg_match('#^https?://#i', $path)) return $path; $path = ltrim($path, '/'); return $path ? asset($path) : $placeholderImg; }; $tooltipLine = function($prizes, $pos) { if (!isset($prizes) || !is_object($prizes)) return 'Prize: Not mentioned'; $col = $prizes->get($pos) ?? $prizes->get((string)$pos); if (!$col || !$col->isNotEmpty()) return 'Prize: Not mentioned'; $p = $col->first(); $posLabel = $pos === 1 ? '1st' : ($pos === 2 ? '2nd' : '3rd'); $t = $posLabel . ' Place Prize' . "\n" . '─────────────────' . "\n" . ($p->title ?? 'Not mentioned'); if (!empty($p->prize_type)) { $types = ['money' => 'Cash Prize', 'gift' => 'Gift', 'recognition' => 'Recognition', 'bonus' => 'Bonus', 'voucher' => 'Voucher', 'trophy' => 'Trophy']; $t .= "\n" . 'Type: ' . ($types[$p->prize_type] ?? ucfirst($p->prize_type)); } if (isset($p->prize_amount) && $p->prize_amount !== null && $p->prize_amount !== '') { $t .= "\n" . 'Amount: ' . ($p->currency ?? '') . ' ' . number_format((float)$p->prize_amount, 2); } if (!empty($p->description)) { $t .= "\n" . '─────────────────' . "\n" . $p->description; } return $t; }; $tip1 = $tooltipLine($prizes ?? null, 1); $tip2 = $tooltipLine($prizes ?? null, 2); $tip3 = $tooltipLine($prizes ?? null, 3); $tip1Html = str_replace(["\r","\n"], '
', e($tip1)); $tip2Html = str_replace(["\r","\n"], '
', e($tip2)); $tip3Html = str_replace(["\r","\n"], '
', e($tip3)); @endphp

Top 3 Employees

Rank changes with respect to points.

2
{{ $emp2 ? ($emp2->category ?: '—') : '—' }}
{{ $emp2 ? (isset($emp2->earned_points) ? $emp2->earned_points . ' pts' : '—') : '—' }}
{{ $emp2 ? ($emp2->employee ?? '—') : '—' }}
1
{{ $emp1 ? ($emp1->category ?: '—') : '—' }}
{{ $emp1 ? (isset($emp1->earned_points) ? $emp1->earned_points . ' pts' : '—') : '—' }}
{{ $emp1 ? ($emp1->employee ?? '—') : '—' }}
3
{{ $emp3 ? ($emp3->category ?: '—') : '—' }}
{{ $emp3 ? (isset($emp3->earned_points) ? $emp3->earned_points . ' pts' : '—') : '—' }}
{{ $emp3 ? ($emp3->employee ?? '—') : '—' }}
@foreach($employees as $employee) @endforeach
Rank Employee Category Points
{{ $loop->iteration }}
{{ $employee->employee ?? '—' }} {{ $employee->category ?? '—' }} {{ $employee->earned_points ?? 0 }} pts
@endif