@php $record = $getRecord(); $items = $record->items; $count = $items->count(); $uid = 'oit-' . $record->id; // --- Order Info Bar --- $customerName = e($record->customer_name ?: 'Walk-in'); $orderTime = $record->created_at ? $record->created_at->format('d M Y, H:i') : '-'; $statusLabel = match($record->status) { 'pending' => 'Menunggu', 'processing' => 'Diproses', 'completed' => 'Selesai', 'cancelled' => 'Dibatalkan', default => $record->status, }; $statusBg = match($record->status) { 'pending' => '#FEF3C7', 'processing' => '#DBEAFE', 'completed' => '#D1FAE5', 'cancelled' => '#FEE2E2', default => '#F3F4F6', }; $statusColor = match($record->status) { 'pending' => '#92400E', 'processing' => '#1E40AF', 'completed' => '#065F46', 'cancelled' => '#991B1B', default => '#374151', }; $methodLabel = match($record->payment_method) { 'cash' => 'Tunai', 'transfer' => 'Transfer', 'qris' => 'QRIS', default => $record->payment_method, }; $payLabel = $record->payment_status === 'paid' ? 'Lunas' : 'Belum Bayar'; $payBg = $record->payment_status === 'paid' ? '#D1FAE5' : '#FEE2E2'; $payColor = $record->payment_status === 'paid' ? '#065F46' : '#991B1B'; // Build info bar HTML $html = '
'; // Pelanggan $html .= '
Pelanggan: ' . $customerName . '
'; // Waktu $html .= '
Waktu: ' . $orderTime . '
'; // Status $html .= '
Status: ' . $statusLabel . '
'; // Pembayaran $html .= '
Bayar: ' . $payLabel . ''; $html .= ' via ' . $methodLabel . '
'; $html .= '
'; // --- Items Table --- $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ($items as $index => $item) { $borderStyle = $index > 0 ? 'border-top:1px solid #F3E8D0;' : ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; // Subtotal $html .= ''; $html .= ''; // Pajak $html .= ''; $html .= ''; // Diskon if ($record->discount > 0) { $html .= ''; $html .= ''; } // Total $html .= ''; $html .= ''; // Modal if ($record->total_cost > 0) { $profit = $record->total - $record->total_cost; $html .= ''; $html .= ''; // Laba $profitColor = $profit >= 0 ? '#059669' : '#DC2626'; $html .= ''; $html .= ''; } $html .= '
ProdukQtyHargaSubtotal
' . e($item->product_name); if ($item->notes) { $html .= ' (' . e($item->notes) . ')'; } $html .= '' . $item->quantity . 'Rp ' . number_format($item->product_price, 0, ',', '.') . 'Rp ' . number_format($item->subtotal, 0, ',', '.') . '
SubtotalRp ' . number_format($record->subtotal, 0, ',', '.') . '
Pajak (PPN 11%)Rp ' . number_format($record->tax, 0, ',', '.') . '
Diskon- Rp ' . number_format($record->discount, 0, ',', '.') . '
TotalRp ' . number_format($record->total, 0, ',', '.') . '
Modal BahanRp ' . number_format($record->total_cost, 0, ',', '.') . '
Laba KotorRp ' . number_format($profit, 0, ',', '.') . '
'; $encodedHtml = base64_encode($html); @endphp