<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php echo e($title); ?></title>
    <link rel="icon" type="image/svg+xml" href="<?php echo e(asset('favicon.svg')); ?>">

    <style>
        @page {
            margin: 2cm;
        }

        body {
            font-family: Helvetica, Arial, sans-serif;
            font-size: 10pt;
            color: #333;
            line-height: 1.4;
        }

        .header {
            text-align: center;
            margin-bottom: 25px;
            border-bottom: 2px solid #333;
            padding-bottom: 10px;
        }

        .header h1 {
            margin: 0;
            font-size: 18pt;
            text-transform: uppercase;
            font-weight: bold;
        }

        .header h2 {
            margin: 5px 0 0;
            font-size: 14pt;
            font-weight: normal;
        }

        .meta-info {
            margin-bottom: 20px;
        }

        .meta-info table {
            width: 100%;
            border: none;
            font-size: 10pt;
        }

        .meta-info td {
            padding: 3px;
        }

        .report-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }

        .report-table th,
        .report-table td {
            border: 1px solid #ccc;
            padding: 6px;
            vertical-align: top;
        }

        .report-table th {
            background: #f2f2f2;
            font-size: 9pt;
            text-transform: uppercase;
        }

        .report-table tr:nth-child(even) {
            background: #fafafa;
        }

        .w-no {
            width: 4%;
            text-align: center;
        }

        .w-date {
            width: 11%;
        }

        .w-status {
            width: 12%;
        }

        .w-qty {
            width: 8%;
            text-align: center;
        }

        .status-rejected {
            color: #dc2626;
            font-weight: bold;
        }

        .status-approved {
            color: #16a34a;
            font-weight: bold;
        }

        .status-pending {
            color: #d97706;
            font-weight: bold;
        }

        .status-active {
            color: #2563eb;
            font-weight: bold;
        }

        .footer {
            margin-top: 40px;
            text-align: right;
            font-size: 9pt;
        }
    </style>
</head>

