@extends('layouts.app') @section('title', 'Pilih Equipment - Pre-Start Check') @section('content')

Pilih Equipment untuk Scan

Pilih kendaraan yang ingin melakukan pre-start check

@if(session('error'))
{{ session('error') }}
@endif @if($equipments->count() > 0)
@foreach($equipments as $equipment) @php $statusStyles = [ 'active' => 'background-color: #007bff; color: white;', 'standby' => 'background-color: #00e335; color: white;', 'damaged' => 'background-color: #ff0000; color: white;', 'default' => 'background-color: #6b7280; color: white;', ]; $rawStatus = $equipment->status ?? 'default'; $statusKey = strtolower(str_replace([' ', '_'], '', $rawStatus)); if (!array_key_exists($statusKey, $statusStyles)) { if (str_contains($statusKey, 'aktif') || str_contains($statusKey, 'active')) $statusKey = 'active'; elseif (str_contains($statusKey, 'stand') || str_contains($statusKey, 'ready')) $statusKey = 'standby'; elseif (str_contains($statusKey, 'rusak') || str_contains($statusKey, 'damage')) $statusKey = 'damaged'; else $statusKey = 'default'; } $statusStyle = $statusStyles[$statusKey]; $statusText = $rawStatus; if ($statusKey === 'standby') $statusText = 'Stand By'; if ($statusKey === 'active') $statusText = 'Active'; if ($statusKey === 'damaged') $statusText = 'Damaged'; @endphp
{{ $equipment->code }}
{{ $equipment->name }}
Lokasi: {{ $equipment->location?->name ?? 'Area tidak tersedia' }}
{{ $statusText }}
Mulai Check >
@endforeach
@else

Tidak ada equipment yang tersedia untuk di-scan

Kembali ke Dashboard
@endif
@endsection