diff --git a/src/app/admin/kyc/page.tsx b/src/app/admin/kyc/page.tsx index 5e39f88..28cd0d7 100644 --- a/src/app/admin/kyc/page.tsx +++ b/src/app/admin/kyc/page.tsx @@ -1,10 +1,10 @@ 'use client'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import Link from 'next/link'; -import { - Shield, Search, Filter, Check, X, Clock, User, Phone, MapPin, FileText, - Eye, Download, Send, MessageSquare, AlertCircle, DollarSign, Bike, +import { + Shield, Search, Filter, Check, X, Clock, User, Phone, MapPin, FileText, + Eye, Download, Send, MessageSquare, AlertCircle, DollarSign, Bike, Store, Users, ChevronDown, ChevronUp, Bell, MoreHorizontal, Image as ImageIcon, Upload, CheckCircle, XCircle, Camera, AlertTriangle, Edit, Globe, Wallet, Calendar, CreditCard, FileSignature, MapPinned, Key, BatteryCharging, Briefcase, Plus @@ -24,7 +24,7 @@ interface NomineeDetails { interface EmploymentInfo { company: string; - dailyEarning: number; + monthlyEarning: number; whyEV: string; experience: string; } @@ -81,22 +81,22 @@ interface Request { location: string; address: string; requiredDocuments: Document[]; - + riderPlan?: RiderPlan; nomineeDetails?: NomineeDetails; employmentInfo?: EmploymentInfo; riskCheck?: RiskCheck; agreement?: Agreement; evAllocation?: EVAllocation; - + securityDeposit?: number; advancePayment?: number; paymentMethod?: 'bank' | 'wallet' | 'cash'; - + bikeRequested?: string; scheduleDate?: string; appointmentDate?: string; - + notes: string[]; messageHistory: { date: string; message: string; from: 'admin' | 'user' }[]; } @@ -121,7 +121,7 @@ const mockRequests: Request[] = [ { id: 'd4', name: 'Profile Photo', status: 'uploaded', uploadedAt: '2024-03-20' }, ], riderPlan: 'daily_rent', - employmentInfo: { company: 'Foodpanda', dailyEarning: 2500, whyEV: 'Low maintenance, good for delivery', experience: '3 years bike riding' }, + employmentInfo: { company: 'Foodpanda', monthlyEarning: 2500, whyEV: 'Low maintenance, good for delivery', experience: '3 years bike riding' }, notes: ['Downloaded app and applied through mobile'], messageHistory: [], }, @@ -188,7 +188,7 @@ const mockRequests: Request[] = [ ], riderPlan: 'rent_to_own', nomineeDetails: { name: 'Fatema Begum', phone: '01712345699', relationship: 'Wife', nid: '1234567890123' }, - employmentInfo: { company: 'Pathao', dailyEarning: 3000, whyEV: 'Want to own EV eventually', experience: '5 years motorcycle experience' }, + employmentInfo: { company: 'Pathao', monthlyEarning: 3000, whyEV: 'Want to own EV eventually', experience: '5 years motorcycle experience' }, riskCheck: { nidVerified: true, nomineeNidVerified: true, deliveryPlatformStatus: 'active', paymentReliability: 'good', notes: 'Verified - clean record', checkedAt: '2024-03-15', checkedBy: 'Admin' }, agreement: { dailyRentObligation: 500, latePenalty: 100, damageTerms: 'Standard terms', vehicleRules: 'Follow JAIBEN guidelines', signedAt: '2024-03-15', signedBy: 'Sofiq Rahman' }, evAllocation: { evId: 'EV-004', bikeModel: 'AIMA Lightning', batteryId: 'BAT-044', hubLocation: 'Dhanmondi Hub', assignedAt: '2024-03-15', gpsActivated: true, checklist: ['Front light working', 'Brakes OK', 'Horn working', 'Tire pressure OK'] }, @@ -243,7 +243,7 @@ const mockRequests: Request[] = [ ], riderPlan: 'monthly_rent', nomineeDetails: { name: 'Rashid', phone: '01798765432', relationship: 'Brother', nid: '9876543210987' }, - employmentInfo: { company: ' ssl', dailyEarning: 2000, whyEV: 'Better income than fuel bike', experience: '2 years' }, + employmentInfo: { company: ' ssl', monthlyEarning: 2000, whyEV: 'Better income than fuel bike', experience: '2 years' }, notes: [], messageHistory: [], }, @@ -343,7 +343,7 @@ export default function RequestsPage() { if (req.id === selectedRequest.id) { return { ...req, - requiredDocuments: req.requiredDocuments.map(doc => + requiredDocuments: req.requiredDocuments.map(doc => doc.id === docId ? { ...doc, status: 'approved' as const } : doc ) }; @@ -363,7 +363,7 @@ export default function RequestsPage() { if (req.id === selectedRequest.id) { return { ...req, - requiredDocuments: req.requiredDocuments.map(doc => + requiredDocuments: req.requiredDocuments.map(doc => doc.id === docId ? { ...doc, status: 'rejected' as const, rejectedReason: reason } : doc ) }; @@ -426,7 +426,7 @@ export default function RequestsPage() { if (actionType === 'approve') { newStatus = 'approved'; - successMessage = selectedRequest.type === 'biker' + successMessage = selectedRequest.type === 'biker' ? `Approved! SMS sent to ${selectedRequest.phone}: Welcome! Your biker request has been approved.` : `Approved! SMS sent to ${selectedRequest.phone}: Welcome! Your investor request has been approved.`; } else if (actionType === 'reject') { @@ -437,7 +437,7 @@ export default function RequestsPage() { successMessage = `Documents requested! SMS sent to ${selectedRequest.phone}: Please upload required documents.`; } - const updatedRequests = requests.map(req => + const updatedRequests = requests.map(req => req.id === selectedRequest.id ? { ...req, status: newStatus } : req ); setRequests(updatedRequests); @@ -453,7 +453,7 @@ export default function RequestsPage() {
Manage biker, investor, and shop requests