@if($viewMode === 'list')

📦 Penjualan Backoffice

Riwayat dan pencatatan transaksi penjualan umum (Non-POS) dan kemitraan Bebek Mba Reina.

@if($successMessage)
✅ {{ $successMessage }}
@endif @if($errorMessage)
⚠️ {{ $errorMessage }}
@endif
@forelse($historySales as $sale) @php $sisaTagihan = max(0, $sale->grand_total - $sale->paid_amount); @endphp @empty @endforelse
TANGGAL NO. INVOICE CABANG PELANGGAN JATUH TEMPO TOTAL UANG MUKA / BAYAR SISA TAGIHAN STATUS AKSI
{{ date('d-m-Y', strtotime($sale->created_at)) }} {{ $sale->invoice_number }} {{ $sale->branch->name ?? 'Global' }} {{ $sale->customer->name ?? '-' }} {{ $sale->due_date ? date('d-m-Y', strtotime($sale->due_date)) : 'COD' }} Rp {{ number_format($sale->grand_total, 0, ',', '.') }} Rp {{ number_format($sale->paid_amount, 0, ',', '.') }} Rp {{ number_format($sisaTagihan, 0, ',', '.') }} @if($sale->payment_status === 'paid') LUNAS @elseif($sale->payment_status === 'partially_paid') CICIL / SEBAGIAN @else BELUM BAYAR @endif
Belum ada transaksi penjualan umum (Non-POS) terdaftar.
TOTAL SELURUH HALAMAN: {{ number_format($summary['grand_total'], 0, ',', '.') }} {{ number_format($summary['paid_amount'], 0, ',', '.') }} {{ number_format($summary['sisa_tagihan'], 0, ',', '.') }}
@if($historySales->hasPages())
{{ $historySales->links() }}
@endif
@elseif($viewMode === 'form')

{{ $editSaleId ? '✍️ Edit Penjualan Backoffice' : '✍️ Input Penjualan Backoffice' }}

{{ $editSaleId ? 'Edit dan perbarui data transaksi penjualan yang sudah tercatat.' : 'Catat transaksi penjualan manual lengkap dengan termin jatuh tempo pembayaran.' }}

@if($errorMessage)
⚠️ {{ $errorMessage }}
@endif

📌 DETAIL INFORMASI NOTA

{{ date('d-m-Y', strtotime($due_date)) }}

🛒 DAFTAR ITEM PRODUK

@foreach($items as $index => $item)
Rp {{ number_format($item['total'], 0, ',', '.') }}
@if(count($items) > 1) @endif
@endforeach

📊 RINGKASAN & BIAYA TAMBAHAN

Subtotal Menu: Rp {{ number_format($this->subtotal, 0, ',', '.') }}
Potongan Diskon Item: - Rp {{ number_format($this->itemDiscount, 0, ',', '.') }}
Tambahan Diskon Nota: - Rp {{ number_format($additional_discount, 0, ',', '.') }}
Biaya Kirim & Transaksi: + Rp {{ number_format((float)$shipping_fee + (float)$service_charge, 0, ',', '.') }}
TOTAL PIUTANG PENJUALAN: Rp {{ number_format($this->grandTotal - $this->pemotongan, 0, ',', '.') }}
@elseif($viewMode === 'detail' && $detailSale) @php $sisaTagihan = max(0, $detailSale->grand_total - $detailSale->paid_amount); @endphp

📄 Detail Penjualan #{{ $detailSale->invoice_number }}

Tanggal: {{ date('d M Y H:i', strtotime($detailSale->created_at)) }} | Cabang: {{ $detailSale->branch->name ?? 'Global' }}

@if($successMessage)
✅ {{ $successMessage }}
@endif @if($errorMessage)
⚠️ {{ $errorMessage }}
@endif

Pelanggan

{{ $detailSale->customer->name ?? '-' }}

Status Pembayaran

@if($detailSale->payment_status === 'paid' || $sisaTagihan <= 0) LUNAS @elseif($detailSale->payment_status === 'partially_paid') CICIL / SEBAGIAN @else BELUM BAYAR @endif

Jatuh Tempo

{{ $detailSale->due_date ? date('d M Y', strtotime($detailSale->due_date)) : 'COD' }}

🛒 Rincian Item

@foreach($detailSale->items as $item) @endforeach
Produk Harga Qty Diskon Subtotal
{{ $item->product->name ?? 'Unknown' }} Rp {{ number_format($item->price, 0, ',', '.') }} {{ $item->quantity }} Rp {{ number_format($item->discount_amount, 0, ',', '.') }} Rp {{ number_format(($item->price * $item->quantity) - $item->discount_amount, 0, ',', '.') }}
@if($sisaTagihan > 0)

💸 CATAT PENERIMAAN PEMBAYARAN

@endif

Ringkasan Tagihan

Total Harga Item Rp {{ number_format($detailSale->subtotal, 0, ',', '.') }}
Total Diskon -Rp {{ number_format($detailSale->discount_amount, 0, ',', '.') }}
Layanan/Kirim Rp {{ number_format($detailSale->service_charge, 0, ',', '.') }}
Pajak (Tax) Rp {{ number_format($detailSale->tax_amount, 0, ',', '.') }}
GRAND TOTAL Rp {{ number_format($detailSale->grand_total, 0, ',', '.') }}
Total Dibayar Rp {{ number_format($detailSale->paid_amount, 0, ',', '.') }}
SISA PIUTANG Rp {{ number_format($sisaTagihan, 0, ',', '.') }}
@endif