diff --git a/src/CAREUI/misc/PrintPreview.tsx b/src/CAREUI/misc/PrintPreview.tsx index 243826c7337..5a32be42998 100644 --- a/src/CAREUI/misc/PrintPreview.tsx +++ b/src/CAREUI/misc/PrintPreview.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from "react"; +import { ReactNode, useState } from "react"; import ButtonV2 from "../../Components/Common/components/ButtonV2"; import CareIcon from "../icons/CareIcon"; import { classNames } from "../../Utils/utils"; @@ -11,18 +11,52 @@ type Props = { title: string; }; +const zoom_values = [ + "scale-50", + "scale-75", + "scale-100", + "scale-125", + "scale-150", + "scale-175", + "scale-200", +]; + export default function PrintPreview(props: Props) { + const [zoom, setZoom] = useState(2); // Initial zoom index to 'scale-100' + + const handleZoomIn = () => { + setZoom((prevZoom) => (prevZoom < zoom_values.length - 1 ? prevZoom + 1 : prevZoom)); + }; + + const handleZoomOut = () => { + setZoom((prevZoom) => (prevZoom > 0 ? prevZoom - 1 : prevZoom)); + }; + return ( -
-
+
+
window.print()}> Print +
{/* Hide on mobile, show on medium screens and up */} + + + Zoom Out + + {zoom_values[zoom].split('-')[1]}% + + + Zoom In + +
-
+

{encounter?.facility_name}

care logo
-
- - {patient && ( - <> - {patient.name} -{" "} - {t(`GENDER__${patient.gender}`)},{" "} - {patientAgeInYears(patient).toString()}yrs - - )} - - - {encounter?.patient_no} - +
+ + {patient && ( + <> + {patient.name} -{" "} + {t(`GENDER__${patient.gender}`)},{" "} + {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} - + + {formatDate(encounter?.encounter_date)} + + + {encounter?.current_bed?.bed_object.location_object?.name} + {" - "} + {encounter?.current_bed?.bed_object.name} + + + + {patient?.allergies ?? "None"} + +
- - {patient?.allergies ?? "None"} - -
- + -
-

+

+

Sign of the Consulting Doctor

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

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

@@ -106,6 +107,8 @@ export default function PrescriptionsPrintPreview() { authorized the same by affixing signature.

+ + ); } @@ -150,31 +153,34 @@ const PrescriptionsTable = ({ } if (!items.length) { - return; + return
No prescriptions available
; // Add a fallback message for empty items } return ( - - - - - - - - - - - - {items.map((item) => ( - - ))} - -
- {prn && "PRN"} Prescriptions -
MedicineDosageDirectionsNotes / Instructions
+
+ + + + + + + + + + + + {items.map((item) => ( + + ))} + +
+ {prn && "PRN"} Prescriptions +
MedicineDosageDirectionsNotes / Instructions
+
); }; + const PrescriptionEntry = ({ obj }: { obj: Prescription }) => { const { t } = useTranslation(); const medicine = obj.medicine_object;