

<?php $__env->startSection('title', 'Detail sumber data — '.config('portal.product_line')); ?>
<?php $__env->startSection('page_heading', 'Laporan — Detail sumber'); ?>
<?php $__env->startSection('page_subheading', 'Per outlet SysOrder, harian SysOrder, dan harian refleksologi — masing-masing berpaginasi sendiri.'); ?>

<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('owner.reports._nav', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <?php echo $__env->make('owner.reports._filters', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <?php if(!empty($data['errors'])): ?>
        <div class="mb-6 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-950" role="alert">
            <p class="font-semibold text-amber-900">Perlu perhatian</p>
            <ul class="mt-2 list-disc space-y-1 pl-5">
                <?php $__currentLoopData = $data['errors']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $err): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><span class="font-medium"><?php echo e($err['source']); ?></span>: <?php echo e($err['message']); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    <?php endif; ?>

    <div class="mb-8 grid gap-4 sm:grid-cols-2">
        <div class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm">
            <p class="text-xs font-semibold uppercase text-sky-800"><?php echo e(config('portal.sources.esborder.title')); ?></p>
            <p class="mt-1 text-2xl font-bold text-slate-900">Rp <?php echo e(number_format($data['esborder']['revenue'] ?? 0, 0, ',', '.')); ?></p>
            <p class="text-xs text-slate-500">Order <?php echo e(number_format($data['esborder']['order_count'] ?? 0, 0, ',', '.')); ?> · Laba kotor Rp <?php echo e(number_format($data['esborder']['gross_profit'] ?? 0, 0, ',', '.')); ?></p>
        </div>
        <div class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm">
            <p class="text-xs font-semibold uppercase text-violet-800"><?php echo e(config('portal.sources.sysreflex.title')); ?></p>
            <p class="mt-1 text-2xl font-bold text-slate-900">Rp <?php echo e(number_format($data['sysreflex']['gross_revenue'] ?? 0, 0, ',', '.')); ?></p>
            <p class="text-xs text-slate-500">Transaksi <?php echo e(number_format($data['sysreflex']['transaction_count'] ?? 0, 0, ',', '.')); ?> · Margin Rp <?php echo e(number_format($data['sysreflex']['margin_after_commission'] ?? 0, 0, ',', '.')); ?></p>
        </div>
    </div>

    <div class="space-y-10">
        <section class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
            <div class="border-b border-slate-100 bg-sky-50/50 px-4 py-3 md:px-5">
                <h2 class="text-sm font-semibold text-sky-900">SysOrder — per outlet</h2>
                <p class="text-xs text-slate-600">Total <?php echo e($outletPaginator->total()); ?> outlet · halaman outlet <?php echo e($outletPaginator->currentPage()); ?>/<?php echo e(max(1, $outletPaginator->lastPage())); ?>.</p>
            </div>
            <?php if($outletPaginator->total() > 0): ?>
                <div class="overflow-x-auto">
                    <table class="min-w-full text-sm">
                        <thead class="bg-slate-50 text-left text-xs uppercase text-slate-600">
                            <tr>
                                <th class="px-4 py-3">Outlet</th>
                                <th class="px-4 py-3 text-right">Order</th>
                                <th class="px-4 py-3 text-right">Revenue</th>
                                <th class="px-4 py-3 text-right">COGS</th>
                                <th class="px-4 py-3 text-right">Laba kotor</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-slate-100">
                            <?php $__currentLoopData = $outletPaginator; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr class="hover:bg-slate-50/80">
                                    <td class="px-4 py-2.5 font-medium text-slate-800"><?php echo e($row['outlet_name'] ?? '—'); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums"><?php echo e(number_format($row['order_count'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums">Rp <?php echo e(number_format($row['revenue'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums text-slate-600">Rp <?php echo e(number_format($row['cogs'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums font-medium text-emerald-700">Rp <?php echo e(number_format($row['gross_profit'] ?? 0, 0, ',', '.')); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
                <div class="border-t border-slate-100 px-4 py-3">
                    <?php echo e($outletPaginator->withQueryString()->links('vendor.pagination.tailwind')); ?>

                </div>
            <?php else: ?>
                <div class="px-4 py-8 text-center text-sm text-slate-500">Tidak ada baris per outlet.</div>
            <?php endif; ?>
        </section>

        <section class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
            <div class="border-b border-slate-100 bg-sky-50/50 px-4 py-3 md:px-5">
                <h2 class="text-sm font-semibold text-sky-900">SysOrder — detail harian</h2>
                <p class="text-xs text-slate-600">Total <?php echo e($fnbDailyPaginator->total()); ?> baris tanggal · halaman <?php echo e($fnbDailyPaginator->currentPage()); ?>/<?php echo e(max(1, $fnbDailyPaginator->lastPage())); ?>.</p>
            </div>
            <?php if($fnbDailyPaginator->total() > 0): ?>
                <div class="overflow-x-auto">
                    <table class="min-w-full text-sm">
                        <thead class="bg-slate-50 text-left text-xs uppercase text-slate-600">
                            <tr>
                                <th class="px-4 py-3">Tanggal</th>
                                <th class="px-4 py-3 text-right">Order</th>
                                <th class="px-4 py-3 text-right">Revenue</th>
                                <th class="px-4 py-3 text-right">COGS</th>
                                <th class="px-4 py-3 text-right">Laba kotor</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-slate-100">
                            <?php $__currentLoopData = $fnbDailyPaginator; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr class="hover:bg-slate-50/80">
                                    <td class="px-4 py-2.5 text-slate-800"><?php echo e($d['date']); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums"><?php echo e(number_format($d['order_count'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums">Rp <?php echo e(number_format($d['revenue'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums text-slate-600">Rp <?php echo e(number_format($d['cogs'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums font-medium text-emerald-700">Rp <?php echo e(number_format($d['gross_profit'] ?? 0, 0, ',', '.')); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
                <div class="border-t border-slate-100 px-4 py-3">
                    <?php echo e($fnbDailyPaginator->withQueryString()->links('vendor.pagination.tailwind')); ?>

                </div>
            <?php else: ?>
                <div class="px-4 py-8 text-center text-sm text-slate-500">Tidak ada harian SysOrder.</div>
            <?php endif; ?>
        </section>

        <section class="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
            <div class="border-b border-slate-100 bg-violet-50/50 px-4 py-3 md:px-5">
                <h2 class="text-sm font-semibold text-violet-900">Refleksologi — detail harian</h2>
                <p class="text-xs text-slate-600">Total <?php echo e($reflexDailyPaginator->total()); ?> baris tanggal · halaman <?php echo e($reflexDailyPaginator->currentPage()); ?>/<?php echo e(max(1, $reflexDailyPaginator->lastPage())); ?>.</p>
            </div>
            <?php if($reflexDailyPaginator->total() > 0): ?>
                <div class="overflow-x-auto">
                    <table class="min-w-full text-sm">
                        <thead class="bg-slate-50 text-left text-xs uppercase text-slate-600">
                            <tr>
                                <th class="px-4 py-3">Tanggal</th>
                                <th class="px-4 py-3 text-right">Transaksi</th>
                                <th class="px-4 py-3 text-right">Omzet</th>
                                <th class="px-4 py-3 text-right">Komisi</th>
                                <th class="px-4 py-3 text-right">Margin</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-slate-100">
                            <?php $__currentLoopData = $reflexDailyPaginator; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr class="hover:bg-slate-50/80">
                                    <td class="px-4 py-2.5 text-slate-800"><?php echo e($d['date'] ?? '—'); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums"><?php echo e(number_format($d['transaction_count'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums">Rp <?php echo e(number_format($d['gross_revenue'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums text-slate-600">Rp <?php echo e(number_format($d['total_commission'] ?? 0, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-2.5 text-right tabular-nums font-medium text-emerald-700">Rp <?php echo e(number_format($d['margin_after_commission'] ?? 0, 0, ',', '.')); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
                <div class="border-t border-slate-100 px-4 py-3">
                    <?php echo e($reflexDailyPaginator->withQueryString()->links('vendor.pagination.tailwind')); ?>

                </div>
            <?php else: ?>
                <div class="px-4 py-8 text-center text-sm text-slate-500">Tidak ada harian refleksologi.</div>
            <?php endif; ?>
        </section>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.portal', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\sysorder\resources\views/owner/reports/sources.blade.php ENDPATH**/ ?>