Skip to content

Commit

Permalink
Add caution for encounter date field if date is beyond 30 days. (#8125)
Browse files Browse the repository at this point in the history
* Add caution for encounter date field if beyond 30 days.

* add translations
  • Loading branch information
rithviknishad authored Jul 11, 2024
1 parent 9ad2780 commit 6739c26
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
28 changes: 18 additions & 10 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1230,16 +1230,9 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
required={["A", "DC", "OP"].includes(
state.form.suggestion,
)}
label={
{
A: "Date & Time of Admission to the Facility",
DC: "Date & Time of Domiciliary Care commencement",
OP: "Date & Time of Out-patient visit",
DD: "Date & Time of Consultation",
HI: "Date & Time of Consultation",
R: "Date & Time of Consultation",
}[state.form.suggestion]
}
label={t(
`encounter_date_field_label__${state.form.suggestion}`,
)}
type="datetime-local"
value={dayjs(state.form.encounter_date).format(
"YYYY-MM-DDTHH:mm",
Expand All @@ -1251,6 +1244,21 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
: undefined
}
/>
{dayjs().diff(state.form.encounter_date, "day") > 30 && (
<div className="mb-6">
<span className="font-medium text-warning-500">
<CareIcon
icon="l-exclamation-triangle"
className="pr-2 text-lg"
/>
{t("caution")}:{" "}
{t("back_dated_encounter_date_caution")}{" "}
<strong className="font-bold">
{dayjs(state.form.encounter_date).fromNow()}.
</strong>
</span>
</div>
)}
</div>

{state.form.route_to_facility === 30 && (
Expand Down
3 changes: 2 additions & 1 deletion src/Locale/en/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,6 @@
"treating_doctor": "Treating Doctor",
"ration_card__NO_CARD": "Non-card holder",
"ration_card__BPL": "BPL",
"ration_card__APL": "APL"
"ration_card__APL": "APL",
"caution": "Caution"
}
7 changes: 7 additions & 0 deletions src/Locale/en/Consultation.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,12 @@
"next_sessions": "Next Sessions",
"no_changes": "No changes",
"encounter_suggestion_edit_disallowed": "Not allowed to switch to this option in edit consultation",
"encounter_date_field_label__A": "Date & Time of Admission to the Facility",
"encounter_date_field_label__DC": "Date & Time of Domiciliary Care commencement",
"encounter_date_field_label__OP": "Date & Time of Out-patient visit",
"encounter_date_field_label__DD": "Date & Time of Consultation",
"encounter_date_field_label__HI": "Date & Time of Consultation",
"encounter_date_field_label__R": "Date & Time of Consultation",
"back_dated_encounter_date_caution": "You are creating an encounter for",
"encounter_duration_confirmation": "The duration of this encounter would be"
}

0 comments on commit 6739c26

Please sign in to comment.