Merge pull request #55 from Kitzanos/task/1474
Add btn "scarica graduatoria" for super user
This commit is contained in:
@@ -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) => {
|
||||
const handleDownloadRanking = (callId) => {
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.downloadCsvReport(
|
||||
applicationId,
|
||||
(resp) => getCsvReportback(resp, applicationId),
|
||||
errCsvReportCallback
|
||||
)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const LatestBandiTableAsync = () => {
|
||||
name: { value: null, matchMode: 'contains' },
|
||||
startDate: { value: null, matchMode: 'dateIs' },
|
||||
endDate: { value: null, matchMode: 'dateIs' },
|
||||
status: { value: 'PUBLISH', matchMode: 'equals' }
|
||||
status: { value: null, matchMode: 'equals' }
|
||||
}
|
||||
});
|
||||
const statuses = ['PUBLISH'];
|
||||
@@ -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) => {
|
||||
const handleDownloadRanking = (callId) => {
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.downloadCsvReport(
|
||||
applicationId,
|
||||
(resp) => getCsvReportback(resp, applicationId),
|
||||
errCsvReportCallback
|
||||
)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ const LatestBandiTableInstructorManagerAsync = () => {
|
||||
name: { value: null, matchMode: 'contains' },
|
||||
startDate: { value: null, matchMode: 'dateIs' },
|
||||
endDate: { value: null, matchMode: 'dateIs' },
|
||||
status: { value: 'PUBLISH', matchMode: 'equals' }
|
||||
status: { value: null, matchMode: 'equals' }
|
||||
}
|
||||
});
|
||||
const statuses = ['PUBLISH'];
|
||||
|
||||
Reference in New Issue
Block a user