@if(env('APP_DEMO', false))
DEMO MODE
/TRANSAKSI PALSU
@endif
@if(!empty($shopLogo)) {{ $shopName ?? 'Logo' }} @endif

SPK PRODUKSI

SURAT PERINTAH KERJA
{{ $order->invoice_number }}
Pelanggan
{{ $order->customer_name }}
@if(!empty($order->notes))
Catatan
{{ $order->notes }}
@endif @foreach($order->items as $index => $item) @php $unitRaw = strtolower(trim((string) ($item->size_unit ?? 'lembar'))); if ($unitRaw === 'm²') { $unitRaw = 'm2'; } if (in_array($unitRaw, ['pcs', 'pc', 'piece', 'sheet'])) { $unitRaw = 'lembar'; } $showSize = in_array($unitRaw, ['m2', 'meter', 'm'], true) && !empty($item->size_description); $showSisi = !in_array($unitRaw, ['m2', 'meter', 'm'], true); $qtyUnit = 'LEMBAR'; if ($unitRaw === 'meter' || $unitRaw === 'm') { $qtyUnit = 'METER'; } elseif ($unitRaw === 'm2') { $qtyUnit = 'M2'; } $meterValue = null; $m2Value = null; $sizeText = strtolower(trim((string) ($item->size_description ?? ''))); $sizeText = str_replace(['×', '*', ' '], ['x', 'x', ''], $sizeText); if (preg_match('/^(\d+(?:[.,]\d+)?)x(\d+(?:[.,]\d+)?)(cm|m)?$/', $sizeText, $matches)) { $a = (float) str_replace(',', '.', $matches[1]); $b = (float) str_replace(',', '.', $matches[2]); $suffix = $matches[3] ?? ''; if ($suffix === 'cm') { $aCm = $a; $bCm = $b; } elseif ($suffix === 'm') { $aCm = $a * 100; $bCm = $b * 100; } else { if ($a >= 10 && $b >= 10) { $aCm = $a; $bCm = $b; } else { $aCm = $a * 100; $bCm = $b * 100; } } if ($unitRaw === 'meter' || $unitRaw === 'm') { $meterResult = min($aCm, $bCm) / 100; $meterValue = rtrim(rtrim(number_format($meterResult, 4, ',', '.'), '0'), ',') . ' meter'; } if ($unitRaw === 'm2') { $m2Result = ($aCm * $bCm) / 10000; $m2Value = rtrim(rtrim(number_format($m2Result, 4, ',', '.'), '0'), ',') . ' m²'; } } if (($unitRaw === 'meter' || $unitRaw === 'm') && !$meterValue && !empty($item->size_value)) { $meterValue = rtrim(rtrim(number_format((float) $item->size_value, 4, ',', '.'), '0'), ',') . ' meter'; } if ($unitRaw === 'm2' && !$m2Value && !empty($item->size_value)) { $m2Value = rtrim(rtrim(number_format((float) $item->size_value, 4, ',', '.'), '0'), ',') . ' m²'; } @endphp
ITEM {{ $index + 1 }}
{{ $item->file_name }}
Produk {{ $item->product_name }}
@if($item->material_name)
Bahan {{ $item->material_name }}
@endif @if($showSize)
Ukuran {{ $item->size_description }}
@endif @if(!empty($meterValue))
Pakai {{ $meterValue }}
@endif @if(!empty($m2Value))
Luas {{ $m2Value }}
@endif @if($showSisi)
Sisi @if(($item->sisi ?? 1) == 2) {{ $item->sisi ?? 1 }} SISI @else {{ $item->sisi ?? 1 }} SISI @endif
@endif
Qty {{ $item->qty }} {{ $qtyUnit }}
@if($item->finishing_note)
Finishing
{{ $item->finishing_note }}
@endif
@endforeach