diff --git a/app/controllers/new_administrateur/types_de_champ_controller.rb b/app/controllers/new_administrateur/types_de_champ_controller.rb
index 4d4e1685c..f81298751 100644
--- a/app/controllers/new_administrateur/types_de_champ_controller.rb
+++ b/app/controllers/new_administrateur/types_de_champ_controller.rb
@@ -57,6 +57,8 @@ module NewAdministrateur
],
methods: [
:drop_down_list_value,
+ :drop_down_secondary_libelle,
+ :drop_down_secondary_description,
:piece_justificative_template_filename,
:piece_justificative_template_url,
:editable_options
@@ -73,6 +75,8 @@ module NewAdministrateur
:parent_id,
:private,
:drop_down_list_value,
+ :drop_down_secondary_libelle,
+ :drop_down_secondary_description,
:piece_justificative_template,
editable_options: [
:cadastres,
@@ -94,6 +98,8 @@ module NewAdministrateur
:description,
:mandatory,
:drop_down_list_value,
+ :drop_down_secondary_libelle,
+ :drop_down_secondary_description,
:piece_justificative_template,
editable_options: [
:cadastres,
diff --git a/app/javascript/components/TypesDeChampEditor/components/TypeDeChamp.jsx b/app/javascript/components/TypesDeChampEditor/components/TypeDeChamp.jsx
index 00ce93494..5679ebedf 100644
--- a/app/javascript/components/TypesDeChampEditor/components/TypeDeChamp.jsx
+++ b/app/javascript/components/TypesDeChampEditor/components/TypeDeChamp.jsx
@@ -14,6 +14,7 @@ import TypeDeChampDropDownOptions from './TypeDeChampDropDownOptions';
import TypeDeChampPieceJustificative from './TypeDeChampPieceJustificative';
import TypeDeChampRepetitionOptions from './TypeDeChampRepetitionOptions';
import TypeDeChampTypesSelect from './TypeDeChampTypesSelect';
+import TypeDeChampDropDownSecondary from './TypeDeChampDropDownSecondary';
const TypeDeChamp = sortableElement(
({ typeDeChamp, dispatch, idx: index, isFirstItem, isLastItem, state }) => {
@@ -22,6 +23,7 @@ const TypeDeChamp = sortableElement(
'multiple_drop_down_list',
'linked_drop_down_list'
].includes(typeDeChamp.type_champ);
+ const isLinkedDropDown = typeDeChamp.type_champ === 'linked_drop_down_list';
const isFile = typeDeChamp.type_champ === 'piece_justificative';
const isCarte = typeDeChamp.type_champ === 'carte';
const isExplication = typeDeChamp.type_champ === 'explication';
@@ -130,6 +132,11 @@ const TypeDeChamp = sortableElement(
isVisible={isDropDown}
handler={updateHandlers.drop_down_list_value}
/>
+
+
+
+
+
+
+ );
+ }
+ return null;
+}
+
+TypeDeChampDropDownSecondary.propTypes = {
+ isVisible: PropTypes.bool,
+ libelleHandler: PropTypes.object,
+ descriptionHandler: PropTypes.object
+};
diff --git a/app/models/champ.rb b/app/models/champ.rb
index 5f7f66e44..131cbe976 100644
--- a/app/models/champ.rb
+++ b/app/models/champ.rb
@@ -41,6 +41,8 @@ class Champ < ApplicationRecord
:drop_down_list_options?,
:drop_down_list_disabled_options,
:drop_down_list_enabled_non_empty_options,
+ :drop_down_secondary_libelle,
+ :drop_down_secondary_description,
:exclude_from_export?,
:exclude_from_view?,
:repetition?,
diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb
index dcf5b096d..97b329b7b 100644
--- a/app/models/type_de_champ.rb
+++ b/app/models/type_de_champ.rb
@@ -58,7 +58,7 @@ class TypeDeChamp < ApplicationRecord
belongs_to :parent, class_name: 'TypeDeChamp', optional: true
has_many :types_de_champ, -> { ordered }, foreign_key: :parent_id, class_name: 'TypeDeChamp', inverse_of: :parent, dependent: :destroy
- store_accessor :options, :cadastres, :old_pj, :drop_down_options, :skip_pj_validation, :skip_content_type_pj_validation
+ store_accessor :options, :cadastres, :old_pj, :drop_down_options, :skip_pj_validation, :skip_content_type_pj_validation, :drop_down_secondary_libelle, :drop_down_secondary_description
has_many :revision_types_de_champ, class_name: 'ProcedureRevisionTypeDeChamp', dependent: :destroy, inverse_of: :type_de_champ
has_many :revisions, through: :revision_types_de_champ
@@ -333,7 +333,9 @@ class TypeDeChamp < ApplicationRecord
:drop_down_list_value,
:piece_justificative_template_filename,
:piece_justificative_template_url,
- :editable_options
+ :editable_options,
+ :drop_down_secondary_libelle,
+ :drop_down_secondary_description
]
}
TYPES_DE_CHAMP = TYPES_DE_CHAMP_BASE
diff --git a/app/views/shared/dossiers/editable_champs/_linked_drop_down_list.html.haml b/app/views/shared/dossiers/editable_champs/_linked_drop_down_list.html.haml
index 8f1a154e4..0f88b773e 100644
--- a/app/views/shared/dossiers/editable_champs/_linked_drop_down_list.html.haml
+++ b/app/views/shared/dossiers/editable_champs/_linked_drop_down_list.html.haml
@@ -4,10 +4,12 @@
{ required: champ.mandatory? },
{ data: { secondary_options: champ.secondary_options } }
%span
- = form.label :secondary_value, class: 'hidden' do
- Valeur secondaire dépendant de la première
+ = form.label :secondary_value do
+ = champ.drop_down_secondary_libelle.presence || "Valeur secondaire dépendant de la première"
- if champ.mandatory?
%span.mandatory *
+ - if champ.drop_down_secondary_description.present?
+ .notice= string_to_html(champ.drop_down_secondary_description)
= form.select :secondary_value,
champ.secondary_options[champ.primary_value],
{ required: champ.mandatory? },