diff --git a/app/components/procedure/instructeurs_options_component/instructeurs_options_component.html.haml b/app/components/procedure/instructeurs_options_component/instructeurs_options_component.html.haml
index e4084a801..36f8d1665 100644
--- a/app/components/procedure/instructeurs_options_component/instructeurs_options_component.html.haml
+++ b/app/components/procedure/instructeurs_options_component/instructeurs_options_component.html.haml
@@ -55,14 +55,14 @@
url: wizard_admin_procedure_groupe_instructeurs_path(@procedure) do |f|
%h1 Configuration du routage
- %h2 Choix du type de routage
+ %h2 Choix du type de configuration
.card.fr-pb-0{ data: { 'action': "click->enable-submit-if-checked#click" } }
- %p.fr-mb-0 Routage
+ %p.fr-mb-0 Configuration
= render Dsfr::RadioButtonListComponent.new(form: f,
target: :state,
- buttons: [ { label: 'À partir d’un champ', value: 'routage_simple', hint: 'crée les groupes en fonction d’un champ du formulaire' } ,
- { label: 'Avancé', value: 'custom_routing', hint: 'libre à vous de créer et de configurer les groupes' }])
+ buttons: [ { label: 'Automatique', value: 'routage_simple', hint: 'crée les groupes automatiquement à partir des valeurs possibles d’un champ du formulaire usager' } ,
+ { label: 'Manuelle', value: 'custom_routing', hint: 'libre à vous de créer et de configurer les groupes en utilisant les champs « routables » du formulaire usager' }])
%ul.fr-btns-group.fr-btns-group--inline-sm
diff --git a/app/models/logic/champ_value.rb b/app/models/logic/champ_value.rb
index b63972089..1d9c9858e 100644
--- a/app/models/logic/champ_value.rb
+++ b/app/models/logic/champ_value.rb
@@ -8,11 +8,11 @@ class Logic::ChampValue < Logic::Term
:decimal_number,
:drop_down_list,
:multiple_drop_down_list,
+ :address,
:communes,
:epci,
:departements,
:regions,
- :address,
:pays
)
diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb
index 0403ac864..b380dc9fe 100644
--- a/app/models/type_de_champ.rb
+++ b/app/models/type_de_champ.rb
@@ -529,6 +529,18 @@ class TypeDeChamp < ApplicationRecord
.map { |_, v| v.map { "« #{I18n.t(_1, scope: [:activerecord, :attributes, :type_de_champ, :type_champs])} »" } }
end
+ def self.humanized_simple_routable_types_by_category
+ Logic::ChampValue::MANAGED_TYPE_DE_CHAMP_BY_CATEGORY
+ .map { |_, v| v.filter_map { "« #{I18n.t(_1, scope: [:activerecord, :attributes, :type_de_champ, :type_champs])} »" if _1.to_s.in?(SIMPLE_ROUTABLE_TYPES) } }
+ .reject(&:empty?)
+ end
+
+ def self.humanized_custom_routable_types_by_category
+ Logic::ChampValue::MANAGED_TYPE_DE_CHAMP_BY_CATEGORY
+ .map { |_, v| v.filter_map { "« #{I18n.t(_1, scope: [:activerecord, :attributes, :type_de_champ, :type_champs])} »" if !_1.to_s.in?(SIMPLE_ROUTABLE_TYPES) } }
+ .reject(&:empty?)
+ end
+
def invalid_regexp?
self.errors.delete(:expression_reguliere)
self.errors.delete(:expression_reguliere_exemple_text)
diff --git a/app/views/administrateurs/groupe_instructeurs/_custom_routing_modal.html.haml b/app/views/administrateurs/groupe_instructeurs/_custom_routing_modal.html.haml
index cc503f514..4f14875e0 100644
--- a/app/views/administrateurs/groupe_instructeurs/_custom_routing_modal.html.haml
+++ b/app/views/administrateurs/groupe_instructeurs/_custom_routing_modal.html.haml
@@ -8,7 +8,7 @@
.fr-modal__content
%h1#fr-modal-title-modal-1.fr-modal__title
%span.fr-icon-arrow-right-line.fr-icon--lg
- Routage avancé
+ Configuration manuelle du routage
.fr-alert.fr-alert--success
%h2.fr-alert__title
Deux groupes par défaut ont été créés
diff --git a/app/views/administrateurs/groupe_instructeurs/_simple_routing_modal.html.haml b/app/views/administrateurs/groupe_instructeurs/_simple_routing_modal.html.haml
index d652983a9..ff817b750 100644
--- a/app/views/administrateurs/groupe_instructeurs/_simple_routing_modal.html.haml
+++ b/app/views/administrateurs/groupe_instructeurs/_simple_routing_modal.html.haml
@@ -8,7 +8,7 @@
.fr-modal__content
%h1#fr-modal-title-modal-1.fr-modal__title
%span.fr-icon-arrow-right-line.fr-icon--lg
- Routage à partir d’un champ
+ Configuration automatique du routage
.fr-alert.fr-alert--success
%h2.fr-alert__title
Les groupes instructeurs ont été créés à partir du champ « #{procedure.routing_champs.first} »
diff --git a/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml b/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml
index 3fb90b18b..de4deae6a 100644
--- a/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml
+++ b/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml
@@ -2,7 +2,7 @@
locals: { steps: [[t('.procedures'), admin_procedures_path],
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
['Groupes', admin_procedure_groupe_instructeurs_path(@procedure)],
- ['Routage à partir d’un champ']] }
+ ['Configuration automatique du routage']] }
.container
.fr-grid-row
@@ -16,14 +16,21 @@
.fr-col
- content_for(:title, 'Routage')
%h1 Configuration du routage
- %h2 Routage à partir d’un champ
+ %h2 Configuration automatique
.fr-alert.fr-alert--info.fr-mb-3w{ aria: { hidden: true } }
%p
- Vous trouverez ci-dessous une suggestion (non exhaustive) de champs issus de votre formulaire. Les groupes d’instructeurs seront créés sur la base du champ que vous aurez sélectionné.
- %br
- Vous pourrez ensuite affiner votre routage en ajoutant des groupes sur la base de l’ensemble des champs « routables » de votre formulaire, soit des champs de type :
+ Vous trouverez ci-dessous une liste de champs de votre formulaire à partir desquels configurer le routage de façon automatique. Les groupes d’instructeurs seront créés à partir des valeurs possibles du champ.
+ Seuls les champs suivants sont ouverts à ce mode de configuration :
%ul
- - TypeDeChamp.humanized_conditionable_types_by_category.each do |category|
+ - TypeDeChamp.humanized_simple_routable_types_by_category.each do |category|
+ %li
+ = category.join(', ')
+
+ %p
+ Si besoin, vous pourrez ensuite affiner votre configuration de façon manuelle, également à partir des champs suivants :
+
+ %ul
+ - TypeDeChamp.humanized_custom_routable_types_by_category.each do |category|
%li
= category.join(', ')
diff --git a/spec/controllers/administrateurs/groupe_instructeurs_controller_spec.rb b/spec/controllers/administrateurs/groupe_instructeurs_controller_spec.rb
index 37c55a6d5..84db0d18f 100644
--- a/spec/controllers/administrateurs/groupe_instructeurs_controller_spec.rb
+++ b/spec/controllers/administrateurs/groupe_instructeurs_controller_spec.rb
@@ -879,7 +879,7 @@ describe Administrateurs::GroupeInstructeursController, type: :controller do
it do
expect(response).to have_http_status(:ok)
- expect(response.body).to include('Choix du type de routage')
+ expect(response.body).to include('Choix du type de configuration')
expect(procedure.reload.routing_enabled).to be_falsey
end
end
diff --git a/spec/models/type_de_champ_spec.rb b/spec/models/type_de_champ_spec.rb
index 3210d5465..b8d4e44f3 100644
--- a/spec/models/type_de_champ_spec.rb
+++ b/spec/models/type_de_champ_spec.rb
@@ -462,6 +462,6 @@ describe TypeDeChamp do
describe '#humanized_conditionable_types_by_category' do
subject { TypeDeChamp.humanized_conditionable_types_by_category }
- it { is_expected.to eq([["« Oui/Non »", "« Case à cocher seule »", "« Choix simple »", "« Choix multiple »"], ["« Nombre entier »", "« Nombre décimal »"], ["« Communes »", "« EPCI »", "« Départements »", "« Régions »", "« Adresse »", "« Pays »"]]) }
+ it { is_expected.to eq([["« Oui/Non »", "« Case à cocher seule »", "« Choix simple »", "« Choix multiple »"], ["« Nombre entier »", "« Nombre décimal »"], ["« Adresse »", "« Communes »", "« EPCI »", "« Départements »", "« Régions »", "« Pays »"]]) }
end
end
diff --git a/spec/system/routing/rules_full_scenario_spec.rb b/spec/system/routing/rules_full_scenario_spec.rb
index 094a284a7..682f7ed10 100644
--- a/spec/system/routing/rules_full_scenario_spec.rb
+++ b/spec/system/routing/rules_full_scenario_spec.rb
@@ -18,13 +18,13 @@ describe 'The routing with rules', js: true do
procedure.defaut_groupe_instructeur.instructeurs << administrateur.instructeur
end
- scenario 'Routage à partir d’un champ' do
+ scenario 'Configuration automatique du routage' do
steps_to_routing_configuration
- choose('À partir d’un champ', allow_label_click: true)
+ choose('Automatique', allow_label_click: true)
click_on 'Continuer'
- expect(page).to have_text('Routage à partir d’un champ')
+ expect(page).to have_text('Configuration automatique')
choose('Spécialité', allow_label_click: true)
click_on 'Créer les groupes'
@@ -46,10 +46,10 @@ describe 'The routing with rules', js: true do
expect(page).to have_select("groupe_instructeur[condition_form][rows][][value]", selected: "scientifique")
end
- scenario 'Routage avancé' do
+ scenario 'Configuration manuelle du routage' do
steps_to_routing_configuration
- choose('Avancé', allow_label_click: true)
+ choose('Manuelle', allow_label_click: true)
click_on 'Continuer'
expect(page).to have_text('Gestion des groupes')
@@ -333,6 +333,6 @@ describe 'The routing with rules', js: true do
click_on 'Options'
expect(page).to have_text('Options concernant l’instruction')
click_on 'Configurer le routage'
- expect(page).to have_text('Choix du type de routage')
+ expect(page).to have_text('Choix du type de configuration')
end
end