@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 = '
| Produk | '; $html .= 'Qty | '; $html .= 'Harga | '; $html .= 'Subtotal | '; $html .= '
|---|---|---|---|
| ' . $item->quantity . ' | '; $html .= 'Rp ' . number_format($item->product_price, 0, ',', '.') . ' | '; $html .= 'Rp ' . number_format($item->subtotal, 0, ',', '.') . ' | '; $html .= '|
| Subtotal | '; $html .= 'Rp ' . number_format($record->subtotal, 0, ',', '.') . ' | ||
| Pajak (PPN 11%) | '; $html .= 'Rp ' . number_format($record->tax, 0, ',', '.') . ' | ||
| Diskon | '; $html .= '- Rp ' . number_format($record->discount, 0, ',', '.') . ' | ||
| Total | '; $html .= 'Rp ' . number_format($record->total, 0, ',', '.') . ' | ||
| Modal Bahan | '; $html .= 'Rp ' . number_format($record->total_cost, 0, ',', '.') . ' | ||
| Laba Kotor | '; $html .= 'Rp ' . number_format($profit, 0, ',', '.') . ' | ||