From 4d84be8d3d4671ea3f62e14fe45083adfc8d326e Mon Sep 17 00:00:00 2001
From: Arkadiusz Bachorski
<60391032+arkadiuszbachorski@users.noreply.github.com>
Date: Sat, 24 Aug 2024 14:27:16 +0200
Subject: [PATCH] Add dosage instructions (#36)
# Add dosage instructions
## :recycle: Current situation & Problem
This PR adds dosage instructions to medications
### Code of Conduct & Contributing Guidelines
By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
---
app/(dashboard)/patients/Medications.tsx | 50 ++++++++++++++++++-
app/(dashboard)/patients/[id]/AllergyForm.tsx | 24 ++++-----
app/(dashboard)/patients/[id]/page.tsx | 11 ++--
modules/firebase/models/medication.ts | 2 +
modules/firebase/utils.ts | 4 +-
5 files changed, 69 insertions(+), 22 deletions(-)
diff --git a/app/(dashboard)/patients/Medications.tsx b/app/(dashboard)/patients/Medications.tsx
index 4490f2d9..df3d4511 100644
--- a/app/(dashboard)/patients/Medications.tsx
+++ b/app/(dashboard)/patients/Medications.tsx
@@ -6,13 +6,22 @@
// SPDX-License-Identifier: MIT
//
'use client'
-import { Plus, Check, Trash } from 'lucide-react'
+import { Plus, Check, Trash, Pencil } from 'lucide-react'
import { z } from 'zod'
import { useMedicationsMap } from '@/app/(dashboard)/patients/clientUtils'
import { MedicationSelect } from '@/app/(dashboard)/patients/MedicationSelect'
import { type MedicationsData } from '@/app/(dashboard)/patients/utils'
import { Button } from '@/packages/design-system/src/components/Button'
import { Card } from '@/packages/design-system/src/components/Card'
+import {
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+ DialogClose,
+} from '@/packages/design-system/src/components/Dialog'
import { EmptyState } from '@/packages/design-system/src/components/EmptyState'
import {
Select,
@@ -28,6 +37,7 @@ import {
TableRow,
TableBody,
} from '@/packages/design-system/src/components/Table'
+import { Textarea } from '@/packages/design-system/src/components/Textarea'
import { Tooltip } from '@/packages/design-system/src/components/Tooltip'
import { Field } from '@/packages/design-system/src/forms/Field'
import { useForm } from '@/packages/design-system/src/forms/useForm'
@@ -49,6 +59,7 @@ const formSchema = z.object({
medications: z.array(
z.object({
id: z.string(),
+ instructions: z.string(),
medication: z.string({ required_error: 'Medication is required' }),
drug: z.string({ required_error: 'Drug is required' }),
quantity: z.number().min(0),
@@ -86,6 +97,7 @@ export const Medications = ({
// `undefined` doesn't get submitted anywhere
medication: undefined as unknown as string,
drug: undefined as unknown as string,
+ instructions: '',
quantity: 1,
frequencyPerDay: 1,
},
@@ -117,7 +129,8 @@ export const Medications = ({
Quantity
Frequency
Daily dosage
-
+ Instructions
+
@@ -305,6 +318,39 @@ export const Medications = ({
}
+
+
+