Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated TreatmentSummary component by integrating it with PrintPreview Component #8430 #8441

Merged
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b916329
Updated TreatmentSummary component by integrating it with PrintPrevie…
Zeshanxviii Aug 29, 2024
b8e5fa8
Converted CSS to Tailwind and removed extra padding.
Zeshanxviii Aug 31, 2024
20f39b9
Updated investigationSummary
Zeshanxviii Aug 31, 2024
393cc7a
Updated investigationSummary
Zeshanxviii Aug 31, 2024
ce0f782
Remove fireRequestV2 (#8446)
sainak Aug 31, 2024
75770a9
Removed unnecessary code from tailwind.config and wrapped only the ne…
Zeshanxviii Sep 1, 2024
47db3eb
Merge branch 'develop' into issues/8430/fixingSpacing
Zeshanxviii Sep 3, 2024
fd5436b
Update TreatmentSummary.tsx
Zeshanxviii Sep 3, 2024
4cb12d1
fix print layout
Zeshanxviii Sep 3, 2024
97138db
fix layout print document
Zeshanxviii Sep 3, 2024
8309e85
Updated Treatment and InvestigationSummary
Zeshanxviii Sep 4, 2024
0386dbb
Fix required changes
Zeshanxviii Sep 5, 2024
7603c41
conflit resolved
Zeshanxviii Sep 5, 2024
c680b38
fix changes
Zeshanxviii Sep 6, 2024
90767f1
fix changes
Zeshanxviii Sep 6, 2024
0593c33
fix patient Detail
Zeshanxviii Sep 6, 2024
112a2b6
fix ShowImvestigation
Zeshanxviii Sep 6, 2024
aa130f6
remove unused import
Zeshanxviii Sep 6, 2024
e81118d
fix lint error
Zeshanxviii Sep 6, 2024
dc967da
fix changes
Zeshanxviii Sep 11, 2024
5b7c455
fix i18n
Zeshanxviii Sep 11, 2024
028485f
Update src/Components/Common/PageTitle.tsx
rithviknishad Sep 11, 2024
47a1b74
Update src/Components/Facility/Investigations/InvestigationTable.tsx
rithviknishad Sep 11, 2024
77a7a95
adds missing useTranslation import
rithviknishad Sep 11, 2024
bb04141
Merge branch 'develop' into issues/8430/fixingSpacing
Zeshanxviii Sep 13, 2024
0bd4a57
Merge branch 'develop' into issues/8430/fixingSpacing
Zeshanxviii Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']")
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Asset/AssetSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class AssetSearchPage {
verifyBadgeContent(expectedText: string) {
cy.get("[data-testid='Name/Serial No./QR ID']").should(
"contain",
expectedText
expectedText,
);
}

Expand Down Expand Up @@ -54,7 +54,7 @@ export class AssetSearchPage {
verifyAssetListContains(dummyCameraText: string) {
cy.get("[data-testid='created-asset-list']").should(
"contain",
dummyCameraText
dummyCameraText,
);
}
}
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientInsurance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Patient/PatientMedicalHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PatientMedicalHistory {
patientSymptoms4,
patientSymptoms5,
patientSymptoms6,
patientSymptoms7
patientSymptoms7,
) {
cy.get("[data-testid=patient-details]").then(($dashboard) => {
cy.url().should("include", "/facility/");
Expand All @@ -51,7 +51,7 @@ class PatientMedicalHistory {
verifyNoSymptosPresent(patientSymptoms1: string) {
cy.get("[data-testid=patient-details]").should(
"not.contain",
patientSymptoms1
patientSymptoms1,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-build-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ fs.writeFile(
return console.log(err);
}
return null;
}
},
);
4 changes: 2 additions & 2 deletions src/Components/Common/PageTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ export default function PageTitle({
>
<CareIcon
icon="l-angle-left"
className="border-box mr-1 rounded-md text-5xl hover:bg-secondary-200"
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
className="border-box mr-1 rounded-md text-5xl hover:bg-secondary-200 print:hidden"
Zeshanxviii marked this conversation as resolved.
Show resolved Hide resolved
/>{" "}
</button>
)}
<h2 className="ml-0 text-2xl font-semibold leading-tight">{title}</h2>
</div>
{componentRight}
</div>
<div className={hideBack ? "my-2" : "my-2 ml-8"}>
<div className={hideBack ? "my-2" : "my-2 ml-8 print:hidden"}>
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
{breadcrumbs && <Breadcrumbs replacements={crumbsReplacements} />}
</div>
</div>
Expand Down
34 changes: 15 additions & 19 deletions src/Components/Facility/Investigations/InvestigationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,10 @@ export const InvestigationTable = ({
return (
<div className="m-4 p-4">
<div className="mb flex flex-col items-center justify-between sm:flex-row">
{title && <div className="text-xl font-bold">{title}</div>}
<div className="flex flex-col py-2 sm:flex-row">
<ButtonV2
variant="primary"
onClick={() => window.print()}
className="my-2 mr-2"
disabled={showForm}
>
Print Report
</ButtonV2>
{title && (
<div className="text-xl font-bold print:text-xs">{title}</div>
)}
<div className="flex flex-col py-2 sm:flex-row print:hidden">
<ButtonV2
disabled={isDischargedPatient}
variant="primary"
Expand All @@ -120,30 +114,31 @@ export const InvestigationTable = ({
<TextFormField
name="test_search"
label="Search Test"
className="mt-2"
className="mt-2 print:hidden"
placeholder="Search test"
value={searchFilter}
onChange={(e) => setSearchFilter(e.value)}
/>
<br />
<div id="section-to-print">
<div className="overflow-x-scroll border-b border-secondary-200 shadow sm:rounded-lg">
<table className="min-w-full divide-y divide-secondary-200">
<thead className="bg-secondary-50">
<div className="print:w-full">
<div className="overflow-x-scroll border-b border-secondary-200 shadow sm:rounded-lg print:overflow-visible print:border-none print:shadow-none">
<table className="min-w-full divide-y divide-secondary-200 print:min-w-0 print:divide-none">
<thead className="bg-secondary-50 print:bg-white">
<tr>
{["Name", "Value", "Unit", "Min", "Max", "Ideal"].map(
(heading) => (
<th
key={heading}
scope="col"
className="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-secondary-800"
className="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider text-secondary-800 print:text-sm print:font-normal print:tracking-normal print:text-black"
>
{heading}
</th>
),
)}
</tr>
</thead>
<tbody x-max="2">
<tbody className="print:divide-none">
{filterTests.length > 0 ? (
filterTests.map((t: any, i) => {
const value =
Expand Down Expand Up @@ -173,12 +168,13 @@ export const InvestigationTable = ({
};
handleValueChange(value, target);
}}
className="print:text-black"
/>
);
})
) : (
<tr className="text-center text-secondary-500">
No tests taken
<tr className="text-center text-secondary-500 print:text-black">
<td className="col-span-6">No tests taken</td>
Zeshanxviii marked this conversation as resolved.
Show resolved Hide resolved
</tr>
)}
</tbody>
Expand Down
38 changes: 19 additions & 19 deletions src/Components/Facility/Investigations/ShowInvestigation.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import _, { set } from "lodash-es";
import { navigate } from "raviger";
import { lazy, useCallback, useReducer } from "react";
import { useTranslation } from "react-i18next";
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 { useTranslation } from "react-i18next";
const Loading = lazy(() => import("../../Common/Loading"));

const initialState = {
Expand All @@ -35,10 +34,15 @@ const updateFormReducer = (state = initialState, action: any) => {
}
};

export default function ShowInvestigation(props: any) {
interface ShowInvestigationProps {
consultationId: string;
patientId: string;
sessionId: string;
facilityId: string;
}
export default function ShowInvestigation(props: ShowInvestigationProps) {
const { consultationId, patientId, sessionId } = props;
const { t } = useTranslation();
const { consultationId, patientId, facilityId, sessionId } = props;

const [state, dispatch] = useReducer(updateFormReducer, initialState);
const { loading: investigationLoading } = useQuery(routes.getInvestigation, {
pathParams: {
Expand Down Expand Up @@ -141,27 +145,23 @@ export default function ShowInvestigation(props: any) {
if (patientLoading || investigationLoading) {
return <Loading />;
}

return (
<div className="mx-auto max-w-7xl px-4">
<PageTitle
title={t("investigations")}
className="mx-3 md:mx-4"
crumbsReplacements={{
[facilityId]: { name: patientData?.facility_object?.name },
[patientId]: { name: patientData?.name },
}}
backUrl={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`}
/>
<PrintPreview
title={t("Investigation Report for {{name}}", {
Zeshanxviii marked this conversation as resolved.
Show resolved Hide resolved
name: patientData?.name,
})}
>
<InvestigationTable
title={`ID: ${sessionId}`}
title={t("Investigation Report of : {{name}}", {
name: patientData?.name,
})}
Zeshanxviii marked this conversation as resolved.
Show resolved Hide resolved
data={state.initialValues}
isDischargedPatient={!!consultation?.discharge_date}
changedFields={state.changedFields}
handleValueChange={handleValueChange}
handleUpdateCancel={handleUpdateCancel}
handleSave={handleSubmit}
/>
</div>
</PrintPreview>
);
}
69 changes: 29 additions & 40 deletions src/Components/Facility/TreatmentSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import {
formatDateTime,
formatPatientAge,
} from "../../Utils/utils";
import useAppHistory from "../../Common/hooks/useAppHistory";
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 {
Expand All @@ -18,6 +16,8 @@ import PageHeadTitle from "../Common/PageHeadTitle";
import { useTranslation } from "react-i18next";
import { PatientModel } from "../Patient/models";
import MedicineRoutes from "../Medicine/routes";
import PrintPreview from "../../CAREUI/misc/PrintPreview";
import careConfig from "@careConfig";

export interface ITreatmentSummaryProps {
consultationId: string;
Expand All @@ -28,12 +28,9 @@ export interface ITreatmentSummaryProps {
export default function TreatmentSummary({
consultationId,
patientId,
facilityId,
}: ITreatmentSummaryProps) {
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 },
Expand All @@ -49,50 +46,42 @@ export default function TreatmentSummary({
<div>
<PageHeadTitle title={t("treatment_summary__head_title")} />
<div className="my-4">
<div className="my-4 flex flex-wrap justify-center gap-2 sm:justify-end">
<button
onClick={(_) => window.print()}
className="btn btn-primary mr-2"
>
<CareIcon icon="l-print" className="mr-2" />
{t("treatment_summary__print")}
</button>
<button onClick={(_) => goBack(url)} className="btn btn-default">
<CareIcon icon="l-times" className="mr-2" />
{t("close")}
</button>
</div>

<div id="section-to-print" className="mx-5">
<h2 className="text-center text-lg">
{consultationData?.facility_name ?? ""}
</h2>
<PrintPreview title={t("treatment_summary__head_title")}>
<div id="section-to-print" className="mx-5">
<div className="mb-3 flex items-center justify-between p-4">
<h3>{consultationData?.facility_name}</h3>
<img
className="h-10 w-auto"
src={careConfig.mainLogo?.dark}
alt="care logo"
/>
</div>
<h2 className="text-center text-lg">
{t("treatment_summary__heading")}
</h2>

<h2 className="text-center text-lg">
{t("treatment_summary__heading")}
</h2>
<div className="text-right font-bold">{formatDate(date)}</div>

<div className="text-right font-bold">{formatDate(date)}</div>
<div className="mb-5 mt-2 border border-gray-800">
<BasicDetailsSection
patientData={patientData}
consultationData={consultationData}
/>

<div className="mb-5 mt-2 border border-gray-800">
<BasicDetailsSection
patientData={patientData}
consultationData={consultationData}
/>
<ComorbiditiesSection patientData={patientData} />

<ComorbiditiesSection patientData={patientData} />
<DiagnosisSection consultationData={consultationData} />

<DiagnosisSection consultationData={consultationData} />
<InvestigationsSection consultationId={consultationId} />

<InvestigationsSection consultationId={consultationId} />
<TreatmentSection consultationData={consultationData} />

<TreatmentSection consultationData={consultationData} />
<PrescriptionsSection consultationId={consultationId} />

<PrescriptionsSection consultationId={consultationId} />

<InstructionsSection consultationData={consultationData} />
<InstructionsSection consultationData={consultationData} />
</div>
</div>
</div>
</PrintPreview>
</div>
</div>
);
Expand Down
3 changes: 1 addition & 2 deletions src/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ button:disabled,
background-size: 1000px 100%;
}


@media print {
body * {
visibility: hidden;
Expand All @@ -450,7 +449,7 @@ button:disabled,
left: 0;
top: 0;
}
}
}

.header-section .appBar {
z-index: 1201;
Expand Down
Loading