<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cetak Resi #<?php echo e($pesanan->id); ?></title>
    <style>
        body { font-family: Arial, sans-serif; margin: 0; padding: 20px; color: #333; }
        .container { max-width: 800px; margin: 0 auto; border: 1px solid #ddd; padding: 30px; border-radius: 8px; }
        .header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 20px; margin-bottom: 20px; }
        .title { font-size: 24px; font-weight: bold; margin: 0 0 5px 0; text-transform: uppercase; }
        .barcode { font-family: 'Courier New', Courier, monospace; font-size: 24px; font-weight: bold; letter-spacing: 2px; }
        .barcode-box { background: #f9f9f9; border: 2px dashed #333; padding: 10px 20px; text-align: center; }

        .section { margin-bottom: 25px; }
        .grid { display: flex; gap: 20px; }
        .col { flex: 1; border: 1px solid #ddd; padding: 15px; border-radius: 4px; }
        h3 { font-size: 14px; color: #666; margin-top: 0; margin-bottom: 15px; text-transform: uppercase; border-bottom: 1px solid #eee; padding-bottom: 5px; }
        p { margin: 5px 0; font-size: 14px; line-height: 1.5; }
        .bold { font-weight: bold; }

        table { width: 100%; border-collapse: collapse; margin-top: 10px; }
        th, td { border: 1px solid #ddd; padding: 12px 10px; text-align: left; font-size: 14px; }
        th { background-color: #f5f5f5; text-transform: uppercase; font-size: 12px; }
        .text-right { text-align: right; }
        .text-center { text-align: center; }

        .footer { text-align: center; margin-top: 30px; font-size: 12px; color: #777; border-top: 1px solid #eee; padding-top: 15px; }

        @media print {
            body { padding: 0; background: #fff; }
            .container { border: none; padding: 0; }
            .no-print { display: none; }
        }
    </style>
</head>
<body onload="window.print()">

    <div class="no-print" style="margin-bottom: 20px; text-align: center;">
        <button onclick="window.print()" style="padding: 10px 20px; background: #000; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-weight: bold;">CETAK SEKARANG</button>
        <button onclick="window.close()" style="padding: 10px 20px; background: #eee; color: #333; border: 1px solid #ddd; border-radius: 5px; cursor: pointer; font-weight: bold; margin-left: 10px;">TUTUP</button>
    </div>

    <div class="container">
        <div class="header">
            <div>
                <h1 class="title">LABEL PENGIRIMAN</h1>
                <p>Order ID: <strong>#ORD-<?php echo e(date('Ymd', strtotime($pesanan->tanggal_pesanan))); ?>-<?php echo e($pesanan->id); ?></strong></p>
                <p>Tanggal: <?php echo e(\Carbon\Carbon::parse($pesanan->tanggal_pesanan)->format('d/m/Y H:i')); ?></p>
            </div>
            <div>
                <div class="barcode-box">
                    <div style="font-size:10px; color:#555; text-transform:uppercase; margin-bottom:5px;">Nomor Resi Pengecekan</div>
                    <div class="barcode"><?php echo e($pesanan->no_resi ?? 'BELUM ADA RESI'); ?></div>
                </div>
            </div>
        </div>

        <div class="section grid">
            <div class="col">
                <h3>Kepada (Penerima)</h3>
                <p class="bold" style="font-size: 18px;"><?php echo e($pesanan->user->nama ?? '-'); ?></p>
                <p style="font-weight: bold;">Telp: <?php echo e($pesanan->user->no_telp ?? '-'); ?></p>
                <p style="margin-top: 15px; padding: 10px; background-color: #f9f9f9; border-radius:4px;">
                    <?php echo e($pesanan->alamat_tujuan); ?><br>
                    Kel. <?php echo e($pesanan->desa->name ?? '-'); ?>, Kec. <?php echo e($pesanan->kecamatan->name ?? '-'); ?><br>
                    <?php echo e($pesanan->regency->name ?? $pesanan->kota); ?>, <?php echo e($pesanan->provinsi->name ?? '-'); ?><br>
                    Kodepos: <?php echo e($pesanan->kode_pos); ?>

                </p>
            </div>
            <div class="col">
                <h3>Dari (Pengirim)</h3>
                <p class="bold" style="font-size: 18px;"><?php echo e(config('app.name', 'Toko Miftah')); ?></p>
                <p>Dukungan Pelanggan Resmi</p>
                <br>
                <table style="margin-top:0;">
                    <tr>
                        <th style="padding: 5px 10px; background:none;">Pembayaran</th>
                        <td style="padding: 5px 10px; text-transform:uppercase; font-weight:bold;"><?php echo e($pesanan->metode_pembayaran ?? '-'); ?></td>
                    </tr>
                    <tr>
                        <th style="padding: 5px 10px; background:none;">Status</th>
                        <td style="padding: 5px 10px;"><strong><?php echo e(in_array($pesanan->status, ['diproses','dikirim','selesai']) ? 'LUNAS / NON-COD' : 'BELUM LUNAS'); ?></strong></td>
                    </tr>
                </table>
            </div>
        </div>

        <div class="section">
            <h3>Rincian Paket Di Dalam</h3>
            <table>
                <thead>
                    <tr>
                        <th width="40" class="text-center">No</th>
                        <th>Deskripsi Produk</th>
                        <th class="text-center" width="60">Qty</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $pesanan->detailPesanans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td class="text-center"><?php echo e($index + 1); ?></td>
                        <td><?php echo e($item->produk->nama ?? 'Item'); ?></td>
                        <td class="text-center bold" style="font-size:16px;"><?php echo e($item->jumlah); ?></td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>

        <div style="margin-top: 40px; padding: 20px; text-align: center; border: 1px dashed #999;">
            <h2 style="margin:0 0 10px 0; font-size:18px;">MOHON TANGANI DENGAN HATI-HATI PADA SAAT PROSES DISTRIBUSI PENGIRIMAN</h2>
        </div>

        <div class="footer">
            Dokumen internal dibuat otomatis oleh <?php echo e(config('app.name', 'Toko Miftah')); ?> pada <?php echo e(now()->format('d M Y H:i:s')); ?>

        </div>
    </div>

</body>
</html>
<?php /**PATH C:\laragon\www\Toko-miftah\resources\views/pesanans/cetak_resi.blade.php ENDPATH**/ ?>