- added translation config;
- implemented 'bandi osservati' page;
This commit is contained in:
@@ -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}/>
|
||||
|
||||
Reference in New Issue
Block a user