diff --git a/src/Components/Facility/ConsultationDetails/ConsultationNursingTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationNursingTab.tsx index 883de678ba3..6f69bc78557 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationNursingTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationNursingTab.tsx @@ -17,6 +17,8 @@ import LogUpdateAnalayseTable from "../Consultations/components/SharedTable"; import { formatDateTime } from "../../../Utils/utils"; import PageTitle from "@/Components/Common/PageTitle"; +import { ConsultationTabProps } from "."; +import { ProcedureType } from "@/Components/Common/prescription-builder/ProcedureBuilder"; const REVERSE_CHOICES = { appetite: { @@ -90,7 +92,7 @@ const ROUTINE_ROWS = [ { subField: true, field: "appetite" } as const, ]; -const NursingPlot = ({ consultationId }: any) => { +const NursingPlot = ({ consultationId }: ConsultationTabProps) => { const { t } = useTranslation(); const [results, setResults] = useState({}); const [currentPage, setCurrentPage] = useState(1); @@ -131,7 +133,9 @@ const NursingPlot = ({ consultationId }: any) => { .reduce((accumulator, value) => accumulator.concat(value), []); const filterEmpty = (field: (typeof NURSING_CARE_PROCEDURES)[number]) => { - const filtered = dataToDisplay.filter((i: any) => i.procedure === field); + const filtered = dataToDisplay.filter( + (i: ProcedureType) => i.procedure === field, + ); return filtered.length > 0; }; @@ -187,7 +191,7 @@ const NursingPlot = ({ consultationId }: any) => { ); }; -const RoutineSection = ({ consultationId }: any) => { +const RoutineSection = ({ consultationId }: ConsultationTabProps) => { const { t } = useTranslation(); const [page, setPage] = useState(1); const [totalCount, setTotalCount] = useState(); @@ -251,7 +255,7 @@ const RoutineSection = ({ consultationId }: any) => { ); }; -export default function ConsultationNursingTab({ consultationId }: any) { +export default function ConsultationNursingTab(props: ConsultationTabProps) { const { t } = useTranslation(); return (
@@ -262,11 +266,11 @@ export default function ConsultationNursingTab({ consultationId }: any) { />

{t("routine")}

- +

{t("nursing_care")}

- +
); diff --git a/src/Components/Facility/Consultations/components/SharedTable.tsx b/src/Components/Facility/Consultations/components/SharedTable.tsx index 35f411a3e66..07a18261c7d 100644 --- a/src/Components/Facility/Consultations/components/SharedTable.tsx +++ b/src/Components/Facility/Consultations/components/SharedTable.tsx @@ -17,7 +17,10 @@ const LogUpdateAnalayseTable: React.FC = ({ const { t } = useTranslation(); // Helper function to get the display value - const getDisplayValue = (value: any, field?: string): string => { + const getDisplayValue = ( + value: string | boolean | null | undefined, + field?: string, + ): string => { if (value == null) { return " "; } @@ -35,7 +38,7 @@ const LogUpdateAnalayseTable: React.FC = ({ return "-"; }; - const isddm_mm = (str: string) => { + const isValidDate = (str: string) => { let ct = 0; for (let i = 0; i < str.length; i++) { if (str[i] == "/") ct++; @@ -45,7 +48,7 @@ const LogUpdateAnalayseTable: React.FC = ({ return false; }; - const ddmm_mmdd = (str: string) => { + const dateConversion = (str: string) => { const time = str.split(";")[0].trim(); const date = str.split(";")[1].trim(); @@ -72,13 +75,13 @@ const LogUpdateAnalayseTable: React.FC = ({ > {/* DD/MM/YYYY -> MM/DD/YYYY */}

- {isddm_mm(date) - ? formatDate(ddmm_mmdd(date)) + {isValidDate(date) + ? formatDate(dateConversion(date)) : formatDate(date)}

- {isddm_mm(date) - ? formatTime(ddmm_mmdd(date)) + {isValidDate(date) + ? formatTime(dateConversion(date)) : formatTime(date)}