add scarica graduatoria button

This commit is contained in:
Noemi
2025-07-02 12:59:28 +02:00
parent 430b3e30dd
commit d6b4bc98e0

View File

@@ -96,23 +96,23 @@ const AllBandiTableAsync = () => {
{['PUBLISH', 'EXPIRED'].includes(rowData.status)
? <Button type="button"
size="small"
icon="pi pi-receipt"
severity='info'
icon="pi pi-download"
iconPos="right"
label={__('CSV', 'gepafin')}
onClick={() => exportToCSV(rowData.id)}/> : null}
label={__('Scarica graduatoria', 'gepafin')}
onClick={() => handleDownloadRanking(rowData.id)}
/> : null}
</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');
@@ -124,7 +124,7 @@ const AllBandiTableAsync = () => {
setLocalAsyncRequest(false);
}
const errCsvReportCallback = (resp) => {
const downloadErrorCallback = (resp) => {
set404FromErrorResponse(resp);
setLocalAsyncRequest(false);
}