@php $cols = $sizeConfig['cols']; $rows = $sizeConfig['rows']; $inset = $sizeConfig['inset'] ?? 1.5; $safeWidth = $sizeConfig['w'] - ($inset * 2); $safeHeight = $sizeConfig['h'] - ($inset * 2); $skip = $skip ?? 0; $piecesPerPack = $piecesPerPack ?? null; $totalPages = (int) max(1, ceil(($totalStickers + $skip) / $perPage)); $brandLogoPath = public_path('build/custom/khayl-logo.png'); $hasBrandLogo = file_exists($brandLogoPath); $productImagePath = $product->image_path ? public_path('storage/' . $product->image_path) : null; $hasProductImage = $productImagePath && file_exists($productImagePath); @endphp {{-- Client 24L sticker sheet: 3 across x 8 down. Label and pitch 66.252 x 34.008mm. Top margin 12.506mm, left margin 6.244mm. Dompdf has no CSS grid, so each sticker is absolutely positioned to land exactly on the die-cut. --}} @php $idx = 0; @endphp @for($p = 0; $p < $totalPages; $p++)
@for($cell = 0; $cell < $perPage; $cell++) @php // Global cell number across the whole run, so the skip // only blanks cells at the very start of page 1. $globalCell = ($p * $perPage) + $cell; $show = $globalCell >= $skip && $idx < $totalStickers; $col = $cell % $cols; $row = intdiv($cell, $cols); $left = $sizeConfig['marginLeft'] + ($col * $sizeConfig['pitchX']); $top = $sizeConfig['marginTop'] + ($row * $sizeConfig['pitchY']); @endphp @if($show)
@if($hasBrandLogo) @else KHAYL @endif {{ $product->product_id }}
@if($hasProductImage) {{ $product->name }} @endif
{{ $product->name }}
@if($piecesPerPack)
{{ $piecesPerPack }} PCS
@endif
@php $idx++; @endphp @endif @endfor
@endfor