

<?php $__env->startSection('content'); ?>
    <div class="space-y-6">
        <div class="flex flex-wrap items-center justify-between gap-4">
            <div>
                <h2 class="text-2xl font-semibold text-slate-900">Laporan Penjualan Menu</h2>
                <p class="text-sm text-slate-500">Ringkasan penjualan per menu berdasarkan periode.</p>
            </div>
            <?php if (isset($component)) { $__componentOriginald0f1fd2689e4bb7060122a5b91fe8561 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.button','data' => ['href' => '#','id' => 'menu-sales-export','variant' => 'secondary','dataUrl' => ''.e(route('reports.menu_sales.export')).'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['href' => '#','id' => 'menu-sales-export','variant' => 'secondary','data-url' => ''.e(route('reports.menu_sales.export')).'']); ?>
                Export Excel
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561)): ?>
<?php $attributes = $__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561; ?>
<?php unset($__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561); ?>
<?php endif; ?>
<?php if (isset($__componentOriginald0f1fd2689e4bb7060122a5b91fe8561)): ?>
<?php $component = $__componentOriginald0f1fd2689e4bb7060122a5b91fe8561; ?>
<?php unset($__componentOriginald0f1fd2689e4bb7060122a5b91fe8561); ?>
<?php endif; ?>
        </div>

        <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
            <form method="get" class="grid gap-4 md:grid-cols-6" id="menu-sales-form">
                <?php if (isset($component)) { $__componentOriginaled2cde6083938c436304f332ba96bb7c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginaled2cde6083938c436304f332ba96bb7c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.select','data' => ['name' => 'period','label' => 'Periode','id' => 'menu-sales-period']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('select'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'period','label' => 'Periode','id' => 'menu-sales-period']); ?>
                    <option value="daily" <?php echo e($period === 'daily' ? 'selected' : ''); ?>>Harian</option>
                    <option value="range" <?php echo e($period === 'range' ? 'selected' : ''); ?>>Range Tanggal</option>
                    <option value="monthly" <?php echo e($period === 'monthly' ? 'selected' : ''); ?>>Bulanan</option>
                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginaled2cde6083938c436304f332ba96bb7c)): ?>
<?php $attributes = $__attributesOriginaled2cde6083938c436304f332ba96bb7c; ?>
<?php unset($__attributesOriginaled2cde6083938c436304f332ba96bb7c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginaled2cde6083938c436304f332ba96bb7c)): ?>
<?php $component = $__componentOriginaled2cde6083938c436304f332ba96bb7c; ?>
<?php unset($__componentOriginaled2cde6083938c436304f332ba96bb7c); ?>
<?php endif; ?>
                <div id="menu-sales-daily" class="<?php echo e($period === 'daily' ? '' : 'hidden'); ?>">
                    <?php if (isset($component)) { $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input','data' => ['name' => 'date','label' => 'Tanggal','type' => 'date','value' => $date,'id' => 'menu-sales-date']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'date','label' => 'Tanggal','type' => 'date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($date),'id' => 'menu-sales-date']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $attributes = $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $component = $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
                </div>
                <div id="menu-sales-range" class="grid gap-4 md:grid-cols-2 md:col-span-2 <?php echo e($period === 'range' ? '' : 'hidden'); ?>">
                    <?php if (isset($component)) { $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input','data' => ['name' => 'start_date','label' => 'Mulai','type' => 'date','value' => $startDate,'id' => 'menu-sales-start']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'start_date','label' => 'Mulai','type' => 'date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($startDate),'id' => 'menu-sales-start']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $attributes = $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $component = $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
                    <?php if (isset($component)) { $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input','data' => ['name' => 'end_date','label' => 'Sampai','type' => 'date','value' => $endDate,'id' => 'menu-sales-end']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'end_date','label' => 'Sampai','type' => 'date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($endDate),'id' => 'menu-sales-end']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $attributes = $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $component = $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
                </div>
                <div id="menu-sales-monthly" class="<?php echo e($period === 'monthly' ? '' : 'hidden'); ?>">
                    <?php if (isset($component)) { $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input','data' => ['name' => 'month','label' => 'Bulan','type' => 'month','value' => $month,'id' => 'menu-sales-month']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'month','label' => 'Bulan','type' => 'month','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($month),'id' => 'menu-sales-month']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $attributes = $__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__attributesOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1)): ?>
