<div class="p-4">
    <h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
        PENDING INVOICE DATA TABLE:
    </h2>
    <div class="overflow-x-auto rounded-lg shadow">
        <table class="w-full divide-y divide-gray-200 text-sm text-center">
            <thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
                <tr>
                    <th class="border px-4 py-2">No</th>
                    <th class="border px-4 py-2">Plant Code</th>
                    <th class="border px-4 py-2">Document Number</th>
                    <th class="border px-4 py-2">Customer Trade Location</th>
                    <th class="border px-4 py-2">Location</th>
                    <th class="border px-4 py-2">Remark</th>
                </tr>
            </thead>
            <tbody class="divide-y divide-gray-100">
                 @if (empty($invoicePending))
                    <tr>
                        <td colspan="6" class="px-4 py-4 text-center text-gray-500">
                            Please select plant to load pending invoice.
                        </td>
                    </tr>
                @else
                @forelse ($invoicePending as $index => $locator)
                    <tr class="hover:bg-gray-50">
                        <td class="border px-4 py-2">{{ $index + 1 }}</td>
                        <td class="border px-4 py-2 whitespace-nowrap">{{ $locator['plant_id'] ?? '-' }}</td>
                        <td class="border px-4 py-2 whitespace-nowrap">{{ $locator['document_number'] ?? '-' }}</td>
                        <td class="border px-4 py-2">{{ $locator['customer_trade_name'] ?? '-' }}</td>
                        <td class="border px-4 py-2 whitespace-nowrap">{{ $locator['location'] ?? '-' }}</td>
                        <td class="border px-4 py-2 whitespace-nowrap">{{ $locator['remark'] ?? '-' }}</td>
                    </tr>
                @empty
                    <tr>
                        <td colspan="9" class="px-4 py-4 text-center text-gray-500">
                            No invoice pending records found.
                        </td>
                    </tr>
                @endforelse
                @endif
            </tbody>
        </table>
    </div>
</div>
