

<?php $__env->startSection('title', 'Layanan refleksologi — '.config('portal.product_line')); ?>
<?php $__env->startSection('page_heading', 'Laporan — Layanan teratas'); ?>
<?php $__env->startSection('page_subheading', 'Layanan diurutkan omzet pada periode terpilih. Data dari sysReflex.'); ?>

<?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="overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm">
        <div class="border-b border-slate-100 px-4 py-3 md:px-5">
            <h2 class="text-sm font-semibold text-slate-900">Detail layanan</h2>
            <p class="mt-0.5 text-xs text-slate-500">Total <?php echo e($servicesPaginator->total()); ?> layanan · halaman <?php echo e($servicesPaginator->currentPage()); ?> dari <?php echo e(max(1, $servicesPaginator->lastPage())); ?>.</p>
        </div>
        <?php if($servicesPaginator->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">#</th>
                            <th class="px-4 py-3">Nama layanan</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 = $servicesPaginator; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $idx => $sv): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr class="hover:bg-slate-50/80">
                                <td class="px-4 py-2.5 tabular-nums text-slate-500"><?php echo e($servicesPaginator->firstItem() + $idx); ?></td>
                                <td class="px-4 py-2.5 font-medium text-slate-800"><?php echo e($sv['service_name'] ?? '—'); ?></td>
                                <td class="px-4 py-2.5 text-right tabular-nums"><?php echo e(number_format($sv['transaction_count'] ?? 0, 0, ',', '.')); ?></td>
                                <td class="px-4 py-2.5 text-right tabular-nums">Rp <?php echo e(number_format($sv['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($sv['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($sv['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($servicesPaginator->withQueryString()->links('vendor.pagination.tailwind')); ?>

            </div>
        <?php else: ?>
            <div class="px-4 py-10 text-center text-sm text-slate-500">Tidak ada data layanan. Pastikan sysReflex sudah menyertakan top_services di API owner summary.</div>
        <?php endif; ?>
    </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/services.blade.php ENDPATH**/ ?>