@extends('admin.layout.main') @section('admin')

Invoices

Manage and view all payment invoices

Total Invoices

{{ $payments->count() }}

All time invoices

Total Amount

{{ number_format($payments->sum('amount'), 0) }} SR

Overall revenue

This Month

{{ number_format($payments->where('created_at', '>=', now()->startOfMonth())->sum('amount'), 0) }} SR

@php $monthlyPercentage = $payments->sum('amount') > 0 ? ($payments->where('created_at', '>=', now()->startOfMonth())->sum('amount') / $payments->sum('amount')) * 100 : 0; @endphp
Monthly share {{ number_format($monthlyPercentage, 0) }}%

Pending

{{ $payments->where('status', 'pending')->count() }}

@php $pendingPercentage = $payments->count() > 0 ? ($payments->where('status', 'pending')->count() / $payments->count()) * 100 : 0; @endphp
{{ number_format($pendingPercentage, 0) }}%

All Invoices

@forelse($payments as $payment) @empty @endforelse
Invoice Client Amount Method Date Status Actions

INV-{{ str_pad($payment->id, 6, '0', STR_PAD_LEFT) }}

Project: {{ $payment->project->name ?? 'N/A' }}

{{ strtoupper(substr($payment->user->name ?? 'C', 0, 1)) }}

{{ $payment->user->name ?? 'N/A' }}

ID: {{ $payment->project_id }}

{{ number_format($payment->amount, 0) }} SR

@php $methodConfig = [ 'cash' => [ 'color' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'icon' => 'fa-money-bill' ], 'bank_transfer' => [ 'color' => 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300', 'icon' => 'fa-university' ], 'check' => [ 'color' => 'bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300', 'icon' => 'fa-file-invoice' ], 'online' => [ 'color' => 'bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-300', 'icon' => 'fa-globe' ], 'mobile_banking' => [ 'color' => 'bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300', 'icon' => 'fa-mobile-alt' ], 'card' => [ 'color' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300', 'icon' => 'fa-credit-card' ] ]; $config = $methodConfig[$payment->payment_method] ?? [ 'color' => 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300', 'icon' => 'fa-money-bill' ]; @endphp {{ ucfirst(str_replace('_', ' ', $payment->payment_method)) }}

{{ \Carbon\Carbon::parse($payment->payment_date)->format('M d, Y') }}

{{ $payment->created_at->format('h:i A') }}

@php $statusConfig = [ 'paid' => [ 'color' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'icon' => 'fa-check-circle' ], 'pending' => [ 'color' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300', 'icon' => 'fa-clock' ], 'failed' => [ 'color' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300', 'icon' => 'fa-times-circle' ] ]; $status = $statusConfig[$payment->status] ?? [ 'color' => 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300', 'icon' => 'fa-question-circle' ]; @endphp {{ ucfirst($payment->status) }}

No invoices found

No payment records available

@if($payments->hasPages())
Showing {{ $payments->firstItem() }} to {{ $payments->lastItem() }} of {{ $payments->total() }} results
@if($payments->onFirstPage()) Previous @else Previous @endif @if($payments->hasMorePages()) Next @else Next @endif
@endif
@endsection