@php $allowedIds = !empty($allowedUomIdsCsv) ? collect(explode(',', $allowedUomIdsCsv))->map(fn($x)=> (int)trim($x))->filter()->all() : []; $allowedUoms = !empty($allowedIds) ? collect($uoms ?? [])->filter(fn($u)=> in_array((int)$u->id, $allowedIds, true))->values() : collect($uoms ?? [])->take(1); $allowedCodesHint = !empty($allowedIds) ? $allowedUoms->pluck('uom_code')->implode(', ') : ''; @endphp
You can enter opening stock in multiple UOMs. Leave any row blank to skip.@if(!empty($allowedCodesHint)) Allowed for stock: {{ $allowedCodesHint }}.@endif
@php $baseObj = collect($uoms ?? [])->firstWhere('uom_code', $baseUomCode ?? null); $baseId = $baseObj->id ?? null; // Exclude base UOM from the remaining list to avoid duplicate row $restUoms = ($allowedUoms ?? collect())->filter(fn($u) => (int)$u->id !== (int)$baseId)->values(); @endphp
@if($baseObj)
@endif @forelse($allowedUoms as $idx => $au) @continue((int)$au->id === (int)$baseId)
@empty
No UOMs configured.
@endforelse
{{-- No base quantity calculation; stays flexible as requested --}}
{{-- JS moved to Opening Stock page; this partial is markup-only. --}}