

<?php $__env->startSection('title', 'Riwayat Pesanan'); ?>

<?php $__env->startSection('content'); ?>
<style>
    body {
        font-family: 'Poppins', sans-serif;
        background: #f9f9f9;
        margin: 0;
        padding: 0;
        color: #333;
    }

    .header {
        background: #ff6b6b;
        color: white;
        padding: 20px;
        text-align: center;
        font-size: 24px;
        font-weight: bold;
        position: relative;
    }

    .header a {
        position: absolute;
        left: 20px;
        top: 20px;
        background: white;
        color: #ff6b6b;
        padding: 8px 12px;
        border-radius: 8px;
        text-decoration: none;
        font-weight: bold;
    }

    .header a:hover {
        background: #ffe0e0;
    }

    .content {
        max-width: 1000px;
        margin: 30px auto;
        padding: 0 15px;
    }

    .order-card {
        background: white;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        transition: 0.3s;
    }

    .order-card:hover {
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    }

    .order-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        font-weight: bold;
        font-size: 18px;
        color: #ff6b6b;
    }

    .order-details p {
        margin: 6px 0;
        line-height: 1.4;
    }

    .status {
        padding: 4px 10px;
        border-radius: 6px;
        font-weight: bold;
        display: inline-block;
        text-transform: capitalize;
    }

    .status.pending {
        background: #ffe066;
        color: #444;
    }

    .status.selesai {
        background: #81c784;
        color: white;
    }

    .btn-pay {
        background: #25D366;
        color: white;
        padding: 6px 12px;
        border-radius: 6px;
        text-decoration: none;
        font-weight: bold;
        display: inline-block;
        margin-top: 8px;
    }

    .btn-pay:hover {
        background: #128C7E;
    }
</style>

<div class="header">
    🍕 Riwayat Pesanan Anda
</div>

<div class="content">

    <?php $__empty_1 = true; $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
        <div class="order-card">

            <div class="order-header">
                <span>Pesanan <?php echo e($order->id); ?></span>
                <span class="status <?php echo e($order->status); ?>"><?php echo e($order->status); ?></span>
            </div>

            <div class="order-details">

                
                <p><strong>Pizza:</strong> 
                    <?php echo e($order->pizza->nama ?? 'Data pizza tidak ditemukan'); ?>

                </p>

                <p><strong>Jumlah:</strong> <?php echo e($order->jumlah); ?></p>

                <p><strong>Total Harga:</strong> 
                    Rp <?php echo e(number_format($order->total_harga, 0, ',', '.')); ?>

                </p>

                <p><strong>Nama Penerima:</strong> <?php echo e($order->nama_pelanggan); ?></p>

                <p><strong>Alamat:</strong> <?php echo e($order->alamat); ?></p>

                <p><strong>Metode Pembayaran:</strong> 
                    <?php echo e(ucfirst($order->metode_pembayaran)); ?>

                </p>

                <p><strong>Tanggal:</strong> 
                    <?php echo e($order->created_at->format('d M Y H:i')); ?>

                </p>

                
                <?php if($order->status == 'pending' && $order->metode_pembayaran == 'qris'): ?>
                    <a href="<?php echo e(route('user.qris', $order->id)); ?>" class="btn-pay">
                        Bayar 💳
                    </a>
                <?php endif; ?>

                <form action="<?php echo e(route('user.order.delete', $order->id)); ?>"
      method="POST"
      style="margin-top: 5px;">
    <?php echo csrf_field(); ?>
    <?php echo method_field('DELETE'); ?>

    <button type="submit" onclick="return confirm('Yakin ingin menghapus pesanan ini?')"
        style="
            background:#ff4d4d;
            color:white;
            border:none;
            padding:6px 10px;
            border-radius:6px;
            cursor:pointer;
            font-weight:bold;
        ">
        Hapus 🗑️
    </button>
</form>
            </div>
        </div>

    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
        <p style="text-align:center; margin-top:30px;">
            Belum ada pesanan 😋
        </p>
    <?php endif; ?>

</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.user', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\pizza_queen_app\resources\views/user/orders/index.blade.php ENDPATH**/ ?>