@php $colorMap = $colorCodes ?? []; @endphp @foreach($products as $productName => $productData) @php $items = $productData['items']; $activeSizes = $productData['active_sizes'] ?? []; $productTotalQty = $items->sum('quantity'); $uniqueColors = $items->pluck('color')->unique(); $currentSheet = $loop->iteration; $totalSheets = $totalProducts; $boxQuantity = $productData['box_quantity'] ?? 60; $totalBoxes = $productTotalQty > 0 ? ceil($productTotalQty / $boxQuantity) : 0; $productCode = $productData['product_code'] ?? 'N/A'; @endphp
Logo

Order Packing Sheet

Packing Now

{{ $productName }} ({{ $productCode }})

Sheet No {{ $currentSheet }} / {{ $totalSheets }}
Shipping To:
{{ $order->user->name ?? '' }}
{{ $order->user->company_name ?? '' }}
{{ admin_phone($order->user->phone_number ?? '') }}
{{ $order->user->complete_address ?? '' }}
Order ID : UF-{{ str_pad($order->id, 4, '0', STR_PAD_LEFT) }}
Booking Date : {{ date('F d, Y', strtotime($order->created_at)) }}
@if(count($activeSizes) > 0) @endif @foreach($activeSizes as $size) @endforeach @php $sr = 1; @endphp @foreach($uniqueColors as $color) @php $colorCode = $colorMap[$color] ?? '#000000'; @endphp @foreach($activeSizes as $size) @php $qty = $items->where('color', $color)->where('size', $size)->sum('quantity'); @endphp @endforeach @endforeach
Sr. ColorsSIZETotal
{{ $size }}
{{ str_pad($sr++, 2, '0', STR_PAD_LEFT) }} {{ $color }} @if($qty > 0) {{ $qty }} @else — @endif {{ $items->where('color', $color)->sum('quantity') }}
Order Summary:
@php $fullBoxes = $boxQuantity > 0 ? floor($productTotalQty / $boxQuantity) : 0; $remainder = $boxQuantity > 0 ? $productTotalQty % $boxQuantity : 0; @endphp
Logo Total Quantity of {{ $productName }}: {{ number_format($productTotalQty) }}
Box Capacity: {{ $boxQuantity }} pcs
@if($fullBoxes > 0)
Box 1—{{ $fullBoxes }}: {{ $boxQuantity }} pcs
@endif @if($remainder > 0)
Box {{ $fullBoxes + 1 }}: {{ str_pad($remainder, 2, '0', STR_PAD_LEFT) }} pcs
@endif
Logo Total Boxes: {{ $totalBoxes }}
Total Quantity of {{ $productName }}: {{ number_format($productTotalQty) }}
Total Number of Boxes: {{ str_pad($totalBoxes, 2, '0', STR_PAD_LEFT) }}
Packed By:

Name: __________     Sign: __________
Logo
@if($currentSheet < $totalSheets)
@endif @endforeach