From ec119e2ae211eb5433d775d8c2d4827869e4f5c4 Mon Sep 17 00:00:00 2001 From: yash-learner Date: Sun, 15 Dec 2024 19:38:11 +0530 Subject: [PATCH] Wire note and priority --- .../LabTest/CreateServiceRequest.tsx | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/LabTest/CreateServiceRequest.tsx b/src/components/LabTest/CreateServiceRequest.tsx index 0282490d166..219f7328929 100644 --- a/src/components/LabTest/CreateServiceRequest.tsx +++ b/src/components/LabTest/CreateServiceRequest.tsx @@ -14,7 +14,7 @@ import { Label } from "../ui/label"; import { RadioGroup, RadioGroupItem } from "../ui/radio-group"; import { Textarea } from "../ui/textarea"; import LabOrderCodeSelect from "./LabOrderCodeSelect"; -import { Coding, ServiceRequest } from "./types"; +import { Annotation, Coding, ServiceRequest } from "./types"; type CreateServiceRequestProps = { encounter: ConsultationModel; @@ -26,10 +26,21 @@ export default function CreateServiceRequest({ const { t } = useTranslation(); const [code, setCode] = useState(); - const [note, setNote] = useState(); + const [note, setNote] = useState([]); const [priority, setPriority] = useState(); const [recurrence, setRecurrence] = useState(); + const handleNoteChange = (e: React.ChangeEvent) => { + const updatedNote: Annotation[] = [ + { + text: e.target.value, + authorString: "CurrentUser", // Replace with actual user + time: new Date().toISOString(), + }, + ]; + setNote(updatedNote); + }; + return ( @@ -42,6 +53,7 @@ export default function CreateServiceRequest({ placeholder="Type your note here." id="note" className="bg-white" + onChange={handleNoteChange} /> )} @@ -53,6 +65,9 @@ export default function CreateServiceRequest({ + setPriority(value as ServiceRequest["priority"]) + } > {["routine", "urgent", "asap", "stat"].map((value) => (
@@ -72,7 +87,7 @@ export default function CreateServiceRequest({
{note === undefined && (