<?php $component = $__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1; ?>
<?php unset($__componentOriginalc2fcfa88dc54fee60e0757a7e0572df1); ?>
<?php endif; ?>
                </div>
                <div class="md:col-span-2">
                    <label for="menu-sales-menu-trigger" class="mb-2 block text-sm font-semibold text-slate-700">Nama Menu</label>
                    <div id="menu-sales-menu-multi" class="relative">
                        <button
                            type="button"
                            id="menu-sales-menu-trigger"
                            class="flex w-full items-center justify-between gap-3 rounded-lg border border-amber-100 bg-white px-3 py-2 text-sm text-slate-700 shadow-sm focus:border-amber-400 focus:outline-none focus:ring-2 focus:ring-amber-200"
                        >
                            <span id="menu-sales-menu-summary" class="truncate text-left">Semua menu</span>
                            <svg class="h-4 w-4 text-slate-500" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
                                <path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.51a.75.75 0 01-1.08 0l-4.25-4.51a.75.75 0 01.02-1.06z" clip-rule="evenodd" />
                            </svg>
                        </button>

                        <div id="menu-sales-menu-dropdown" class="absolute z-30 mt-2 hidden w-full overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl">
                            <div class="border-b border-slate-100 p-3">
                                <input
                                    type="text"
                                    id="menu-sales-menu-search"
                                    placeholder="Cari menu..."
                                    class="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-700 focus:border-amber-400 focus:outline-none focus:ring-2 focus:ring-amber-200"
                                />
                            </div>
                            <div id="menu-sales-menu-options" class="max-h-64 space-y-1 overflow-auto p-2">
                                <?php $__empty_1 = true; $__currentLoopData = $menuOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menuOption): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <?php ($checked = in_array($menuOption, $menuNames ?? [], true)); ?>
                                    <label
                                        class="menu-sales-option flex cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-sm text-slate-700 hover:bg-amber-50"
                                        data-label="<?php echo e(\Illuminate\Support\Str::lower($menuOption)); ?>"
                                    >
                                        <input type="checkbox" value="<?php echo e($menuOption); ?>" class="menu-sales-option-checkbox h-4 w-4 rounded border-slate-300 text-amber-500 focus:ring-amber-300" <?php echo e($checked ? 'checked' : ''); ?>>
                                        <span class="truncate"><?php echo e($menuOption); ?></span>
                                    </label>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <p class="px-2 py-3 text-sm text-slate-500">Belum ada menu.</p>
                                <?php endif; ?>
                                <p id="menu-sales-menu-empty" class="hidden px-2 py-3 text-sm text-slate-500">Menu tidak ditemukan.</p>
                            </div>
                            <div class="flex items-center justify-between border-t border-slate-100 p-3">
                                <button type="button" id="menu-sales-menu-clear" class="text-sm font-semibold text-slate-500 hover:text-slate-700">Reset</button>
                                <button type="button" id="menu-sales-menu-apply" class="rounded-md bg-slate-900 px-3 py-1.5 text-sm font-semibold text-white hover:bg-slate-800">Terapkan</button>
                            </div>
                        </div>
                    </div>

                    <div id="menu-sales-menu-badges" class="mt-2 flex flex-wrap gap-2"></div>

                    <select name="menu[]" id="menu-sales-menu" multiple class="sr-only" tabindex="-1" aria-hidden="true">
                        <?php $__currentLoopData = $menuOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menuOption): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($menuOption); ?>" <?php echo e(in_array($menuOption, $menuNames ?? [], true) ? 'selected' : ''); ?>><?php echo e($menuOption); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="flex items-end">
                    <button
                        type="submit"
                        class="inline-flex w-full items-center justify-center rounded-lg bg-slate-900 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-slate-800 focus:outline-none focus:ring-2 focus:ring-slate-300"
                    >
                        Filter
                    </button>
                </div>
            </form>
         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>

        <div class="grid gap-4 md:grid-cols-2">
            <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                <p class="text-sm text-slate-500">Total Qty</p>
                <p class="mt-2 text-2xl font-semibold text-slate-900"><?php echo e($totalQty); ?></p>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                <p class="text-sm text-slate-500">Total Penjualan</p>
                <p class="mt-2 text-2xl font-semibold text-slate-900"><?php echo e(format_rupiah($totalSales)); ?></p>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
        </div>

        <?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
            <?php if (isset($component)) { $__componentOriginal163c8ba6efb795223894d5ffef5034f5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal163c8ba6efb795223894d5ffef5034f5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.table','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('table'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                <thead class="bg-slate-50 text-xs uppercase text-slate-500">
                    <tr>
                        <th class="px-4 py-3">Menu</th>
                        <th class="px-4 py-3 text-right">Harga Pokok</th>
                        <th class="px-4 py-3 text-right">Harga Jual</th>
                        <th class="px-4 py-3 text-right">Qty</th>
                        <th class="px-4 py-3 text-right">Total Penjualan</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr class="border-b border-slate-100">
                            <td class="px-4 py-3 font-medium text-slate-800"><?php echo e($row->nama); ?></td>
                            <td class="px-4 py-3 text-right"><?php echo e(format_rupiah($row->menu_harga_pokok ?? 0)); ?></td>
                            <td class="px-4 py-3 text-right"><?php echo e(format_rupiah($row->menu_harga_jual ?? 0)); ?></td>
                            <td class="px-4 py-3 text-right"><?php echo e($row->total_qty); ?></td>
                            <td class="px-4 py-3 text-right"><?php echo e(format_rupiah($row->total_sales)); ?></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td class="px-4 py-6 text-center text-slate-500" colspan="5">Data kosong.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal163c8ba6efb795223894d5ffef5034f5)): ?>
