import { useState } from 'react'; import { Device } from './InventoryManagement'; interface DeviceFormProps { onAddDevice: (device: Device) => void; } export default function DeviceForm({ onAddDevice }: DeviceFormProps) { const [name, setName] = useState(''); const [quantity, setQuantity] = useState(''); const [serialNumber, setSerialNumber] = useState(''); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); const newDevice: Device = { id: Date.now().toString(), name, quantity: parseInt(quantity), serialNumber, }; onAddDevice(newDevice); setName(''); setQuantity(''); setSerialNumber(''); }; return (
); }