@extends('layouts.app') @section('title', 'Sales') @section('page', 'sales') @section('salesNav', 'sales-list') @php $statusVariant = fn($s) => match ($s) { 'Completed', 'Paid' => 'success', 'Refunded', 'Cancelled' => 'danger', default => 'neutral', }; $paymentLabel = fn($p) => ucfirst((string) $p); $paymentVariant = fn($p) => match (strtolower((string) $p)) { 'cash' => 'success', 'bank' => 'info', 'credit' => 'warning', 'card' => 'primary', default => 'neutral', }; @endphp @section('content') @include('partials.sales-nav') @if (session('success')) {{ session('success') }} @endif @if ($errors->any()) {{ $errors->first() }} @endif New Sale

Total Sales

{{ $totalSales }}

In selected dates

Today

{{ $todaySales }}

Within this range

Revenue

{{ money($totalRevenue) }}

Selected period ({{ currency_code() }})

Avg Ticket

{{ money($avgTicket) }}

Average sale total

@forelse ($sales as $row) @php $itemsPayload = $row->items ->map(static function ($item) { return [ 'name' => $item->product_name, 'code' => $item->product_code, 'qty' => $item->qty, 'unit_price' => (float) $item->unit_price, 'line_total' => (float) $item->line_total, 'image' => $item->product?->imageUrl(), ]; }) ->values(); $billLabel = $row->bill_no ? 'Bill No '.$row->bill_no : ($row->invoice_no ?: '—'); @endphp {{ $billLabel }} {{ $row->sale_date?->format('Y-m-d H:i') ?? '—' }} {{ $row->customer?->name ?? '—' }} {{ $row->user?->name ?? '—' }} {{ $paymentLabel($row->payment_method) }} {{ $row->items_count }} items {{ money((float) $row->total) }} {{ $row->status }}
@empty No sales yet. Complete a sale from POS. @endforelse
@endsection @push('styles') @endpush @push('scripts') @endpush