import { useState } from 'react';
const types = ['Crown','Bridge','Denture','Partial Denture','Implant Planning','Study Model'];
const CaseForm = ({ onSave, onCancel }) => {
  const [v,setV] = useState({case_number:'',patient_name:'',case_type:'Crown',due_date:''});
  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 required className="studio-input" placeholder="Case number" onChange={set('case_number')} />
    <input required className="studio-input" placeholder="Patient name" onChange={set('patient_name')} />
    <select className="studio-input" onChange={set('case_type')}>{types.map(x => <option key={x}>{x}</option>)}</select>
    <input className="studio-input" type="date" onChange={set('due_date')} />
    <div className="flex gap-2 sm:col-span-2"><button className="primary-button">Create case</button><button type="button" onClick={onCancel} className="secondary-button">Cancel</button></div>
  </form>;
};
export default CaseForm;