diff --git a/src/app/(main)/analytics/ProjectClaimsReport/page.tsx b/src/app/(main)/analytics/ProjectClaimsReport/page.tsx
index 9f97f39..b570c8f 100644
--- a/src/app/(main)/analytics/ProjectClaimsReport/page.tsx
+++ b/src/app/(main)/analytics/ProjectClaimsReport/page.tsx
@@ -1,24 +1,30 @@
-//src\app\(main)\analytics\DelayReport\page.tsx
import { Metadata } from "next";
-import { I18nProvider } from "@/i18n";
-import Typography from "@mui/material/Typography";
-import ProjectClaimsReportComponent from "@/components/Report/ProjectClaimsReport";
+import { Suspense } from "react";
+import { I18nProvider, getServerI18n } from "@/i18n";
+import { fetchProjects } from "@/app/api/projects";
+import GenerateLateStartReport from "@/components/Report/LateStartReportGen";
+import { Typography } from "@mui/material";
export const metadata: Metadata = {
- title: "Project Claims Report",
+ title: "Late Start Report",
};
-const ProjectClaimsReport: React.FC = () => {
- return (
-
-
- Project Claims Report
-
- {/* }>
-
- */}
-
-
- );
+const LateStartReport: React.FC = async () => {
+ const { t } = await getServerI18n("reports");
+ fetchProjects();
+
+ return (
+ <>
+
+ {t("Project Cash Flow Report")}
+
+
+ }>
+
+
+
+ >
+ );
};
-export default ProjectClaimsReport;
+
+export default LateStartReport;
diff --git a/src/app/api/reports/actions.ts b/src/app/api/reports/actions.ts
index 544ea2d..3d49a16 100644
--- a/src/app/api/reports/actions.ts
+++ b/src/app/api/reports/actions.ts
@@ -49,17 +49,17 @@ export const fetchMonthlyWorkHoursReport = async (data: MonthlyWorkHoursReportRe
// };
export const fetchLateStartReport = async (data: LateStartReportRequest) => {
- const response = await fetch(`${BASE_API_URL}/reports/downloadLateStartReport`, {
+ const response = await serverFetchBlob(`${BASE_API_URL}/reports/downloadLateStartReport`, {
method: "POST",
body: JSON.stringify(data),
headers: { "Content-Type": "application/json" },
});
- if (!response.ok) {
- const errorText = await response.text(); // Attempt to read the response text
- throw new Error(`Network response was not ok: ${response.status} - ${errorText}`);
- }
- const blob = await response.blob();
- return { fileBlob: blob, fileName: 'Late_Start_Report.xlsx' };
-
+ // if (!response.ok) {
+ // const errorText = await response.text(); // Attempt to read the response text
+ // throw new Error(`Network response was not ok: ${response.status} - ${errorText}`);
+ // }
+ // const blob = await response.blob();
+ // return { fileBlob: blob, fileName: 'Late_Start_Report.xlsx' };
+ return response
};
diff --git a/src/components/Report/LateStartReportGen/LateStartReportGen.tsx b/src/components/Report/LateStartReportGen/LateStartReportGen.tsx
index 3ad03f0..1cdab3d 100644
--- a/src/components/Report/LateStartReportGen/LateStartReportGen.tsx
+++ b/src/components/Report/LateStartReportGen/LateStartReportGen.tsx
@@ -21,14 +21,6 @@ const ProgressByClientSearch: React.FC = ({ projects }) => {
const [clientCombo, setclientCombo] = useState([])
const [isLoading, setIsLoading] = useState(true)
// const [teamCombo, setteamCombo] = useState([]);
- // const getteamCombo = () => {
- // axios.get(`${apiPath}${GET_QC_CATEGORY_COMBO}`)
- // .then(response => {
- // setteamCombo(response.data.records)})
- // .catch(error => {
- // console.error('Error fetching data: ', error);
- // });
- // }
const getTeamCombo = async() => {
try {
@@ -39,6 +31,7 @@ const ProgressByClientSearch: React.FC = ({ projects }) => {
console.log(err)
}
}
+
// const getClientCombo = async() => {
// try {
// const response = await fetchCombo()
@@ -48,6 +41,7 @@ const ProgressByClientSearch: React.FC = ({ projects }) => {
// console.log(err)
// }
// }
+
useEffect(() => {
getTeamCombo()
}, [])
diff --git a/src/components/Report/ReportSearchBox/SearchBox.tsx b/src/components/Report/ReportSearchBox/SearchBox.tsx
index 70a707e..22186da 100644
--- a/src/components/Report/ReportSearchBox/SearchBox.tsx
+++ b/src/components/Report/ReportSearchBox/SearchBox.tsx
@@ -26,6 +26,7 @@ import { fetchLateStartReport } from "@/app/api/reports/actions";
import * as XLSX from 'xlsx-js-style';
import { LateStartReportRequest } from "@/app/api/reports";
import { fetchTeamCombo } from "@/app/api/team/actions";
+import { downloadFile } from "@/app/utils/commonUtil";
//import { DownloadReportButton } from '../LateStartReportGen/DownloadReportButton';
interface BaseCriterion {
@@ -134,21 +135,24 @@ function SearchBox({
// Call fetchLateStartReport and wait for the blob
//const responseBlob = await fetchLateStartReport(requestData);
const fileResponse = await fetchLateStartReport(requestData);
- const blob = fileResponse.fileBlob;
+ if (fileResponse) {
+ downloadFile(new Uint8Array(fileResponse.blobValue), fileResponse.filename!!)
+ }
+ // const blob = fileResponse.fileBlob;
- // Create a URL from the Blob response
- const url = window.URL.createObjectURL(blob);
+ // // Create a URL from the Blob response
+ // const url = window.URL.createObjectURL(fileResponse);
- // Create an anchor element and trigger the download
- const a = document.createElement('a');
- a.href = url;
- a.download = "Late_Start_Report.xlsx"; // Set the filename for download
- document.body.appendChild(a);
- a.click();
- a.remove();
+ // // Create an anchor element and trigger the download
+ // const a = document.createElement('a');
+ // a.href = url;
+ // a.download = "Late_Start_Report.xlsx"; // Set the filename for download
+ // document.body.appendChild(a);
+ // a.click();
+ // a.remove();
- // Optionally revoke the URL if you want to free up resources
- window.URL.revokeObjectURL(url);
+ // // Optionally revoke the URL if you want to free up resources
+ // window.URL.revokeObjectURL(url);
} catch (error) {
console.error('Error downloading the file: ', error);
}