<body>

    <div class="header">
        <h1>Sipian</h1>
        <h2><?php echo e($title); ?></h2>
    </div>

    <div class="meta-info">
        <table>
            <tr>
                <td width="120"><strong>Periode</strong></td>
                <td>:
                    <?php echo e(\Carbon\Carbon::parse($dateFrom)->format('d F Y')); ?>

                    -
                    <?php echo e(\Carbon\Carbon::parse($dateTo)->format('d F Y')); ?>

                </td>
            </tr>
            <tr>
                <td><strong>Dicetak</strong></td>
                <td>: <?php echo e(now()->format('d F Y, H:i')); ?></td>
            </tr>
        </table>
    </div>

    <table class="report-table">
        <thead>
            <tr>
                <th class="w-no">No</th>

                <?php if($reportType === 'room'): ?>
                <th>Peminjam</th>
                <th>Divisi</th>
                <th>Ruangan</th>
                <th>Kegiatan</th>
                <th>Kursi</th>
                <th class="w-date">Mulai</th>
                <th class="w-date">Selesai</th>
                <th class="w-status">Status</th>

                <?php elseif($reportType === 'vehicle'): ?>
                <th>Kendaraan</th>
                <th>Peminjam</th>
                <th>Divisi</th>
                <th>Keperluan</th>
                <th>Tujuan</th>
                <th class="w-date">Mulai</th>
                <th class="w-date">Selesai</th>
                <th class="w-status">Status</th>

                <?php elseif($reportType === 'item_request'): ?>
                <th>Peminta</th>
                <th>Divisi</th>
                <th>Barang</th>
                <th class="w-qty">Jumlah</th>
                <th class="w-date">Tgl Pengajuan</th>
                <th class="w-date">Target Realisasi</th>
                <th>Keperluan</th>
                <th>Catatan Admin</th>
                <th class="w-status">Status</th>

                <?php else: ?>
                <th>Peminjam</th>
                <th>Divisi</th>
                <th>Barang</th>
                <th class="w-qty">Jml</th>
                <th class="w-date">Pinjam</th>
                <th class="w-date">Rencana Kembali</th>
                <th class="w-date">Aktual Kembali</th>
                <th class="w-status">Status</th>
                <?php endif; ?>
            </tr>
        </thead>

        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
                <td style="text-align:center"><?php echo e($loop->iteration); ?></td>

                <?php if($reportType === 'room'): ?>
                <td><?php echo e($item->user->name ?? '-'); ?></td>
                <td><?php echo e($item->user->divisi->nama ?? '-'); ?></td>
                <td><strong><?php echo e($item->room->name ?? '-'); ?></strong></td>
                <td><?php echo e($item->title); ?></td>
                <td><?php echo e($item->chair_count ?: '-'); ?></td>
                <td><?php echo e($item->start_time->format('d/m/Y H:i')); ?></td>
                <td><?php echo e($item->end_time->format('d/m/Y H:i')); ?></td>
                <td>
                    <?php if($item->status === 'rejected'): ?>
                    <span class="status-rejected">Ditolak</span>
                    <?php elseif($item->status === 'approved'): ?>
                    <span class="status-approved">Disetujui</span>
                    <?php else: ?>
                    <span class="status-pending"><?php echo e(ucfirst($item->status)); ?></span>
                    <?php endif; ?>
                </td>

                <?php elseif($reportType === 'vehicle'): ?>
                <td><strong><?php echo e($item->vehicle->name ?? '-'); ?></strong></td>
                <td><?php echo e($item->user->name ?? '-'); ?></td>
                <td><?php echo e($item->user->divisi->nama ?? '-'); ?></td>
                <td><?php echo e($item->purpose ?? '-'); ?></td>
                <td><?php echo e($item->destination ?? '-'); ?></td>
                <td><?php echo e($item->start_time->format('d/m/Y H:i')); ?></td>
                <td><?php echo e($item->end_time->format('d/m/Y H:i')); ?></td>
                <td>
                    <?php if($item->status === 'rejected'): ?>
                    <span class="status-rejected">Ditolak</span>
                    <?php elseif($item->status === 'approved'): ?>
                    <span class="status-approved">Disetujui</span>
                    <?php else: ?>
                    <span class="status-pending"><?php echo e(ucfirst($item->status)); ?></span>
                    <?php endif; ?>
                </td>

                <?php elseif($reportType === 'item_request'): ?>
                <td><?php echo e($item->user->name ?? '-'); ?></td>
                <td><?php echo e($item->user->divisi->nama ?? '-'); ?></td>
                <td><?php echo e($item->item_name_snapshot ?? '-'); ?></td>
                <td style="text-align:center">
                    <?php echo e(rtrim(rtrim(number_format($item->quantity, 2, '.', ''), '0'), '.')); ?> <?php echo e($item->unit_snapshot ?? '-'); ?>

                </td>
                <td><?php echo e($item->request_date ? \Carbon\Carbon::parse($item->request_date)->format('d/m/Y') : '-'); ?></td>
                <td><?php echo e($item->realization_date ? \Carbon\Carbon::parse($item->realization_date)->format('d/m/Y') : '-'); ?></td>
                <td><?php echo e($item->purpose ?? '-'); ?></td>
                <td><?php echo e($item->admin_note ?? '-'); ?></td>
                <td>
                    <?php if($item->status === 'approved'): ?>
                    <span class="status-approved">Baik (sesuai quantity)</span>
                    <?php elseif($item->status === 'cancelled'): ?>
                    <span class="status-rejected">Belum diterima</span>
                    <?php else: ?>
                    <span class="status-pending">Menunggu verifikasi</span>
                    <?php endif; ?>
                </td>

                <?php else: ?>
                <td><?php echo e($item->user->name ?? '-'); ?></td>
                <td><?php echo e($item->user->divisi->nama ?? '-'); ?></td>
                <td><?php echo e($item->item->nama ?? '-'); ?></td>
                <td style="text-align:center"><?php echo e($item->jumlah); ?></td>
                <td><?php echo e(\Carbon\Carbon::parse($item->tanggal_pinjam)->format('d/m/Y H:i')); ?></td>
                <td><?php echo e($item->tanggal_kembali ? \Carbon\Carbon::parse($item->tanggal_kembali)->format('d/m/Y') : '-'); ?></td>
                <td><?php echo e($item->actual_return_date ? \Carbon\Carbon::parse($item->actual_return_date)->format('d/m/Y H:i') : '-'); ?></td>
                <td>
                    <?php if($item->status === 'rejected'): ?>
                    <span class="status-rejected">Ditolak</span>
                    <?php elseif($item->actual_return_date): ?>
                    <span class="status-approved">Dikembalikan</span>
                    <?php else: ?>
                    <span class="status-active">Belum Kembali</span>
                    <?php endif; ?>
                </td>
                <?php endif; ?>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="10" style="text-align:center;padding:20px">
                    Tidak ada data
                </td>
            </tr>
            <?php endif; ?>
        </tbody>
    </table>

    <div class="footer">
        <p>Surabaya, <?php echo e(now()->format('d F Y')); ?></p>
        <p>Mengetahui,</p>
        <br><br><br>
        <p>( _______________________ )</p>
        <p>Kepala Bagian Umum</p>
    </div>

</body>

</html>
<?php /**PATH /Users/Afifudin/Downloads/Magang/SIpian_2026-05-06/resources/views/reports/pdf.blade.php ENDPATH**/ ?>