saving progress;

This commit is contained in:
Vitalii Kiiko
2025-03-24 15:51:56 +01:00
parent f2fc9b8b49
commit 5fcb0d765c
27 changed files with 492 additions and 38 deletions

View File

@@ -49,7 +49,8 @@ const AllBandiTable = () => {
const getFormattedBandiData = (data) => {
return data.map((d) => {
d.dates = d.dates.map(v => is(String, v) ? new Date(v) : (v ? v : ''));
d.dateStart = is(String, d.dates[0]) ? new Date(d.dates[0]) : (d.dates[0] ? d.dates[0] : '');
d.dateEnd = is(String, d.dates[1]) ? new Date(d.dates[1]) : (d.dates[1] ? d.dates[1] : '');
return d;
});
};
@@ -62,8 +63,8 @@ const AllBandiTable = () => {
setFilters({
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
name: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
start_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
end_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
dateStart: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
dateEnd: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
status: { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] },
});
};
@@ -81,15 +82,15 @@ const AllBandiTable = () => {
}*/
const dateStartBodyTemplate = (rowData) => {
return getDateFromISOstring(rowData.dates[0]);
return getDateFromISOstring(rowData.dateStart);
};
const dateEndBodyTemplate = (rowData) => {
return getDateFromISOstring(rowData.dates[1]);
return getDateFromISOstring(rowData.dateEnd);
};
const dateFilterTemplate = (options) => {
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="dd/mm/yy" placeholder="dd/mm/yyyy" mask="99/99/9999" />;
};
const statusBodyTemplate = (rowData) => {
@@ -130,14 +131,17 @@ const AllBandiTable = () => {
filter sortable
filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '8rem' }}/>
<Column header={__('Data Pubblicazione', 'gepafin')} filterField="start_date" dataType="date"
<Column header={__('Data Pubblicazione', 'gepafin')} filterField="dateStart" dataType="date"
style={{ minWidth: '8rem' }}
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column header={__('Data Scadenza', 'gepafin')} filterField="end_date" dataType="date"
body={dateStartBodyTemplate} filter
filterElement={dateFilterTemplate}/>
<Column header={__('Data Scadenza', 'gepafin')} filterField="dateEnd" dataType="date"
style={{ minWidth: '8rem' }}
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
body={dateEndBodyTemplate} filter
filterElement={dateFilterTemplate}/>
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
style={{ minWidth: '7rem' }} body={statusBodyTemplate}
filter sortable
filterElement={statusFilterTemplate}/>
<Column header={__('Azioni', 'gepafin')}
body={actionsBodyTemplate}/>