<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cetak QR Code</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #fff;
            margin: 0;
            padding: 10px;
        }
        .qr-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 15px;
        }
        .qr-item {
            border: 1.5px solid #000;
            padding: 12px;
            text-align: center;
            page-break-inside: avoid;
            border-radius: 5px;
        }
        .qr-item img, .qr-item svg {
            max-width: 100%;
            height: auto;
            margin-bottom: 8px;
        }
        .qr-item h4 {
            margin: 0 0 3px 0;
            font-size: 13px;
            color: #000;
            font-weight: 700;
            line-height: 1.2;
            text-transform: uppercase;
        }
        .qr-item p {
            margin: 0;
            font-size: 11px;
            color: #333;
            font-weight: 500;
        }
        @media print {
            body {
                padding: 0;
            }
            .no-print {
                display: none !important;
            }
            .qr-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }
        .print-btn {
            display: block;
            width: 100%;
            max-width: 300px;
            margin: 10px auto 20px auto;
            padding: 12px;
            background-color: #2c3e50;
            color: #fff;
            border: none;
            border-radius: 6px;
            font-size: 15px;
            font-weight: bold;
            cursor: pointer;
            text-align: center;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
    </style>
</head>
<body>

    <button onclick="window.print()" class="print-btn no-print">Klik untuk Cetak Label</button>

    <div class="qr-grid">
        <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="qr-item">
                <?php echo \SimpleSoftwareIO\QrCode\Facades\QrCode::size(120)->generate(route('maintenance.public.show', $item->qr_token)); ?>

                <h4><?php echo e($item->name); ?></h4>
                <p><?php echo e($item->location?->name ?? 'Semua Lokasi'); ?></p>
                <div style="font-size: 9px; margin-top: 5px; color: #666; font-weight: bold; letter-spacing: 1px;">INVENTARIS</div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

        <?php $__currentLoopData = $facilities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $facility): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="qr-item">
                <?php echo \SimpleSoftwareIO\QrCode\Facades\QrCode::size(120)->generate(route('maintenance.public.show', $facility->qr_token)); ?>

                <h4><?php echo e($facility->name); ?></h4>
                <p><?php echo e($facility->location?->name ?? 'Semua Lokasi'); ?></p>
                <div style="font-size: 9px; margin-top: 5px; color: #666; font-weight: bold; letter-spacing: 1px;">FASILITAS</div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>

    <?php if($items->count() == 0 && $facilities->count() == 0): ?>
        <div style="text-align: center; padding: 50px; color: #666;">
            Tidak ada data QR Code untuk dicetak.
        </div>
    <?php endif; ?>

    <script>
        window.onload = function() {
            setTimeout(function() {
                // window.print(); // Di-disable agar user klik tombol manual jika ingin melihat preview dulu
            }, 500);
        };
    </script>
</body>
</html>
<?php /**PATH G:\Project\inventaris-pondok\resources\views/qr/print.blade.php ENDPATH**/ ?>