@props(['orders', 'showDesigner' => true, 'showActions' => true, 'actions' => []])

<div class="overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.03]">
    <div class="overflow-x-auto">
        <table class="w-full">
            <thead>
                <tr class="border-b border-gray-200 dark:border-gray-800">
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">No. Invoice</th>
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">Pelanggan</th>
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">File</th>
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">Total</th>
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">Pembayaran</th>
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">Produksi</th>
                    @if($showActions)
                    <th class="px-5 py-3 text-left text-sm font-medium text-gray-500 dark:text-gray-400">Aksi</th>
                    @endif
                </tr>
            </thead>
            <tbody class="divide-y divide-gray-200 dark:divide-gray-800">
                @forelse($orders as $order)
                <tr class="hover:bg-gray-50 dark:hover:bg-white/[0.02]">
                    <td class="px-5 py-4">
                        <span class="text-sm font-medium text-gray-800 dark:text-white/90">{{ $order->invoice_number }}</span>
                        @if($showDesigner && $order->designer)
                        <br><span class="text-xs text-gray-500">{{ $order->designer->name }}</span>
                        @endif
                    </td>
                    <td class="px-5 py-4">
                        <span class="text-sm text-gray-800 dark:text-white/90">{{ $order->customer_name }}</span>
                        @if($order->customer_phone)
                        <br><span class="text-xs text-gray-500">{{ $order->customer_phone }}</span>
                        @endif
                    </td>
                    <td class="px-5 py-4">
                        <span class="text-sm font-medium text-gray-800 dark:text-white/90">{{ $order->file_name }}</span>
                        <br><span class="text-xs text-gray-500">{{ $order->size }} | {{ $order->qty }} pcs</span>
                    </td>
                    <td class="px-5 py-4">
                        <span class="text-sm font-medium text-gray-800 dark:text-white/90">Rp {{ number_format($order->total_price, 0, ',', '.') }}</span>
                    </td>
                    <td class="px-5 py-4">
                        <span class="inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium {{ $order->getPaymentStatusBadgeClass() }}">
                            {{ $order->getPaymentStatusLabel() }}
                        </span>
                    </td>
                    <td class="px-5 py-4">
                        <span class="inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium {{ $order->getProductionStatusBadgeClass() }}">
                            {{ $order->getProductionStatusLabel() }}
                        </span>
                    </td>
                    @if($showActions)
                    <td class="px-5 py-4">
                        <div class="flex items-center gap-2">
                            {{ $slot ?? '' }}
                        </div>
                    </td>
                    @endif
                </tr>
                @empty
                <tr>
                    <td colspan="{{ $showActions ? 7 : 6 }}" class="px-5 py-8 text-center text-sm text-gray-500 dark:text-gray-400">
                        Tidak ada data order
                    </td>
                </tr>
                @endforelse
            </tbody>
        </table>
    </div>
</div>
