diff --git a/app/javascript/components/ComboCommunesSearch.js b/app/javascript/components/ComboCommunesSearch.js new file mode 100644 index 000000000..56d43ffee --- /dev/null +++ b/app/javascript/components/ComboCommunesSearch.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { ReactQueryCacheProvider } from 'react-query'; + +import ComboSearch from './ComboSearch'; +import { queryCache } from './shared/queryCache'; + +function ComboCommunesSearch(params) { + return ( + + [ + code, + `${nom} (${codesPostaux[0]})` + ]} + /> + + ); +} + +export default ComboCommunesSearch; diff --git a/app/javascript/loaders/ComboCommunesSearch.js b/app/javascript/loaders/ComboCommunesSearch.js new file mode 100644 index 000000000..7689f27f7 --- /dev/null +++ b/app/javascript/loaders/ComboCommunesSearch.js @@ -0,0 +1,3 @@ +import Loadable from '../components/Loadable'; + +export default Loadable(() => import('../components/ComboCommunesSearch')); diff --git a/app/views/shared/dossiers/editable_champs/_communes.html.haml b/app/views/shared/dossiers/editable_champs/_communes.html.haml index 0087a725e..394aeb460 100644 --- a/app/views/shared/dossiers/editable_champs/_communes.html.haml +++ b/app/views/shared/dossiers/editable_champs/_communes.html.haml @@ -1,4 +1,3 @@ -= form.select :value, [champ.value].compact, - { include_blank: true }, - required: champ.mandatory?, - class: 'select2 communes' +- hidden_field_id = SecureRandom.uuid += form.hidden_field :value, { data: { uuid: hidden_field_id } } += react_component("ComboCommunesSearch", mandatory: champ.mandatory?, hiddenFieldId: hidden_field_id)