@if($isReceived)
Received ({{ $relatedReceivings->count() }})
@else
Not Received
@endif
@if($isReceived)
@endif
@if($ptc->stock_status == 6)
Add Receiving
@endif
@if(!$isReceived)
{{-- Edit button only visible for issuances that have NOT been received yet --}}
@if($issuance->is_ptc_master == 1)
Edit
@else
Edit
@endif
@endif
@empty
No issuance records yet.
@endforelse
@if($movements && $movements->count() > 0)
Complete Movement History
Sr.
Reference
Type
Stage
Date
By
Actions
@php
// Build a map of issuance stock_ids to their sequence numbers
$issuanceSeqMap = [];
foreach($issuances as $idx => $iss) {
$issuanceSeqMap[$iss->stock_id] = str_pad($idx + 1, 3, '0', STR_PAD_LEFT);
}
@endphp
@foreach($movements as $index => $movement)
@php
// Format display reference based on type
if ($movement->is_ptc_master == 1) {
$displayRef = 'PTC-' . $ptc->stock_no . ' / I001';
} elseif ($movement->stock_type == 2) {
// Issuance - find sequence from map
$issSeq = $issuanceSeqMap[$movement->stock_id] ?? $movement->stock_no;
$displayRef = 'PTC-' . $ptc->stock_no . ' / I' . $issSeq;
} else {
// Receiving - use stored format directly (R{n}-I{seq})
$displayRef = 'PTC-' . $ptc->stock_no . ' / ' . $movement->stock_no;
}
@endphp