From a894ce6995f9dce2c6fec6997bd2e0878f6d235a Mon Sep 17 00:00:00 2001 From: Amjith Titus Date: Wed, 22 Jan 2025 13:12:23 +0530 Subject: [PATCH] Add Authored On field (#10094) --- public/locale/en.json | 1 + .../MedicationRequestQuestion.tsx | 30 +++++++++++++++-- src/components/ui/date-time-picker.tsx | 33 ++++++++++--------- src/types/emr/medicationRequest.ts | 3 ++ 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/public/locale/en.json b/public/locale/en.json index e7ab17781fc..42547268ec5 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -455,6 +455,7 @@ "audit_log": "Audit Log", "auth_login_title": "Authorized Login", "auth_method_unsupported": "This authentication method is not supported, please try a different method", + "authored_on": "Authored On", "authorize_shift_delete": "Authorize shift delete", "auto_generated_for_care": "Auto Generated for Care", "autofilled_fields": "Autofilled Fields", diff --git a/src/components/Questionnaire/QuestionTypes/MedicationRequestQuestion.tsx b/src/components/Questionnaire/QuestionTypes/MedicationRequestQuestion.tsx index 6e34f840b3d..f078fa982a2 100644 --- a/src/components/Questionnaire/QuestionTypes/MedicationRequestQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/MedicationRequestQuestion.tsx @@ -20,6 +20,7 @@ import { CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; +import { DateTimePicker } from "@/components/ui/date-time-picker"; import { Dialog, DialogContent } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; @@ -84,6 +85,7 @@ export function MedicationRequestQuestion({ ...medications, { ...parseMedicationStringToRequest(medication), + authored_on: new Date().toISOString(), }, ]; updateQuestionnaireResponseCB({ @@ -166,12 +168,12 @@ export function MedicationRequestQuestion({
{/* Header - Only show on desktop */} -
+
{t("medicine")}
@@ -199,6 +201,9 @@ export function MedicationRequestQuestion({
{t("intent")}
+
+ {t("authored_on")} +
{t("notes")}
@@ -438,7 +443,7 @@ const MedicationRequestGridRow: React.FC = ({ }; return ( -
+
{/* Medicine Name */}
@@ -742,6 +747,24 @@ const MedicationRequestGridRow: React.FC = ({
+ {/* Authored On */} +
+ + { + if (!date) return; + onUpdate?.({ authored_on: date.toISOString() }); + }} + disabled={disabled} + /> +
{/* Notes */}
@@ -775,6 +798,7 @@ const MedicationRequestGridRow: React.FC = ({ /> )}
+ {/* Remove Button */}