|
|
@@ -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<T extends string> { |
|
|
@@ -134,21 +135,24 @@ function SearchBox<T extends string>({ |
|
|
|
// 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); |
|
|
|
} |
|
|
|