@php $order = $this->record; $items = $this->getOrderItems(); $searchResults = $this->getSearchResults(); $customer = $order->customer; $customers = $this->getCustomers(); $isCompleted = $order->status === 'completed'; $isCancelled = $order->status === 'cancelled'; $isLocked = $isCompleted || $isCancelled; @endphp
{{-- Header --}}

Form Pesanan

@if(!$isLocked) @else SELESAI @endif
{{-- Order Info --}}
{{ $order->order_number }}
{{ $order->created_at->format('d/m/Y') }}
@php $statusColor = match($order->status) { 'pending' => ['bg' => '#FEF3C7', 'border' => '#FCD34D', 'text' => '#92400E'], 'processing' => ['bg' => '#DBEAFE', 'border' => '#93C5FD', 'text' => '#1E40AF'], 'completed' => ['bg' => '#ECFDF5', 'border' => '#A7F3D0', 'text' => '#059669'], 'cancelled' => ['bg' => '#FEF2F2', 'border' => '#FECACA', 'text' => '#DC2626'], default => ['bg' => '#F9FAFB', 'border' => '#E5E7EB', 'text' => '#111827'], }; $statusLabel = match($order->status) { 'pending' => 'Menunggu', 'processing' => 'Diproses', 'completed' => 'Selesai', 'cancelled' => 'Dibatalkan', default => $order->status, }; @endphp
{{ $statusLabel }}
{{ $customer?->name ?? 'Umum' }}
@if(!$isLocked)
@else
{{ match($order->payment_method) { 'cash' => 'Tunai', 'transfer' => 'Transfer Bank', 'qris' => 'QRIS', default => $order->payment_method } }} — {{ match($order->payment_status) { 'paid' => 'Lunas', 'partial' => 'Sebagian', 'unpaid' => 'Belum Bayar', default => $order->payment_status } }}
@endif
@if(!$isLocked) @else
{{ $order->due_date ? $order->due_date->format('d/m/Y') : '-' }}
@endif
{{-- Search Product --}}
status === 'completed' ? 'disabled' : '' }} />
{{-- Search Results Dropdown --}} @if(count($searchResults) > 0)
@foreach($searchResults as $product) @endforeach
@endif
{{-- Items Table - Desktop --}}
@forelse($items as $idx => $item) @php $costPerUnit = (float) ($item->product?->cost_per_unit ?? 0); $sellingPrice = (float) $item->product_price; $isBelowCost = $sellingPrice > 0 && $costPerUnit > 0 && $sellingPrice < $costPerUnit; $isZeroPrice = $sellingPrice <= 0; $isValidated = (bool) $item->is_validated; $rowBg = $isValidated ? '#F0FDF4' : ($isZeroPrice ? '#FEF2F2' : ($isBelowCost ? '#FFFBEB' : 'transparent')); @endphp @empty @endforelse
NO NAMA PRODUK SKU SATUAN HARGA MODAL HARGA JUAL QTY DISKON SUBTOTAL CEK HAPUS
{{ $idx + 1 }} {{ $item->product_name }} @if($isZeroPrice && !$isValidated)
Harga jual belum diisi!
@elseif($isBelowCost && !$isValidated)
Harga di bawah modal!
@endif @if((float) $item->qty_returned > 0)
Retur: {{ (int) $item->qty_returned }}
@endif
{{ $item->product?->sku ?? '-' }} {{ $item->product?->unit ?? 'pcs' }} Rp {{ number_format((int) ($item->product?->cost_per_unit ?? 0), 0, ',', '.') }} @if(!$isLocked && !$isValidated) @else Rp {{ number_format((int) $item->product_price, 0, ',', '.') }} @endif @if(!$isLocked && !$isValidated) @else {{ (int) $item->quantity - (int) $item->qty_returned }} @endif @if(!$isLocked && !$isValidated)
%
@else {{ (float) $item->discount }}% @endif
@php $effectiveQty = (int) $item->quantity - (int) $item->qty_returned; $effectiveSubtotal = (float) $item->qty_returned > 0 ? $effectiveQty * (float) $item->product_price : (float) $item->subtotal; @endphp Rp {{ number_format((int) $effectiveSubtotal, 0, ',', '.') }} @if($isLocked) @if($isValidated) VALID @else CHECK @endif @elseif($isValidated) @else @endif @if($isLocked) @elseif(!$isValidated) @else @endif
Belum ada item. Cari produk di atas untuk menambahkan.
{{-- Items - Mobile Card View --}} {{-- Summary Footer --}}
{{-- Status Change Modal --}} {{-- SweetAlert2 (for delete confirm only) --}}