

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

<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-12">
        <h2 class="mb-4"><i class="fas fa-history me-2"></i>Riwayat Pesanan</h2>
    </div>
</div>

<?php if($orders->count() > 0): ?>
<div class="row">
    <?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <div class="col-md-6 mb-4">
        <div class="card">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-start mb-3">
                    <div>
                        <h5 class="card-title mb-1">Pesanan #<?php echo e($order->id); ?></h5>
                        <small class="text-muted"><?php echo e($order->created_at->format('d M Y, H:i')); ?></small>
                    </div>
                    <span class="status-badge status-<?php echo e($order->status); ?>">
                        <?php switch($order->status):
                            case ('pending'): ?> Menunggu <?php break; ?>
                            <?php case ('confirmed'): ?> Dikonfirmasi <?php break; ?>
                            <?php case ('processing'): ?> Diproses <?php break; ?>
                            <?php case ('completed'): ?> Selesai <?php break; ?>
                            <?php case ('cancelled'): ?> Dibatalkan <?php break; ?>
                        <?php endswitch; ?>
                    </span>
                </div>
                
                <div class="mb-3">
                    <?php $__currentLoopData = $order->orderItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="d-flex justify-content-between">
                        <span><?php echo e($item->quantity); ?>x <?php echo e($item->menu->name); ?></span>
                        <span>Rp <?php echo e(number_format($item->price * $item->quantity, 0, ',', '.')); ?></span>
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                
                <hr>
                
                <div class="d-flex justify-content-between align-items-center">
                    <strong>Total</strong>
                    <strong class="text-success">Rp <?php echo e(number_format($order->total_price, 0, ',', '.')); ?></strong>
                </div>
                
                <?php if($order->payment_method): ?>
                <div class="mt-2">
                    <small class="text-muted">
                        <i class="fas fa-credit-card me-1"></i>Pembayaran: 
                        <?php echo e($order->payment_method === 'cash' ? 'Cash' : 'QRIS'); ?>

                    </small>
                </div>
                <?php endif; ?>
                
                <?php if($order->notes): ?>
                <div class="mt-2">
                    <small class="text-muted">Catatan: <?php echo e($order->notes); ?></small>
                </div>
                <?php endif; ?>
                
                <div class="mt-3">
                    <a href="<?php echo e(route('menu.order-detail', $order)); ?>" class="btn btn-sm btn-outline-primary">
                        <i class="fas fa-eye me-1"></i>Lihat Detail
                    </a>
                </div>
            </div>
        </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

<?php else: ?>
<div class="text-center py-5">
    <i class="fas fa-clipboard-list fa-4x text-muted mb-3"></i>
    <h4 class="text-muted">Belum ada pesanan</h4>
    <p>Silakan pilih menu terlebih dahulu</p>
    <a href="<?php echo e(route('menu.index')); ?>" class="btn btn-primary">
        <i class="fas fa-utensils me-2"></i>Lihat Menu
    </a>
</div>
<?php endif; ?>
<?php $__env->stopSection(); ?>

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