<form id="gr-bulk-form" method="post" class="visually-hidden erp-bulk-form" autocomplete="off">
    @csrf
    <input type="hidden" name="confirmation" id="gr-bulk-confirm" value="" required>
</form>

<x-ui.table.table :columns="[
    ['label' => '', 'align' => 'center'],
    ['label' => __('procurement.receipts.columns.id')],
    ['label' => __('procurement.receipts.columns.po')],
    ['label' => __('procurement.receipts.columns.warehouse')],
    ['label' => __('procurement.receipts.columns.status')],
    ['label' => __('procurement.bulk.inline_validate'), 'align' => 'center'],
    ['label' => __('common.view'), 'align' => 'end'],
]">
    @forelse ($receipts as $receipt)
        <x-ui.table.row>
            <td class="text-center">
                @if ($receipt->status === 'draft' && Gate::allows('transition', $receipt))
                    <input class="form-check-input erp-bulk-row" type="checkbox" form="gr-bulk-form" name="ids[]" value="{{ $receipt->id }}">
                @else
                    <span class="text-muted">—</span>
                @endif
            </td>
            <td>#{{ $receipt->id }}</td>
            <td>{{ $receipt->purchaseOrder?->po_number ?? '—' }}</td>
            <td>{{ $receipt->warehouse?->code ?? '—' }}</td>
            <td>
                <x-ui.operational.status-badge :label="$receipt->status" variant="neutral" />
            </td>
            <td class="text-center">
                @if ($receipt->status === 'draft' && Gate::allows('transition', $receipt))
                    <form method="post" action="{{ route('procurement.goods-receipts.validate.store', $receipt) }}" class="d-inline" data-operational-confirm="{{ __('procurement.receipts.actions.validate') }}">
                        @csrf
                        <button type="submit" class="btn btn-sm btn-outline-primary">{{ __('procurement.bulk.inline_validate') }}</button>
                    </form>
                @else
                    —
                @endif
            </td>
            <td class="text-end">
                <x-ui.buttons.secondary :href="route('procurement.goods-receipts.show', $receipt)">{{ __('common.view') }}</x-ui.buttons.secondary>
            </td>
        </x-ui.table.row>
    @empty
        <x-ui.table.row>
            <td colspan="7" class="p-0">
                <x-ui.operational.empty-state :title="__('operational_ui.index.empty_default')" />
            </td>
        </x-ui.table.row>
    @endforelse
</x-ui.table.table>
