add button to dashboard

This commit is contained in:
Noemi
2025-07-02 14:00:15 +02:00
parent d6b4bc98e0
commit 285474f139

View File

@@ -95,23 +95,22 @@ const LatestBandiTableAsync = () => {
</Link>
<Button type="button"
size="small"
icon="pi pi-receipt"
severity="info"
icon="pi pi-download"
iconPos="right"
label={__('CSV', 'gepafin')}
onClick={() => exportToCSV(rowData.id)}/>
label={__('Scarica graduatoria', 'gepafin')}
onClick={() => handleDownloadRanking(rowData.id)}/>
</div>
}
const exportToCSV = (applicationId) => {
setLocalAsyncRequest(true);
ApplicationService.downloadCsvReport(
applicationId,
(resp) => getCsvReportback(resp, applicationId),
errCsvReportCallback
)
}
const handleDownloadRanking = (callId) => {
setLocalAsyncRequest(true);
ApplicationService.downloadRanking(callId,
(resp) => downloadSuccessCallback(resp, callId),
downloadErrorCallback)
}
const getCsvReportback = (resp, applicationId) => {
const downloadSuccessCallback = (resp, applicationId) => {
const file = new Blob([resp], { type: 'text/csv' });
const url = window.URL.createObjectURL(file);
const link = document.createElement('a');
@@ -123,7 +122,7 @@ const LatestBandiTableAsync = () => {
setLocalAsyncRequest(false);
}
const errCsvReportCallback = (resp) => {
const downloadErrorCallback = (resp) => {
set404FromErrorResponse(resp);
setLocalAsyncRequest(false);
}