@extends('layouts.portal') @section('title', 'Agent Invoices') @section('sidebar') @include('admin.partials.sidebar', ['active' => 'agent-invoices']) @endsection @section('content')
View agent transactions by month and process payments directly
Currently showing: {{ \Carbon\Carbon::parse($displayMonth . '-01')->format('F Y') }}
Total Pending Amount
RM{{ number_format($stats['total_pending'], 2) }}
Active Agents
{{ $stats['count_agents'] }}
Average per Agent
RM{{ number_format($stats['avg_per_agent'], 2) }}
| Agent Name | Phone | Transactions | Commission Level | Total Amount (RM) | Status | Actions | ||
|---|---|---|---|---|---|---|---|---|
|
{{ strtoupper(substr($summary['agent']->name, 0, 1)) }}
{{ $summary['agent']->name }}
|
{{ $summary['agent']->email }} | {{ $summary['agent']->phone ?? 'N/A' }} | {{ $summary['transaction_count'] }} | @php $commissionLevel = 'Standard'; $levelColor = 'gray'; $totalAmount = $summary['total_amount']; if ($totalAmount >= 5000) { $commissionLevel = 'Platinum'; $levelColor = 'purple'; } elseif ($totalAmount >= 3000) { $commissionLevel = 'Gold'; $levelColor = 'yellow'; } elseif ($totalAmount >= 1000) { $commissionLevel = 'Silver'; $levelColor = 'gray'; } elseif ($totalAmount >= 500) { $commissionLevel = 'Bronze'; $levelColor = 'orange'; } @endphp {{ $commissionLevel }} | RM{{ number_format($summary['total_amount'], 2) }} |
@php
$hasCompleted = $summary['commissions']->where('status', 'completed')->count() > 0;
$hasPaid = $summary['commissions']->where('status', 'paid')->count() > 0;
$hasPending = $summary['commissions']->where('status', 'pending')->count() > 0;
@endphp
@if($hasPending && !$hasCompleted && !$hasPaid)
Pending
@elseif(($hasCompleted || $hasPaid) && !$hasPending)
Completed
@elseif(($hasPending) && ($hasCompleted || $hasPaid))
Completed
Pending
@endif
|
|
No pending agent commissions found