|
|
@@ -7,6 +7,7 @@ import { ProjectResult } from "@/app/api/projects"; |
|
|
|
import { EX02ProjectCashFlowReportFilter } from "@/app/api/reports"; |
|
|
|
import { fetchEX02ProjectCashFlowReport } from "@/app/api/reports/actions"; |
|
|
|
import { downloadFile } from "@/app/utils/commonUtil"; |
|
|
|
import { BASE_API_URL } from "@/config/api"; |
|
|
|
|
|
|
|
interface Props { |
|
|
|
projects: ProjectResult[]; |
|
|
@@ -21,7 +22,7 @@ const GenerateEX02ProjectCashFlowReport: React.FC<Props> = ({ projects }) => { |
|
|
|
|
|
|
|
const searchCriteria: Criterion<SearchParamNames>[] = useMemo( |
|
|
|
() => [ |
|
|
|
{ label: t("Project"), paramName: "project", type: "select", options: projectCombo}, |
|
|
|
{ label: t("Project"), paramName: "project", type: "select", options: projectCombo }, |
|
|
|
], |
|
|
|
[t], |
|
|
|
); |
|
|
@@ -32,17 +33,10 @@ const GenerateEX02ProjectCashFlowReport: React.FC<Props> = ({ projects }) => { |
|
|
|
criteria={searchCriteria} |
|
|
|
onSearch={async (query) => { |
|
|
|
const projectIndex = projectCombo.findIndex(project => project === query.project) |
|
|
|
const response = await fetchEX02ProjectCashFlowReport({projectId: projects[projectIndex].id}) |
|
|
|
console.log(response) |
|
|
|
const response = await fetchEX02ProjectCashFlowReport({ projectId: projects[projectIndex].id }) |
|
|
|
if (response) { |
|
|
|
downloadFile(response.blobText, response.blobType, response.filename!!) |
|
|
|
downloadFile(new Uint8Array(response.blobValue), response.filename!!) |
|
|
|
} |
|
|
|
|
|
|
|
// const url = URL.createObjectURL(response.blob); |
|
|
|
// const link = document.createElement("a"); |
|
|
|
// link.href = url; |
|
|
|
// link.setAttribute("download", "abc.xlsx"); |
|
|
|
// link.click(); |
|
|
|
}} |
|
|
|
/> |
|
|
|
</> |
|
|
|