From b916329462950e3c37f446006e664433462ce471 Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:29:20 +0530 Subject: [PATCH 01/20] Updated TreatmentSummary component by integrating it with PrintPreview component --- src/Components/Facility/TreatmentSummary.tsx | 568 ++++++++++--------- src/style/index.css | 37 +- 2 files changed, 338 insertions(+), 267 deletions(-) diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index e75eec5b80a..7c34a627110 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -8,6 +8,7 @@ import useSlug from "../../Common/hooks/useSlug"; import useAppHistory from "../../Common/hooks/useAppHistory"; import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; +import PrintPreview from "../../CAREUI/misc/PrintPreview"; // Import the PrintPreview component import CareIcon from "../../CAREUI/icons/CareIcon"; const TreatmentSummary = (props: any) => { @@ -33,308 +34,343 @@ const TreatmentSummary = (props: any) => { }); return ( -
-
-
- - -
+ <> + +

+ {consultationData?.facility_name ?? ""} +

-
-

- {consultationData?.facility_name ?? ""} -

+

INTERIM TREATMENT SUMMARY

-

INTERIM TREATMENT SUMMARY

+
{formatDate(date)}
-
{formatDate(date)}
+
+
+
+ Name : {patientData?.name ?? ""} +
+
+ Address : {patientData?.address ?? ""} +
+
-
-
+
+
- Name : {patientData?.name ?? ""} + Age :{" "} + {patientData ? formatPatientAge(patientData, true) : ""}
-
- Address : {patientData?.address ?? ""} +
+ OP : {consultationData?.patient_no ?? ""}
-
-
-
- Age :{" "} - {patientData ? formatPatientAge(patientData, true) : ""} -
-
- OP : {consultationData?.patient_no ?? ""} -
-
- -
- {consultationData?.suggestion === "DC" ? ( - Date of domiciliary care commenced : - ) : ( - Date of admission : - )} - - {consultationData?.encounter_date - ? formatDateTime(consultationData.encounter_date) - : " --/--/----"} - -
+
+ {consultationData?.suggestion === "DC" ? ( + Date of domiciliary care commenced : + ) : ( + Date of admission : + )} + + {consultationData?.encounter_date + ? formatDateTime(consultationData.encounter_date) + : " --/--/----"} +
+
-
-
- Gender : - {GENDER_TYPES.find((i) => i.id === patientData?.gender)?.text} -
+
+
+ Gender : + {GENDER_TYPES.find((i) => i.id === patientData?.gender)?.text} +
-
- Contact person : - - {" "} - {patientData?.emergency_phone_number - ? patientData.emergency_phone_number - : " -"} - -
+
+ Contact person : + + {" "} + {patientData?.emergency_phone_number + ? patientData.emergency_phone_number + : " -"} +
+
-
- Comorbidities : -
- - +
+ Comorbidities : +
+
+ + + + + + + + {patientData?.medical_history && + patientData.medical_history.length > 0 ? ( + patientData.medical_history.map( + (obj: any, index: number) => { + return ( + + + + + ); + }, + ) + ) : ( - - + + - - - {patientData?.medical_history && - patientData.medical_history.length > 0 ? ( - patientData.medical_history.map( - (obj: any, index: number) => { - return ( - - - - - ); - }, - ) - ) : ( - - - - - )} - -
DiseaseDetails
+ {obj["disease"]} + + {obj["details"] ? obj["details"] : "---"} +
DiseaseDetails + --- + + --- +
- {obj["disease"]} - - {obj["details"] ? obj["details"] : "---"} -
- --- - - --- -
-
+ )} + +
+
-
- Diagnosis : -
-
- History of present illness : - {consultationData?.history_of_present_illness - ? consultationData.history_of_present_illness - : " ---"} -
+
+ Diagnosis : +
+
+ History of present illness : + {consultationData?.history_of_present_illness + ? consultationData.history_of_present_illness + : " ---"} +
-
- Examination details and clinical conditions : - {consultationData?.examination_details - ? consultationData.examination_details - : " ---"} -
+
+ Examination details and clinical conditions : + {consultationData?.examination_details + ? consultationData.examination_details + : " ---"} +
-
- Physical Examination info : - {consultationData?.last_daily_round?.physical_examination_info - ? consultationData.last_daily_round - ?.physical_examination_info - : " ---"} -
+
+ Physical Examination info : + {consultationData?.last_daily_round?.physical_examination_info + ? consultationData.last_daily_round?.physical_examination_info + : " ---"}
+
-
- General Instructions : - {patientData?.last_consultation?.consultation_notes ? ( -
- {patientData.last_consultation.consultation_notes} -
- ) : ( - " ---" - )} -
+
+ General Instructions : + {patientData?.last_consultation?.consultation_notes ? ( +
+ {patientData.last_consultation.consultation_notes} +
+ ) : ( + " ---" + )} +
-
- Relevant investigations : +
+ Relevant investigations : -
- - +
+
+ + + + + + + + + + + + {investigations && investigations.results.length > 0 ? ( + investigations.results.map((value: any, index: number) => { + return ( + + + + + + + + + ); + }) + ) : ( - - - - - - + + + + + + - - - - {investigations && investigations.results.length > 0 ? ( - investigations.results.map( - (value: any, index: number) => { - return ( - - - - - - - - - ); - }, - ) - ) : ( - - - - - - - - - )} - -
+ Date + + Name + + Result + + Ideal value + + values range + + unit +
+ {formatDate( + value["session_object"]["session_created_date"], + )} + + {value["investigation_object"]["name"]} + + {value["notes"] || value["value"]} + + {value["ideal_value"]} + + {value["range"]} + + {value["unit"]} +
- Date - - Name - - Result - - Ideal value - - values range - - unit - + --- + + --- + + --- + + --- + + --- + + --- +
- {formatDate( - value["session_object"][ - "session_created_date" - ], - )} - - {value["investigation_object"]["name"]} - - {value["notes"] || value["value"]} - - {value["investigation_object"]["ideal_value"] || - "-"} - - {value["investigation_object"]["min_value"]} -{" "} - {value["investigation_object"]["max_value"]} - - {value["investigation_object"]["unit"] || "-"} -
- --- - - --- - - --- - - --- - - --- - - --- -
-
+ )} + + + {investigations && investigations.results.length > 0 ? ( + investigations.results.map((value: any, index: number) => { + return ( + + + {formatDate( + value["session_object"]["session_created_date"], + )} + + + {value["investigation_object"]["name"]} + + + {value["notes"] || value["value"]} + + + {value["investigation_object"]["ideal_value"] || + "-"} + + + {value["investigation_object"]["min_value"]} -{" "} + {value["investigation_object"]["max_value"]} + + + {value["investigation_object"]["unit"] || "-"} + + + ); + }) + ) : ( + + + --- + + + --- + + + --- + + + --- + + + --- + + + --- + + + )} + +
+
-
- Treatment : - {consultationData?.treatment_plan ? ( -

{consultationData.treatment_plan}

- ) : ( -

---

- )} - Treatment summary/Treament Plan : +
+ Treatment : + {consultationData?.treatment_plan ? ( +

{consultationData.treatment_plan}

+ ) : ( +

---

+ )} + Treatment summary/Treament Plan : -
- - +
+
+ + + + + + + + + + {consultationData?.last_daily_round ? ( - - - + + + - - - - {consultationData?.last_daily_round ? ( - - - - - - ) : ( - - - - - - )} - -
DateSpo2Temperature
DateSpo2 - Temperature - + {formatDateTime( + consultationData.last_daily_round.modified_date, + )} + + {consultationData.last_daily_round.ventilator_spo2 || + "-"} + + {consultationData.last_daily_round.temperature || "-"} +
- {formatDateTime( - consultationData.last_daily_round.modified_date, - )} - - {consultationData.last_daily_round.ventilator_spo2 || - "-"} - - {consultationData.last_daily_round.temperature || "-"} -
- --- - - --- - - --- -
-
+ ) : ( + + + --- + + + --- + + + --- + + + )} + +
+ +
+
-
+ ); }; diff --git a/src/style/index.css b/src/style/index.css index 327cc03d047..6fb6c199875 100644 --- a/src/style/index.css +++ b/src/style/index.css @@ -1306,4 +1306,39 @@ input[type="number"] { font-weight: 700; color: #2856ff; font-size: 1rem; -} \ No newline at end of file +} + + + +@media print { + body { + padding-top: 40px; + padding-bottom: 40px; + } + + .print-preview { + padding: 10px; + margin: 0; + } + + .print-preview .header, + .print-preview .footer { + padding: 10px; + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + } + + .header { + text-align: center; + font-size: 14px; + font-weight: bold; + margin-bottom: 20px; + } + + .footer { + text-align: center; + font-size: 12px; + margin-top: 20px; + } + } + \ No newline at end of file From b8e5fa8522ef55b6e1a0791e4f95c8ec080365f7 Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Sat, 31 Aug 2024 14:49:23 +0530 Subject: [PATCH 02/20] Converted CSS to Tailwind and removed extra padding. --- src/CAREUI/misc/PrintPreview.tsx | 8 ++--- src/Components/Facility/TreatmentSummary.tsx | 2 +- src/style/index.css | 37 +------------------- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/src/CAREUI/misc/PrintPreview.tsx b/src/CAREUI/misc/PrintPreview.tsx index 243826c7337..a163f62bc2e 100644 --- a/src/CAREUI/misc/PrintPreview.tsx +++ b/src/CAREUI/misc/PrintPreview.tsx @@ -14,18 +14,18 @@ type Props = { export default function PrintPreview(props: Props) { return ( -
-
+
+
window.print()}> Print
-
+
{props.children}
diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index 7c34a627110..191219b590c 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -374,4 +374,4 @@ const TreatmentSummary = (props: any) => { ); }; -export default TreatmentSummary; +export default TreatmentSummary; \ No newline at end of file diff --git a/src/style/index.css b/src/style/index.css index 6fb6c199875..327cc03d047 100644 --- a/src/style/index.css +++ b/src/style/index.css @@ -1306,39 +1306,4 @@ input[type="number"] { font-weight: 700; color: #2856ff; font-size: 1rem; -} - - - -@media print { - body { - padding-top: 40px; - padding-bottom: 40px; - } - - .print-preview { - padding: 10px; - margin: 0; - } - - .print-preview .header, - .print-preview .footer { - padding: 10px; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - } - - .header { - text-align: center; - font-size: 14px; - font-weight: bold; - margin-bottom: 20px; - } - - .footer { - text-align: center; - font-size: 12px; - margin-top: 20px; - } - } - \ No newline at end of file +} \ No newline at end of file From 20f39b924ca77e83a0df7cbd92579b8d2f42a322 Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:49:45 +0530 Subject: [PATCH 03/20] Updated investigationSummary --- src/CAREUI/misc/PrintPreview.tsx | 4 +- src/Components/Common/PageTitle.tsx | 4 +- .../Investigations/InvestigationTable.tsx | 39 ++++++++-------- .../Investigations/ShowInvestigation.tsx | 45 ++++++++++--------- src/style/index.css | 17 ------- tailwind.config.js | 1 + 6 files changed, 50 insertions(+), 60 deletions(-) diff --git a/src/CAREUI/misc/PrintPreview.tsx b/src/CAREUI/misc/PrintPreview.tsx index a163f62bc2e..390fcce71d0 100644 --- a/src/CAREUI/misc/PrintPreview.tsx +++ b/src/CAREUI/misc/PrintPreview.tsx @@ -11,6 +11,8 @@ type Props = { title: string; }; +const PRINT_BUTTON_LABEL: string = "Print"; + export default function PrintPreview(props: Props) { return ( @@ -18,7 +20,7 @@ export default function PrintPreview(props: Props) {
window.print()}> - Print + {PRINT_BUTTON_LABEL}
diff --git a/src/Components/Common/PageTitle.tsx b/src/Components/Common/PageTitle.tsx index 3af4c873872..14776ba2981 100644 --- a/src/Components/Common/PageTitle.tsx +++ b/src/Components/Common/PageTitle.tsx @@ -70,7 +70,7 @@ export default function PageTitle({ > {" "} )} @@ -78,7 +78,7 @@ export default function PageTitle({
{componentRight}
-
+
{breadcrumbs && }
diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index 6984b0baedb..a11a68d73cf 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -82,18 +82,12 @@ export const InvestigationTable = ({ }); return ( -
+
- {title &&
{title}
} -
- window.print()} - className="my-2 mr-2" - disabled={showForm} - > - Print Report - + {title && ( +
{title}
+ )} +
setSearchFilter(e.value)} />
-
-
- - +
+
+
+ {["Name", "Value", "Unit", "Min", "Max", "Ideal"].map( (heading) => ( @@ -143,7 +141,7 @@ export const InvestigationTable = ({ )} - + {filterTests.length > 0 ? ( filterTests.map((t: any, i) => { const value = @@ -173,12 +171,13 @@ export const InvestigationTable = ({ }; handleValueChange(value, target); }} + className="print:text-black" /> ); }) ) : ( - - No tests taken + + )} diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index a7f74b98fde..156aa09a4ac 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -8,6 +8,7 @@ import request from "../../../Utils/request/request"; import useQuery from "../../../Utils/request/useQuery"; import PageTitle from "../../Common/PageTitle"; import InvestigationTable from "./InvestigationTable"; +import PrintPreview from "../../../CAREUI/misc/PrintPreview"; const Loading = lazy(() => import("../../Common/Loading")); @@ -143,25 +144,29 @@ export default function ShowInvestigation(props: any) { } return ( -
- - -
+ +
+ + +
+
); } diff --git a/src/style/index.css b/src/style/index.css index 327cc03d047..026b4820843 100644 --- a/src/style/index.css +++ b/src/style/index.css @@ -435,23 +435,6 @@ button:disabled, background-size: 1000px 100%; } - -@media print { - body * { - visibility: hidden; - } - #section-to-print, - #section-to-print * { - visibility: visible; - -webkit-print-color-adjust: exact; - } - #section-to-print { - position: absolute; - left: 0; - top: 0; - } -} - .header-section .appBar { z-index: 1201; } diff --git a/tailwind.config.js b/tailwind.config.js index 31aa43878dc..747bff5e9e7 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -23,6 +23,7 @@ module.exports = { vs: "348px", ...defaultTheme.screens, "3xl": "1920px", + print: { raw: "print" }, }, extend: { fontFamily: { From 393cc7ada516d78fd8708427a27a294a61fe5809 Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:59:41 +0530 Subject: [PATCH 04/20] Updated investigationSummary --- src/Components/Facility/TreatmentSummary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index 191219b590c..48d0a57ada3 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -8,7 +8,7 @@ import useSlug from "../../Common/hooks/useSlug"; import useAppHistory from "../../Common/hooks/useAppHistory"; import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; -import PrintPreview from "../../CAREUI/misc/PrintPreview"; // Import the PrintPreview component +import PrintPreview from "../../CAREUI/misc/PrintPreview"; import CareIcon from "../../CAREUI/icons/CareIcon"; const TreatmentSummary = (props: any) => { From ce0f7823bb63108667c9b97a6729baf11e593e39 Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Sat, 31 Aug 2024 11:05:52 +0530 Subject: [PATCH 05/20] Remove fireRequestV2 (#8446) --- src/Redux/fireRequest.tsx | 103 -------------------------------------- 1 file changed, 103 deletions(-) diff --git a/src/Redux/fireRequest.tsx b/src/Redux/fireRequest.tsx index 99cd2fe7ca4..fb1a7746167 100644 --- a/src/Redux/fireRequest.tsx +++ b/src/Redux/fireRequest.tsx @@ -1,7 +1,5 @@ import * as Notification from "../Utils/Notifications.js"; -import { isEmpty, omitBy } from "lodash-es"; - import { LocalStorageKeys } from "../Common/constants"; import api from "./api"; import axios from "axios"; @@ -173,104 +171,3 @@ export const fireRequest = ( }); }; }; - -export const fireRequestV2 = ( - key: string, - path: any = [], - params: any = {}, - successCallback: any = () => undefined, - errorCallback: any = () => undefined, - pathParam?: any, - altKey?: string, -) => { - // cancel previous api call - if (isRunning[altKey ? altKey : key]) { - isRunning[altKey ? altKey : key].cancel(); - } - isRunning[altKey ? altKey : key] = axios.CancelToken.source(); - // get api url / method - const request = Object.assign({}, requestMap[key]); - if (path.length > 0) { - request.path += "/" + path.join("/"); - } - if (request.method === undefined || request.method === "GET") { - request.method = "GET"; - const qs = new URLSearchParams(omitBy(params, isEmpty)).toString(); - if (qs !== "") { - request.path += `?${qs}`; - } - } - // set dynamic params in the URL - if (pathParam) { - Object.keys(pathParam).forEach((param: any) => { - request.path = request.path.replace(`{${param}}`, pathParam[param]); - }); - } - - // set authorization header in the request header - const config: any = { - headers: {}, - }; - if (!request.noAuth && localStorage.getItem(LocalStorageKeys.accessToken)) { - config.headers["Authorization"] = - "Bearer " + localStorage.getItem(LocalStorageKeys.accessToken); - } - const axiosApiCall: any = axios.create(config); - - fetchDataRequest(key); - return axiosApiCall[request.method.toLowerCase()](request.path, { - ...params, - cancelToken: isRunning[altKey ? altKey : key].token, - }) - .then((response: any) => { - successCallback(response.data); - }) - .catch((error: any) => { - errorCallback(error); - if (error.response) { - // temporarily don't show invalid phone number error on duplicate patient check - if (error.response.status === 400 && key === "searchPatient") { - return; - } - - // deleteUser: 404 is for permission denied - if (error.response.status === 404 && key === "deleteUser") { - Notification.Error({ - msg: "Permission denied!", - }); - } - - // currentUser is ignored because on the first page load - // 403 error is displayed for invalid credential. - if (error.response.status === 403 && key === "currentUser") { - if (localStorage.getItem(LocalStorageKeys.accessToken)) { - localStorage.removeItem(LocalStorageKeys.accessToken); - } - } - - // 400 Bad Request Error - if (error.response.status === 400 || error.response.status === 406) { - Notification.BadRequest({ - errs: error.response.data, - }); - } - - // 4xx Errors - if (error.response.status > 400 && error.response.status < 600) { - if (error.response.data && error.response.data.detail) { - Notification.Error({ - msg: error.response.data.detail, - }); - } else { - Notification.Error({ - msg: "Something went wrong...!", - }); - } - if (error.response.status === 429) { - return error.response; - } - return; - } - } - }); -}; From 75770a90c9aa5ae70b9c85f0509bea23ebaf913e Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:48:09 +0530 Subject: [PATCH 06/20] Removed unnecessary code from tailwind.config and wrapped only the necessary components in PrintPreview in the ShowInvestigation file. --- .../Investigations/ShowInvestigation.tsx | 30 +++++++++---------- tailwind.config.js | 1 - 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index 156aa09a4ac..b6a37811108 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -144,19 +144,19 @@ export default function ShowInvestigation(props: any) { } return ( - -
- + <> + + -
-
+ + ); } diff --git a/tailwind.config.js b/tailwind.config.js index 747bff5e9e7..31aa43878dc 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -23,7 +23,6 @@ module.exports = { vs: "348px", ...defaultTheme.screens, "3xl": "1920px", - print: { raw: "print" }, }, extend: { fontFamily: { From fd5436b47c20d5dd6cb70e9b8b656219a6b66d22 Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:43:56 +0530 Subject: [PATCH 07/20] Update TreatmentSummary.tsx --- src/Components/Facility/TreatmentSummary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index dc14c3d9b1c..14a56a08a44 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -1,6 +1,6 @@ import { GENDER_TYPES } from "../../Common/constants"; import { - classNames, + formatDate, formatDateTime, formatPatientAge, From 4cb12d128724c5002c3b5f3a9b15a34c9b1c52b7 Mon Sep 17 00:00:00 2001 From: Zeeshan <95434634+Zeshanxviii@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:28:30 +0530 Subject: [PATCH 08/20] fix print layout --- src/CAREUI/misc/PrintPreview.tsx | 2 +- src/Components/Facility/TreatmentSummary.tsx | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/CAREUI/misc/PrintPreview.tsx b/src/CAREUI/misc/PrintPreview.tsx index 390fcce71d0..33cf81f3f3d 100644 --- a/src/CAREUI/misc/PrintPreview.tsx +++ b/src/CAREUI/misc/PrintPreview.tsx @@ -27,7 +27,7 @@ export default function PrintPreview(props: Props) {
{props.children}
diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index 48d0a57ada3..fc350b240cb 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -35,7 +35,7 @@ const TreatmentSummary = (props: any) => { return ( <> - +

{consultationData?.facility_name ?? ""}

@@ -364,12 +364,6 @@ const TreatmentSummary = (props: any) => {
-
- -
); }; From 8309e85e481e827790da019f0edc4c2c33934f06 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Thu, 5 Sep 2024 03:40:36 +0530 Subject: [PATCH 09/20] Updated Treatment and InvestigationSummary --- .../Common/components/PatientDetail.tsx | 29 +++++ .../Investigations/InvestigationTable.tsx | 123 +++++++++--------- .../Investigations/ShowInvestigation.tsx | 97 ++++++++++---- src/Components/Facility/TreatmentSummary.tsx | 91 ++++++++----- src/Components/Medicine/PrintPreview.tsx | 30 +---- src/style/index.css | 16 +++ 6 files changed, 239 insertions(+), 147 deletions(-) create mode 100644 src/Components/Common/components/PatientDetail.tsx diff --git a/src/Components/Common/components/PatientDetail.tsx b/src/Components/Common/components/PatientDetail.tsx new file mode 100644 index 00000000000..594b54ab10c --- /dev/null +++ b/src/Components/Common/components/PatientDetail.tsx @@ -0,0 +1,29 @@ +import { ReactNode } from "react"; +import { classNames } from "../../../Utils/utils"; + +export const PatientDetail = ({ + name, + children, + className, + }: { + name: string; + children?: ReactNode; + className?: string; + }) => { + return ( +
+
{name}:
+ {children != null ? ( + {children} + ) : ( +
+ )} +
+ ); + }; + \ No newline at end of file diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index a11a68d73cf..21d452121ee 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -82,7 +82,7 @@ export const InvestigationTable = ({ }); return ( -
+
{title && (
{title}
@@ -120,70 +120,63 @@ export const InvestigationTable = ({ onChange={(e) => setSearchFilter(e.value)} />
-
-
-
{heading}
No tests taken
- - - {["Name", "Value", "Unit", "Min", "Max", "Ideal"].map( - (heading) => ( - - ), - )} - - - - {filterTests.length > 0 ? ( - filterTests.map((t: any, i) => { - const value = - changedFields[t.id]?.notes ?? - changedFields[t.id]?.value ?? - null; - const isChanged = changedFields[t.id]?.initialValue !== value; - return ( - { - const { target, value } = - t?.investigation_object?.investigation_type === - "Float" - ? { - target: `${t.id}.value`, - value: Number(e.value) || null, - } - : { - target: `${t.id}.notes`, - value: e.value, - }; - handleValueChange(value, target); - }} - className="print:text-black" - /> - ); - }) - ) : ( - - - - )} - -
- {heading} -
No tests taken
-
-
+
+
+ + + + {["Name", "Value", "Unit", "Min", "Max", "Ideal"].map((heading) => ( + + ))} + + + + {filterTests.length > 0 ? ( + filterTests.map((t: any, i) => { + const value = + changedFields[t.id]?.notes ?? changedFields[t.id]?.value ?? null; + const isChanged = changedFields[t.id]?.initialValue !== value; + return ( + { + const { target, value } = + t?.investigation_object?.investigation_type === "Float" + ? { + target: `${t.id}.value`, + value: Number(e.value) || null, + } + : { + target: `${t.id}.notes`, + value: e.value, + }; + handleValueChange(value, target); + }} + className="print:text-black" + /> + ); + }) + ) : ( + + + + )} + +
+ {heading} +
No tests taken
+
+
+
); }; diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index 3ba55f706a8..71d23d437e2 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -6,9 +6,11 @@ import routes from "../../../Redux/api"; import * as Notification from "../../../Utils/Notifications.js"; import request from "../../../Utils/request/request"; import useQuery from "../../../Utils/request/useQuery"; -import PageTitle from "../../Common/PageTitle"; import InvestigationTable from "./InvestigationTable"; import PrintPreview from "../../../CAREUI/misc/PrintPreview"; +import { PatientDetail } from "../../Common/components/PatientDetail"; +import { formatDate, formatDateTime, formatName, patientAgeInYears } from "../../../Utils/utils"; +import useConfig from "../../../Common/hooks/useConfig"; const Loading = lazy(() => import("../../Common/Loading")); @@ -38,6 +40,7 @@ const updateFormReducer = (state = initialState, action: any) => { export default function ShowInvestigation(props: any) { const { t } = useTranslation(); + const { main_logo } = useConfig(); const { consultationId, patientId, facilityId, sessionId } = props; const [state, dispatch] = useReducer(updateFormReducer, initialState); @@ -144,29 +147,77 @@ export default function ShowInvestigation(props: any) { } return ( - <> - - + +
+ +
+ + +
+

{consultation?.facility_name}

+ care logo +
+
+ + {patientData && ( + <> + {patientData.name} -{" "} + {t(`GENDER__${patientData.gender}`)},{" "} + {patientAgeInYears(patientData).toString()}yrs + + )} + + + {consultation?.patient_no} + + + + {formatDate(consultation?.encounter_date)} + + + {consultation?.current_bed?.bed_object.location_object?.name} + {" - "} + {consultation?.current_bed?.bed_object.name} + +
+
+ title={`Investigation Report of :${patientData?.name}`} + data={state.initialValues} + isDischargedPatient={!!consultation?.discharge_date} + changedFields={state.changedFields} + handleValueChange={handleValueChange} + handleUpdateCancel={handleUpdateCancel} + handleSave={handleSubmit} + /> +
+

+ Sign of the Consulting Doctor +

+ + {consultation?.treating_physician_object && + formatName(consultation?.treating_physician_object)} + +

+ Generated on: {formatDateTime(new Date())} +

+

+ This is a computer generated prescription. It shall be issued to the + patient only after the concerned doctor has verified the content and + authorized the same by affixing signature. +

+
+
+
- ); } diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index a10ca77ff4b..7896755f8fc 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -2,6 +2,7 @@ import { GENDER_TYPES } from "../../Common/constants"; import { formatDate, formatDateTime, + formatName, formatPatientAge, } from "../../Utils/utils"; import useAppHistory from "../../Common/hooks/useAppHistory"; @@ -9,7 +10,7 @@ import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; import CareIcon from "../../CAREUI/icons/CareIcon"; import { ConsultationModel } from "./models"; -import { useMemo } from "react"; +import { ReactNode, useMemo } from "react"; import { ActiveConditionVerificationStatuses, ConsultationDiagnosis, @@ -19,6 +20,8 @@ import { useTranslation } from "react-i18next"; import { PatientModel } from "../Patient/models"; import MedicineRoutes from "../Medicine/routes"; import PrintPreview from "../../CAREUI/misc/PrintPreview"; +import useConfig from "../../Common/hooks/useConfig"; +import { PatientDetail } from "../Common/components/PatientDetail"; export interface ITreatmentSummaryProps { consultationId: string; @@ -31,6 +34,8 @@ export default function TreatmentSummary({ patientId, facilityId, }: ITreatmentSummaryProps) { + + const { main_logo } = useConfig(); const { t } = useTranslation(); const date = new Date(); const { goBack } = useAppHistory(); @@ -50,37 +55,55 @@ export default function TreatmentSummary({
- -
-

- {consultationData?.facility_name ?? ""} -

- -

- {t("treatment_summary__heading")} -

- -
{formatDate(date)}
- -
- - - - - - - - - - - + +
- -
+
+

{consultationData?.facility_name}

+ care logo
+

+ {t("treatment_summary__heading")} +

+ +
{formatDate(date)}
+ +
+ + + + + + + + + + + + + +
+
+

+ Sign of the Consulting Doctor +

+ + {consultationData?.treating_physician_object && + formatName(consultationData?.treating_physician_object)} + +

+ Generated on: {formatDateTime(new Date())} +

+

+ This is a computer generated prescription. It shall be issued to the + patient only after the concerned doctor has verified the content and + authorized the same by affixing signature. +

+
+
@@ -516,4 +539,10 @@ function InstructionsSection({ consultationData }: IInstructionsSection) { )} ); -} \ No newline at end of file +} + + + +// Things that i added + + diff --git a/src/Components/Medicine/PrintPreview.tsx b/src/Components/Medicine/PrintPreview.tsx index 05763e00f79..3c81eccb431 100644 --- a/src/Components/Medicine/PrintPreview.tsx +++ b/src/Components/Medicine/PrintPreview.tsx @@ -4,7 +4,6 @@ import { useSlugs } from "../../Common/hooks/useSlug"; import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; import { - classNames, formatDate, formatDateTime, formatName, @@ -14,7 +13,7 @@ import MedicineRoutes from "./routes"; import { Prescription } from "./models"; import useConfig from "../../Common/hooks/useConfig"; import { ReactNode } from "react"; - +import { PatientDetail } from "../Common/components/PatientDetail"; export default function PrescriptionsPrintPreview() { const { main_logo } = useConfig(); const { t } = useTranslation(); @@ -47,7 +46,7 @@ export default function PrescriptionsPrintPreview() { } disabled={!(patient && encounter && items)} > -
+

{encounter?.facility_name}

care logo
@@ -110,31 +109,6 @@ export default function PrescriptionsPrintPreview() { ); } -const PatientDetail = ({ - name, - children, - className, -}: { - name: string; - children?: ReactNode; - className?: string; -}) => { - return ( -
-
{name}:
- {children != null ? ( - {children} - ) : ( -
- )} -
- ); -}; const PrescriptionsTable = ({ items, diff --git a/src/style/index.css b/src/style/index.css index 026b4820843..254bf4e9b6e 100644 --- a/src/style/index.css +++ b/src/style/index.css @@ -435,6 +435,22 @@ button:disabled, background-size: 1000px 100%; } +@media print { + body * { + visibility: hidden; + } + #section-to-print, + #section-to-print * { + visibility: visible; + -webkit-print-color-adjust: exact; + } + #section-to-print { + position: absolute; + left: 0; + top: 0; + } +} + .header-section .appBar { z-index: 1201; } From 0386dbbc9a0a16dbc615c718560bef44e18ee220 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Thu, 5 Sep 2024 12:35:25 +0530 Subject: [PATCH 10/20] Fix required changes --- .../{PatientDetail.tsx => KeyValueDetail.tsx} | 5 +- .../Investigations/ShowInvestigation.tsx | 79 +++++++++---------- src/Components/Facility/TreatmentSummary.tsx | 9 +-- src/Components/Medicine/PrintPreview.tsx | 26 +++--- 4 files changed, 55 insertions(+), 64 deletions(-) rename src/Components/Common/components/{PatientDetail.tsx => KeyValueDetail.tsx} (92%) diff --git a/src/Components/Common/components/PatientDetail.tsx b/src/Components/Common/components/KeyValueDetail.tsx similarity index 92% rename from src/Components/Common/components/PatientDetail.tsx rename to src/Components/Common/components/KeyValueDetail.tsx index 594b54ab10c..c05401f2b0c 100644 --- a/src/Components/Common/components/PatientDetail.tsx +++ b/src/Components/Common/components/KeyValueDetail.tsx @@ -1,7 +1,6 @@ import { ReactNode } from "react"; import { classNames } from "../../../Utils/utils"; - -export const PatientDetail = ({ + const KeyValueDetail = ({ name, children, className, @@ -26,4 +25,6 @@ export const PatientDetail = ({
); }; + +export default KeyValueDetail \ No newline at end of file diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index 71d23d437e2..2e1a7e875b2 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -8,7 +8,7 @@ import request from "../../../Utils/request/request"; import useQuery from "../../../Utils/request/useQuery"; import InvestigationTable from "./InvestigationTable"; import PrintPreview from "../../../CAREUI/misc/PrintPreview"; -import { PatientDetail } from "../../Common/components/PatientDetail"; +import KeyValueDetail from "../../Common/components/KeyValueDetail"; import { formatDate, formatDateTime, formatName, patientAgeInYears } from "../../../Utils/utils"; import useConfig from "../../../Common/hooks/useConfig"; @@ -147,49 +147,43 @@ export default function ShowInvestigation(props: any) { } return ( + -
- -
- - + >

{consultation?.facility_name}

care logo
-
- - {patientData && ( - <> - {patientData.name} -{" "} - {t(`GENDER__${patientData.gender}`)},{" "} - {patientAgeInYears(patientData).toString()}yrs - - )} - - - {consultation?.patient_no} - - - - {formatDate(consultation?.encounter_date)} - - - {consultation?.current_bed?.bed_object.location_object?.name} - {" - "} - {consultation?.current_bed?.bed_object.name} - -
-
+
+ + {patientData && ( + <> + {patientData.name} -{" "} + {t(`GENDER__${patientData.gender}`)},{" "} + {patientAgeInYears(patientData).toString()}yrs + + )} + + + {consultation?.patient_no} + + + + {formatDate(consultation?.encounter_date)} + + + {consultation?.current_bed?.bed_object.location_object?.name} + {" - "} + {consultation?.current_bed?.bed_object.name} + +
Sign of the Consulting Doctor

- + {consultation?.treating_physician_object && formatName(consultation?.treating_physician_object)} - +

Generated on: {formatDateTime(new Date())}

@@ -216,8 +210,7 @@ export default function ShowInvestigation(props: any) { authorized the same by affixing signature.

-
- + ); } diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index 7896755f8fc..fa0f7281f36 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -21,7 +21,7 @@ import { PatientModel } from "../Patient/models"; import MedicineRoutes from "../Medicine/routes"; import PrintPreview from "../../CAREUI/misc/PrintPreview"; import useConfig from "../../Common/hooks/useConfig"; -import { PatientDetail } from "../Common/components/PatientDetail"; +import KeyValueDetail from "../Common/components/KeyValueDetail"; export interface ITreatmentSummaryProps { consultationId: string; @@ -90,10 +90,10 @@ export default function TreatmentSummary({

Sign of the Consulting Doctor

- + {consultationData?.treating_physician_object && formatName(consultationData?.treating_physician_object)} - +

Generated on: {formatDateTime(new Date())}

@@ -543,6 +543,3 @@ function InstructionsSection({ consultationData }: IInstructionsSection) { -// Things that i added - - diff --git a/src/Components/Medicine/PrintPreview.tsx b/src/Components/Medicine/PrintPreview.tsx index 3c81eccb431..49055a8d641 100644 --- a/src/Components/Medicine/PrintPreview.tsx +++ b/src/Components/Medicine/PrintPreview.tsx @@ -13,7 +13,7 @@ import MedicineRoutes from "./routes"; import { Prescription } from "./models"; import useConfig from "../../Common/hooks/useConfig"; import { ReactNode } from "react"; -import { PatientDetail } from "../Common/components/PatientDetail"; +import KeyValueDetail from "../Common/components/KeyValueDetail"; export default function PrescriptionsPrintPreview() { const { main_logo } = useConfig(); const { t } = useTranslation(); @@ -51,7 +51,7 @@ export default function PrescriptionsPrintPreview() { care logo
- + {patient && ( <> {patient.name} -{" "} @@ -59,12 +59,12 @@ export default function PrescriptionsPrintPreview() { {patientAgeInYears(patient).toString()}yrs )} - - + + {encounter?.patient_no} - + - {formatDate(encounter?.encounter_date)} - - + + {encounter?.current_bed?.bed_object.location_object?.name} {" - "} {encounter?.current_bed?.bed_object.name} - + - + {patient?.allergies ?? "None"} - +
@@ -92,10 +92,10 @@ export default function PrescriptionsPrintPreview() {

Sign of the Consulting Doctor

- + {encounter?.treating_physician_object && formatName(encounter?.treating_physician_object)} - +

Generated on: {formatDateTime(new Date())}

From c680b389f443e4154d4cf9bad2dcdad250f2476f Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Fri, 6 Sep 2024 14:59:20 +0530 Subject: [PATCH 11/20] fix changes --- src/CAREUI/misc/PrintPreview.tsx | 3 +- src/Components/Facility/TreatmentSummary.tsx | 49 +------------------- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/src/CAREUI/misc/PrintPreview.tsx b/src/CAREUI/misc/PrintPreview.tsx index 33cf81f3f3d..c0421f2b541 100644 --- a/src/CAREUI/misc/PrintPreview.tsx +++ b/src/CAREUI/misc/PrintPreview.tsx @@ -11,7 +11,6 @@ type Props = { title: string; }; -const PRINT_BUTTON_LABEL: string = "Print"; export default function PrintPreview(props: Props) { return ( @@ -20,7 +19,7 @@ export default function PrintPreview(props: Props) {
window.print()}> - {PRINT_BUTTON_LABEL} + Print
diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index bc7bfdd6363..3e9715a913f 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -1,16 +1,13 @@ import { GENDER_TYPES } from "../../Common/constants"; import { - classNames, formatDate, formatDateTime, - formatName, formatPatientAge, } from "../../Utils/utils"; -import useAppHistory from "../../Common/hooks/useAppHistory"; import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; import { ConsultationModel } from "./models"; -import { ReactNode, useMemo } from "react"; +import { useMemo } from "react"; import { ActiveConditionVerificationStatuses, ConsultationDiagnosis, @@ -36,8 +33,6 @@ export default function TreatmentSummary({ const { t } = useTranslation(); const date = new Date(); - const { goBack } = useAppHistory(); - const url = `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`; const { data: patientData } = useQuery(routes.getPatient, { pathParams: { id: patientId }, @@ -84,23 +79,6 @@ export default function TreatmentSummary({
-
-

- Sign of the Consulting Doctor -

- - {consultationData?.treating_physician_object && - formatName(consultationData?.treating_physician_object)} - -

- Generated on: {formatDateTime(new Date())} -

-

- This is a computer generated prescription. It shall be issued to the - patient only after the concerned doctor has verified the content and - authorized the same by affixing signature. -

-
@@ -538,29 +516,4 @@ function InstructionsSection({ consultationData }: IInstructionsSection) { ); } -const PatientDetail = ({ - name, - children, - className, -}: { - name: string; - children?: ReactNode; - className?: string; -}) => { - return ( -
-
{name}:
- {children != null ? ( - {children} - ) : ( -
- )} -
- ); -}; From 90767f1718f22b16c3a636648d10b6bd53970407 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Fri, 6 Sep 2024 15:06:43 +0530 Subject: [PATCH 12/20] fix changes --- .../Investigations/ShowInvestigation.tsx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index 2fed5be75f0..ff8fdad11d4 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -190,23 +190,6 @@ export default function ShowInvestigation(props: any) { handleUpdateCancel={handleUpdateCancel} handleSave={handleSubmit} /> -
-

- Sign of the Consulting Doctor -

- - {consultation?.treating_physician_object && - formatName(consultation?.treating_physician_object)} - -

- Generated on: {formatDateTime(new Date())} -

-

- This is a computer generated prescription. It shall be issued to the - patient only after the concerned doctor has verified the content and - authorized the same by affixing signature. -

-
); From 112a2b62f3e3df5c146b543a7680e801a4239c05 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Fri, 6 Sep 2024 23:31:18 +0530 Subject: [PATCH 13/20] fix ShowImvestigation --- .../Investigations/ShowInvestigation.tsx | 63 +++++-------------- 1 file changed, 15 insertions(+), 48 deletions(-) diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index ff8fdad11d4..53d5e12460c 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -144,54 +144,20 @@ export default function ShowInvestigation(props: any) { } return ( - - -
-

{consultation?.facility_name}

- care logo -
-
- - {patientData && ( - <> - {patientData.name} -{" "} - {t(`GENDER__${patientData.gender}`)},{" "} - {patientAgeInYears(patientData).toString()}yrs - - )} - - - {consultation?.patient_no} - - - - {formatDate(consultation?.encounter_date)} - - - {consultation?.current_bed?.bed_object.location_object?.name} - {" - "} - {consultation?.current_bed?.bed_object.name} - -
- -
- + + + + + ); } @@ -199,6 +165,7 @@ const PatientDetail = ({ name, children, className, + }: { name: string; children?: ReactNode; From aa130f60d39272ab6d2f6832b590732181be170d Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Fri, 6 Sep 2024 20:48:30 +0530 Subject: [PATCH 14/20] remove unused import --- .../Investigations/ShowInvestigation.tsx | 40 ++----------------- src/Components/Facility/TreatmentSummary.tsx | 18 ++++----- 2 files changed, 12 insertions(+), 46 deletions(-) diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index 53d5e12460c..64f83b96e99 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -1,15 +1,12 @@ import _, { set } from "lodash-es"; import { navigate } from "raviger"; -import { lazy, ReactNode, useCallback, useReducer } from "react"; -import { useTranslation } from "react-i18next"; +import { lazy, useCallback, useReducer } from "react"; import routes from "../../../Redux/api"; import * as Notification from "../../../Utils/Notifications.js"; import request from "../../../Utils/request/request"; import useQuery from "../../../Utils/request/useQuery"; import InvestigationTable from "./InvestigationTable"; import PrintPreview from "../../../CAREUI/misc/PrintPreview"; -import { classNames, formatDate, formatDateTime, formatName, patientAgeInYears } from "../../../Utils/utils"; -import careConfig from "@careConfig"; const Loading = lazy(() => import("../../Common/Loading")); const initialState = { @@ -37,8 +34,7 @@ const updateFormReducer = (state = initialState, action: any) => { }; export default function ShowInvestigation(props: any) { - const { t } = useTranslation(); - const { consultationId, patientId, facilityId, sessionId } = props; + const { consultationId, patientId, sessionId } = props; const [state, dispatch] = useReducer(updateFormReducer, initialState); const { loading: investigationLoading } = useQuery(routes.getInvestigation, { @@ -144,9 +140,7 @@ export default function ShowInvestigation(props: any) { } return ( - - + - ); } - -const PatientDetail = ({ - name, - children, - className, - -}: { - name: string; - children?: ReactNode; - className?: string; -}) => { - return ( -
-
{name}:
- {children != null ? ( - {children} - ) : ( -
- )} -
- ); -}; diff --git a/src/Components/Facility/TreatmentSummary.tsx b/src/Components/Facility/TreatmentSummary.tsx index 3e9715a913f..610e7dc189d 100644 --- a/src/Components/Facility/TreatmentSummary.tsx +++ b/src/Components/Facility/TreatmentSummary.tsx @@ -28,9 +28,7 @@ export interface ITreatmentSummaryProps { export default function TreatmentSummary({ consultationId, patientId, - facilityId, }: ITreatmentSummaryProps) { - const { t } = useTranslation(); const date = new Date(); @@ -48,13 +46,16 @@ export default function TreatmentSummary({
- +
- -
-

{consultationData?.facility_name}

- care logo -
+
+

{consultationData?.facility_name}

+ care logo +

{t("treatment_summary__heading")}

@@ -516,4 +517,3 @@ function InstructionsSection({ consultationData }: IInstructionsSection) { ); } - From 0593c33cf15e606a716f56291b543ce97e1deab3 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Fri, 6 Sep 2024 21:03:54 +0530 Subject: [PATCH 15/20] fix patient Detail --- src/Components/Medicine/PrintPreview.tsx | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/Components/Medicine/PrintPreview.tsx b/src/Components/Medicine/PrintPreview.tsx index dbdc5d76b63..a5b78b5a3ec 100644 --- a/src/Components/Medicine/PrintPreview.tsx +++ b/src/Components/Medicine/PrintPreview.tsx @@ -46,7 +46,7 @@ export default function PrescriptionsPrintPreview() { } disabled={!(patient && encounter && items)} > -
+

{encounter?.facility_name}

{ + return ( +
+
{name}:
+ {children != null ? ( + {children} + ) : ( +
+ )} +
+ ); +}; const PrescriptionsTable = ({ items, @@ -246,29 +271,3 @@ const PrescriptionEntry = ({ obj }: { obj: Prescription }) => { ); }; - -const PatientDetail = ({ - name, - children, - className, -}: { - name: string; - children?: ReactNode; - className?: string; -}) => { - return ( -
-
{name}:
- {children != null ? ( - {children} - ) : ( -
- )} -
- ); -}; \ No newline at end of file From e81118de468498624f955157404e9be55b6a824a Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Sat, 7 Sep 2024 02:23:03 +0530 Subject: [PATCH 16/20] fix lint error --- cypress/pageobject/Asset/AssetFilters.ts | 2 +- cypress/pageobject/Asset/AssetSearch.ts | 4 +- .../pageobject/Patient/PatientInsurance.ts | 2 +- .../Patient/PatientMedicalHistory.ts | 4 +- scripts/generate-build-version.js | 2 +- src/CAREUI/misc/PrintPreview.tsx | 7 +- .../Investigations/InvestigationTable.tsx | 116 +++++++++--------- src/Routers/routes/ConsultationRoutes.tsx | 2 +- 8 files changed, 73 insertions(+), 66 deletions(-) diff --git a/cypress/pageobject/Asset/AssetFilters.ts b/cypress/pageobject/Asset/AssetFilters.ts index 33363f2d161..ac83ca97c0b 100644 --- a/cypress/pageobject/Asset/AssetFilters.ts +++ b/cypress/pageobject/Asset/AssetFilters.ts @@ -3,7 +3,7 @@ export class AssetFilters { facilityName: string, assetStatus: string, assetClass: string, - assetLocation: string + assetLocation: string, ) { cy.contains("Advanced Filters").click(); cy.get("input[name='Facilities']") diff --git a/cypress/pageobject/Asset/AssetSearch.ts b/cypress/pageobject/Asset/AssetSearch.ts index b1ccb2f71c9..653c7bdd89c 100644 --- a/cypress/pageobject/Asset/AssetSearch.ts +++ b/cypress/pageobject/Asset/AssetSearch.ts @@ -17,7 +17,7 @@ export class AssetSearchPage { verifyBadgeContent(expectedText: string) { cy.get("[data-testid='Name/Serial No./QR ID']").should( "contain", - expectedText + expectedText, ); } @@ -54,7 +54,7 @@ export class AssetSearchPage { verifyAssetListContains(dummyCameraText: string) { cy.get("[data-testid='created-asset-list']").should( "contain", - dummyCameraText + dummyCameraText, ); } } diff --git a/cypress/pageobject/Patient/PatientInsurance.ts b/cypress/pageobject/Patient/PatientInsurance.ts index be4c25c5535..60eaefffa44 100644 --- a/cypress/pageobject/Patient/PatientInsurance.ts +++ b/cypress/pageobject/Patient/PatientInsurance.ts @@ -2,7 +2,7 @@ class PatientInsurance { typePatientInsuranceDetail( containerId: string, fieldId: string, - value: string + value: string, ) { cy.get(`#${containerId}`).within(() => { cy.get(`#${fieldId}`).click().type(value); diff --git a/cypress/pageobject/Patient/PatientMedicalHistory.ts b/cypress/pageobject/Patient/PatientMedicalHistory.ts index 1c9b733f3ba..a0dbdd0131a 100644 --- a/cypress/pageobject/Patient/PatientMedicalHistory.ts +++ b/cypress/pageobject/Patient/PatientMedicalHistory.ts @@ -31,7 +31,7 @@ class PatientMedicalHistory { patientSymptoms4, patientSymptoms5, patientSymptoms6, - patientSymptoms7 + patientSymptoms7, ) { cy.get("[data-testid=patient-details]").then(($dashboard) => { cy.url().should("include", "/facility/"); @@ -51,7 +51,7 @@ class PatientMedicalHistory { verifyNoSymptosPresent(patientSymptoms1: string) { cy.get("[data-testid=patient-details]").should( "not.contain", - patientSymptoms1 + patientSymptoms1, ); } } diff --git a/scripts/generate-build-version.js b/scripts/generate-build-version.js index 36e7ea1162a..84b8e0e5928 100644 --- a/scripts/generate-build-version.js +++ b/scripts/generate-build-version.js @@ -20,5 +20,5 @@ fs.writeFile( return console.log(err); } return null; - } + }, ); diff --git a/src/CAREUI/misc/PrintPreview.tsx b/src/CAREUI/misc/PrintPreview.tsx index c0421f2b541..64e21489d74 100644 --- a/src/CAREUI/misc/PrintPreview.tsx +++ b/src/CAREUI/misc/PrintPreview.tsx @@ -11,7 +11,6 @@ type Props = { title: string; }; - export default function PrintPreview(props: Props) { return ( @@ -26,7 +25,11 @@ export default function PrintPreview(props: Props) {
{props.children}
diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index 21d452121ee..1e544b01814 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -121,62 +121,66 @@ export const InvestigationTable = ({ />
-
- - - - {["Name", "Value", "Unit", "Min", "Max", "Ideal"].map((heading) => ( - - ))} - - - - {filterTests.length > 0 ? ( - filterTests.map((t: any, i) => { - const value = - changedFields[t.id]?.notes ?? changedFields[t.id]?.value ?? null; - const isChanged = changedFields[t.id]?.initialValue !== value; - return ( - { - const { target, value } = - t?.investigation_object?.investigation_type === "Float" - ? { - target: `${t.id}.value`, - value: Number(e.value) || null, - } - : { - target: `${t.id}.notes`, - value: e.value, - }; - handleValueChange(value, target); - }} - className="print:text-black" - /> - ); - }) - ) : ( - - - - )} - -
- {heading} -
No tests taken
-
-
- +
+ + + + {["Name", "Value", "Unit", "Min", "Max", "Ideal"].map( + (heading) => ( + + ), + )} + + + + {filterTests.length > 0 ? ( + filterTests.map((t: any, i) => { + const value = + changedFields[t.id]?.notes ?? + changedFields[t.id]?.value ?? + null; + const isChanged = changedFields[t.id]?.initialValue !== value; + return ( + { + const { target, value } = + t?.investigation_object?.investigation_type === + "Float" + ? { + target: `${t.id}.value`, + value: Number(e.value) || null, + } + : { + target: `${t.id}.notes`, + value: e.value, + }; + handleValueChange(value, target); + }} + className="print:text-black" + /> + ); + }) + ) : ( + + + + )} + +
+ {heading} +
No tests taken
+
+
); }; diff --git a/src/Routers/routes/ConsultationRoutes.tsx b/src/Routers/routes/ConsultationRoutes.tsx index bb2a3c9c913..598fd06adc3 100644 --- a/src/Routers/routes/ConsultationRoutes.tsx +++ b/src/Routers/routes/ConsultationRoutes.tsx @@ -155,4 +155,4 @@ export default { tab={tab} /> ), -}; \ No newline at end of file +}; From 5b7c4551383a727e1630bb82e551dd50f87b8d11 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Wed, 11 Sep 2024 17:11:23 +0530 Subject: [PATCH 17/20] fix i18n --- src/Components/Common/PageTitle.tsx | 2 +- src/Components/Facility/Investigations/InvestigationTable.tsx | 2 +- src/Components/Facility/Investigations/ShowInvestigation.tsx | 4 ++-- src/Locale/en/Consultation.json | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Components/Common/PageTitle.tsx b/src/Components/Common/PageTitle.tsx index 14776ba2981..c7c0ac648b7 100644 --- a/src/Components/Common/PageTitle.tsx +++ b/src/Components/Common/PageTitle.tsx @@ -70,7 +70,7 @@ export default function PageTitle({ > {" "} )} diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index 1e544b01814..292cff8d419 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -174,7 +174,7 @@ export const InvestigationTable = ({ }) ) : ( - No tests taken + t(no_tests_taken) )} diff --git a/src/Components/Facility/Investigations/ShowInvestigation.tsx b/src/Components/Facility/Investigations/ShowInvestigation.tsx index a2c6978a669..7477c64f899 100644 --- a/src/Components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/Components/Facility/Investigations/ShowInvestigation.tsx @@ -147,12 +147,12 @@ export default function ShowInvestigation(props: ShowInvestigationProps) { } return ( Date: Wed, 11 Sep 2024 17:55:35 +0530 Subject: [PATCH 18/20] Update src/Components/Common/PageTitle.tsx --- src/Components/Common/PageTitle.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Common/PageTitle.tsx b/src/Components/Common/PageTitle.tsx index c7c0ac648b7..3af4c873872 100644 --- a/src/Components/Common/PageTitle.tsx +++ b/src/Components/Common/PageTitle.tsx @@ -78,7 +78,7 @@ export default function PageTitle({
{componentRight}
-
+
{breadcrumbs && }
From 47a1b741bc48f5ad4c6c06c3f527223cd65a9294 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Wed, 11 Sep 2024 17:58:57 +0530 Subject: [PATCH 19/20] Update src/Components/Facility/Investigations/InvestigationTable.tsx --- src/Components/Facility/Investigations/InvestigationTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index 292cff8d419..c7b042b068f 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -174,7 +174,7 @@ export const InvestigationTable = ({ }) ) : ( - t(no_tests_taken) + {t("no_tests_taken")} )} From 77a7a95f16dbc524edb1be98c682e56c34d52671 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Wed, 11 Sep 2024 18:03:16 +0530 Subject: [PATCH 20/20] adds missing useTranslation import --- src/Components/Facility/Investigations/InvestigationTable.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Components/Facility/Investigations/InvestigationTable.tsx b/src/Components/Facility/Investigations/InvestigationTable.tsx index c7b042b068f..18c64108b6f 100644 --- a/src/Components/Facility/Investigations/InvestigationTable.tsx +++ b/src/Components/Facility/Investigations/InvestigationTable.tsx @@ -4,6 +4,7 @@ import { SelectFormField } from "../../Form/FormFields/SelectFormField"; import TextFormField from "../../Form/FormFields/TextFormField"; import { classNames } from "../../../Utils/utils"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; const TestRow = ({ data, i, onChange, showForm, value, isChanged }: any) => { return ( @@ -70,6 +71,7 @@ export const InvestigationTable = ({ handleUpdateCancel, handleSave, }: any) => { + const { t } = useTranslation(); const [searchFilter, setSearchFilter] = useState(""); const [showForm, setShowForm] = useState(false); const filterTests = Object.values(data).filter((i: any) => {