2026-05-15 17:40:21 +05:30

408 lines
18 KiB
PHP

<?php
use App\Http\Controllers\Admin\AdminAuthController;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
// Redirect root to admin dashboard (which guards via AdminMiddleware or redirects to login)
Route::get('/', function () {
return redirect()->route('admin.dashboard');
});
// Admin Auth Routes
Route::get('/admin/login', [AdminAuthController::class, 'showLogin'])->name('admin.login');
Route::post('/admin/login', [AdminAuthController::class, 'login'])->name('admin.login.submit');
Route::post('/admin/logout', [AdminAuthController::class, 'logout'])->name('admin.logout');
// Temporary Mobile Mockup Routes for Client Review
Route::get('/mobile/welcome', function () {
return Inertia::render('Mobile/Welcome'); });
Route::get('/mobile/worker/register', function () {
return Inertia::render('Mobile/WorkerRegister'); });
Route::get('/mobile/worker/home', function () {
return Inertia::render('Mobile/WorkerHome'); });
Route::get('/mobile/worker/explore', function () {
return Inertia::render('Mobile/WorkerExplore'); });
Route::get('/mobile/worker/job/detail', function () {
return Inertia::render('Mobile/WorkerJobDetail'); });
Route::get('/mobile/worker/chat', function () {
return Inertia::render('Mobile/WorkerChatList'); });
Route::get('/mobile/worker/chat/detail', function () {
return Inertia::render('Mobile/WorkerChat'); });
Route::get('/mobile/worker/announcements', function () {
return Inertia::render('Mobile/WorkerAnnouncements'); });
Route::get('/mobile/worker/profile', function () {
return Inertia::render('Mobile/WorkerProfile'); });
Route::get('/mobile/worker/profile/edit', function () {
return Inertia::render('Mobile/WorkerEditProfile'); });
Route::get('/mobile/employer/home', function () {
return Inertia::render('Mobile/EmployerHome'); });
Route::get('/mobile/employer/workers', function () {
return Inertia::render('Mobile/EmployerWorkers'); });
Route::get('/mobile/employer/workers/{id}', function ($id) {
return Inertia::render('Mobile/WorkerDetail', ['id' => $id]); });
Route::get('/mobile/employer/shortlist', function () {
return Inertia::render('Mobile/EmployerShortlist'); });
Route::get('/mobile/employer/candidates', function () {
return Inertia::render('Mobile/EmployerCandidates'); });
Route::get('/mobile/employer/messages', function () {
return Inertia::render('Mobile/EmployerMessages'); });
Route::get('/mobile/employer/chat/{id}', function ($id) {
return Inertia::render('Mobile/EmployerChatDetail', ['id' => $id]); });
Route::get('/mobile/employer/subscription', function () {
return Inertia::render('Mobile/EmployerSubscription'); });
Route::get('/mobile/employer/profile', function () {
return Inertia::render('Mobile/EmployerProfile'); });
Route::get('/mobile/employer/profile/edit', function () {
return Inertia::render('Mobile/EmployerProfileEdit'); });
Route::get('/mobile/employer/profile/security', function () {
return Inertia::render('Mobile/EmployerSecurity'); });
Route::get('/mobile/employer/profile/notifications', function () {
return Inertia::render('Mobile/EmployerNotifications'); });
Route::get('/mobile/employer/support', function () {
return Inertia::render('Mobile/EmployerSupport'); });
Route::get('/mobile/employer/announcements', function () {
return Inertia::render('Mobile/EmployerAnnouncements'); });
Route::get('/mobile/employer/splash', function () {
return Inertia::render('Mobile/EmployerSplash'); });
Route::get('/mobile/employer/welcome', function () {
return Inertia::render('Mobile/EmployerWelcome'); });
Route::get('/mobile/employer/login', function () {
return Inertia::render('Mobile/EmployerLogin'); });
Route::get('/mobile/employer/otp', function () {
return Inertia::render('Mobile/EmployerOTP'); });
Route::get('/mobile/employer/forgot-password', function () {
return Inertia::render('Mobile/EmployerForgotPassword'); });
Route::get('/mobile/employer/register', function () {
return Inertia::render('Mobile/EmployerRegister'); });
// Admin Protected Routes
Route::prefix('admin')->middleware(['admin'])->group(function () {
Route::get('/dashboard', [\App\Http\Controllers\Admin\DashboardController::class, 'index'])->name('admin.dashboard');
Route::post('/verifications/approve', [\App\Http\Controllers\Admin\DashboardController::class, 'approveVerification'])->name('admin.verifications.approve');
Route::post('/verifications/reject', [\App\Http\Controllers\Admin\DashboardController::class, 'rejectVerification'])->name('admin.verifications.reject');
Route::get('/workers', [\App\Http\Controllers\Admin\WorkerController::class, 'index'])->name('admin.workers');
Route::post('/workers/{worker}/toggle-status', [\App\Http\Controllers\Admin\WorkerController::class, 'toggleStatus'])->name('admin.workers.toggle-status');
Route::get('/workers/verifications', [\App\Http\Controllers\Admin\WorkerVerificationController::class, 'index'])->name('admin.workers.verifications');
Route::post('/workers/{worker}/verify', [\App\Http\Controllers\Admin\WorkerVerificationController::class, 'verify'])->name('admin.workers.verify');
Route::get('/employers', function () {
return Inertia::render('Admin/Employers/Index');
})->name('admin.employers');
Route::get('/subscriptions', function () {
return Inertia::render('Admin/Subscriptions/Index');
})->name('admin.subscriptions');
Route::get('/payments', function () {
return Inertia::render('Admin/Payments/Index');
})->name('admin.payments');
Route::get('/master-data/categories', function () {
return Inertia::render('Admin/MasterData/WorkerCategories');
})->name('admin.categories');
Route::get('/announcements', function () {
return Inertia::render('Admin/Announcements/Index');
})->name('admin.announcements');
});
// Employer Auth Routes
Route::get('/employer/login', [\App\Http\Controllers\Employer\EmployerAuthController::class, 'showLogin'])->name('employer.login');
Route::post('/employer/login', [\App\Http\Controllers\Employer\EmployerAuthController::class, 'login'])->name('employer.login.submit');
Route::get('/employer/register', [\App\Http\Controllers\Employer\EmployerAuthController::class, 'showRegister'])->name('employer.register');
Route::post('/employer/register', [\App\Http\Controllers\Employer\EmployerAuthController::class, 'register'])->name('employer.register.submit');
Route::get('/employer/verify-email/{token}', [\App\Http\Controllers\Employer\EmployerAuthController::class, 'verifyEmail'])->name('employer.verify');
Route::post('/employer/logout', [\App\Http\Controllers\Employer\EmployerAuthController::class, 'logout'])->name('employer.logout');
Route::get('/employer/pending-verification', function () {
return Inertia::render('Employer/Auth/PendingVerification');
})->name('employer.pending-verification');
Route::get('/employer/forgot-password', function () {
return Inertia::render('Employer/Auth/ForgotPassword');
})->name('employer.forgot-password');
// Employer Protected Routes
Route::prefix('employer')->middleware(['employer'])->group(function () {
Route::get('/dashboard', [\App\Http\Controllers\Employer\DashboardController::class, 'index'])->name('employer.dashboard');
Route::get('/workers', [\App\Http\Controllers\Employer\WorkerController::class, 'index'])->name('employer.workers');
Route::get('/workers/{id}', [\App\Http\Controllers\Employer\WorkerController::class, 'show'])->name('employer.workers.show');
Route::get('/workers/{id}/hire', function ($id) {
// Mock worker for now - in reality, would fetch from DB
$worker = [
'id' => $id,
'name' => 'Maria Santos',
'nationality' => 'Filipino',
'category' => 'Domestic Helper',
'salary' => 2500,
];
return Inertia::render('Employer/Hiring/Confirm', ['worker' => $worker]);
})->name('employer.hiring.confirm');
Route::get('/workers/{id}/hire/success', function ($id) {
$worker = [
'id' => $id,
'name' => 'Maria Santos',
];
return Inertia::render('Employer/Hiring/Success', ['worker' => $worker]);
})->name('employer.hiring.success');
// Job Management
Route::get('/jobs', function () {
return Inertia::render('Employer/Jobs/Index');
})->name('employer.jobs');
Route::get('/jobs/create', function () {
return Inertia::render('Employer/Jobs/Create');
})->name('employer.jobs.create');
Route::get('/jobs/{id}/applicants', function ($id) {
$job = ['id' => $id, 'title' => 'Experienced Mason Project', 'category' => 'Mason', 'salary' => 2800];
return Inertia::render('Employer/Jobs/Applicants', ['job' => $job]);
})->name('employer.jobs.applicants');
Route::get('/subscription', function () {
return Inertia::render('Employer/Subscription', [
'currentPlan' => 'Premium Employer Pass',
'expiresAt' => '2026-12-31',
'plans' => [
[
'id' => 'basic',
'name' => 'Basic Search',
'price' => '99 AED',
'period' => 'month',
'features' => ['Browse 500+ verified workers', 'Shortlist up to 10 candidates', 'Standard OCR vetting'],
'popular' => false,
],
[
'id' => 'premium',
'name' => 'Premium Employer Pass',
'price' => '199 AED',
'period' => 'month',
'features' => ['Unlimited shortlisting', 'Direct candidate messaging', 'Priority interview scheduling', 'Dedicated support'],
'popular' => true,
],
[
'id' => 'enterprise',
'name' => 'VIP Concierge',
'price' => '499 AED',
'period' => 'month',
'features' => ['All Premium features', 'Assigned recruitment manager', 'Background medical verification guarantee', 'Free replacement within 30 days'],
'popular' => false,
],
]
]);
})->name('employer.subscription');
Route::get('/messages', function () {
return Inertia::render('Employer/Messages/Index', [
'conversations' => [
[
'id' => 201,
'worker_name' => 'Maria Santos',
'category' => 'Childcare',
'last_message' => 'Yes ma\'am, I am available for a video interview tomorrow at 10 AM.',
'unread' => true,
'online' => true,
'sent_at' => '10 mins ago',
],
[
'id' => 202,
'worker_name' => 'Lakshmi Sharma',
'category' => 'Elderly Care',
'last_message' => 'I have 5 years of experience in Dubai taking care of elderly patients.',
'unread' => true,
'online' => false,
'sent_at' => '2 hours ago',
],
[
'id' => 203,
'worker_name' => 'Siti Aminah',
'category' => 'Housekeeping',
'last_message' => 'Thank ma\'am for shortlisting my profile. Please let me know your offer.',
'unread' => false,
'online' => true,
'sent_at' => '1 day ago',
],
]
]);
})->name('employer.messages');
Route::get('/messages/{id}', function ($id) {
$conversations = [
[
'id' => 201,
'worker_name' => 'Maria Santos',
'category' => 'Childcare',
'last_message' => 'Yes ma\'am, I am available for a video interview tomorrow at 10 AM.',
'unread' => true,
'online' => true,
'sent_at' => '10 mins ago',
],
[
'id' => 202,
'worker_name' => 'Lakshmi Sharma',
'category' => 'Elderly Care',
'last_message' => 'I have 5 years of experience in Dubai taking care of elderly patients.',
'unread' => true,
'online' => false,
'sent_at' => '2 hours ago',
],
[
'id' => 203,
'worker_name' => 'Siti Aminah',
'category' => 'Housekeeping',
'last_message' => 'Thank ma\'am for shortlisting my profile. Please let me know your offer.',
'unread' => false,
'online' => true,
'sent_at' => '1 day ago',
],
];
return Inertia::render('Employer/Messages/Show', [
'conversations' => $conversations,
'conversation' => collect($conversations)->firstWhere('id', (int) $id) ?? [
'id' => (int) $id,
'worker_name' => 'Maria Santos',
'category' => 'Childcare',
'online' => true,
'salary' => '1,800 AED',
'nationality' => 'Philippines',
],
'initialMessages' => [
[
'id' => 1,
'sender' => 'employer',
'text' => 'Hello! I reviewed your profile and I am very interested in hiring you. Are you available for a phone interview?',
'time' => 'Yesterday, 4:15 PM',
],
[
'id' => 2,
'sender' => 'worker',
'text' => 'Good day ma\'am! Yes, thank you for reaching out. I am available anytime today or tomorrow.',
'time' => 'Yesterday, 4:30 PM',
],
[
'id' => 3,
'sender' => 'worker',
'text' => 'I have all my documents ready and my current visa is transferable.',
'time' => 'Yesterday, 4:31 PM',
],
]
]);
})->name('employer.messages.show');
Route::get('/shortlist', function () {
return Inertia::render('Employer/Shortlist', [
'shortlistedWorkers' => [
[
'id' => 101,
'name' => 'Maria Santos',
'nationality' => 'Philippines',
'category' => 'Childcare',
'skills' => ['Childcare', 'Cooking', 'Housekeeping'],
'availability' => 'Immediate',
'experience' => '5+ Years',
'salary' => 1800,
'verified' => true,
],
[
'id' => 103,
'name' => 'Siti Aminah',
'nationality' => 'Indonesia',
'category' => 'Housekeeping',
'skills' => ['Housekeeping', 'Ironing', 'Deep Cleaning'],
'availability' => 'Immediate',
'experience' => '3-5 Years',
'salary' => 1400,
'verified' => true,
],
[
'id' => 105,
'name' => 'Anoma Perera',
'nationality' => 'Sri Lanka',
'category' => 'Cooking',
'skills' => ['Cooking', 'Baking'],
'availability' => 'Immediate',
'experience' => '5+ Years',
'salary' => 2200,
'verified' => true,
],
]
]);
})->name('employer.shortlist');
Route::get('/candidates', function () {
return Inertia::render('Employer/SelectedCandidates', [
'selectedWorkers' => [
[
'id' => 101,
'name' => 'Maria Santos',
'category' => 'Site Supervisor',
'nationality' => 'Philippines',
'salary' => '4,500',
'status' => 'Interview Scheduled',
'experience' => '8 Years'
],
[
'id' => 102,
'name' => 'Lakshmi Sharma',
'category' => 'Electrician',
'nationality' => 'India',
'salary' => '3,200',
'status' => 'Offer Extended',
'experience' => '5 Years'
],
[
'id' => 103,
'name' => 'Siti Aminah',
'category' => 'Project Coordinator',
'nationality' => 'Indonesia',
'salary' => '5,500',
'status' => 'Hired',
'experience' => '10 Years'
],
[
'id' => 104,
'name' => 'Ahmed Khan',
'category' => 'Mason',
'nationality' => 'Pakistan',
'salary' => '2,800',
'status' => 'Reviewing',
'experience' => '4 Years'
],
[
'id' => 105,
'name' => 'John Doe',
'category' => 'Carpenter',
'nationality' => 'United Kingdom',
'salary' => '6,000',
'status' => 'Rejected',
'experience' => '12 Years'
],
]
]);
})->name('employer.candidates');
Route::get('/announcements', function () {
return Inertia::render('Employer/Announcements');
})->name('employer.announcements');
Route::get('/profile', function () {
$sess = session('user');
$user = is_array($sess) ? (object) $sess : ($sess ?? (object) [
'name' => 'John Doe',
'email' => 'employer@example.com',
'phone' => '+971 50 123 4567',
]);
return Inertia::render('Employer/Profile', [
'employerProfile' => [
'name' => $user->name ?? 'John Doe',
'email' => $user->email ?? 'employer@example.com',
'phone' => $user->phone ?? '+971 50 123 4567',
'company_name' => 'Al Mansoor Household',
'emirates_id_status' => 'approved',
]
]);
})->name('employer.profile');
});