- updates in styles, col 'actions' of the table for pre instructor;

This commit is contained in:
Vitalii Kiiko
2025-07-01 09:08:27 +02:00
parent 8ba27c5aac
commit f9e6d227d3

View File

@@ -24,7 +24,7 @@ import ProperBandoLabel from '../../../../components/ProperBandoLabel';
import { Dropdown } from 'primereact/dropdown'; import { Dropdown } from 'primereact/dropdown';
import { Tag } from 'primereact/tag'; import { Tag } from 'primereact/tag';
import { Calendar } from 'primereact/calendar'; import { Calendar } from 'primereact/calendar';
import { storeGet, storeSet } from '../../../../store'; import { storeGet } from '../../../../store';
const AllBandiPreInstructorTableAsync = () => { const AllBandiPreInstructorTableAsync = () => {
@@ -44,7 +44,7 @@ const AllBandiPreInstructorTableAsync = () => {
status: { value: null, matchMode: 'equals' } status: { value: null, matchMode: 'equals' }
} }
}); });
const statuses = ['DRAFT','PUBLISH','EXPIRED']; const statuses = ['DRAFT', 'PUBLISH', 'EXPIRED'];
const role = storeGet('getRole') const role = storeGet('getRole')
@@ -68,7 +68,8 @@ const AllBandiPreInstructorTableAsync = () => {
const getCallback = (resp) => { const getCallback = (resp) => {
if (resp.status === 'SUCCESS') { if (resp.status === 'SUCCESS') {
const { body, totalRecords, const {
body, totalRecords,
//currentPage, totalPages, pageSize //currentPage, totalPages, pageSize
} = resp.data; } = resp.data;
setTotalRecordsNum(totalRecords); setTotalRecordsNum(totalRecords);
@@ -92,19 +93,21 @@ const AllBandiPreInstructorTableAsync = () => {
const actionsBodyTemplate = (rowData) => { const actionsBodyTemplate = (rowData) => {
return ( return (
<div className="p-d-flex p-flex-column"> <div className="appPageSection__tableActions">
<Link to={`/bandi/${rowData.id}`}> <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> </Link>
{role === 'ROLE_INSTRUCTOR_MANAGER' && ( {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> </div>
) )
} }
const downloadSuccessCallback = (resp, callId) => { const downloadSuccessCallback = (resp, callId) => {
const file = new Blob([resp], { type: 'text/csv' }); const file = new Blob([resp], { type: 'text/csv' });
const url = window.URL.createObjectURL(file); const url = window.URL.createObjectURL(file);
const link = document.createElement('a'); const link = document.createElement('a');
@@ -116,15 +119,15 @@ const AllBandiPreInstructorTableAsync = () => {
setLocalAsyncRequest(false); setLocalAsyncRequest(false);
} }
const downloadErrorCallback = (resp) => { const downloadErrorCallback = (resp) => {
setLocalAsyncRequest(false); setLocalAsyncRequest(false);
} }
const handleDownloadRanking = (callId)=>{ const handleDownloadRanking = (callId) => {
setLocalAsyncRequest(true); setLocalAsyncRequest(true);
ApplicationService.downloadRanking(callId, ApplicationService.downloadRanking(callId,
(resp)=>downloadSuccessCallback(resp,callId), (resp) => downloadSuccessCallback(resp, callId),
downloadErrorCallback) downloadErrorCallback)
} }
const statusBodyTemplate = (rowData) => { const statusBodyTemplate = (rowData) => {
@@ -147,7 +150,8 @@ const AllBandiPreInstructorTableAsync = () => {
} }
setLazyState({ ...lazyState, filters, first: 0 }); 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) => { const dateFilterTemplate = (options) => {
@@ -162,7 +166,7 @@ const AllBandiPreInstructorTableAsync = () => {
const dateEndBodyTemplate = (rowData) => { const dateEndBodyTemplate = (rowData) => {
const endTimeObg = getTimeParsedFromString(rowData.endTime); const endTimeObg = getTimeParsedFromString(rowData.endTime);
return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg); return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg);
}; };
useEffect(() => { useEffect(() => {
@@ -205,7 +209,7 @@ const AllBandiPreInstructorTableAsync = () => {
filterMatchModeOptions={translationStrings.statusFilterOptions} filterMatchModeOptions={translationStrings.statusFilterOptions}
header={__('Stato', 'gepafin')} header={__('Stato', 'gepafin')}
style={{ minWidth: '7rem' }} style={{ minWidth: '7rem' }}
body={statusBodyTemplate} /> body={statusBodyTemplate}/>
<Column header={__('Azioni', 'gepafin')} <Column header={__('Azioni', 'gepafin')}
body={actionsBodyTemplate}/> body={actionsBodyTemplate}/>
</DataTable> </DataTable>