@extends('layouts.admin-master') @section('title', 'Dashboard') @section('style') @include('admin.style') @endsection @section('content')
@include('admin.header')
{{-- ── Welcome Banner ── --}} {{-- ── Stat Cards ── --}} {{-- ── Charts Row ── --}}
{{-- Registration Trend Chart --}}
Registration Trend — last 6 months
Farmers Vendors
{{-- Deal Status Breakdown ── --}}
@php $dPending = \App\Models\Interest::where('status','pending')->count(); $dAccepted = \App\Models\Interest::where('status','accepted')->count(); $dCountered = \App\Models\Interest::where('status','countered')->count(); $dRejected = \App\Models\Interest::where('status','rejected')->count(); $dTotal = $dPending + $dAccepted + $dCountered + $dRejected; $pct = fn($n) => $dTotal > 0 ? round($n / $dTotal * 100) : 0; @endphp
Deal Status Breakdown
{{ $dTotal }} total
{{-- Accepted --}}
Accepted
{{ $dAccepted }} ({{ $pct($dAccepted) }}%)
{{-- Pending --}}
Pending
{{ $dPending }} ({{ $pct($dPending) }}%)
{{-- Countered --}}
Countered
{{ $dCountered }} ({{ $pct($dCountered) }}%)
{{-- Rejected --}}
Rejected
{{ $dRejected }} ({{ $pct($dRejected) }}%)
{{-- ── Bottom Row ── --}}
{{-- KYC Progress ── --}}
KYC Completion
View Report →
@php $farmerKycDone = $totalFarmers > 0 ? round((($totalFarmers - $farmerKycPending) / $totalFarmers) * 100) : 0; $vendorKycDone = $totalVendors > 0 ? round((($totalVendors - $vendorKycPending) / $totalVendors) * 100) : 0; @endphp
Farmers KYC {{ $farmerKycDone }}%
{{ $totalFarmers - $farmerKycPending }} verified {{ $farmerKycPending }} pending
Vendors KYC {{ $vendorKycDone }}%
{{ $totalVendors - $vendorKycPending }} verified {{ $vendorKycPending }} pending
{{-- Quick Links ── --}} {{-- System Health ── --}}
System Overview
@php $totalDeals = \App\Models\Interest::count(); $pendingDeals = \App\Models\Interest::where('status','pending')->count(); $flaggedDeals = \App\Models\Interest::where('is_flagged',1)->count(); @endphp
Total Registered Users
{{ $totalFarmers + $totalVendors }} users on platform
{{ $totalFarmers + $totalVendors }}
Pending Deals
Awaiting farmer/vendor response
{{ $pendingDeals }}
Flagged Deals
Marked suspicious by admin
{{ $flaggedDeals }}
Total Deal Volume
All interests ever created
{{ $totalDeals }}
@include('admin.footer')
@endsection @php $chartMonths = []; $chartFarmerData = []; $chartVendorData = []; for ($i = 5; $i >= 0; $i--) { $start = now()->subMonths($i)->startOfMonth(); $end = now()->subMonths($i)->endOfMonth(); $chartMonths[] = now()->subMonths($i)->format('M Y'); $chartFarmerData[] = \App\Models\Farmer::whereHas('user', function($q) use ($start, $end) { $q->whereBetween('created_at', [$start, $end]); })->count(); $chartVendorData[] = \App\Models\Vendor::whereHas('user', function($q) use ($start, $end) { $q->whereBetween('created_at', [$start, $end]); })->count(); } @endphp @section('script') @include('admin.script') @endsection