'use client'; import { useState, use } from 'react'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { User, Phone, Mail, MapPin, Calendar, Heart, Briefcase, Car, Navigation, FileText, Clock, TrendingUp, CreditCard, Shield, Award, Star, Activity, Eye, Edit, Trash2, ArrowLeft, PhoneCall, MessageCircle, CheckCircle, XCircle, AlertTriangle, DollarSign as DollarSignIcon, Wallet, Bike as BikeIcon, Wrench, Ban, MoreHorizontal, Copy, ExternalLink, Download, Upload, Bell, MessageSquare, Send, RefreshCcw, Image } from 'lucide-react'; interface DrivingLicense { number: string; issueDate: string; expiryDate: string; class: string; status: 'valid' | 'expired' | 'suspended'; } interface Document { type: 'nid' | 'passport' | 'driving_license' | 'other'; number: string; verified: boolean; } interface Biker { id: string; name: string; email: string; phone: string; alternatePhone?: string; status: 'active' | 'pending' | 'inactive' | 'blocked'; createdAt: string; location: string; address: string; dateOfBirth: string; gender: 'male' | 'female' | 'other'; bloodGroup: string; occupation: string; emergencyContact: string; emergencyPhone: string; emergencyRelation: string; drivingLicense: DrivingLicense; documents: Document[]; gpsDeviceId?: string; gpsPhone?: string; totalRides: number; totalDistance: number; totalRideHours: number; totalSpent: number; currentBike?: string; bikePlate?: string; depositPaid: number; walletBalance: number; rating: number; totalRatings: number; responseTime: number; cancellationRate: number; kycStatus: 'verified' | 'pending' | 'rejected'; membershipType: 'free' | 'basic' | 'premium' | 'vip'; insuranceStatus: 'active' | 'expired' | 'none'; insuranceExpiry?: string; notes?: string; lastRideAt?: string; firstRideAt?: string; joinedFrom: string; } const mockBikers: Biker[] = [ { id: 'B001', name: 'Rahim Ahmed', email: 'rahim@email.com', phone: '01712345678', alternatePhone: '01912345678', status: 'active', createdAt: '2024-01-15', location: 'Gulshan, Dhaka', address: 'House 12, Road 5, Gulshan 1, Dhaka 1212', dateOfBirth: '1995-03-15', gender: 'male', bloodGroup: 'O+', occupation: 'Student', emergencyContact: 'Karim Ahmed', emergencyPhone: '01712345679', emergencyRelation: 'Brother', drivingLicense: { number: 'DL2024001234', issueDate: '2023-01-15', expiryDate: '2033-01-14', class: 'M', status: 'valid' }, documents: [{ type: 'nid', number: '1234567890', verified: true }], gpsDeviceId: 'GP-001234', gpsPhone: '01712345678', totalRides: 156, totalDistance: 2340, totalRideHours: 468, totalSpent: 54500, currentBike: 'Etron ET50', bikePlate: 'Dhaka Metro Cha-1234', depositPaid: 5000, walletBalance: 1250, rating: 4.8, totalRatings: 156, responseTime: 2.5, cancellationRate: 2.1, kycStatus: 'verified', membershipType: 'premium', insuranceStatus: 'active', insuranceExpiry: '2025-01-14', notes: 'Reliable rider, frequently uses premium service', lastRideAt: '2024-03-21', firstRideAt: '2024-01-15', joinedFrom: 'App Store', }, { id: 'B002', name: 'Karim Hasan', email: 'karim@email.com', phone: '01712345679', status: 'active', createdAt: '2024-02-20', location: 'Banani, Dhaka', address: 'House 5, Road 11, Banani, Dhaka 1213', dateOfBirth: '1990-07-22', gender: 'male', bloodGroup: 'B+', occupation: 'Business', emergencyContact: 'Rahim Hasan', emergencyPhone: '01712345678', emergencyRelation: 'Friend', drivingLicense: { number: 'DL2024005678', issueDate: '2023-06-20', expiryDate: '2033-06-19', class: 'M', status: 'valid' }, documents: [{ type: 'nid', number: '1234567891', verified: true }], gpsDeviceId: 'GP-001235', totalRides: 89, totalDistance: 1335, totalRideHours: 267, totalSpent: 31200, currentBike: 'Yadea DT3', bikePlate: 'Dhaka Metro Cha-5678', depositPaid: 5000, walletBalance: 800, rating: 4.5, totalRatings: 89, responseTime: 3.2, cancellationRate: 4.5, kycStatus: 'verified', membershipType: 'basic', insuranceStatus: 'active', insuranceExpiry: '2025-02-19', joinedFrom: 'Website', }, { id: 'B003', name: 'Jamal Mahmud', email: 'jamal@email.com', phone: '01712345680', status: 'pending', createdAt: '2024-03-18', location: 'Uttara, Dhaka', address: 'Sector 10, Uttara, Dhaka 1230', dateOfBirth: '1988-11-05', gender: 'male', bloodGroup: 'A+', occupation: 'Job Holder', emergencyContact: 'Mahmud Ali', emergencyPhone: '01712345681', emergencyRelation: 'Father', drivingLicense: { number: '', issueDate: '', expiryDate: '', class: 'M', status: 'valid' }, documents: [{ type: 'nid', number: '1234567892', verified: false }], totalRides: 0, totalDistance: 0, totalRideHours: 0, totalSpent: 0, depositPaid: 0, walletBalance: 0, rating: 0, totalRatings: 0, responseTime: 0, cancellationRate: 0, kycStatus: 'pending', membershipType: 'free', insuranceStatus: 'none', joinedFrom: 'Referral', }, { id: 'B004', name: 'Ali Rahman', email: 'ali@email.com', phone: '01712345681', status: 'active', createdAt: '2023-12-01', location: 'Dhanmondi, Dhaka', address: 'House 27, Road 8, Dhanmondi, Dhaka 1205', dateOfBirth: '1992-06-10', gender: 'male', bloodGroup: 'AB+', occupation: 'Engineer', emergencyContact: 'Rahman Ali', emergencyPhone: '01712345682', emergencyRelation: 'Brother', drivingLicense: { number: 'DL202301234', issueDate: '2023-05-10', expiryDate: '2033-05-09', class: 'M', status: 'valid' }, documents: [{ type: 'nid', number: '1234567893', verified: true }], gpsDeviceId: 'GP-001236', totalRides: 234, totalDistance: 3510, totalRideHours: 702, totalSpent: 81900, currentBike: 'AIMA Lightning', bikePlate: 'Dhaka Metro Cha-9012', depositPaid: 5000, walletBalance: 2100, rating: 4.9, totalRatings: 234, responseTime: 1.8, cancellationRate: 1.2, kycStatus: 'verified', membershipType: 'vip', insuranceStatus: 'active', insuranceExpiry: '2024-12-01', joinedFrom: 'Facebook', }, { id: 'B005', name: 'Mostafa Kamal', email: 'mostafa@email.com', phone: '01712345682', status: 'inactive', createdAt: '2023-08-15', location: 'Mirpur, Dhaka', address: 'Mirpur 1, Dhaka 1216', dateOfBirth: '1997-02-28', gender: 'male', bloodGroup: 'O-', occupation: 'Teacher', emergencyContact: 'Kamal Mostafa', emergencyPhone: '01712345683', emergencyRelation: 'Father', drivingLicense: { number: 'DL2022009876', issueDate: '2022-08-15', expiryDate: '2024-08-14', class: 'M', status: 'expired' }, documents: [{ type: 'nid', number: '1234567894', verified: true }], totalRides: 45, totalDistance: 675, totalRideHours: 135, totalSpent: 15750, depositPaid: 5000, walletBalance: 0, rating: 3.8, totalRatings: 45, responseTime: 4.5, cancellationRate: 8.9, kycStatus: 'verified', membershipType: 'free', insuranceStatus: 'expired', insuranceExpiry: '2024-01-14', joinedFrom: 'App Store', }, ]; const statusColors: Record = { active: 'bg-green-100 text-green-700', pending: 'bg-amber-100 text-amber-700', inactive: 'bg-slate-100 text-slate-500', blocked: 'bg-red-100 text-red-700', }; const kycColors: Record = { verified: 'bg-green-100 text-green-700', pending: 'bg-amber-100 text-amber-700', rejected: 'bg-red-100 text-red-700', }; const membershipColors: Record = { free: 'bg-slate-100 text-slate-600', basic: 'bg-blue-100 text-blue-700', premium: 'bg-purple-100 text-purple-700', vip: 'bg-amber-100 text-amber-700', }; interface PageProps { params: Promise<{ id: string }>; } export default function BikerDetailPage({ params }: PageProps) { const resolvedParams = use(params); const router = useRouter(); const [activeTab, setActiveTab] = useState('personal'); const biker = mockBikers.find(b => b.id === resolvedParams.id) || mockBikers[0]; const tabs = [ { id: 'personal', label: 'Personal', icon: User }, { id: 'license', label: 'License & GPS', icon: Car }, { id: 'documents', label: 'Documents', icon: FileText }, { id: 'rent', label: 'Rent History', icon: DollarSignIcon }, { id: 'bike', label: 'Bike', icon: BikeIcon }, // { id: 'reviews', label: 'Reviews', icon: MessageCircle }, // { id: 'stats', label: 'Statistics', icon: TrendingUp }, { id: 'account', label: 'Account', icon: CreditCard }, { id: 'activity', label: 'Activity', icon: Activity }, ]; const rentHistory = [ { id: 'R001', date: '2024-03-21', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R002', date: '2024-03-20', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R003', date: '2024-03-19', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R004', date: '2024-03-18', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R005', date: '2024-03-17', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R006', date: '2024-03-16', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R007', date: '2024-03-15', amount: 50, status: 'paid', bikeId: 'EV001', plan: 'Single' }, { id: 'R008', date: '2024-03-14', amount: 0, status: 'pending', bikeId: 'EV001', plan: 'Single' }, ]; const rentedBikesHistory = [ { id: 'RB001', bikeId: 'EV001', bikeName: 'AIMA Lightning', plate: 'Dhaka Metro Cha-9012', startDate: '2024-03-14', endDate: null, status: 'active', plan: 'Single', dailyRate: 50, totalDays: 8, totalRent: 400 }, { id: 'RB002', bikeId: 'EV003', bikeName: 'Yadea DT3', plate: 'Dhaka Metro Cha-5678', startDate: '2024-02-01', endDate: '2024-03-13', status: 'returned', plan: 'Rent-to-Own', dailyRate: 45, totalDays: 42, totalRent: 1890 }, { id: 'RB003', bikeId: 'EV005', bikeName: 'Etron ET50', plate: 'Dhaka Metro Cha-1234', startDate: '2024-01-10', endDate: '2024-01-31', status: 'returned', plan: 'Shared', dailyRate: 60, totalDays: 22, totalRent: 1320 }, ]; return (

Biker Details

View and manage biker profile

{biker.name.charAt(0)}

{biker.name}

{biker.status === 'active' && } {biker.status === 'pending' && } {biker.status === 'blocked' && } {biker.status}

ID: {biker.id} • {biker.location}

{biker.kycStatus === 'verified' && } {biker.kycStatus === 'pending' && } KYC: {biker.kycStatus} {biker.membershipType} {biker.rating > 0 && ( {biker.rating} ({biker.totalRatings}) )}
{activeTab === 'personal' && (

Personal Information

Address

{biker.address}

Emergency Contact

)} {activeTab === 'license' && (

Driving License

GPS Tracking Device

)} {activeTab === 'documents' && (

Uploaded Documents

{biker.documents.map((doc, idx) => (

{doc.type}

Number: {doc.number || 'N/A'}

{doc.verified ? : } {doc.verified ? 'Verified' : 'Pending'}
))}
)} {activeTab === 'reviews' && (

Biker Reviews

{[ { rider: 'Tashrif', rating: 5, comment: 'Great service! Very polite and quick.', date: '2024-03-20', rideId: 'R001' }, { rider: 'Mahir', rating: 4, comment: 'Good ride, arrived on time.', date: '2024-03-19', rideId: 'R002' }, { rider: 'Raisa', rating: 5, comment: 'Excellent experience. Would recommend!', date: '2024-03-18', rideId: 'R003' }, { rider: 'Anika', rating: 3, comment: 'Ride was okay but a bit slow.', date: '2024-03-17', rideId: 'R004' }, { rider: 'Ovi', rating: 5, comment: 'Best biker ever! Helped with luggage.', date: '2024-03-16', rideId: 'R005' }, ].map((review, idx) => (
{review.rider.charAt(0)}

{review.rider}

Ride: {review.rideId}

{Array.from({ length: review.rating }).map((_, i) => ( ))}

{review.comment}

{review.date}

))}
)} {activeTab === 'rent' && (

Daily Rent History

Total Paid

৳{rentHistory.filter(r => r.status === 'paid').reduce((sum, r) => sum + r.amount, 0)}

Pending

৳{rentHistory.filter(r => r.status === 'pending').reduce((sum, r) => sum + r.amount, 0)}

Total Days

{rentHistory.length}

Current Plan

{biker.membershipType}

{rentHistory.map(rent => ( ))}
Date Bike ID Plan Amount Status Actions
{rent.date} {rent.bikeId} {rent.plan} ৳{rent.amount} {rent.status === 'paid' && } {rent.status === 'pending' && } {rent.status} {rent.status === 'pending' ? ( ) : ( - )}
)} {activeTab === 'bike' && (

Rented Bikes Details

{biker.currentBike || 'No Bike Assigned'}

Plate: {biker.bikePlate || 'N/A'}

Mileage

{biker.lastRideAt || 'N/A'}

{biker.totalDistance.toLocaleString()} km

Battery Health

%
Good

85 km

Bike Images

Front
Back
Left Side
Right Side

Notes

Rented Bikes History

{rentedBikesHistory.map(rental => ( ))}
Bike Plate Plan Start Date End Date Days Total Rent Status

{rental.bikeName}

{rental.bikeId}

{rental.plate} {rental.plan} {rental.startDate} {rental.endDate || '-'} {rental.totalDays} ৳{rental.totalRent} {rental.status === 'active' && } {rental.status === 'returned' && } {rental.status === 'active' ? 'Active' : 'Returned'}
)} {activeTab === 'stats' && (
5 ? 'red' : ''} />
)} {activeTab === 'account' && (

Financial

Verification & Insurance

)} {activeTab === 'activity' && (

Activity Log

{[ { action: 'Profile Updated', date: '2024-03-21', icon: Edit }, { action: 'Ride Completed', date: '2024-03-21', icon: BikeIcon }, { action: 'Wallet Top Up - ৳2000', date: '2024-03-20', icon: Wallet }, { action: 'KYC Verified', date: '2024-01-15', icon: CheckCircle }, ].map((log, idx) => { const Icon = log.icon; return (

{log.action}

{log.date}

); })}
)}
{/*
*/}
); } function InfoCard({ label, value, highlight }: { label: string; value: string; highlight?: string }) { return (

{label}

{value}

); } function StatCard({ label, value, icon: Icon, color }: { label: string; value: string; icon: any; color: string }) { return (

{value}

{label}

); }