patient update 4
This commit is contained in:
@@ -3,7 +3,6 @@ import { useState, useEffect } from 'react';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useUser } from '@clerk/nextjs';
|
import { useUser } from '@clerk/nextjs';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
||||||
|
|
||||||
@@ -21,21 +20,7 @@ const AccountPage = () => {
|
|||||||
|
|
||||||
if (!userData) return <div>Loading...</div>;
|
if (!userData) return <div>Loading...</div>;
|
||||||
|
|
||||||
const [medications, setMedications] = useState([]);
|
console.log(userData);
|
||||||
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([]);
|
|
||||||
const handleDiagnosesChange = (e) => {
|
|
||||||
setDiagnoses(e.target.value.split(','));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto p-4">
|
<div className="container mx-auto p-4">
|
||||||
@@ -56,61 +41,6 @@ const AccountPage = () => {
|
|||||||
<Label>Role:</Label>
|
<Label>Role:</Label>
|
||||||
<p>{userData.role}</p>
|
<p>{userData.role}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-4">
|
|
||||||
<Label>Medications:</Label>
|
|
||||||
<br/>
|
|
||||||
{medications.map((medication, index) => (
|
|
||||||
<div key={index} className="mb-2 grid grid-cols-3 gap-2">
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="Name"
|
|
||||||
value={medication.name}
|
|
||||||
onChange={(e) => handleMedicationsChange(index, 'name', e.target.value)}
|
|
||||||
className="mb-2"
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="Dosage"
|
|
||||||
value={medication.dosage}
|
|
||||||
onChange={(e) => handleMedicationsChange(index, 'dosage', e.target.value)}
|
|
||||||
className="mb-2"
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="Frequency"
|
|
||||||
value={medication.frequency}
|
|
||||||
onChange={(e) => handleMedicationsChange(index, 'frequency', e.target.value)}
|
|
||||||
className="mb-2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
<div className="mb-2 grid grid-cols-4 gap-2">
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="Name"
|
|
||||||
className="mb-2"
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="Dosage"
|
|
||||||
className="mb-2"
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="Frequency"
|
|
||||||
className="mb-2"
|
|
||||||
/>
|
|
||||||
<Button onClick={handleAddMedication}>Add Medication</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mb-4">
|
|
||||||
<Label>Diagnoses:</Label>
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
value={diagnoses.join(',')}
|
|
||||||
onChange={handleDiagnosesChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,6 +22,6 @@
|
|||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/connectDB.js", "src/lib/utils.js", "src/app/(web)/account/page.jsx"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/connectDB.js", "src/lib/utils.js", "src/app/(web)/account/page.jsx", "src/app/(panels)/suite/patient/account/page.jsx"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user