diff --git a/CHANGELOG.md b/CHANGELOG.md index 60027afe6..e4d02d9f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ +### [7.26.1](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v7.26.0...v7.26.1) (2024-03-29) + + +### Bug Fixes + +* fixed tipologia_bandi in BandiInEvidenceTemplate ([#627](https://github.com/RedTurtle/design-comuni-plone-theme/issues/627)) ([38549fc](https://github.com/RedTurtle/design-comuni-plone-theme/commit/38549fc778be9b24321b95da3a1b2bd2c089d21d)) + +## [7.26.0](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v7.25.4...v7.26.0) (2024-03-28) + + +### Features + +* added new date filter in bandiSearch block, fixed reset of search results and sidemenu layout ([#624](https://github.com/RedTurtle/design-comuni-plone-theme/issues/624)) ([8f838fb](https://github.com/RedTurtle/design-comuni-plone-theme/commit/8f838fbe56bfee29a9496f918d42b84294e155e0)) + + +### Bug Fixes + +* added aria-hidden attribute to icons block ([#595](https://github.com/RedTurtle/design-comuni-plone-theme/issues/595)) ([da2e1a4](https://github.com/RedTurtle/design-comuni-plone-theme/commit/da2e1a4f368e87f93696333b726348d7002271cf)) +* added aria-label for cardReadMore component in iconBlock ([#619](https://github.com/RedTurtle/design-comuni-plone-theme/issues/619)) ([bce4f36](https://github.com/RedTurtle/design-comuni-plone-theme/commit/bce4f36bf9ff8f98079436e709ee963e0e611b3b)) +* added role='button' to search link ([#612](https://github.com/RedTurtle/design-comuni-plone-theme/issues/612)) ([c8b7440](https://github.com/RedTurtle/design-comuni-plone-theme/commit/c8b744021b5063172621b6481cc48ce26dd64b3a)) +* changed accessible labels for customer satisfaction ([#589](https://github.com/RedTurtle/design-comuni-plone-theme/issues/589)) ([48320ad](https://github.com/RedTurtle/design-comuni-plone-theme/commit/48320ad6e3c5db3f58621e3a127c41178aa37695)) +* collapse button alignment for filters in Search page ([#585](https://github.com/RedTurtle/design-comuni-plone-theme/issues/585)) ([3e91b8e](https://github.com/RedTurtle/design-comuni-plone-theme/commit/3e91b8e6d248c6f261f18bbb20e0011cb6ec3cc9)) +* general background color for icon block ([#609](https://github.com/RedTurtle/design-comuni-plone-theme/issues/609)) ([1edc6f1](https://github.com/RedTurtle/design-comuni-plone-theme/commit/1edc6f1a51f498d48cb7e5e5880454d2071595fd)) +* removed unnecessary h3 in footer ([#593](https://github.com/RedTurtle/design-comuni-plone-theme/issues/593)) ([44a7484](https://github.com/RedTurtle/design-comuni-plone-theme/commit/44a7484ace7ecb74ccff06bcb256eaf3c759459c)) + +### [7.25.4](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v7.25.3...v7.25.4) (2024-03-18) + + +### Bug Fixes + +* mobile search icon in header ([#597](https://github.com/RedTurtle/design-comuni-plone-theme/issues/597)) ([7b8b0d9](https://github.com/RedTurtle/design-comuni-plone-theme/commit/7b8b0d93fc51fc8548661156660e1444d22becb4)) +* subsite styles for simple list, index of content, search block ([#572](https://github.com/RedTurtle/design-comuni-plone-theme/issues/572)) ([5869d83](https://github.com/RedTurtle/design-comuni-plone-theme/commit/5869d83c16faace4e851450574954854cd9ed0cf)) +* subsites list bullet colors ([#574](https://github.com/RedTurtle/design-comuni-plone-theme/issues/574)) ([814d55d](https://github.com/RedTurtle/design-comuni-plone-theme/commit/814d55d4a1510daa732956241b3a53ef9f063a5b)) + ### [7.25.3](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v7.25.2...v7.25.3) (2024-03-07) diff --git a/RELEASE.md b/RELEASE.md index ed4b094b6..b7ed84293 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -35,6 +35,22 @@ ### Fix - Tradotto il messaggio per Screen Reader del bottone per aprire e chiudere il menu in mobile. +### Novità + +- Aggiunto nuovo filtro per Data di chiusura del procedimento nel blocco di ricerca Bandi + +### Migliorie + +- Migliorata l'accessibilità del bottone "Cerca". +- Migliorata l'accessibilità del blocco Icone. +- Migliorata l'accessibilità per la customer satisfaction. + +### Fix + +- Migliorato l'allineamento dei filtri nella pagina di Ricerca. +- Sistemato al cambio pagina il reset dei risultati di ricerca nei blocchi di ricerca Bandi, Eventi e UO +- Sistemato layout del menu laterale sinistro nella vista del Bando +- Sistemato il flag Mostra tipologia bandi nel blocco elenco con variazione Bandi in Evidenza ## Versione 7.25.3 (07/03/2024) diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po index 00f274fcd..7a20b533c 100644 --- a/locales/de/LC_MESSAGES/volto.po +++ b/locales/de/LC_MESSAGES/volto.po @@ -1436,7 +1436,7 @@ msgid "customer_satisfaction" msgstr "" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: No +# defaultMessage: No, it was not useful msgid "customer_satisfaction_no" msgstr "" @@ -1461,7 +1461,7 @@ msgid "customer_satisfaction_title" msgstr "" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: Yes +# defaultMessage: Yes, it was useful msgid "customer_satisfaction_yes" msgstr "" @@ -2862,6 +2862,21 @@ msgstr "" msgid "searchBlock_categoria_filter" msgstr "" +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Filtro per data di chiusura del procedimento +msgid "searchBlock_chiusura_filter" +msgstr "" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura dal +msgid "searchBlock_chiusura_filter_from" +msgstr "" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura al +msgid "searchBlock_chiusura_filter_to" +msgstr "" + #: components/ItaliaTheme/Blocks/BandiSearch/Sidebar #: components/ItaliaTheme/Blocks/EventSearch/DefaultFilters #: components/ItaliaTheme/Blocks/EventSearch/Sidebar diff --git a/locales/en/LC_MESSAGES/volto.po b/locales/en/LC_MESSAGES/volto.po index de19da772..efb592b06 100644 --- a/locales/en/LC_MESSAGES/volto.po +++ b/locales/en/LC_MESSAGES/volto.po @@ -1421,7 +1421,7 @@ msgid "customer_satisfaction" msgstr "" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: No +# defaultMessage: No, it was not useful msgid "customer_satisfaction_no" msgstr "" @@ -1446,7 +1446,7 @@ msgid "customer_satisfaction_title" msgstr "" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: Yes +# defaultMessage: Yes, it was useful msgid "customer_satisfaction_yes" msgstr "" @@ -2847,6 +2847,21 @@ msgstr "" msgid "searchBlock_categoria_filter" msgstr "" +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Filtro per data di chiusura del procedimento +msgid "searchBlock_chiusura_filter" +msgstr "Filter by process closing date" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura dal +msgid "searchBlock_chiusura_filter_from" +msgstr "Closing from" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura al +msgid "searchBlock_chiusura_filter_to" +msgstr "Closing to" + #: components/ItaliaTheme/Blocks/BandiSearch/Sidebar #: components/ItaliaTheme/Blocks/EventSearch/DefaultFilters #: components/ItaliaTheme/Blocks/EventSearch/Sidebar diff --git a/locales/es/LC_MESSAGES/volto.po b/locales/es/LC_MESSAGES/volto.po index 0bb57ab38..f4d874b52 100644 --- a/locales/es/LC_MESSAGES/volto.po +++ b/locales/es/LC_MESSAGES/volto.po @@ -1430,7 +1430,7 @@ msgid "customer_satisfaction" msgstr "Resultados de las encuestas de satisfacción del cliente" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: No +# defaultMessage: No, it was not useful msgid "customer_satisfaction_no" msgstr "No" @@ -1455,7 +1455,7 @@ msgid "customer_satisfaction_title" msgstr "¿Fue esta página útil para usted?" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: Yes +# defaultMessage: Yes, it was useful msgid "customer_satisfaction_yes" msgstr "Sí" @@ -2856,6 +2856,21 @@ msgstr "Color de botones" msgid "searchBlock_categoria_filter" msgstr "Filtrar por Categoría" +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Filtro per data di chiusura del procedimento +msgid "searchBlock_chiusura_filter" +msgstr "Filtrar por fecha de cierre del procedimiento" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura dal +msgid "searchBlock_chiusura_filter_from" +msgstr "Cerrando desde" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura al +msgid "searchBlock_chiusura_filter_to" +msgstr "Cerrando a las" + #: components/ItaliaTheme/Blocks/BandiSearch/Sidebar #: components/ItaliaTheme/Blocks/EventSearch/DefaultFilters #: components/ItaliaTheme/Blocks/EventSearch/Sidebar diff --git a/locales/fr/LC_MESSAGES/volto.po b/locales/fr/LC_MESSAGES/volto.po index abe9835b0..54367e282 100644 --- a/locales/fr/LC_MESSAGES/volto.po +++ b/locales/fr/LC_MESSAGES/volto.po @@ -1438,7 +1438,7 @@ msgid "customer_satisfaction" msgstr "Résultats des enquêtes de satisfaction client" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: No +# defaultMessage: No, it was not useful msgid "customer_satisfaction_no" msgstr "No" @@ -1463,7 +1463,7 @@ msgid "customer_satisfaction_title" msgstr "Est-ce que cette page vous a été utile?" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: Yes +# defaultMessage: Yes, it was useful msgid "customer_satisfaction_yes" msgstr "Oui" @@ -2864,6 +2864,21 @@ msgstr "" msgid "searchBlock_categoria_filter" msgstr "Catégorie" +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Filtro per data di chiusura del procedimento +msgid "searchBlock_chiusura_filter" +msgstr "Filtrer par date de clôture de la procédure" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura dal +msgid "searchBlock_chiusura_filter_from" +msgstr "Fermeture à partir de" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura al +msgid "searchBlock_chiusura_filter_to" +msgstr "Clôture à" + #: components/ItaliaTheme/Blocks/BandiSearch/Sidebar #: components/ItaliaTheme/Blocks/EventSearch/DefaultFilters #: components/ItaliaTheme/Blocks/EventSearch/Sidebar diff --git a/locales/it/LC_MESSAGES/volto.po b/locales/it/LC_MESSAGES/volto.po index 253610f72..4c165c29d 100644 --- a/locales/it/LC_MESSAGES/volto.po +++ b/locales/it/LC_MESSAGES/volto.po @@ -1421,9 +1421,9 @@ msgid "customer_satisfaction" msgstr "Risultati indagini di customer satisfaction" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: No +# defaultMessage: No, it was not useful msgid "customer_satisfaction_no" -msgstr "No" +msgstr "No, questa pagina non mi è stata utile." #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction # defaultMessage: Submit your comment @@ -1446,9 +1446,9 @@ msgid "customer_satisfaction_title" msgstr "Questa pagina ti è stata utile?" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: Yes +# defaultMessage: Yes, it was useful msgid "customer_satisfaction_yes" -msgstr "Sì" +msgstr "Sì, questa pagina mi è stata utile" #: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderEventDates # defaultMessage: dal {dateStart} fino a conclusione @@ -2847,6 +2847,21 @@ msgstr "" msgid "searchBlock_categoria_filter" msgstr "" +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Filtro per data di chiusura del procedimento +msgid "searchBlock_chiusura_filter" +msgstr "" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura dal +msgid "searchBlock_chiusura_filter_from" +msgstr "" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura al +msgid "searchBlock_chiusura_filter_to" +msgstr "" + #: components/ItaliaTheme/Blocks/BandiSearch/Sidebar #: components/ItaliaTheme/Blocks/EventSearch/DefaultFilters #: components/ItaliaTheme/Blocks/EventSearch/Sidebar diff --git a/locales/volto.pot b/locales/volto.pot index d82a9dff5..5cffc80d4 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -1423,7 +1423,7 @@ msgid "customer_satisfaction" msgstr "" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: No +# defaultMessage: No, it was not useful msgid "customer_satisfaction_no" msgstr "" @@ -1448,7 +1448,7 @@ msgid "customer_satisfaction_title" msgstr "" #: components/ItaliaTheme/CustomerSatisfaction/CustomerSatisfaction -# defaultMessage: Yes +# defaultMessage: Yes, it was useful msgid "customer_satisfaction_yes" msgstr "" @@ -2849,6 +2849,21 @@ msgstr "" msgid "searchBlock_categoria_filter" msgstr "" +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Filtro per data di chiusura del procedimento +msgid "searchBlock_chiusura_filter" +msgstr "" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura dal +msgid "searchBlock_chiusura_filter_from" +msgstr "" + +#: components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters +# defaultMessage: Chiusura al +msgid "searchBlock_chiusura_filter_to" +msgstr "" + #: components/ItaliaTheme/Blocks/BandiSearch/Sidebar #: components/ItaliaTheme/Blocks/EventSearch/DefaultFilters #: components/ItaliaTheme/Blocks/EventSearch/Sidebar diff --git a/package.json b/package.json index 4ba849157..e92af4cc7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "design-comuni-plone-theme", "description": "Volto Theme for Italia design guidelines", "license": "MIT", - "version": "7.25.3", + "version": "7.26.1", "addons": [ "@plone-collective/volto-sentry", "volto-multilingual-widget", diff --git a/src/actions/index.js b/src/actions/index.js index c563bcc8b..6c4b4ac5d 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -14,8 +14,8 @@ import { getSearchFilters, GET_SEARCH_FILTERS } from './getSearchFilters'; import { getSearchResults, GET_SEARCH_RESULTS } from './getSearchResults'; import { getCalendarResults, GET_CALENDAR_RESULTS } from './calendarSearch'; - import { setOriginalQuery, ORIGINAL_QUERY } from './setOriginalQuery'; +import { resetQuerystringResults } from './resetQuerystringResults'; import { getCalendarDayResults, @@ -61,4 +61,5 @@ export { ORIGINAL_QUERY, getSearchBandiFilters, GET_SEARCH_BANDI_FILTERS, + resetQuerystringResults, }; diff --git a/src/actions/resetQuerystringResults.js b/src/actions/resetQuerystringResults.js new file mode 100644 index 000000000..74c8de98d --- /dev/null +++ b/src/actions/resetQuerystringResults.js @@ -0,0 +1,18 @@ +/* +- il reducer del type RESET_QUERYSTRING_RESULTS viene già dichiarato in Volto nel file querystringsearch.js +*/ + +export const RESET_QUERYSTRING_RESULTS = 'RESET_QUERYSTRING_RESULTS'; + +/** + * Reset querystring results function. + * @function resetQuerystringResults + * @param {string} subrequest Key of the subrequest. + * @returns {Object} Search content action. + */ +export function resetQuerystringResults(subrequest = null) { + return { + type: RESET_QUERYSTRING_RESULTS, + subrequest, + }; +} diff --git a/src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx b/src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx index 3a053b1f8..c4fc46482 100644 --- a/src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx +++ b/src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx @@ -13,7 +13,7 @@ import { getQueryStringResults } from '@plone/volto/actions'; import { flattenToAppURL } from '@plone/volto/helpers'; import BandiInEvidenceTemplate from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate'; import { Pagination } from 'design-comuni-plone-theme/components/ItaliaTheme'; - +import { resetQuerystringResults } from 'design-comuni-plone-theme/actions'; import FiltersConfig from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/BandiSearch/FiltersConfig'; const messages = defineMessages({ @@ -36,7 +36,7 @@ const messages = defineMessages({ }, }); -const Body = ({ data, inEditMode, path, onChangeBlock }) => { +const Body = ({ data, id, inEditMode, path, onChangeBlock }) => { const intl = useIntl(); const b_size = 6; @@ -48,14 +48,19 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => { const dispatch = useDispatch(); const querystringResults = useSelector((state) => { - return state.querystringsearch?.subrequests?.bandi_search; + return state.querystringsearch?.subrequests?.[id + '_bandi_search']; }); const items = useSelector((state) => { - return state.querystringsearch?.subrequests?.bandi_search?.items ?? []; + return ( + state.querystringsearch?.subrequests?.[id + '_bandi_search']?.items ?? [] + ); }); const loading = useSelector((state) => { - return state.querystringsearch?.subrequests?.bandi_search?.loading || false; + return ( + state.querystringsearch?.subrequests?.[id + '_bandi_search']?.loading || + false + ); }); const resultsRef = createRef(); @@ -79,7 +84,9 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => { }); if (data.defaultQuerystring) { - query.push(...data.defaultQuerystring.filter(el => el.i !== 'portal_type')); + query.push( + ...data.defaultQuerystring.filter((el) => el.i !== 'portal_type'), + ); } if (data.location && data.location[0]) { @@ -100,7 +107,7 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => { sort_on: data.sort_on, sort_order: data.sort_order ? 'descending' : 'ascending', }, - 'bandi_search', + id + '_bandi_search', page, ), ); @@ -120,6 +127,7 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => { newState = { ...getInitialState(), }; + dispatch(resetQuerystringResults(id + '_bandi_search')); } else { const f = newState[action.filter]; const defaultReducer = (value, state) => value; diff --git a/src/components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters.js b/src/components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters.js index ca118a6de..c936f5292 100644 --- a/src/components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters.js +++ b/src/components/ItaliaTheme/Blocks/BandiSearch/DefaultFilters.js @@ -51,6 +51,10 @@ const messages = defineMessages({ id: 'searchBlock_scadenza_filter', defaultMessage: 'Filtro per data di scadenza del bando', }, + chiusura_filter: { + id: 'searchBlock_chiusura_filter', + defaultMessage: 'Filtro per data di chiusura del procedimento', + }, scadenza_dal: { id: 'searchBlock_scadenza_filter_from', defaultMessage: 'Scadenza dal', @@ -59,6 +63,14 @@ const messages = defineMessages({ id: 'searchBlock_scadenza_filter_to', defaultMessage: 'Scadenza al', }, + chiusura_dal: { + id: 'searchBlock_chiusura_filter_from', + defaultMessage: 'Chiusura dal', + }, + chiusura_al: { + id: 'searchBlock_chiusura_filter_to', + defaultMessage: 'Chiusura al', + }, search_keyword: { id: 'Cerca per parola chiave', defaultMessage: 'Cerca per parola chiave', @@ -103,7 +115,9 @@ const DefaultFilters = (pathSearch) => { // placeholder: intl.formatMessage(messages.tipologia), dispatch: { action: getSearchBandiFilters, - path: subsite ? flattenToAppURL(subsite['@id']) : pathSearch || '/', + path: subsite + ? flattenToAppURL(subsite['@id']) + : pathSearch || '/', stateSelector: 'searchBandiFilters', resultProp: 'tipologie', }, @@ -154,7 +168,9 @@ const DefaultFilters = (pathSearch) => { options: { dispatch: { action: getSearchBandiFilters, - path: subsite ? flattenToAppURL(subsite['@id']) : pathSearch || '/', + path: subsite + ? flattenToAppURL(subsite['@id']) + : pathSearch || '/', stateSelector: 'searchBandiFilters', resultProp: 'offices', }, @@ -182,7 +198,9 @@ const DefaultFilters = (pathSearch) => { options: { dispatch: { action: getSearchBandiFilters, - path: subsite ? flattenToAppURL(subsite['@id']) : pathSearch || '/', + path: subsite + ? flattenToAppURL(subsite['@id']) + : pathSearch || '/', stateSelector: 'searchBandiFilters', resultProp: 'subjects', }, @@ -220,7 +238,6 @@ const DefaultFilters = (pathSearch) => { endLabel: intl.formatMessage(messages.scadenza_al), }, }, - reducer: (value, state) => { return { startDate: value.start ?? state.widget.props.defaultStart, @@ -262,6 +279,65 @@ const DefaultFilters = (pathSearch) => { } }, }, + chiusura_filter: { + label: intl.formatMessage(messages.chiusura_filter), + type: 'chiusura_filter', + widget: { + component: DateFilter, + props: { + // value: { + // startDate: moment().startOf('day'), + // endDate: moment().endOf('day'), + // }, + showClearDates: true, + // defaultStart: moment().startOf('day'), + // defaultEnd: moment().endOf('day'), + isOutsideRange: () => false, + startLabel: intl.formatMessage(messages.chiusura_dal), + endLabel: intl.formatMessage(messages.chiusura_al), + }, + }, + reducer: (value, state) => { + return { + startDate: value.start ?? state.widget.props.defaultStart, + endDate: value.end ?? state.widget.props.defaultEnd, + }; + }, + query: (value, query) => { + const date_fmt = 'YYYY-MM-DD HH:mm'; + if (value?.startDate || value?.endDate) { + if (value?.startDate && !value.endDate) { + let start_v = value.startDate.clone(); + let start = start_v?.startOf('day')?.utc()?.format(date_fmt); + query.push({ + i: 'chiusura_procedimento_bando', + o: 'plone.app.querystring.operation.date.largerThan', //plone.app.querystring.operation.date.largerThan + v: start, + }); + } else if (!value?.startDate && value?.endDate) { + let end_v = value.endDate.clone(); + let end = end_v.add(1, 'd').startOf('day')?.utc().format(date_fmt); + query.push({ + i: 'chiusura_procedimento_bando', + o: 'plone.app.querystring.operation.date.lessThan', //plone.app.querystring.operation.date.lessThan + v: end, + }); + } else { + let start_v = value.startDate.clone(); + let start = start_v.startOf('day')?.utc()?.format(date_fmt); + + let end_v = value.endDate.clone(); + let end = end_v.add(1, 'd').startOf('day')?.utc()?.format(date_fmt); + + query.push({ + i: 'chiusura_procedimento_bando', + o: 'plone.app.querystring.operation.date.between', + v: [start, end], + }); + } + } + }, + }, }; }; diff --git a/src/components/ItaliaTheme/Blocks/BandiSearch/Edit.jsx b/src/components/ItaliaTheme/Blocks/BandiSearch/Edit.jsx index d8f1e5071..7495a50a2 100644 --- a/src/components/ItaliaTheme/Blocks/BandiSearch/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/BandiSearch/Edit.jsx @@ -14,7 +14,7 @@ const messages = defineMessages({ }, }); -const Edit = ({ data, block, onChangeBlock, selected, pathname }) => { +const Edit = ({ data, id, block, onChangeBlock, selected, pathname }) => { const intl = useIntl(); return ( @@ -24,6 +24,7 @@ const Edit = ({ data, block, onChangeBlock, selected, pathname }) => { )}
{