@php
    $isPosted = $receipt->status === 'posted';
@endphp

@if ($isPosted)
    <div class="alert alert-success d-flex align-items-center gap-2 small">
        <span class="fe fe-lock"></span>
        <span>{{ __('inventory.operations.immutable_posted') }} @if ($receipt->posted_at) — {{ $receipt->posted_at }} @endif</span>
    </div>
@endif

<h5 class="h6">{{ __('procurement.receipts.lines') }}</h5>
<x-ui.table.table :columns="[
    ['label' => __('inventory.items.fields.sku')],
    ['label' => __('procurement.receipts.qty_received')],
    ['label' => __('inventory.operations.quarantine')],
    ['label' => __('procurement.receipts.integrity')],
]">
    @foreach ($receipt->items as $line)
        <x-ui.table.row class="{{ $line->quarantined_at ? 'table-warning' : '' }}">
            <td>{{ $line->purchaseOrderItem?->inventoryItem?->sku ?? '—' }}</td>
            <td>{{ $line->quantity_received }}</td>
            <td>
                @if ($line->quarantined_at)
                    <x-ui.operational.status-badge :label="(string) $line->quarantined_at" variant="warning" />
                @else
                    —
                @endif
            </td>
            <td>{{ $line->integrity_violation_code ?? '—' }}</td>
        </x-ui.table.row>
    @endforeach
</x-ui.table.table>

@if ($isPosted)
    <p class="small text-muted mt-3 mb-0">{{ __('inventory.visibility.notice') }}</p>
@endif