<?php $attributes = $__attributesOriginal163c8ba6efb795223894d5ffef5034f5; ?>
<?php unset($__attributesOriginal163c8ba6efb795223894d5ffef5034f5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal163c8ba6efb795223894d5ffef5034f5)): ?>
<?php $component = $__componentOriginal163c8ba6efb795223894d5ffef5034f5; ?>
<?php unset($__componentOriginal163c8ba6efb795223894d5ffef5034f5); ?>
<?php endif; ?>

            <div class="mt-4"><?php echo e($rows->links()); ?></div>
         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
    </div>

    <script>
        const menuSalesForm = document.getElementById('menu-sales-form');
        if (menuSalesForm) {
            menuSalesForm.querySelectorAll('select').forEach((select) => {
                select.classList.remove('select2');
            });
        }

        const menuSalesPeriod = document.getElementById('menu-sales-period');
        const menuSalesDaily = document.getElementById('menu-sales-daily');
        const menuSalesRange = document.getElementById('menu-sales-range');
        const menuSalesMonthly = document.getElementById('menu-sales-monthly');
        const menuSalesDate = document.getElementById('menu-sales-date');
        const menuSalesStart = document.getElementById('menu-sales-start');
        const menuSalesEnd = document.getElementById('menu-sales-end');
        const menuSalesMonth = document.getElementById('menu-sales-month');
        const menuSalesMenu = document.getElementById('menu-sales-menu');
        const menuSalesExport = document.getElementById('menu-sales-export');
        const menuSalesMenuMulti = document.getElementById('menu-sales-menu-multi');
        const menuSalesMenuTrigger = document.getElementById('menu-sales-menu-trigger');
        const menuSalesMenuDropdown = document.getElementById('menu-sales-menu-dropdown');
        const menuSalesMenuSearch = document.getElementById('menu-sales-menu-search');
        const menuSalesMenuBadges = document.getElementById('menu-sales-menu-badges');
        const menuSalesMenuClear = document.getElementById('menu-sales-menu-clear');
        const menuSalesMenuApply = document.getElementById('menu-sales-menu-apply');
        const menuSalesMenuSummary = document.getElementById('menu-sales-menu-summary');
        const menuSalesMenuEmpty = document.getElementById('menu-sales-menu-empty');
        const menuSalesOptionRows = Array.from(document.querySelectorAll('.menu-sales-option'));
        const menuSalesOptionCheckboxes = Array.from(document.querySelectorAll('.menu-sales-option-checkbox'));

        function toggleMenuSalesFields() {
            const value = menuSalesPeriod.value;
            const isDaily = value === 'daily';
            const isRange = value === 'range';
            const isMonthly = value === 'monthly';

            menuSalesDaily.classList.toggle('hidden', !isDaily);
            menuSalesRange.classList.toggle('hidden', !isRange);
            menuSalesMonthly.classList.toggle('hidden', !isMonthly);

            if (!isDaily && menuSalesDate) {
                menuSalesDate.value = '';
            }
            if (!isRange) {
                if (menuSalesStart) menuSalesStart.value = '';
                if (menuSalesEnd) menuSalesEnd.value = '';
            }
            if (!isMonthly && menuSalesMonth) {
                menuSalesMonth.value = '';
            }
        }

        function escapeHtml(value) {
            const div = document.createElement('div');
            div.textContent = value;
            return div.innerHTML;
        }

        function getSelectedMenuValues() {
            return menuSalesOptionCheckboxes.filter((checkbox) => checkbox.checked).map((checkbox) => checkbox.value);
        }

        function syncMenuSelectValues() {
            if (!menuSalesMenu) {
                return;
            }

            const selectedValues = getSelectedMenuValues();
            Array.from(menuSalesMenu.options).forEach((option) => {
                option.selected = selectedValues.includes(option.value);
            });
        }

        function renderMenuSelection() {
            if (!menuSalesMenuSummary || !menuSalesMenuBadges) {
                return;
            }

            const selectedValues = getSelectedMenuValues();
            if (selectedValues.length === 0) {
                menuSalesMenuSummary.textContent = 'Semua menu';
                menuSalesMenuBadges.innerHTML = '<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold text-slate-600">Semua menu</span>';
                return;
            }

            menuSalesMenuSummary.textContent = selectedValues.length <= 2
                ? selectedValues.join(', ')
                : `${selectedValues.length} menu dipilih`;

            const visible = selectedValues.slice(0, 4)
                .map((value) => `<span class="rounded-full bg-emerald-50 px-2.5 py-1 text-xs font-semibold text-emerald-700">${escapeHtml(value)}</span>`)
                .join('');
            const remaining = selectedValues.length - 4;
            const more = remaining > 0
                ? `<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold text-slate-600">+${remaining} lagi</span>`
                : '';

            menuSalesMenuBadges.innerHTML = visible + more;
        }

        function filterMenuOptions(keyword) {
            const q = (keyword || '').trim().toLowerCase();
            let visibleCount = 0;
            menuSalesOptionRows.forEach((row) => {
                const label = row.dataset.label || '';
                const hidden = q && !label.includes(q);
                row.classList.toggle('hidden', hidden);
                if (!hidden) {
                    visibleCount += 1;
                }
            });

            if (menuSalesMenuEmpty) {
                const hasOptions = menuSalesOptionRows.length > 0;
                menuSalesMenuEmpty.classList.toggle('hidden', !hasOptions || visibleCount > 0);
            }
        }

        function openMenuDropdown() {
            if (!menuSalesMenuDropdown) {
                return;
            }
            menuSalesMenuDropdown.classList.remove('hidden');
            menuSalesMenuSearch?.focus();
        }

        function closeMenuDropdown() {
            if (!menuSalesMenuDropdown) {
                return;
            }
            menuSalesMenuDropdown.classList.add('hidden');
            if (menuSalesMenuSearch) {
                menuSalesMenuSearch.value = '';
            }
            filterMenuOptions('');
        }

        const handleMenuPeriodChange = () => {
            toggleMenuSalesFields();
        };

        menuSalesPeriod?.addEventListener('change', handleMenuPeriodChange);
        document.addEventListener('change', (event) => {
            if (event.target && event.target.id === 'menu-sales-period') {
                handleMenuPeriodChange();
            }
        }, true);
        if (window.$ && $.fn.select2) {
            $(document).on('select2:select', '#menu-sales-period', handleMenuPeriodChange);
        }

        menuSalesMenuTrigger?.addEventListener('click', () => {
            if (menuSalesMenuDropdown?.classList.contains('hidden')) {
                openMenuDropdown();
            } else {
                closeMenuDropdown();
            }
        });

        menuSalesMenuSearch?.addEventListener('input', (event) => {
            filterMenuOptions(event.target.value);
        });

        menuSalesMenuSearch?.addEventListener('keydown', (event) => {
            if (event.key === 'Enter') {
                event.preventDefault();
            }
        });

        menuSalesMenuClear?.addEventListener('click', () => {
            menuSalesOptionCheckboxes.forEach((checkbox) => {
                checkbox.checked = false;
            });
            syncMenuSelectValues();
            renderMenuSelection();
        });

        menuSalesOptionCheckboxes.forEach((checkbox) => {
            checkbox.addEventListener('change', () => {
                syncMenuSelectValues();
                renderMenuSelection();
            });
        });

        menuSalesMenuApply?.addEventListener('click', () => {
            syncMenuSelectValues();
            renderMenuSelection();
            closeMenuDropdown();
        });

        document.addEventListener('click', (event) => {
            if (!menuSalesMenuMulti?.contains(event.target)) {
                closeMenuDropdown();
            }
        });

        document.addEventListener('keydown', (event) => {
            if (event.key === 'Escape') {
                closeMenuDropdown();
            }
        });

        toggleMenuSalesFields();
        syncMenuSelectValues();
        renderMenuSelection();
        filterMenuOptions('');

        menuSalesExport?.addEventListener('click', (event) => {
            event.preventDefault();
            const params = new URLSearchParams();
            if (!menuSalesForm) {
                return;
            }

            menuSalesForm.querySelectorAll('input, select').forEach((field) => {
                if (!field.name || field.disabled) {
                    return;
                }
                if (field.closest('.hidden')) {
                    return;
                }
                if (field instanceof HTMLSelectElement && field.multiple) {
                    Array.from(field.selectedOptions).forEach((option) => {
                        if (option.value) {
                            params.append(field.name, option.value);
                        }
                    });
                    return;
                }

                if (!field.value) {
                    return;
                }
                params.set(field.name, field.value);
            });

            const url = menuSalesExport.dataset.url || menuSalesExport.getAttribute('href') || '';
            if (!url) {
                return;
            }
            const query = params.toString();
            window.location.href = query ? `${url}?${query}` : url;
        });
    </script>
<?php $__env->stopSection(); ?>

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