

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

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

<?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <?php if($category->menus->count() > 0): ?>
    <div class="row mb-4">
        <div class="col-12">
            <h4 class="border-bottom pb-2 mb-3">
                <i class="fas fa-tags me-2"></i><?php echo e($category->name); ?>

                <?php if($category->description): ?>
                    <small class="text-muted fs-6"><?php echo e($category->description); ?></small>
                <?php endif; ?>
            </h4>
        </div>
        
        <?php $__currentLoopData = $category->menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="col-md-6 col-lg-4 mb-4">
            <div class="card menu-card h-100">
                <?php if($menu->image): ?>
                <img src="<?php echo e(asset('images/menus/' . $menu->image)); ?>" class="menu-image card-img-top" alt="<?php echo e($menu->name); ?>">
                <?php else: ?>
                <div class="menu-image bg-secondary d-flex align-items-center justify-content-center">
                    <i class="fas fa-utensils fa-3x text-white"></i>
                </div>
                <?php endif; ?>
                <div class="card-body">
                    <h5 class="card-title"><?php echo e($menu->name); ?></h5>
                    <p class="card-text text-muted"><?php echo e($menu->description ?? 'Tidak ada deskripsi'); ?></p>
                    <div class="d-flex justify-content-between align-items-center">
                        <span class="price-tag">Rp <?php echo e(number_format($menu->price, 0, ',', '.')); ?></span>
                        <?php if($menu->is_available): ?>
                        <button class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#addToCartModal<?php echo e($menu->id); ?>">
                            <i class="fas fa-cart-plus me-1"></i>Tambah
                        </button>
                        <?php else: ?>
                        <span class="badge bg-secondary">Tidak Tersedia</span>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>

        <!-- Add to Cart Modal -->
        <div class="modal fade" id="addToCartModal<?php echo e($menu->id); ?>" tabindex="-1">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Tambah ke Keranjang</h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                    </div>
                    <form action="<?php echo e(route('menu.add-to-cart')); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <div class="modal-body">
                            <h6><?php echo e($menu->name); ?></h6>
                            <p class="text-muted">Rp <?php echo e(number_format($menu->price, 0, ',', '.')); ?></p>
                            <input type="hidden" name="menu_id" value="<?php echo e($menu->id); ?>">
                            <div class="mb-3">
                                <label for="quantity<?php echo e($menu->id); ?>" class="form-label">Jumlah</label>
                                <input type="number" class="form-control" id="quantity<?php echo e($menu->id); ?>" name="quantity" value="1" min="1" required>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
                            <button type="submit" class="btn btn-primary">Tambah ke Keranjang</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>
    <?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

<?php if($categories->isEmpty() || $categories->every(fn($c) => $c->menus->count() == 0)): ?>
<div class="text-center py-5">
    <i class="fas fa-utensils fa-4x text-muted mb-3"></i>
    <h4 class="text-muted">Menu belum tersedia</h4>
    <p>Silakanhubungi admin untuk menambahkan menu.</p>
</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/menu.blade.php ENDPATH**/ ?>