<!DOCTYPE html>
<html lang="id">

<head>
    <meta charset="UTF-8">
    <title>Cetak Laporan Service #{{ $data->id }}</title>
    <link rel="stylesheet" href="{{ asset('css/style-print.css') }}">
</head>

<body onload="window.print()">
    <table style="width: 100%; border: none; margin-bottom: 20px;">
        <tr>
            <td style="border: none; text-align: center; vertical-align: middle;">
                <div style="display: flex; align-items: center; justify-content: center; gap: 15px;">

                    @php
                    $lokasiFix = strtolower($data->lokasi ?? '');
                    @endphp

                    @if(str_contains($lokasiFix, 'retail'))
                    <img src="{{ asset('img/simba-toko.jpg') }}" style="width: 100px;">
                    @elseif(str_contains($lokasiFix, 'ruko'))
                    {{-- Di sini Mas ganti keywordnya jadi 'ruko' --}}
                    <img src="{{ asset('img/sju.png') }}" style="width: 80px;">
                    @else
                    <img src="{{ asset('img/sju.png') }}" style="width: 80px;">
                    @endif

                    <div style="text-align: left;">
                        <h3 style="margin: 0; color: #000080;">PT. SIMBA JAYA UTAMA</h3>
                        <p style="margin: 0; font-weight: bold;">
                            Laporan Perbaikan - {{ ucwords($data->lokasi ?? 'Kantor') }}
                        </p>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <hr style="border: 1px solid black; margin-top: -10px;">

    <p style="text-align: center;" class="judul">HASIL ANALISIS SERVICE</p>

    <table>
        <tr>
            <th>Nomor Laporan</th>
            <td>#{{ $data->id }}</td>
        </tr>
        <tr>
            <th>Nama Pelapor</th>
            <td>{{ $data->pelapor }}</td>
        </tr>
        <tr>
            <th>Perangkat</th>
            <td>{{ $data->perangkat }}</td>
        </tr>
        <tr>
            <th>Keluhan</th>
            <td>{{ $data->keluhan }}</td>
        </tr>
        <tr>
            <th>Hasil Analisis</th>
            <td>{{ $data->analisis_it }}</td>
        </tr>
        <tr>
            <th>Tindakan</th>
            <td>{{ $data->tindakan ?? 'Belum Diisi' }}</td>
        </tr>
        <tr>
            <th>Rekomendasi</th>
            <td>{{ $data->rekomendasi ?? 'Tidak Ada Rekomendasi' }}</td>
        </tr>
        <tr>
            <th>Status Akhir</th>
            <td>{{ $data->status }}</td>
        </tr>
        <tr>
            <th>Tanggal Laporan</th>
            <td>{{ date('d F Y', strtotime($data->created_at)) }}</td>
        </tr>
        <tr>
            <th>Tanggal Selesai</th>
            <td>{{ $data->tgl_selesai ? date('d F Y', strtotime($data->tgl_selesai)) : '-' }}</td>
        </tr>
    </table>

    <table style="width: 100%; margin-top: 40px; border-collapse: collapse; border: none;">

        <tr style="text-align: center; font-weight: bold; border: none;">
            <td style="width: 25%; border: none; vertical-align: bottom;">Pelapor</td>
            <td style="width: 25%; border: none; vertical-align: bottom;">Pemeriksa</td>
            <td style="width: 25%; border: none; vertical-align: bottom;">Verifikator</td>
            <td style="width: 100%; border: none; vertical-align: bottom; position: relative;">
                <div style="font-weight: normal; white-space: nowrap; margin-top: -25px; margin-bottom: 5px;">
                    Sidoarjo, <?php echo date('d F Y'); ?>
                </div>
                Manager Corp. & Support
            </td>
        </tr>

        <tr style="border: none; height: 80px;">
            <td style="border: none;"></td>
            <td style="border: none;">
                <img src="{{ asset('img/ttd-it.png') }}" style="width: 100px; height: 100px; display: block;">
            </td>
            <td style="border: none;"></td>
            <td style="border: none;"></td>
            <td style="border: none;"></td>
        </tr>

        <tr style="text-align: center; font-weight: normal; vertical-align: bottom; border: none;">
            <td style="border: none;">( {{ $data->pelapor }} )</td>
            <td style="border: none;">( ILHAM )</td>
            <td style="border: none;">( IPANG )</td>
            <td style="border: none;">( PAK INDRA )</td>
        </tr>
    </table>
</body>

</html>
