- updates in styles, col 'actions' of the table for pre instructor;
This commit is contained in:
@@ -24,7 +24,7 @@ import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import { storeGet, storeSet } from '../../../../store';
|
||||
import { storeGet } from '../../../../store';
|
||||
|
||||
|
||||
const AllBandiPreInstructorTableAsync = () => {
|
||||
@@ -44,7 +44,7 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
status: { value: null, matchMode: 'equals' }
|
||||
}
|
||||
});
|
||||
const statuses = ['DRAFT','PUBLISH','EXPIRED'];
|
||||
const statuses = ['DRAFT', 'PUBLISH', 'EXPIRED'];
|
||||
|
||||
const role = storeGet('getRole')
|
||||
|
||||
@@ -68,7 +68,8 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
|
||||
const getCallback = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
const { body, totalRecords,
|
||||
const {
|
||||
body, totalRecords,
|
||||
//currentPage, totalPages, pageSize
|
||||
} = resp.data;
|
||||
setTotalRecordsNum(totalRecords);
|
||||
@@ -92,19 +93,21 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return (
|
||||
<div className="p-d-flex p-flex-column">
|
||||
<div className="appPageSection__tableActions">
|
||||
<Link to={`/bandi/${rowData.id}`}>
|
||||
<Button severity="info" label={__('Mostra', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right" />
|
||||
<Button severity="info" label={__('Mostra', 'gepafin')} icon="pi pi-eye" size="small"
|
||||
iconPos="right"/>
|
||||
</Link>
|
||||
{role === 'ROLE_INSTRUCTOR_MANAGER' && (
|
||||
<Button severity="info" label={__('Scarica graduatoria', 'gepafin')} icon="pi pi-download" size="small" iconPos="right" style={{marginTop:'10px'}} onClick={() => handleDownloadRanking(rowData.id)}/>
|
||||
<Button severity="info" label={__('Scarica graduatoria', 'gepafin')} icon="pi pi-download"
|
||||
size="small" iconPos="right"
|
||||
onClick={() => handleDownloadRanking(rowData.id)}/>
|
||||
)}
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const downloadSuccessCallback = (resp, callId) => {
|
||||
const downloadSuccessCallback = (resp, callId) => {
|
||||
const file = new Blob([resp], { type: 'text/csv' });
|
||||
const url = window.URL.createObjectURL(file);
|
||||
const link = document.createElement('a');
|
||||
@@ -116,15 +119,15 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
setLocalAsyncRequest(false);
|
||||
}
|
||||
|
||||
const downloadErrorCallback = (resp) => {
|
||||
const downloadErrorCallback = (resp) => {
|
||||
setLocalAsyncRequest(false);
|
||||
}
|
||||
|
||||
const handleDownloadRanking = (callId)=>{
|
||||
const handleDownloadRanking = (callId) => {
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.downloadRanking(callId,
|
||||
(resp)=>downloadSuccessCallback(resp,callId),
|
||||
downloadErrorCallback)
|
||||
ApplicationService.downloadRanking(callId,
|
||||
(resp) => downloadSuccessCallback(resp, callId),
|
||||
downloadErrorCallback)
|
||||
}
|
||||
|
||||
const statusBodyTemplate = (rowData) => {
|
||||
@@ -147,7 +150,8 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
}
|
||||
setLazyState({ ...lazyState, filters, first: 0 });
|
||||
}}
|
||||
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"/>;
|
||||
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel}
|
||||
className="p-column-filter"/>;
|
||||
};
|
||||
|
||||
const dateFilterTemplate = (options) => {
|
||||
@@ -162,7 +166,7 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
|
||||
const dateEndBodyTemplate = (rowData) => {
|
||||
const endTimeObg = getTimeParsedFromString(rowData.endTime);
|
||||
return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg);
|
||||
return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -205,7 +209,7 @@ const AllBandiPreInstructorTableAsync = () => {
|
||||
filterMatchModeOptions={translationStrings.statusFilterOptions}
|
||||
header={__('Stato', 'gepafin')}
|
||||
style={{ minWidth: '7rem' }}
|
||||
body={statusBodyTemplate} />
|
||||
body={statusBodyTemplate}/>
|
||||
<Column header={__('Azioni', 'gepafin')}
|
||||
body={actionsBodyTemplate}/>
|
||||
</DataTable>
|
||||
|
||||
Reference in New Issue
Block a user