Skip to content

Commit

Permalink
feat: added pre-filters in BandoSearch and updated user selection fil…
Browse files Browse the repository at this point in the history
…ters, added parameters in bando listing block (#537)
  • Loading branch information
SaraBianchi authored Feb 15, 2024
1 parent 1c917f8 commit 50a232d
Show file tree
Hide file tree
Showing 13 changed files with 265 additions and 30 deletions.
25 changes: 25 additions & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2898,6 +2898,16 @@ msgstr ""
msgid "searchBlock_help"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Questi filtri non verranno visualizzati dall'utente ma consentono di pre filtrare i bandi secondo alcuni criteri.
msgid "searchBlock_help_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Filtri pre-impostati
msgid "searchBlock_pre_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down Expand Up @@ -3218,6 +3228,11 @@ msgstr ""
msgid "share"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
msgstr ""

#: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
# defaultMessage: Mostra la data
msgid "show_date"
Expand Down Expand Up @@ -3269,6 +3284,11 @@ msgstr ""
msgid "show_map_full_width"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra le note anche per i bandi scaduti
msgid "show_note"
msgstr ""

#: config/Blocks/ListingOptions/ribbonCardTemplate
# defaultMessage: Mostra il nastro solo sulla prima card
msgid "show_only_first_ribbon"
Expand Down Expand Up @@ -3591,6 +3611,11 @@ msgstr ""
msgid "ulteriori_informazioni"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
# defaultMessage: Data di ultima modifica
msgid "ultima_modifica_bando"
msgstr ""

#: helpers/amministrazioneTrasparenteHelper
# defaultMessage: unità operativa
msgid "unita_operativa"
Expand Down
25 changes: 25 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,16 @@ msgstr ""
msgid "searchBlock_help"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Questi filtri non verranno visualizzati dall'utente ma consentono di pre filtrare i bandi secondo alcuni criteri.
msgid "searchBlock_help_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Filtri pre-impostati
msgid "searchBlock_pre_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down Expand Up @@ -3203,6 +3213,11 @@ msgstr "Arrange on 4 columns"
msgid "share"
msgstr "Share"

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
msgstr ""

#: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
# defaultMessage: Mostra la data
msgid "show_date"
Expand Down Expand Up @@ -3254,6 +3269,11 @@ msgstr ""
msgid "show_map_full_width"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra le note anche per i bandi scaduti
msgid "show_note"
msgstr ""

#: config/Blocks/ListingOptions/ribbonCardTemplate
# defaultMessage: Mostra il nastro solo sulla prima card
msgid "show_only_first_ribbon"
Expand Down Expand Up @@ -3576,6 +3596,11 @@ msgstr "Responsible office"
msgid "ulteriori_informazioni"
msgstr "Further information"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
# defaultMessage: Data di ultima modifica
msgid "ultima_modifica_bando"
msgstr ""

#: helpers/amministrazioneTrasparenteHelper
# defaultMessage: unità operativa
msgid "unita_operativa"
Expand Down
25 changes: 25 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2892,6 +2892,16 @@ msgstr "Filtro 2"
msgid "searchBlock_help"
msgstr "Seleccionar filtros de búsqueda para mostrar en bloquear."

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Questi filtri non verranno visualizzati dall'utente ma consentono di pre filtrare i bandi secondo alcuni criteri.
msgid "searchBlock_help_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Filtri pre-impostati
msgid "searchBlock_pre_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down Expand Up @@ -3212,6 +3222,11 @@ msgstr "Organizar en 4 columnas"
msgid "share"
msgstr "Compartir"

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
msgstr ""

#: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
# defaultMessage: Mostra la data
msgid "show_date"
Expand Down Expand Up @@ -3263,6 +3278,11 @@ msgstr "Mostrar el título de la imagen."
msgid "show_map_full_width"
msgstr "Mostrar el mapa en ancho completo"

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra le note anche per i bandi scaduti
msgid "show_note"
msgstr ""

#: config/Blocks/ListingOptions/ribbonCardTemplate
# defaultMessage: Mostra il nastro solo sulla prima card
msgid "show_only_first_ribbon"
Expand Down Expand Up @@ -3585,6 +3605,11 @@ msgstr "Oficina responsable"
msgid "ulteriori_informazioni"
msgstr "Más información"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
# defaultMessage: Data di ultima modifica
msgid "ultima_modifica_bando"
msgstr ""

#: helpers/amministrazioneTrasparenteHelper
# defaultMessage: unità operativa
msgid "unita_operativa"
Expand Down
25 changes: 25 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,16 @@ msgstr ""
msgid "searchBlock_help"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Questi filtri non verranno visualizzati dall'utente ma consentono di pre filtrare i bandi secondo alcuni criteri.
msgid "searchBlock_help_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Filtri pre-impostati
msgid "searchBlock_pre_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down Expand Up @@ -3220,6 +3230,11 @@ msgstr "Disposer sur 4 colonnes"
msgid "share"
msgstr "Partager"

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
msgstr ""

#: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
# defaultMessage: Mostra la data
msgid "show_date"
Expand Down Expand Up @@ -3271,6 +3286,11 @@ msgstr ""
msgid "show_map_full_width"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra le note anche per i bandi scaduti
msgid "show_note"
msgstr ""

#: config/Blocks/ListingOptions/ribbonCardTemplate
# defaultMessage: Mostra il nastro solo sulla prima card
msgid "show_only_first_ribbon"
Expand Down Expand Up @@ -3593,6 +3613,11 @@ msgstr "Bureau responsable"
msgid "ulteriori_informazioni"
msgstr "Informations complémentaires"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
# defaultMessage: Data di ultima modifica
msgid "ultima_modifica_bando"
msgstr ""

#: helpers/amministrazioneTrasparenteHelper
# defaultMessage: unità operativa
msgid "unita_operativa"
Expand Down
25 changes: 25 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,16 @@ msgstr ""
msgid "searchBlock_help"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Questi filtri non verranno visualizzati dall'utente ma consentono di pre filtrare i bandi secondo alcuni criteri.
msgid "searchBlock_help_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Filtri pre-impostati
msgid "searchBlock_pre_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down Expand Up @@ -3203,6 +3213,11 @@ msgstr "Disponi su 4 colonne"
msgid "share"
msgstr "Condividi"

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
msgstr ""

#: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
# defaultMessage: Mostra la data
msgid "show_date"
Expand Down Expand Up @@ -3254,6 +3269,11 @@ msgstr ""
msgid "show_map_full_width"
msgstr "Mostra la mappa a tutta larghezza"

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra le note anche per i bandi scaduti
msgid "show_note"
msgstr ""

#: config/Blocks/ListingOptions/ribbonCardTemplate
# defaultMessage: Mostra il nastro solo sulla prima card
msgid "show_only_first_ribbon"
Expand Down Expand Up @@ -3576,6 +3596,11 @@ msgstr "Ufficio responsabile"
msgid "ulteriori_informazioni"
msgstr "Ulteriori informazioni"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
# defaultMessage: Data di ultima modifica
msgid "ultima_modifica_bando"
msgstr ""

#: helpers/amministrazioneTrasparenteHelper
# defaultMessage: unità operativa
msgid "unita_operativa"
Expand Down
27 changes: 26 additions & 1 deletion locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-01-16T14:29:53.874Z\n"
"POT-Creation-Date: 2024-02-07T17:28:21.593Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -2885,6 +2885,16 @@ msgstr ""
msgid "searchBlock_help"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Questi filtri non verranno visualizzati dall'utente ma consentono di pre filtrare i bandi secondo alcuni criteri.
msgid "searchBlock_help_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
# defaultMessage: Filtri pre-impostati
msgid "searchBlock_pre_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down Expand Up @@ -3205,6 +3215,11 @@ msgstr ""
msgid "share"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
msgstr ""

#: components/ItaliaTheme/Blocks/HighlightedContent/Sidebar
# defaultMessage: Mostra la data
msgid "show_date"
Expand Down Expand Up @@ -3256,6 +3271,11 @@ msgstr ""
msgid "show_map_full_width"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra le note anche per i bandi scaduti
msgid "show_note"
msgstr ""

#: config/Blocks/ListingOptions/ribbonCardTemplate
# defaultMessage: Mostra il nastro solo sulla prima card
msgid "show_only_first_ribbon"
Expand Down Expand Up @@ -3578,6 +3598,11 @@ msgstr ""
msgid "ulteriori_informazioni"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
# defaultMessage: Data di ultima modifica
msgid "ultima_modifica_bando"
msgstr ""

#: helpers/amministrazioneTrasparenteHelper
# defaultMessage: unità operativa
msgid "unita_operativa"
Expand Down
16 changes: 12 additions & 4 deletions src/actions/getSearchBandiFilters.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
export const GET_SEARCH_BANDI_FILTERS = 'GET_SEARCH_BANDI_FILTERS';
import { expandToBackendURL } from '@plone/volto/helpers';

/**
* Get search bandi filters.
* @function getSearchBandiFilters
* @returns {Object} Get search bandi filters action.
*/
* @returns {Object} Get search bandi filters action:
* {
* offices: [],
* subjects: [],
* tipologie: [],
* }
*/

export function getSearchBandiFilters(path = '') {
let p = path === '/' ? '' : path;
// let p = path === '/' ? '' : path;
const pathSearchFilters = `${path === '/' ? '' : expandToBackendURL(path)}/@bandi-search-filters`;
return {
type: GET_SEARCH_BANDI_FILTERS,
request: {
op: 'get',
path: p + '/@bandi-search-filters',
path: pathSearchFilters,
},
};
}
7 changes: 6 additions & 1 deletion src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => {
}
});

if (data.defaultQuerystring) {
query.push(...data.defaultQuerystring.filter(el => el.i !== 'portal_type'));
}

if (data.location && data.location[0]) {
query.push({
i: 'path',
Expand Down Expand Up @@ -125,7 +129,8 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => {
return newState;
};

const filtersConfig = FiltersConfig(null);
const pathSearch = data?.location?.length > 0 ? data.location[0]['@id'] : '/';
const filtersConfig = FiltersConfig(null, pathSearch);
const getInitialState = () => {
return {
filterOne: filtersConfig[data?.filter_one],
Expand Down
Loading

0 comments on commit 50a232d

Please sign in to comment.