import { useState } from 'react';
const PatientForm = ({ onSave, onCancel }) => {
  const [v,setV] = useState({patient_code:'',full_name:'',date_of_birth:'',notes:''});
  const set = key => e => setV({...v,[key]:e.target.value});
  return <form onSubmit={e => { e.preventDefault(); onSave(v); }} className="glass-panel mb-5 grid gap-3 p-4 sm:grid-cols-2">
    <input className="studio-input" required placeholder="Patient code" value={v.patient_code} onChange={set('patient_code')} />
    <input className="studio-input" required placeholder="Full name" value={v.full_name} onChange={set('full_name')} />
    <input className="studio-input" type="date" value={v.date_of_birth} onChange={set('date_of_birth')} />
    <input className="studio-input" placeholder="Notes" value={v.notes} onChange={set('notes')} />
    <div className="flex gap-2 sm:col-span-2"><button className="primary-button">Save patient</button><button type="button" onClick={onCancel} className="secondary-button">Cancel</button></div>
  </form>;
};
export default PatientForm;