@php $blocks = [16, 32, 48, 64, 80]; $tipeIntern = request()->get('tipe_intern', 'all'); @endphp @php $aktif = $reportit ->where('lastname', '!=', 'IN') ->where('isactive', 1) ->filter(function ($item) { return !isset($item->source) || $item->source != 'magang'; }) ->sortBy(fn ($item) => mb_strtolower($item->name ?? '')) ->values(); $nonaktif = $reportit->filter(function ($item) { return $item->isactive == 0 && $item->total_poin > 0 && (!isset($item->source) || $item->source != 'magang'); }) ->sortBy(fn ($item) => mb_strtolower($item->name ?? '')) ->values(); $intern = $reportit->filter(function ($item) { return $item->lastname == 'IN' && $item->isactive == 1 && (!isset($item->source) || $item->source != 'magang'); }) ->sortBy(fn ($item) => mb_strtolower($item->name ?? '')) ->values(); $internGrouped = $intern->groupBy('mentor_name'); // Filter untuk Intern Univ (source = 'magang') $internUniv = $reportit->filter(function ($item) { return isset($item->source) && $item->source == 'magang' && $item->isactive == 1; }) ->sortBy(fn ($item) => mb_strtolower($item->name ?? '')) ->values(); $internUnivGrouped = $internUniv->groupBy('mentor_name'); @endphp
@if ($reportit->isEmpty())
Maaf - Tidak ada data!
@else
@if (($tipeIntern == 'all' || $tipeIntern == 'intern_it') && $aktif->count())
Intern IT
@foreach ($aktif->chunk(ceil($aktif->count() / 2)) as $chunk)
@foreach ($chunk as $r) @php $isDanger = !isset($r->has_start_today) || (int) $r->has_start_today !== 1; @endphp
@if ($isDanger)
{{ $r->name }}
@else
{{ $r->name }}
@endif
@foreach ($blocks as $b) @php $fill = 0; if ($r->total_poin >= $b) { $fill = 100; } elseif ($r->total_poin >= $b - 10) { $fill = (($r->total_poin - ($b - 10)) / 10) * 100; } $fillShown = $isDanger && $fill == 0 ? 2 : $fill; @endphp
@endforeach
@if ($isDanger) {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @else {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @endif
@endforeach
@endforeach
@endif @if (($tipeIntern == 'all' || $tipeIntern == 'internship') && $intern->count())
Internship
@foreach ($internGrouped as $mentorName => $internList) @php $borderColors = [ '#e57373', '#ffb74d', '#ffd54f', '#81c784', '#64b5f6', '#ba68c8', '#f06292', '#4db6ac', ]; $borderColor = $borderColors[$loop->index % count($borderColors)]; @endphp
Mentor: {{ $mentorName ?? 'Belum Ada Mentor' }} {{ $internList->count() }} orang
@foreach ($internList->chunk(ceil($internList->count() / 2)) as $chunk)
@foreach ($chunk as $r) @php $isDanger = !isset($r->has_start_today) || (int) $r->has_start_today !== 1; @endphp
@if ($isDanger)
{{ $r->name }}
@else
{{ $r->name }}
@endif
@foreach ($blocks as $b) @php $fill = 0; if ($r->total_poin >= $b) { $fill = 100; } elseif ($r->total_poin >= $b - 10) { $fill = (($r->total_poin - ($b - 10)) / 10) * 100; } $fillShown = $isDanger && $fill == 0 ? 2 : $fill; @endphp
@endforeach
@if ($isDanger) {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @else {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @endif
@endforeach
@endforeach @if (!$loop->last)
@endif @endforeach
@endif @if (($tipeIntern == 'all' || $tipeIntern == 'intern_univ') && $internUniv->count())
Internship Universitas
@foreach ($internUnivGrouped as $mentorName => $internUnivList) @php $borderColors = [ '#e57373', '#ffb74d', '#ffd54f', '#81c784', '#64b5f6', '#ba68c8', '#f06292', '#4db6ac', ]; $borderColor = $borderColors[$loop->index % count($borderColors)]; @endphp {{--
Mentor: {{ $mentorName ?? 'Belum Ada Mentor' }} {{ $internUnivList->count() }} orang
--}} @foreach ($internUnivList->chunk(ceil($internUnivList->count() / 2)) as $chunk)
@foreach ($chunk as $r) @php $isDanger = !isset($r->has_start_today) || (int) $r->has_start_today !== 1; @endphp
@if ($isDanger)
{{ $r->name }}
@else
{{ $r->name }}
@endif
@foreach ($blocks as $b) @php $fill = 0; if ($r->total_poin >= $b) { $fill = 100; } elseif ($r->total_poin >= $b - 10) { $fill = (($r->total_poin - ($b - 10)) / 10) * 100; } $fillShown = $isDanger && $fill == 0 ? 2 : $fill; @endphp
@endforeach
@if ($isDanger) {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @else {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @endif
@endforeach
@endforeach @if (!$loop->last)
@endif @endforeach
@endif {{-- ========== NON AKTIF (ALWAYS SHOW) ========== --}} @if ($nonaktif->count())
Non Aktif
@foreach ($nonaktif->chunk(ceil($nonaktif->count() / 2)) as $chunk)
@foreach ($chunk as $r) @php $isDanger = !isset($r->has_start_today) || (int) $r->has_start_today !== 1; @endphp
@if ($isDanger)
{{ $r->name }}
@else
{{ $r->name }}
@endif
@foreach ($blocks as $b) @php $fill = 0; if ($r->total_poin >= $b) { $fill = 100; } elseif ($r->total_poin >= $b - 10) { $fill = (($r->total_poin - ($b - 10)) / 10) * 100; } $fillShown = $isDanger && $fill == 0 ? 2 : $fill; @endphp
@endforeach
@if ($isDanger) {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @else {{ number_format(($r->total_poin / 80) * 100, 1) }}% - {{ $r->total_poin }} @endif
@endforeach
@endforeach
@endif
@endif