diff --git a/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx b/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx index e775939561..fa589c8971 100644 --- a/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx @@ -4,16 +4,22 @@ import ButtonV2 from "../../../Common/components/ButtonV2"; import { DailyRoundsModel } from "../../../Patient/models"; import LogUpdateCardAttribute from "./LogUpdateCardAttribute"; import { ConsultationModel } from "../../models"; +import { useSlugs } from "../../../../Common/hooks/useSlug"; interface Props { round: DailyRoundsModel; consultationData: ConsultationModel; - onViewDetails: () => void; - onUpdateLog?: () => void; } const DefaultLogUpdateCard = ({ round, ...props }: Props) => { + const [facilityId, patientId, consultationId] = useSlugs( + "facility", + "patient", + "consultation", + ); const { t } = useTranslation(); + const consultationUrl = `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`; + return (
{ ghost size="small" className="w-full" - onClick={props.onViewDetails} + href={ + ["NORMAL", "TELEMEDICINE", "DOCTORS_LOG"].includes( + round.rounds_type!, + ) + ? `${consultationUrl}/daily-rounds/${round.id}` + : `${consultationUrl}/daily_rounds/${round.id}` + } > {t("view_details")} @@ -55,7 +67,16 @@ const DefaultLogUpdateCard = ({ round, ...props }: Props) => { ghost size="small" className="w-full" - onClick={props.onUpdateLog} + href={ + [ + "NORMAL", + "TELEMEDICINE", + "DOCTORS_LOG", + "COMMUNITY_NURSES_LOG", + ].includes(round.rounds_type!) + ? `${consultationUrl}/daily-rounds/${round.id}/update` + : `${consultationUrl}/daily_rounds/${round.id}/update` + } > {t("update_log")} diff --git a/src/Components/Facility/Consultations/DailyRoundsList.tsx b/src/Components/Facility/Consultations/DailyRoundsList.tsx index ddf5b28fd8..561a4f1a95 100644 --- a/src/Components/Facility/Consultations/DailyRoundsList.tsx +++ b/src/Components/Facility/Consultations/DailyRoundsList.tsx @@ -1,4 +1,3 @@ -import { navigate } from "raviger"; import { DailyRoundsModel } from "../../Patient/models"; import VirtualNursingAssistantLogUpdateCard from "./DailyRounds/VirtualNursingAssistantLogUpdateCard"; import DefaultLogUpdateCard from "./DailyRounds/DefaultLogUpdateCard"; @@ -24,8 +23,6 @@ export default function DailyRoundsList({ consultation }: Props) { const { t } = useTranslation(); const [query, setQuery] = useState(); - const consultationUrl = `/facility/${consultation.facility}/patient/${consultation.patient}/consultation/${consultation.id}`; - return ( navigate(itemUrl)} - onUpdateLog={() => navigate(`${itemUrl}/update`)} /> ); diff --git a/src/Components/LogUpdate/CriticalCarePreview.tsx b/src/Components/LogUpdate/CriticalCarePreview.tsx index 8302468162..7e18e12b10 100644 --- a/src/Components/LogUpdate/CriticalCarePreview.tsx +++ b/src/Components/LogUpdate/CriticalCarePreview.tsx @@ -58,12 +58,13 @@ export default function CriticalCarePreview(props: Props) {

Consultation Updates -
+
{t(`ROUNDS_TYPE__${data.rounds_type}`)}

+ -
- {(["left", "right"] as const).map((dir) => ( -
-
{dir} Pupil
- - {data[`${dir}_pupil_size`] === 0 && ( + {(data.left_pupil_light_reaction || + data.left_pupil_light_reaction_detail || + data.left_pupil_size || + data.left_pupil_size_detail || + data.right_pupil_light_reaction || + data.right_pupil_light_reaction_detail || + data.right_pupil_size || + data.right_pupil_size_detail) && ( +
+ {(["left", "right"] as const).map((dir) => ( +
+
{dir} Pupil
- )} - )} - /> - -
- ))} -
+ + +
+ ))} +
+ )}
-
+
{data.bp && (
Blood Pressure
@@ -304,20 +314,23 @@ export default function CriticalCarePreview(props: Props) { label={t("heartbeat_description")} value={data.rhythm_detail} /> -

Pain Scale

- + {!!data.pain_scale_enhanced?.length && ( + <> +

Pain Scale

+ + + )}
{!!IOBalanceSections.flatMap((s) => s.fields.flatMap((f) => data[f.key] ?? []), ).length && ( -
- - s.fields.map((f) => f.key), - )} - /> +
+ s.fields.map((f) => f.key), + ).some((field) => data[field]?.length)} + >
{IOBalanceSections.map(({ name, fields }) => (
@@ -384,7 +397,7 @@ export default function CriticalCarePreview(props: Props) {
  • ))} @@ -392,8 +405,10 @@ export default function CriticalCarePreview(props: Props) {
    )} -
    - +
    { const parentContext = React.useContext(sectionContext); - const [hasValue, setHasValue] = React.useState(false); + const [hasValue, setHasValue] = React.useState(props.show ?? false); useEffect(() => { if (parentContext && hasValue) { @@ -595,26 +611,6 @@ const Detail = (props: { ); }; -const ShowOnData = (props: { - data: DailyRoundsModel; - fields: (keyof DailyRoundsModel)[]; -}) => { - const context = React.useContext(sectionContext); - - useEffect(() => { - if ( - context && - props.fields.some( - (field) => props.data[field] != null && props.data[field] !== "", - ) - ) { - context.hasValue(); - } - }, [props.data, context]); - - return null; -}; - const ChoiceDetail = (props: { name: keyof DailyRoundsModel; data: DailyRoundsModel; diff --git a/src/Components/LogUpdate/Sections/NursingCare.tsx b/src/Components/LogUpdate/Sections/NursingCare.tsx index f4dd34d5e1..e97bda64e9 100644 --- a/src/Components/LogUpdate/Sections/NursingCare.tsx +++ b/src/Components/LogUpdate/Sections/NursingCare.tsx @@ -34,7 +34,7 @@ const NursingCare = ({ log, onChange }: LogUpdateSectionProps) => { {nursing.map((obj) => ( - + {t(`NURSING_CARE_PROCEDURE__${obj.procedure}`)} diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index f9e78b136e..d74cded605 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -366,7 +366,7 @@ export const DailyRounds = (props: any) => { urination_frequency: state.form.urination_frequency, sleep: state.form.sleep, nutrition_route: state.form.nutrition_route, - oral_issue: state.form.oral_issue, + oral_issue: state.form.oral_issue ?? undefined, appetite: state.form.appetite, blood_sugar_level: state.form.blood_sugar_level, nursing: state.form.nursing, @@ -384,9 +384,15 @@ export const DailyRounds = (props: any) => { if (obj) { dispatch({ type: "set_form", form: initForm }); Notification.Success({ - msg: `${t(obj.rounds_type as string)} log updated successfully`, + msg: t("LOG_UPDATE_UPDATED_NOTIFICATION", { + roundType: t(`ROUNDS_TYPE__${state.form.rounds_type}`), + }), }); - if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { + if ( + ["NORMAL", "TELEMEDICINE", "COMMUNITY_NURSES_LOG"].includes( + state.form.rounds_type, + ) + ) { navigate( `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, ); @@ -675,7 +681,7 @@ export const DailyRounds = (props: any) => { -
    +
    Bladder
    { )} />
    -
    +
    Nutrition