@extends('layouts.app') @section('title', 'Recent Transactions') @section('content')
@if($sales->isEmpty()) @else @foreach($sales as $sale) @endforeach @endif
Invoice # Products Qty Date & Time Customer Payment Total Amount Actions

No recent transactions found

#{{ $sale->invoice_no }} @if($sale->items && $sale->items->count() > 0)
{{ $sale->items->take(2)->map(function($item) { return $item->product ? $item->product->name : $item->name; })->implode(', ') }} @if($sale->items->count() > 2) +{{ $sale->items->count() - 2 }} more @endif
@else No items @endif
{{ $sale->items ? $sale->items->sum('quantity') : 0 }} {{ $sale->created_at ? $sale->created_at->format('d M Y, H:i') : '' }} {{ $sale->customer_name ?? 'Walk-In Customer' }} @if($sale->payment_method === 'split')
Split Payment @if($sale->payments && $sale->payments->count() > 0) @foreach($sale->payments as $payment) {{ ucwords(str_replace('_', ' ', $payment->method)) }} ({{ number_format($payment->amount, 0) }}){{ !$loop->last ? ', ' : '' }} @endforeach @endif
@else @php $methodName = str_replace('_', ' ', $sale->payment_method ?? 'Cash'); $methodName = ucwords($methodName); @endphp {{ $methodName }} @endif
MWK {{ number_format($sale->total_amount ?? 0, 2) }}
@csrf @method('DELETE')
@if($sales->hasPages())
{{ $sales->links() }}
@endif
@endsection @section('scripts') @endsection