@extends('layouts.app') @section('title', 'Sales History') @section('content')

Sales History

Monitor and manage all your transactions in one place.

{{-- Print and Download use the PDF of the filters below (every matching sale), not the web page --}} @include('partials.pdf-button', [ 'class' => 'btn btn-danger rounded-pill px-3 shadow-sm', 'printClass' => 'btn btn-white border rounded-pill px-3 shadow-sm', ]) New Sale
Reset
Sales Summary
@php $displayNames = \App\Helpers\PaymentMethods::getDisplayNames(); $totalSalesAmount = collect($summary['payment_methods'] ?? [])->sum('total') ?? 0; $totalTransactions = collect($summary['payment_methods'] ?? [])->sum('count') ?? 0; @endphp
Total Sales

MWK {{ number_format($totalSalesAmount, 0) }}

{{ $totalTransactions }} transactions
{{-- Only the payment methods used in this period --}} @php $usedMethods = collect($displayNames)->filter(fn ($name, $method) => ($summary['payment_methods'][$method]['count'] ?? 0) > 0); @endphp @forelse($usedMethods as $method => $displayName) @php $data = $summary['payment_methods'][$method]; @endphp
{{ $displayName }}
MWK {{ number_format($data['total'], 0) }}
{{ $data['count'] }} {{ $data['count'] == 1 ? 'sale' : 'sales' }}
@empty
No sales in this period
@endforelse
@php $canEditSales = auth()->user()->hasPermission('edit_pos_sell'); $canVoidSales = auth()->user()->hasPermission('delete_pos_sell'); @endphp
Transaction Records
{{ $sales->total() }} {{ \Illuminate\Support\Str::plural('record', $sales->total()) }}
{{-- Compact table: action icons always visible (no menu). Phones: one card per sale. --}}
@forelse($sales as $s) @php $first = $s->items->first(); $more = $s->items->count() - 1; $allNames = $s->items->map(fn ($i) => optional($i->product)->name ?? 'Deleted product')->implode(', '); $methodLabel = $s->payment_method === 'split' ? 'Split' : ($displayNames[$s->payment_method] ?? ucwords(str_replace('_', ' ', (string) $s->payment_method))); $cashier = $s->register->user->name ?? null; @endphp @empty @endforelse
Invoice Customer Products Payment Total Actions
{{ $s->invoice_no ?? 'INV-' . str_pad($s->id, 5, '0', STR_PAD_LEFT) }}
{{ $s->created_at->format('d M Y, H:i') }}
{{ $s->customer_name ?: 'Walk-in' }}
@if($cashier)
by {{ $cashier }}
@endif
@if($first)
{{ optional($first->product)->name ?? 'Deleted product' }}@if($more > 0) +{{ $more }}@endif
@else
No items
@endif
{{ rtrim(rtrim(number_format((float) $s->total_items, 2), '0'), '.') }} {{ \Illuminate\Support\Str::plural('item', (float) $s->total_items) }}
{{ $methodLabel }}
{{ ucfirst($s->payment_status) }}
MWK {{ number_format($s->total_amount, 2) }}
@if($canEditSales) @endif @if($canVoidSales)
@csrf @method('DELETE')
@endif
No sales match these filters.
@if($sales->hasPages()) @endif
@endsection @section('scripts') @endsection