@extends('layouts.app') @section('content') {{-- Flash Messages --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Stat Cards --}}
{{-- Orders Table --}}

{{ ($currentTab ?? 'active') === 'history' ? 'Daftar Pembayaran Lunas' : 'Daftar Tagihan' }}

{{-- Customer Filter --}}
@forelse($orders as $order) @php $age = (int) floor($order->created_at->diffInDays(now())); $ageClass = $age > 30 ? 'text-error-600 bg-error-50' : ($age > 7 ? 'text-warning-600 bg-warning-50' : 'text-gray-600 bg-gray-100'); $totalPaid = $order->getTotalPaid(); $remaining = $order->getRemainingBalance(); @endphp @if($order->payments->count() > 0) @php $paymentData = $order->payments->map(fn($p) => [ 'id' => $p->id, 'date' => $p->created_at->format('d/m/Y H:i'), 'amount' => $p->amount, 'method' => $p->payment_method, 'proof' => $p->proof_path ? asset('storage/' . $p->proof_path) : null, 'notes' => $p->notes, 'cashier' => $p->cashier->name ?? '-' ])->values()->toJson(); @endphp @else @endif @empty @endforelse @if($orders->count() > 0) @endif {{-- Floating Selection Bar --}}
Tanggal Invoice Pelanggan Total Dibayar Sisa Umur Aksi
{{ $order->created_at->format('d/m/Y') }} {{ $order->invoice_number }} @if($order->is_credit) Piutang @endif @if($order->isPartiallyPaid()) Cicilan @endif Rp {{ number_format($order->total_price, 0, ',', '.') }} -Rp {{ number_format($remaining, 0, ',', '.') }} {{ $age }} hari
@if(($currentTab ?? 'active') === 'active') @else @endif

Tidak ada tagihan! 🎉

Total Piutang Rp {{ number_format($summary['total_receivables'], 0, ',', '.') }}
@if($orders->hasPages())
{{ $orders->links() }}
@endif
{{-- Payment Dialog --}} {{-- Payment History Dialog --}} {{-- Batch Payment Dialog --}} @endsection @push('scripts') @endpush