@php
$paperSize = $paperSize ?? request('paper', 'a4');
if (!in_array($paperSize, ['a4', 'a5', '215x165'], true)) {
$paperSize = 'a4';
}
$pageCss = match ($paperSize) {
'a5' => 'size: A5 portrait; margin: 9mm;',
'215x165' => 'size: 215mm 165mm; margin: 7mm;',
default => 'size: A4 portrait; margin: 12mm 14mm;',
};
$bodyFontSize = match ($paperSize) {
'a5' => '12px',
'215x165' => '12px',
default => '14px',
};
$logoMaxWidth = match ($paperSize) {
'a5' => '125px',
'215x165' => '130px',
default => '165px',
};
$logoMaxHeight = match ($paperSize) {
'a5' => '58px',
'215x165' => '60px',
default => '78px',
};
$tableFontSize = match ($paperSize) {
'a5' => '11px',
'215x165' => '11px',
default => '13px',
};
$tableCellHeight = match ($paperSize) {
'a5' => '24px',
'215x165' => '23px',
default => '28px',
};
$signatureHeight = match ($paperSize) {
'a5' => '45px',
'215x165' => '42px',
default => '72px',
};
$minRows = match ($paperSize) {
'a5' => 7,
'215x165' => 6,
default => 10,
};
@endphp
@php
$items = collect($order->items ?? []);
$blankRows = max($minRows - $items->count(), 0);
$vehicleName = $deliveryNote->vehicle_name ?: optional($deliveryNote->vehicle)->name ?: 'Kendaraan';
$plateNumber = $deliveryNote->plate_number ?: optional($deliveryNote->vehicle)->plate_number ?: 'Plat No';
$recipientName = $deliveryNote->recipient_name ?: ($order->customer_name ?? 'INSTANSI');
$paperLabel = match ($paperSize) {
'a5' => 'A5',
'215x165' => '21,5 × 16,5 cm',
default => 'A4',
};
$logoSrc = '';
if (!empty($shopLogo)) {
if (str_starts_with($shopLogo, 'http://') || str_starts_with($shopLogo, 'https://') || str_starts_with($shopLogo, '/') || str_starts_with($shopLogo, 'data:image')) {
$logoSrc = $shopLogo;
} else {
$logoSrc = asset('storage/' . ltrim($shopLogo, '/'));
}
}
@endphp
Ukuran: {{ $paperLabel }}
SURAT JALAN No.
{{ $deliveryNote->number }}
Kami kirimkan barang - barang tersebut dibawah ini dengan kendaraan
{{ $vehicleName }}
No.
{{ $plateNumber }}
| QUANTITY |
RINCIAN |
@forelse($items as $item)
@php
$qty = (float) ($item->qty ?? 0);
$qtyText = $qty > 0 ? rtrim(rtrim(number_format($qty, 2, ',', '.'), '0'), ',') : '-';
$desc = collect([
$item->product_name ?? null,
!empty($item->file_name) ? 'File: ' . $item->file_name : null,
!empty($item->size_description) ? 'Ukuran: ' . $item->size_description : null,
!empty($item->material_name) ? 'Bahan: ' . $item->material_name : null,
!empty($item->finishing_note) ? 'Finishing: ' . $item->finishing_note : null,
])->filter()->implode(' | ');
@endphp
| {{ $qtyText }} |
{{ $desc ?: '-' }} |
@empty
| |
|
@endforelse
@for($i = 0; $i < $blankRows; $i++)
| |
|
@endfor
@if($deliveryNote->notes)
Catatan: {{ $deliveryNote->notes }}
@endif
| Tanda Terima |
Hormat Kami, |
|
|
| (................................) |
{{ $shopName ?? config('app.name') }} |
@if(!empty($shopAddress) || !empty($shopPhone))
@endif