From ca8a3732f5cb02b897730d65cbc5d033d042369e Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Fri, 7 Jul 2023 11:05:00 +0200 Subject: [PATCH] feat(DossierAssignment): add warning when dossier is reaffected --- .../champs_rows_show_component.html.haml | 2 ++ app/models/champ.rb | 1 + app/views/shared/champs/drop_down_list/_show.html.haml | 6 ++++++ 3 files changed, 9 insertions(+) create mode 100644 app/views/shared/champs/drop_down_list/_show.html.haml diff --git a/app/components/dossiers/champs_rows_show_component/champs_rows_show_component.html.haml b/app/components/dossiers/champs_rows_show_component/champs_rows_show_component.html.haml index 3e9523527..3dbe36494 100644 --- a/app/components/dossiers/champs_rows_show_component/champs_rows_show_component.html.haml +++ b/app/components/dossiers/champs_rows_show_component/champs_rows_show_component.html.haml @@ -18,6 +18,8 @@ = render partial: "shared/champs/carte/show", locals: { champ: champ } - when TypeDeChamp.type_champs.fetch(:dossier_link) = render partial: "shared/champs/dossier_link/show", locals: { champ: champ } + - when TypeDeChamp.type_champs.fetch(:drop_down_list) + = render partial: "shared/champs/drop_down_list/show", locals: { champ: champ } - when TypeDeChamp.type_champs.fetch(:multiple_drop_down_list) = render partial: "shared/champs/multiple_drop_down_list/show", locals: { champ: champ } - when TypeDeChamp.type_champs.fetch(:piece_justificative), TypeDeChamp.type_champs.fetch(:titre_identite) diff --git a/app/models/champ.rb b/app/models/champ.rb index 81b0f2864..a2c603a27 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -84,6 +84,7 @@ class Champ < ApplicationRecord delegate :to_typed_id, :to_typed_id_for_query, to: :type_de_champ, prefix: true delegate :revision, to: :dossier, prefix: true + delegate :used_by_routing_rules?, to: :type_de_champ scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) } scope :public_only, -> { where(private: false) } diff --git a/app/views/shared/champs/drop_down_list/_show.html.haml b/app/views/shared/champs/drop_down_list/_show.html.haml new file mode 100644 index 000000000..abd661d24 --- /dev/null +++ b/app/views/shared/champs/drop_down_list/_show.html.haml @@ -0,0 +1,6 @@ +- if champ.used_by_routing_rules? && champ.dossier.forced_groupe_instructeur + %p + %span= champ.value + %span.fr-badge.fr-badge--warning.fr-badge--sm dossier réaffecté au groupe « #{champ.dossier.groupe_instructeur.label} » +- else + %p= champ.value