@extends('layouts.app') @section('title', 'MPESA Dashboard') @section('style') @endsection @section('content')

Total Transactions

{{ number_format($stats['total']['transactions']) }}

Today: {{ number_format($stats['today']['transactions']) }}

Total Amount

Ksh {{ number_format($stats['total']['amount'], 2) }}

Today: Ksh {{ number_format($stats['today']['amount'], 2) }}

Matched Transactions

{{ number_format($stats['total']['matched']) }}

@if($stats['today']['unmatched'] > 0) @else @endif Unmatched: {{ $stats['today']['unmatched'] }}

Active Credentials

{{ $credentials->count() }}

@if($credentials->where('is_active', true)->first()) {{ $credentials->where('is_active', true)->first()->environment_display }} @else No active credentials @endif

Transaction Activity (Last 7 Days)
Credentials Status

@if($credentials->count() > 0) @foreach($credentials as $credential)
{{ $credential->name }}

{{ $credential->shortcode_masked }} • {{ $credential->environment_display }} @if($credential->is_active) Active @endif

@if($credential->last_success) Last success: {{ $credential->last_success->diffForHumans() }} @endif
@if(!$loop->last)
@endif @endforeach @else

No credentials configured

Add Credentials
@endif
Recent Transactions

@forelse($recentTransactions as $transaction) @empty @endforelse
Transaction ID Phone Amount Date Status Sale Actions
{{ $transaction->transaction_id }} @if($transaction->mpesa_receipt_number)
Receipt: {{ $transaction->mpesa_receipt_number }} @endif
{{ $transaction->formatted_phone }} @if($transaction->full_name)
{{ $transaction->full_name }} @endif
Ksh {{ number_format($transaction->amount, 2) }} {{ $transaction->transaction_date->format('M d, Y') }}
{{ $transaction->transaction_date->format('h:i A') }}
@if($transaction->status == 'completed') Completed @elseif($transaction->status == 'pending') Pending @elseif($transaction->status == 'failed') Failed @elseif($transaction->status == 'reversed') Reversed @elseif($transaction->status == 'matched') Matched @endif @if($transaction->sale_id) Sale #{{ $transaction->sale_id }} @else Unmatched @endif
@if(!$transaction->sale_id && $transaction->status == 'completed') @endif

No recent transactions

@if($topPhones->count() > 0)
Top Customers by Transaction Volume

@foreach($topPhones as $phone => $data) @endforeach
Phone Transactions Total Amount Matched Unmatched Actions
{{ $phone }} @php $customer = \App\Models\Customer::where('phone', $phone)->first(); @endphp @if($customer)
{{ $customer->name }} @endif
{{ $data->transaction_count }} Ksh {{ number_format($data->total_amount, 2) }} {{ $data->matched }} {{ $data->unmatched }}
@if($customer) @endif
@endif
@endsection @section('script') @endsection