import { useState } from 'react'; interface Driver { id: string; name: string; phone: string; currentLocation: { lat: number; lng: number }; assignedVipIds: string[]; vehicleCapacity?: number; } interface EditDriverFormProps { driver: Driver; onSubmit: (driverData: any) => void; onCancel: () => void; } const EditDriverForm: React.FC = ({ driver, onSubmit, onCancel }) => { const [formData, setFormData] = useState({ name: driver.name, phone: driver.phone, vehicleCapacity: driver.vehicleCapacity || 4, currentLocation: { lat: driver.currentLocation.lat, lng: driver.currentLocation.lng } }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); onSubmit({ ...formData, id: driver.id }); }; const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; if (name === 'lat' || name === 'lng') { setFormData(prev => ({ ...prev, currentLocation: { ...prev.currentLocation, [name]: parseFloat(value) || 0 } })); } else if (name === 'vehicleCapacity') { setFormData(prev => ({ ...prev, [name]: parseInt(value) || 0 })); } else { setFormData(prev => ({ ...prev, [name]: value })); } }; return (
{/* Modal Header */}

Edit Driver

Update driver information for {driver.name}

{/* Modal Body */}
{/* Basic Information Section */}

Basic Information

🚗 Select the maximum number of passengers this vehicle can accommodate

{/* Location Section */}

Current Location

Current coordinates: {formData.currentLocation.lat.toFixed(6)}, {formData.currentLocation.lng.toFixed(6)}

You can use GPS coordinates or get them from a mapping service

); }; export default EditDriverForm;