diff --git a/frontend/src/components/cytology/CytologyCaseView.js b/frontend/src/components/cytology/CytologyCaseView.js
index fd093a9164..c2c23834a3 100644
--- a/frontend/src/components/cytology/CytologyCaseView.js
+++ b/frontend/src/components/cytology/CytologyCaseView.js
@@ -146,7 +146,9 @@ function CytologyCaseView() {
const [reportParams, setReportParams] = useState({
0: {
submited: false,
- }});
+ reportLink: "",
+ },
+ });
const handleConfirm = () => {
var diagnosis = { ...pathologySampleInfo.diagnosis };
@@ -183,7 +185,7 @@ function CytologyCaseView() {
}
}
- const reportStatus = (pdfGenerated, index) => {
+ const reportStatus = async (pdfGenerated, blob, index) => {
setNotificationVisible(true);
setLoadingReport(false);
if (pdfGenerated) {
@@ -197,7 +199,18 @@ function CytologyCaseView() {
params[index] = {};
}
params[index].submited = true;
+ params[index].reportLink = window.URL.createObjectURL(blob, {
+ type: "application/pdf",
+ });
setReportParams(params);
+
+ var newReports = [...pathologySampleInfo.reports];
+ let encodedFile = await toBase64(blob);
+ newReports[index].base64Image = encodedFile;
+ setPathologySampleInfo({
+ ...pathologySampleInfo,
+ reports: newReports,
+ });
} else {
setNotificationBody({
kind: NotificationKinds.error,
@@ -868,7 +881,7 @@ function CytologyCaseView() {
iconDescription="file upload"
multiple={false}
accept={["image/jpeg", "image/png", "application/pdf"]}
- disabled={false}
+ disabled={reportParams[index]?.submited}
name=""
buttonKind="primary"
size="lg"
@@ -899,30 +912,49 @@ function CytologyCaseView() {
}
-
- {pathologySampleInfo.reports[index].image && (
- <>
-
- >
- )}
-
+
+ {pathologySampleInfo.reports[index].image && (
+ <>
+ {!reportParams[index]?.submited && (
+
+
+
+ )}
+ >
+ )}
+
+ {reportParams[index]?.submited && (
+
+
+
+ )}
-
-
- {immunohistochemistrySampleInfo.reports[index]
- .image && (
- <>
-
- >
- )}
-
+
+ {immunohistochemistrySampleInfo.reports[index].image && (
+ <>
+ {!reportParams[index]?.submited && (
+
+
+
+ )}
+ >
+ )}
+ {reportParams[index]?.submited && (
+
+
+
+ )}
+
-
- {pathologySampleInfo.reports[index].image && (
- <>
-
- >
- )}
-
+ {pathologySampleInfo.reports[index].image && (
+ <>
+ {!reportParams[index]?.submited && (
+
+
+
+ )}
+ >
+ )}
+
+ {reportParams[index]?.submited && (
+
+
+
+ )}