2026-04-29 13:32:22 +03:30
|
|
|
'use client';
|
|
|
|
|
|
2026-04-30 14:05:44 +03:30
|
|
|
import { Button } from '@/components/ui/common/Button';
|
|
|
|
|
import { Input } from '@/components/ui/common/Input';
|
2026-04-29 13:32:22 +03:30
|
|
|
import { CreatePatientInput } from '@/types/patient';
|
|
|
|
|
|
|
|
|
|
interface CreatePatientModalProps {
|
|
|
|
|
isOpen: boolean;
|
|
|
|
|
formData: CreatePatientInput;
|
|
|
|
|
onChange: (patch: Partial<CreatePatientInput>) => void;
|
|
|
|
|
onSubmit: () => void;
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
loading?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function CreatePatientModal({
|
|
|
|
|
isOpen,
|
|
|
|
|
formData,
|
|
|
|
|
onChange,
|
|
|
|
|
onSubmit,
|
|
|
|
|
onClose,
|
|
|
|
|
loading = false,
|
|
|
|
|
}: CreatePatientModalProps) {
|
|
|
|
|
if (!isOpen) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="surface-card p-4 space-y-3">
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
|
|
|
|
<Input
|
|
|
|
|
label="First name"
|
|
|
|
|
value={formData.firstName || ''}
|
|
|
|
|
onChange={(e) => onChange({ firstName: e.target.value })}
|
|
|
|
|
/>
|
|
|
|
|
<Input
|
|
|
|
|
label="Last name"
|
|
|
|
|
value={formData.lastName || ''}
|
|
|
|
|
onChange={(e) => onChange({ lastName: e.target.value })}
|
|
|
|
|
/>
|
|
|
|
|
<Input
|
|
|
|
|
label="Phone"
|
|
|
|
|
value={formData.phone || ''}
|
|
|
|
|
onChange={(e) => onChange({ phone: e.target.value })}
|
|
|
|
|
/>
|
|
|
|
|
<Input
|
|
|
|
|
label="Email"
|
|
|
|
|
type="email"
|
|
|
|
|
value={formData.email || ''}
|
|
|
|
|
onChange={(e) => onChange({ email: e.target.value })}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex gap-2">
|
|
|
|
|
<Button
|
|
|
|
|
variant="primary"
|
|
|
|
|
onClick={onSubmit}
|
|
|
|
|
isLoading={loading}
|
|
|
|
|
disabled={!formData.firstName || !formData.lastName}
|
|
|
|
|
>
|
|
|
|
|
Save Patient
|
|
|
|
|
</Button>
|
|
|
|
|
<Button variant="ghost" onClick={onClose}>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|