@extends('template.master') @section('content')
@php $colors = ['primary', 'secondary', 'danger', 'warning']; @endphp @foreach ($equipmentStats as $index => $stat)
Total Unit {{ $stat->type_name }}

{{ $stat->total_equipment }}

Jumlah Unit {{ $stat->type_name }}.
@endforeach
@foreach ($sites as $site)
@foreach ($site->shifts() as $shift)
Shift - {{ $shift->name }}
@foreach ($site->units->sortBy(function ($item) { if (Str::startsWith($item->unit_code, 'L-')) { return 1; } if (Str::startsWith($item->unit_code, 'E-')) { return 2; } if (Str::startsWith($item->unit_code, 'DT-')) { return 3; } if (Str::startsWith($item->unit_code, 'S-')) { return 4; } return 5; }) as $item) @php $status = $groupedBySiteShift[$item->id . '_' . $shift->id]->status_checklist ?? 'Belum Checklist'; $map = [ 'Baik' => ['color' => 'info', 'label' => 'Baik'], 'Cukup' => ['color' => 'success', 'label' => 'Cukup'], 'Rusak' => ['color' => 'danger', 'label' => 'Rusak'], 'Rusak Fatal' => ['color' => 'black', 'label' => 'Rusak Fatal'], 'Belum Checklist' => ['color' => 'primary', 'label' => 'Belum Checklist'], 'N/A' => ['color' => 'secondary', 'label' => 'N/A'], ]; $prefix = strtolower(strtok($item->unit_code, '-')); if (strtolower($item->unit_code) === 'water truck') { $prefix = 'wm'; } $color = $map[$status]['color']; $label = $map[$status]['label']; $iconPath = asset("images/icon-unit/{$prefix}-{$color}.png"); @endphp
{{ $item->unit_code ?? 'Unknown' }}
{{ $item->unit_code }}
{{ $label }}
@endforeach
@endforeach
@endforeach
@endsection @push('extraJS') @endpush