113 lines
3.4 KiB
PHP
113 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
/**
|
|
* Display the admin dashboard overview.
|
|
*/
|
|
public function index()
|
|
{
|
|
$stats = [
|
|
'total_workers' => 1420,
|
|
'pending_verifications' => 0, // No longer pending as they are auto-approved
|
|
'active_subscriptions' => 312,
|
|
'revenue_this_month_aed' => 48500,
|
|
'new_employers_this_week' => 28,
|
|
];
|
|
|
|
// This section now tracks recently auto-processed verifications instead of pending ones
|
|
$recentVerifications = [
|
|
[
|
|
'id' => 101,
|
|
'name' => 'Fatima Zahra',
|
|
'type' => 'Worker',
|
|
'processed_at' => '2 hours ago',
|
|
'document_type' => 'Passport & Visa',
|
|
'status' => 'Auto-Approved',
|
|
],
|
|
[
|
|
'id' => 102,
|
|
'name' => 'Ahmed Mansoor',
|
|
'type' => 'Employer',
|
|
'processed_at' => '4 hours ago',
|
|
'document_type' => 'Emirates ID',
|
|
'status' => 'Auto-Approved',
|
|
],
|
|
];
|
|
|
|
$recentSubscriptions = [
|
|
[
|
|
'id' => 501,
|
|
'employer_name' => 'Hassan Al Hosani',
|
|
'plan_name' => 'Premium Employer Plan',
|
|
'amount_aed' => 499,
|
|
'subscribed_at' => 'Today, 10:30 AM',
|
|
],
|
|
[
|
|
'id' => 502,
|
|
'employer_name' => 'Sarah Sterling',
|
|
'plan_name' => 'Standard Search Plan',
|
|
'amount_aed' => 199,
|
|
'subscribed_at' => 'Yesterday',
|
|
],
|
|
[
|
|
'id' => 503,
|
|
'employer_name' => 'Rashid Al Nuaimi',
|
|
'plan_name' => 'Enterprise VIP',
|
|
'amount_aed' => 1299,
|
|
'subscribed_at' => 'May 12, 2026',
|
|
],
|
|
[
|
|
'id' => 504,
|
|
'employer_name' => 'Elena Rostova',
|
|
'plan_name' => 'Standard Search Plan',
|
|
'amount_aed' => 199,
|
|
'subscribed_at' => 'May 11, 2026',
|
|
],
|
|
[
|
|
'id' => 505,
|
|
'employer_name' => 'Omar Farooq',
|
|
'plan_name' => 'Premium Employer Plan',
|
|
'amount_aed' => 499,
|
|
'subscribed_at' => 'May 10, 2026',
|
|
],
|
|
];
|
|
|
|
return Inertia::render('Admin/Dashboard', [
|
|
'stats' => $stats,
|
|
'recent_verifications' => $recentVerifications,
|
|
'recent_subscriptions' => $recentSubscriptions,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Approve a pending verification (Legacy/Manual Override).
|
|
*/
|
|
public function approveVerification(Request $request)
|
|
{
|
|
$validated = $request->validate([
|
|
'id' => 'required|integer',
|
|
]);
|
|
|
|
return back()->with('success', 'Verification document #' . $validated['id'] . ' has been approved manually.');
|
|
}
|
|
|
|
/**
|
|
* Reject a pending verification (Legacy/Manual Override).
|
|
*/
|
|
public function rejectVerification(Request $request)
|
|
{
|
|
$validated = $request->validate([
|
|
'id' => 'required|integer',
|
|
]);
|
|
|
|
return back()->with('success', 'Verification document #' . $validated['id'] . ' has been rejected.');
|
|
}
|
|
}
|