@if(!$box || $box === 'all') @php $grouped = $packitems->groupBy('box'); @endphp @foreach($grouped as $boxNo => $items)

Sales Order Number: {{ $so_no }}

Box Number: {{ $boxNo }}

Date: {{ now()->format('d/m/Y') }}

Dimension: {{ $items->first()->dimension ?? '-' }}

Weight: {{ $items->first()->weight ?? '-' }}

Generated On: {{ now()->format('d/m/Y H:i:s') }}

@php $serial = 1; @endphp @foreach($items as $item) @php $itemsArray = json_decode($item->items, true); @endphp @if(is_array($itemsArray)) @foreach($itemsArray as $packItem) @php $itemData = json_decode($packItem, true); @endphp @endforeach @endif @endforeach
Serial No Item Name Quantity
{{ $serial++ }} {{ $itemData['item'] ?? 'N/A' }} {{ $itemData['qty'] ?? 'N/A' }}

@endforeach @else

Sales Order Number: {{ $so_no }}

Box Number: {{ $box }}

Date: {{ now()->format('d/m/Y') }}

Dimension: {{ $packitems->first()->dimension ?? '-' }}

Weight: {{ $packitems->first()->weight ?? '-' }}

Generated On: {{ now()->format('d/m/Y H:i:s') }}

@php $serial = 1; @endphp @foreach($packitems as $item) @php $itemsArray = json_decode($item->items, true); @endphp @if(is_array($itemsArray)) @foreach($itemsArray as $packItem) @php $itemData = json_decode($packItem, true); @endphp @endforeach @endif @endforeach
Serial No Item Name Quantity Dimension Weight
{{ $serial++ }} {{ $itemData['item'] ?? 'N/A' }} {{ $itemData['qty'] ?? 'N/A' }} {{ $item->dimension }} {{ $item->weight }}
@endif