From d2d5cebed465317382feae9adaa98a17e36b41a6 Mon Sep 17 00:00:00 2001 From: mahendar Date: Fri, 13 Dec 2024 16:43:55 +0530 Subject: [PATCH 1/9] updated shift details page --- src/Routers/routes/PatientRoutes.tsx | 4 + src/components/Shifting/ShiftDetails.tsx | 412 +++++++++--------- .../Shifting/ShiftingCommentsSection.tsx | 22 +- src/components/Shifting/ShiftingTable.tsx | 287 ++++++------ 4 files changed, 368 insertions(+), 357 deletions(-) diff --git a/src/Routers/routes/PatientRoutes.tsx b/src/Routers/routes/PatientRoutes.tsx index 31d6d99a037..3ce7d658028 100644 --- a/src/Routers/routes/PatientRoutes.tsx +++ b/src/Routers/routes/PatientRoutes.tsx @@ -7,6 +7,7 @@ import { patientTabs } from "@/components/Patient/PatientDetailsTab"; import { PatientHome } from "@/components/Patient/PatientHome"; import PatientNotes from "@/components/Patient/PatientNotes"; import { PatientRegister } from "@/components/Patient/PatientRegister"; +import ShiftDetails from "@/components/Shifting/ShiftDetails"; import { AppRoutes } from "@/Routers/AppRouter"; @@ -39,6 +40,9 @@ const PatientRoutes: AppRoutes = { facilityId, patientId, }) => , + "/facility/:facilityId/patient/:patientId/shift/:shiftId": ({ shiftId }) => ( + + ), "/facility/:facilityId/patient/:patientId/files": ({ facilityId, patientId, diff --git a/src/components/Shifting/ShiftDetails.tsx b/src/components/Shifting/ShiftDetails.tsx index 4a6f6c855bb..9a864caeba9 100644 --- a/src/components/Shifting/ShiftDetails.tsx +++ b/src/components/Shifting/ShiftDetails.tsx @@ -40,7 +40,7 @@ export default function ShiftDetails(props: { id: string }) { const { data, loading } = useQuery(routes.getShiftDetails, { pathParams: { id: props.id }, }); - const showCopyToclipBoard = (data: any) => { + const _showCopyToclipBoard = (data: any) => { return ( { + const _showPatientCard = (patientData: PatientModel) => { const patientGender = GENDER_TYPES.find( (i) => i.id === patientData?.gender, )?.text; return ( -
+
{t("name")}: @@ -494,255 +494,251 @@ export default function ShiftDetails(props: { id: string }) {
)} -
-
-
- - {t("patient_name")}:{" "} - - - {data?.patient_object?.name} - +
+
+
+
+ {t("created")} on +
+
+ +
-
- Status: - - {shiftStatusOptions.find( - (option) => data?.status === option.text, - )?.label || data?.status} - +
+
+ {t("last_edited")} +
+
+ +
-
- - {t("origin_facility")}:{" "} - - {data?.origin_facility_object?.name || "--"} +
+ + +
- {careConfig.wartimeShifting && ( +
+
+
- {t("shifting_approving_facility")}:{" "} + {t("patient_name")}: - {data?.shifting_approving_facility_object?.name || "--"} + + {data?.patient_object?.name} + +
+
+ + {"View Patient details"} +
- )} -
- - {t("assigned_facility")}:{" "} - - {data?.assigned_facility_external || - data?.assigned_facility_object?.name || - "--"} -
-
- - {t("contact_person_at_the_facility")}:{" "} - - {data?.refering_facility_contact_name || "--"} -
-
- - {t("phone_number_at_current_facility")}:{" "} - - {data?.refering_facility_contact_number ? ( - - {data.refering_facility_contact_number} - - ) : ( - "--" - )} -
-
- - {" "} - {t("is_emergency")}:{" "} - - - {" "} - {data?.emergency ? t("yes") : t("no")} - -
-
- - {t("is_up_shift")}:{" "} - - - {" "} - {data?.is_up_shift ? t("yes") : t("no")} - -
-
- - {t("patient_category")}:{" "} - - - {" "} - {data?.patient_object.last_consultation?.last_daily_round - ?.patient_category ?? - data?.patient_object.last_consultation?.category} -
- {careConfig.kasp.enabled && ( +
- {careConfig.kasp.fullString}:{" "} + Status:{" "} + + + {shiftStatusOptions.find( + (option) => data?.status === option.text, + )?.label || data?.status} + +
+
+ + {t("is_up_shift")}: - {" "} - {data?.is_kasp ? t("yes") : t("no")} + {data?.is_up_shift ? t("yes") : t("no")}
- )} - {careConfig.wartimeShifting && ( - <> +
+ + {t("is_emergency")}: + + + {data?.emergency ? t("yes") : t("no")} + +
+
+ + {t("patient_category")}: + + + {data?.patient_object.last_consultation?.last_daily_round + ?.patient_category ?? + data?.patient_object.last_consultation?.category} + +
+ +
+ + {t("contact_person_at_the_facility")}: + + {data?.refering_facility_contact_name || "--"} +
+
+ + {careConfig.kasp.enabled && (
- {careConfig.kasp.fullString}:{" "} + {careConfig.kasp.fullString}: - {" "} {data?.is_kasp ? t("yes") : t("no")}
+ )} + {careConfig.wartimeShifting && ( + <> +
+ + {t("vehicle_preference")}: + + {data?.vehicle_preference || + data?.preferred_vehicle_choice} +
+
+ + {t("facility_preference")}: + + {data?.assigned_facility_type || "--"} +
+
+ + {t("severity_of_breathlessness")}: + + {data?.breathlessness_level || "--"} +
+ + )} +
+ + {t("origin_facility")}: + + {data?.origin_facility_object?.name || "--"} +
+ {careConfig.wartimeShifting && (
- {t("vehicle_preference")}:{" "} - - {data?.vehicle_preference || data?.preferred_vehicle_choice} -
-
- - {t("facility_preference")}:{" "} + {t("shifting_approving_facility")}: - {data?.assigned_facility_type || "--"} + {data?.shifting_approving_facility_object?.name || "--"}
-
- - {t("severity_of_breathlessness")}:{" "} - - {data?.breathlessness_level || "--"} -
{" "} - - )} - -
- - {t("reason")}:{" "} - - {data?.reason || "--"} -
-
- - {t("ambulance_driver_name")}:{" "} - - - {data?.ambulance_driver_name || "--"} - -
-
- - {t("ambulance_phone_number")}:{" "} - - - {data?.ambulance_phone_number ? ( - - {data?.ambulance_phone_number} - - ) : ( - "--" - )} - -
-
- - {t("ambulance_number")}:{" "} - - {data?.ambulance_number || "--"} -
-
- - {t("comments")}:{" "} - - {data?.comments || "--"} -
- - - {t("created")}: + {t("assigned_facility")}: - } - time={data?.created_date} - /> - - {t("updated")}: + {data?.assigned_facility_external || + data?.assigned_facility_object?.name || + "--"} +
+
+ + {t("reason")}:{" "} - } - time={data?.modified_date} - /> + {data?.reason || "--"} +
+
-
-
-
+
+
+ {/*

{t("details_of_patient")} {showCopyToclipBoard(data)}

{data?.patient_object && showPatientCard(data?.patient_object)} -
-
-

{t("comments")}

- -
-
+
*/} +
+

{t("details_of_origin_facility")}

-
-

{t("audit_log")}

+ {showFacilityCard(data?.origin_facility_object)} +
+
+

{t("Ambulance Details")}

-
-
-
- {t("created")} -
-
- +
+
+ + {t("ambulance_driver_name")}: + + + {data?.ambulance_driver_name || "--"} +
-
-
-
- {t("last_edited")} +
+ + {t("ambulance_phone_number")}: + + + {data?.ambulance_phone_number ? ( + + {data?.ambulance_phone_number} + + ) : ( + "--" + )} +
-
- +
+ + {t("ambulance_number")}: + + + {data?.ambulance_number || "--"} +
-
-

{t("details_of_origin_facility")}

- - {showFacilityCard(data?.origin_facility_object)} -
{!data?.assigned_facility_external && ( -
-

{t("details_of_assigned_facility")}

+
+

{t("details_of_assigned_facility")}

{showFacilityCard(data?.assigned_facility_object)}
)} {careConfig.wartimeShifting && ( -
+

{t("details_of_shifting_approving_facility")}

@@ -750,6 +746,12 @@ export default function ShiftDetails(props: { id: string }) {
)}
+
+
+

{t("comments")}

+ +
+
)} diff --git a/src/components/Shifting/ShiftingCommentsSection.tsx b/src/components/Shifting/ShiftingCommentsSection.tsx index f406316d758..0b54bc432c7 100644 --- a/src/components/Shifting/ShiftingCommentsSection.tsx +++ b/src/components/Shifting/ShiftingCommentsSection.tsx @@ -47,6 +47,17 @@ const CommentSection = (props: CommentSectionProps) => { > {(_, query) => (
+
+ + + + > + {(item) => } + +
+ +
+