diff --git a/src/app/(panels)/suite/patient/account/page.jsx b/src/app/(panels)/suite/patient/account/page.jsx index 613633b..3786cbf 100644 --- a/src/app/(panels)/suite/patient/account/page.jsx +++ b/src/app/(panels)/suite/patient/account/page.jsx @@ -7,15 +7,9 @@ import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { Card, CardHeader, CardContent } from '@/components/ui/card'; -import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible" -import { ChevronDown } from "lucide-react" - -import { PersonForm } from './PatientForm'; - const AccountPage = () => { const { user } = useUser(); const [userData, setUserData] = useState(null); - const [patients, setPatients] = useState([]); useEffect(() => { if (user) { @@ -28,20 +22,24 @@ const AccountPage = () => { } }, [user]); - const handleRoleChange = async () => { - const newRole = userData.role === 'patient' ? 'caregiver' : 'patient'; - await axios.put(`/api/user?userId=${user.id}`, { role: newRole }); - setUserData({ ...userData, role: newRole }); - if (newRole === 'caregiver') { - axios.get('/api/patients').then(res => setPatients(res.data)); - } else { - setPatients([]); - setSelectedPatient(null); - } - }; - if (!userData) return
Loading...
; + const [medications, setMedications] = useState(userData.medications || []); + const handleMedicationsChange = (index, field, value) => { + const newMedications = [...medications]; + newMedications[index][field] = value; + setMedications(newMedications); + } + + const handleAddMedication = () => { + setMedications([...medications, { name: '', dosage: '', frequency: '' }]); + } + + const [diagnoses, setDiagnoses] = useState(userData.diagnoses || []); + const handleDiagnosesChange = (e) => { + setDiagnoses(e.target.value.split(',')); + } + return (
@@ -61,36 +59,61 @@ const AccountPage = () => {

{userData.role}

- - - {userData.role === 'caregiver' && ( -
-

Patients

- +
+ +
+ {medications.map((medication, index) => ( +
+ handleMedicationsChange(index, 'name', e.target.value)} + className="mb-2" + /> + handleMedicationsChange(index, 'dosage', e.target.value)} + className="mb-2" + /> + handleMedicationsChange(index, 'frequency', e.target.value)} + className="mb-2" + /> +
+ ))} +
+ + + +
- )} +
+
+ + +