Merge branch 'develop' into feature/74-new-evaluation-flow
This commit is contained in:
@@ -23,6 +23,7 @@ import { Calendar } from 'primereact/calendar';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Link } from 'react-router-dom';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const AllBandiTable = () => {
|
||||
@@ -115,7 +116,7 @@ const AllBandiTable = () => {
|
||||
};
|
||||
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter" showClear />;
|
||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
@@ -136,7 +137,7 @@ const AllBandiTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="name" header={__('Nome Bando', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
|
||||
@@ -17,6 +17,7 @@ import renderHtmlContent from '../../../../helpers/renderHtmlContent';
|
||||
|
||||
// api
|
||||
import BandoService from '../../../../service/bando-service';
|
||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||
|
||||
// components
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
@@ -25,10 +26,11 @@ import { Dropdown } from 'primereact/dropdown';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Button } from 'primereact/button';
|
||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||
|
||||
// i18n
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
const AllBandiAccordion = () => {
|
||||
const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const [items, setItems] = useState(null);
|
||||
@@ -40,7 +42,8 @@ const AllBandiAccordion = () => {
|
||||
useEffect(() => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId]
|
||||
['companyId', chosenCompanyId],
|
||||
['onlyPreferredCall', showOnlyPreferred]
|
||||
]);
|
||||
}, [chosenCompanyId]);
|
||||
|
||||
@@ -81,7 +84,19 @@ const AllBandiAccordion = () => {
|
||||
}
|
||||
|
||||
const amountBodyTemplate = (rowData) => {
|
||||
return getNumberWithCurrency(rowData.amount);
|
||||
return <span
|
||||
className="appPageSection__titleClickable"
|
||||
onClick={() => {
|
||||
let newExpandedRows;
|
||||
if (isNil(expandedRows) || isNil(expandedRows[rowData.id])) {
|
||||
newExpandedRows = isNil(expandedRows)
|
||||
? wrap({}).set([rowData.id], true).value()
|
||||
: wrap(expandedRows).set([rowData.id], true).value();
|
||||
} else {
|
||||
newExpandedRows = wrap(expandedRows).del([rowData.id]).value();
|
||||
}
|
||||
setExpandedRows(newExpandedRows);
|
||||
}}>{getNumberWithCurrency(rowData.amount)}</span>;
|
||||
};
|
||||
|
||||
const statusBodyTemplate = (rowData) => {
|
||||
@@ -89,11 +104,14 @@ const AllBandiAccordion = () => {
|
||||
};
|
||||
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter" showClear />;
|
||||
return <Dropdown value={options.value} options={statuses}
|
||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||
showClear/>;
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)}/>;
|
||||
};
|
||||
|
||||
const addToFavourites = (id, preferredId) => {
|
||||
@@ -188,7 +206,7 @@ const AllBandiAccordion = () => {
|
||||
loading={isAsyncRequest}
|
||||
dataKey="id"
|
||||
filters={filters}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
expandedRows={expandedRows}
|
||||
onRowToggle={(e) => setExpandedRows(e.data)}
|
||||
rowExpansionTemplate={rowExpansionTemplate}
|
||||
@@ -198,7 +216,7 @@ const AllBandiAccordion = () => {
|
||||
body={nameBodyTemplate}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Importo totale', 'gepafin')} filterField="amount"
|
||||
style={{ minWidth: '10rem' }} body={amountBodyTemplate} sortable/>
|
||||
style={{ minWidth: '10rem' }} body={amountBodyTemplate}/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||
style={{ width: '8rem' }} body={statusBodyTemplate} filter sortable
|
||||
filterElement={statusFilterTemplate}/>
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
import React, { useState, useEffect} from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { is, uniq, isNil, isEmpty } from 'ramda';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
// store
|
||||
import { storeGet, storeSet, useStore } from '../../../../store';
|
||||
|
||||
// tools
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||
import getDateFromISOstring from '../../../../helpers/getDateFromISOstring';
|
||||
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||
import getNumberWithCurrency from '../../../../helpers/getNumberWithCurrency';
|
||||
import renderHtmlContent from '../../../../helpers/renderHtmlContent';
|
||||
|
||||
// api
|
||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||
|
||||
// components
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
import { Column } from 'primereact/column';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Button } from 'primereact/button';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const AllBandiPreferredAccordion = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [expandedRows, setExpandedRows] = useState(null);
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
const userData = storeGet.main.userData();
|
||||
PreferredBandoService.getPreferredCalls(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId],
|
||||
['userId', userData.id]
|
||||
]);
|
||||
}, [chosenCompanyId]);
|
||||
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setItems(getFormattedBandiData(data.data));
|
||||
setStatuses(uniq(data.data.map(o => o.status)))
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errGetCallbacks = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getFormattedBandiData = (data) => {
|
||||
return data.map((d) => {
|
||||
d.dates = d.dates.map(v => is(String, v) ? new Date(v) : (v ? v : ''));
|
||||
return d;
|
||||
});
|
||||
};
|
||||
|
||||
const nameBodyTemplate = (rowData) => {
|
||||
return <span
|
||||
className="appPageSection__titleClickable"
|
||||
onClick={() => {
|
||||
let newExpandedRows;
|
||||
if (isNil(expandedRows) || isNil(expandedRows[rowData.id])) {
|
||||
newExpandedRows = isNil(expandedRows)
|
||||
? wrap({}).set([rowData.id], true).value()
|
||||
: wrap(expandedRows).set([rowData.id], true).value();
|
||||
} else {
|
||||
newExpandedRows = wrap(expandedRows).del([rowData.id]).value();
|
||||
}
|
||||
setExpandedRows(newExpandedRows);
|
||||
}}>{rowData.name}</span>
|
||||
}
|
||||
|
||||
const amountBodyTemplate = (rowData) => {
|
||||
return getNumberWithCurrency(rowData.amount);
|
||||
};
|
||||
|
||||
const statusBodyTemplate = (rowData) => {
|
||||
return <ProperBandoLabel status={rowData.status}/>;
|
||||
};
|
||||
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||
};
|
||||
|
||||
const addToFavourites = (id, preferredId) => {
|
||||
const companyId = storeGet.main.chosenCompanyId()
|
||||
const data = {
|
||||
companyId,
|
||||
callId: id
|
||||
}
|
||||
if (preferredId && preferredId !== 0) {
|
||||
PreferredBandoService.deleteFromPreferred(preferredId, (data) => removeFavCallback(data, id), errToggleFavCallback);
|
||||
} else {
|
||||
PreferredBandoService.addToPreferred(data, addFavCallback, errToggleFavCallback);
|
||||
}
|
||||
}
|
||||
|
||||
const removeFavCallback = (data, id) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
const newItems = items.map((o) => {
|
||||
if (o.id === id) {
|
||||
return {
|
||||
...o,
|
||||
preferredCallId: null
|
||||
}
|
||||
} else {
|
||||
return o;
|
||||
}
|
||||
});
|
||||
setItems(newItems)
|
||||
}
|
||||
}
|
||||
const addFavCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
const newItems = items.map((o) => {
|
||||
if (o.id === data.data.callId) {
|
||||
return {
|
||||
...o,
|
||||
preferredCallId: data.data.id
|
||||
}
|
||||
} else {
|
||||
return o;
|
||||
}
|
||||
});
|
||||
setItems(newItems)
|
||||
}
|
||||
}
|
||||
|
||||
const errToggleFavCallback = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
}
|
||||
|
||||
const goToBandoPage = (id) => {
|
||||
navigate(`/bandi/${id}`)
|
||||
}
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <div className="appPageSection__tableActions">
|
||||
<button type="button"
|
||||
className="appPageSection__addToFavourites"
|
||||
data-active={!isNil(rowData.preferredCallId)}
|
||||
onClick={() => addToFavourites(rowData.id, rowData.preferredCallId)}>
|
||||
<i className="pi pi-heart" style={{ fontSize: '1rem' }}></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
const rowExpansionTemplate = (data) => {
|
||||
return (
|
||||
<div className="p-3">
|
||||
{renderHtmlContent(data.descriptionShort)}
|
||||
<p>{__('Scadenza', 'gepafin')}: {getDateFromISOstring(data.dates[1])}</p>
|
||||
{!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && !data.confidi
|
||||
? <Button onClick={() => goToBandoPage(data.id)} severity="info">
|
||||
{__('Partecipa', 'gepafin')}
|
||||
</Button> : null}
|
||||
{!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && data.confidi
|
||||
? <Button onClick={() => goToBandoPage(data.id)} severity="info">
|
||||
{__('Mostra', 'gepafin')}
|
||||
</Button> : null}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const allowExpansion = (rowData) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
return(
|
||||
<div className="appPageSection__table">
|
||||
<DataTable value={items}
|
||||
paginator
|
||||
rows={10}
|
||||
loading={isAsyncRequest}
|
||||
dataKey="id"
|
||||
filters={filters}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
expandedRows={expandedRows}
|
||||
onRowToggle={(e) => setExpandedRows(e.data)}
|
||||
rowExpansionTemplate={rowExpansionTemplate}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column expander={allowExpansion} style={{ width: '5rem' }} />
|
||||
<Column field="name" header={__('Bando', 'gepafin')}
|
||||
body={nameBodyTemplate}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Importo totale', 'gepafin')} filterField="amount"
|
||||
style={{ minWidth: '10rem' }} body={amountBodyTemplate} sortable/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||
style={{ width: '8rem' }} body={statusBodyTemplate} filter sortable
|
||||
filterElement={statusFilterTemplate}/>
|
||||
{!isEmpty(chosenCompanyId) && chosenCompanyId !== 0
|
||||
? <Column header={__('Azioni', 'gepafin')}
|
||||
style={{ width: '8rem' }}
|
||||
body={actionsBodyTemplate}/> : null}
|
||||
</DataTable>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AllBandiPreferredAccordion;
|
||||
43
src/pages/BandiPreferredBeneficiario/index.js
Normal file
43
src/pages/BandiPreferredBeneficiario/index.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import React from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { isEmpty } from 'ramda';
|
||||
|
||||
// store
|
||||
import { useStore } from '../../store';
|
||||
|
||||
// components
|
||||
import AllBandiAccordion from '../BandiBeneficiario/components/AllBandiAccordion';
|
||||
|
||||
const BandiPreferredBeneficiario = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Bandi osservati', 'gepafin')}</h1>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{isEmpty(chosenCompanyId) || chosenCompanyId === 0
|
||||
? <>
|
||||
<div className="appPageSection__message warning">
|
||||
<i className="pi pi-exclamation-triangle"></i>
|
||||
<span className="summary">{__('Attenzione', 'gepafin')}</span>
|
||||
<span>
|
||||
{__('Per applicare ai bandi devi Registare un Azienda clicca', 'gepafin')}
|
||||
<Link to={`/agguingi-azienda`} style={{marginLeft: '0.5ch'}}>{__('qua', 'gepafin')}</Link>
|
||||
</span>
|
||||
</div>
|
||||
<div className="appPage__spacer"></div>
|
||||
</> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
<AllBandiAccordion showOnlyPreferred={true}/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default BandiPreferredBeneficiario;
|
||||
@@ -26,6 +26,7 @@ import { Button } from 'primereact/button';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Link } from 'react-router-dom';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
const DraftApplicationsTable = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
@@ -142,7 +143,7 @@ const DraftApplicationsTable = () => {
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses}
|
||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||
itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter"
|
||||
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||
showClear/>;
|
||||
};
|
||||
|
||||
@@ -169,7 +170,7 @@ const DraftApplicationsTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||
sortable
|
||||
|
||||
@@ -16,6 +16,7 @@ import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Link } from 'react-router-dom';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const LatestBandiTable = () => {
|
||||
@@ -23,7 +24,7 @@ const LatestBandiTable = () => {
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
const [, setStatuses] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setLocalAsyncRequest(true);
|
||||
@@ -128,7 +129,7 @@ const LatestBandiTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="name" header={__('Nome Bando', 'gepafin')} filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||
style={{ minWidth: '8rem' }}/>
|
||||
|
||||
@@ -107,7 +107,7 @@ const LatestUsersActivityTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}{__('Nessun dato disponibile', 'gepafin')}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column header={__('Timestamp', 'gepafin')} filterField="date" dataType="date"
|
||||
style={{ minWidth: '8rem' }}
|
||||
|
||||
@@ -8,6 +8,10 @@ import { storeGet, useStore } from '../../../../store';
|
||||
|
||||
// api
|
||||
import BandoService from '../../../../service/bando-service';
|
||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||
|
||||
// tools
|
||||
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||
|
||||
// components
|
||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||
@@ -19,8 +23,8 @@ import { InputIcon } from 'primereact/inputicon';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const LatestBandiTable = () => {
|
||||
@@ -29,7 +33,7 @@ const LatestBandiTable = () => {
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
const [, setStatuses] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
@@ -209,7 +213,7 @@ const LatestBandiTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="name" header={__('Nome Bando', 'gepafin')} filter
|
||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||
|
||||
@@ -26,6 +26,7 @@ import { Calendar } from 'primereact/calendar';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Link } from 'react-router-dom';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
const MyLatestSubmissionsTable = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
@@ -145,7 +146,7 @@ const MyLatestSubmissionsTable = () => {
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses}
|
||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||
itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter"
|
||||
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||
showClear/>;
|
||||
};
|
||||
|
||||
@@ -175,7 +176,7 @@ const MyLatestSubmissionsTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||
sortable
|
||||
|
||||
@@ -9,6 +9,10 @@ import { useStore } from '../../../../store';
|
||||
// api
|
||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||
|
||||
// tools
|
||||
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
|
||||
// components
|
||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
@@ -19,7 +23,10 @@ import { InputIcon } from 'primereact/inputicon';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Tag } from 'primereact/tag';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
const PreInstructorDomandeTable = () => {
|
||||
const userData = useStore().main.userData();
|
||||
@@ -126,6 +133,14 @@ const PreInstructorDomandeTable = () => {
|
||||
return <ProperBandoLabel status={rowData.status}/>;
|
||||
};
|
||||
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||
};
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <Link to={`/domande/${rowData.applicationId}`}>
|
||||
<Button severity="info" label={__('Valuta', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||
@@ -140,7 +155,7 @@ const PreInstructorDomandeTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
@@ -160,7 +175,8 @@ const PreInstructorDomandeTable = () => {
|
||||
style={{ minWidth: '8rem' }}
|
||||
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')}
|
||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} />
|
||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||
filterElement={statusFilterTemplate} />
|
||||
<Column header={__('Azioni', 'gepafin')}
|
||||
body={actionsBodyTemplate}/>
|
||||
</DataTable>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { InputIcon } from 'primereact/inputicon';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
||||
@@ -26,7 +27,7 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
const [, setStatuses] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setLocalAsyncRequest(true);
|
||||
@@ -154,7 +155,7 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||
sortable
|
||||
|
||||
@@ -25,6 +25,7 @@ import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const BeneficiarioDomandeTable = () => {
|
||||
@@ -141,7 +142,7 @@ const BeneficiarioDomandeTable = () => {
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses}
|
||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||
itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter"
|
||||
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||
showClear/>;
|
||||
};
|
||||
|
||||
@@ -169,7 +170,7 @@ const BeneficiarioDomandeTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||
sortable
|
||||
|
||||
@@ -7,7 +7,11 @@ import { Link } from 'react-router-dom';
|
||||
import { storeGet } from '../../../../store';
|
||||
|
||||
// api
|
||||
import AmendmentsService from '../../../../service/amendments-service';
|
||||
|
||||
// tools
|
||||
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
|
||||
// components
|
||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||
@@ -19,7 +23,10 @@ import { InputIcon } from 'primereact/inputicon';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import AmendmentsService from '../../../../service/amendments-service';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Tag } from 'primereact/tag';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
|
||||
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||
@@ -129,6 +136,14 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||
return <ProperBandoLabel status={rowData.status}/>;
|
||||
};
|
||||
|
||||
const statusFilterTemplate = (options) => {
|
||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||
};
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <Link to={`/domande/${rowData.applicationId}/soccorso/${rowData.id}`}>
|
||||
<Button severity="info" label={__('Dettagli', 'gepafin')} size="small" />
|
||||
@@ -143,7 +158,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
@@ -163,7 +178,8 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||
style={{ minWidth: '8rem' }}
|
||||
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')}
|
||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} />
|
||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||
filterElement={statusFilterTemplate} />
|
||||
<Column header={__('Azioni', 'gepafin')}
|
||||
body={actionsBodyTemplate}/>
|
||||
</DataTable>
|
||||
|
||||
@@ -25,6 +25,7 @@ import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
const AllUsersTable = () => {
|
||||
const users = useStore().main.users();
|
||||
@@ -150,7 +151,7 @@ const AllUsersTable = () => {
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
emptyMessage={translationStrings.emptyMessage}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column body={nameBodyTemplate}
|
||||
header={__('Nome utente', 'gepafin')}
|
||||
|
||||
Reference in New Issue
Block a user