Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETQ admin j'ai une nouvelle interface de configuration d'un groupe instructeur #11285

Merged
merged 12 commits into from
Feb 11, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
method: :patch,
data: { turbo: true, controller: 'autosave' },
class: 'form width-100' do
.conditionnel.mt-2.width-100
.conditionnel.width-100
.flex
- if @groupe_instructeur.invalid_rule?
%p.fr-mb-1w.fr-badge.fr-badge--warning.fr-badge--sm règle invalide
Expand All @@ -12,7 +12,7 @@

= render Conditions::ConditionsErrorsComponent.new(conditions: condition_per_row, source_tdcs: @source_tdcs)

%table.condition-table.mt-2
%table.condition-table
%thead
%tr
%th.far-left
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- content_for(:title, 'Groupes')
%h1 Gestion des groupes
%h1.fr-h2 Gestion des groupes

= render Procedure::ImportComponent.new(procedure: @procedure)

Expand All @@ -17,38 +17,41 @@
Exporter la liste (.csv)

.fr-table.fr-table--no-caption.fr-table--layout-fixed.fr-mt-2w
%table
%caption= table_header
%thead
%tr
%th{ colspan: 4 }
Groupes
%th{ colspan: 1 }
Dossiers
%th{ colspan: 1 }
Instructeurs
%tbody
- @groupe_instructeurs.each do |gi|
%tr
%td{ colspan: 4 }
= link_to admin_procedure_groupe_instructeur_path(@procedure, gi), class: 'fr-link' do
%span= gi.label
- if gi.closed
%p.fr-badge.fr-badge--info.fr-badge--sm.fr-ml-1w inactif
- elsif gi.invalid_rule?
%p.fr-badge.fr-badge--warning.fr-badge--sm.fr-ml-1w règle invalide
- elsif gi.non_unique_rule?
%p.fr-badge.fr-badge--warning.fr-badge--sm.fr-ml-1w règle déjà attribuée à #{gi.groups_with_same_rule}
%p= gi.routing_rule&.to_s(@procedure.active_revision.types_de_champ)
.fr-table__wrapper
.fr-table__container
.fr-table__content
%table
%caption= table_header
%thead
%tr
%th.fr-col-9{ scope: 'col' }
Groupes
%th.fr-col-1{ scope: 'col' }
Dossiers
%th.fr-col-2.fr-cell--right{ scope: 'col' }
Instructeurs
%tbody
- @groupe_instructeurs.each do |gi|
%tr
%td.fr-col-9{ scope: 'col' }
= link_to admin_procedure_groupe_instructeur_path(@procedure, gi), class: 'fr-link' do
%span= gi.label
- if gi.closed
%p.fr-badge.fr-badge--info.fr-badge--sm.fr-ml-1w inactif
- elsif gi.invalid_rule?
%p.fr-badge.fr-badge--warning.fr-badge--sm.fr-ml-1w règle invalide
- elsif gi.non_unique_rule?
%p.fr-badge.fr-badge--warning.fr-badge--sm.fr-ml-1w règle déjà attribuée à #{gi.groups_with_same_rule}
%p= gi.routing_rule&.to_s(@procedure.active_revision.types_de_champ)

%td{ colspan: 1 }
%span.fr-mr-1w
#{gi.dossiers.visible_by_administration.size}
%span.fr-icon.fr-icon-folder-2-line.fr-mr-2w{ style: 'width: 25px; text-align: center;' }
%td{ colspan: 1 }
%span.fr-mr-1w
#{gi.instructeurs.count}
%span.fr-icon.fr-icon-user-line{ style: 'width: 25px; text-align: center;' }
%td.fr-col-1{ scope: 'col' }
%span.fr-mr-1w
#{gi.dossiers.visible_by_administration.size}
%span.fr-icon.fr-icon-folder-2-line.fr-mr-2w{ style: 'width: 25px; text-align: center;' }
%td.fr-col-2.fr-cell--right{ scope: 'col' }
%span.fr-mr-1w
#{gi.instructeurs.count}
%span.fr-icon.fr-icon-user-line{ style: 'width: 25px; text-align: center;' }

.fr-mt-1w
= paginate @groupe_instructeurs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- content_for(:title, 'Options')
- if @state.nil?
%h1 Options concernant l’instruction
%h1.fr-h2 Options concernant l’instruction

%ul.fr-toggle__list
%li
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ fr:
select: Sélectionner
move_files_confirmation: Réaffecter les dossiers à un autre groupe afin de pouvoir le supprimer
move_files:
zero: Déplacer les dossiers en brouillon
one: Déplacer un dossier
other: Déplacer les %{count} dossiers
zero: Réaffecter les dossiers en brouillon
one: Réaffecter le dossier
other: Réaffecter les %{count} dossiers
number_of_files:
zero: Aucun dossier n’est actuellement affecté à ce groupe.
one: "%{count} dossier est actuellement affecté à ce groupe."
other: "%{count} dossiers sont actuellement affectés à ce groupe."
delete: Supprimer le groupe
delete_confirmation: Êtes-vous sûr de vouloir supprimer le groupe "%{group_name}" ?
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
%div{ id: dom_id(@groupe_instructeur, :routing) }
%h1 Paramètres du groupe
%h1.fr-h2 Configuration du groupe « #{@groupe_instructeur.label} »
%h2.fr-h3 Paramètres du groupe

= render Procedure::ImportComponent.new(procedure: @procedure)
.card
= form_for @groupe_instructeur,
url: admin_procedure_groupe_instructeur_path(@procedure, @groupe_instructeur),
method: :patch do |f|
= f.label :label, 'Nom du groupe', class: 'fr-label fr-mb-1w'
.flex
= f.text_field :label, required: true, class: 'fr-input flex auto fr-mr-2w'
= f.button 'Renommer', class: 'fr-btn fr-btn--tertiary'

= form_for @groupe_instructeur,
url: admin_procedure_groupe_instructeur_path(@procedure, @groupe_instructeur),
method: :patch do |f|
= f.label :label, 'Nom du groupe', class: 'fr-label fr-mb-1w'
.flex
= f.text_field :label, required: true, class: 'fr-input flex auto fr-mr-2w'
= f.button 'Renommer', class: 'fr-btn fr-btn--secondary'

= form_for @groupe_instructeur,
url: admin_procedure_groupe_instructeur_update_state_path(@procedure, @groupe_instructeur),
method: :patch,
data: { turbo: true, controller: 'autosubmit' } do |f|
.fr-checkbox-group.fr-my-3w
= f.check_box :closed, { id: 'closed', "aria-describedby" => "closed-messages", :name => "closed" }
%label.fr-label{ :for => "closed" }
Groupe inactif
%span.fr-hint-text Si cette option est activée, les usagers ne pourront plus sélectionner ce groupe d’instructeurs

= render Conditions::RoutingRulesComponent.new(groupe_instructeur: @groupe_instructeur)

.fr-hint-text.mt-2.mb-2
%span Si vous ne trouvez pas l'option correspondant à votre groupe, veuillez l'ajouter dans le
%span
= link_to 'champ concerné', champs_admin_procedure_path(@procedure)

.flex.fr-btns-group--sm.fr-btns-group--inline.fr-btns-group--icon-right.mb-2
= form_for @groupe_instructeur,
url: admin_procedure_groupe_instructeur_update_state_path(@procedure, @groupe_instructeur),
method: :patch,
data: { turbo: true, controller: 'autosubmit' } do |f|
.fr-checkbox-group.fr-my-3w
= f.check_box :closed, { id: 'closed', "aria-describedby" => "closed-messages", :name => "closed" }
%label.fr-label{ :for => "closed" }
Groupe inactif
%span.fr-hint-text Si cette option est activée, les dossiers ne seront pas routés dans ce groupe si les usagers sélectionnent ce choix.
- if @groupe_instructeur.can_delete?
%p= t('.delete')
= button_to admin_procedure_groupe_instructeur_path(@procedure, @groupe_instructeur),
class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-delete-line',
class: 'fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-delete-line',
method: :delete,
data: { confirm: t('.delete_confirmation', group_name: @groupe_instructeur.label) } do
Supprimer
Supprimer ce groupe
- else
= button_to reaffecter_dossiers_admin_procedure_groupe_instructeur_path(@procedure, @groupe_instructeur),
class: 'fr-btn fr-btn--tertiary fr-icon-folder-2-line',
title: t('.move_files_confirmation'),
method: :get do
= t('.move_files', count: @groupe_instructeur.dossiers.visible_by_administration.size)
%em Vous ne pouvez pas supprimer ce groupe car des dossiers lui sont affectés.

%h2.fr-h3 Dossiers affectés
.card
.flex.justify-between.align-center.fr-btns-group--sm.fr-btns-group--icon-right
%span.fr-icon.fr-icon-folder-2-line.fr-mr-2w
= t('.number_of_files', count: @groupe_instructeur.dossiers.visible_by_administration.size)
- if !@groupe_instructeur.can_delete?
= button_to reaffecter_dossiers_admin_procedure_groupe_instructeur_path(@procedure, @groupe_instructeur),
class: 'fr-btn fr-btn--tertiary fr-icon-folder-2-line',
title: t('.move_files_confirmation'),
method: :get do
= t('.move_files', count: @groupe_instructeur.dossiers.visible_by_administration.size)

%h2.fr-h3 Règle(s) de routage
.card
= render Conditions::RoutingRulesComponent.new(groupe_instructeur: @groupe_instructeur)
%p.fr-alert.fr-alert--info.fr-mt-3w{ aria: { hidden: true } }
Si vous ne trouvez pas l’option correspondant à votre groupe, veuillez l’ajouter dans le champ concerné dans la page d’édition des
= link_to('champs du formulaire',
champs_admin_procedure_path(@procedure),
**helpers.external_link_attributes)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@available_instructeur_emails = available_instructeur_emails
end

flash[:alert] = "Aucun fichier joint pour le tampon de l'attestation"
flash[:alert] = "Aucun fichier joint pour le tampon de lattestation"

Check warning on line 19 in app/controllers/concerns/groupe_instructeurs_signature_concern.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/concerns/groupe_instructeurs_signature_concern.rb#L19

Added line #L19 was not covered by tests
render :show
else
if @groupe_instructeur.signature.attach(signature_file)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
= render Attachment::EditComponent.new(attached_file: @attestation_template.logo, direct_upload: false)


%h3.fr-h5.fr-mt-5w Tampon de l'attestation
%h3.fr-h5.fr-mt-5w Tampon de lattestation
%p.fr-text--sm.fr-text-mention--grey.fr-mb-0
Dimensions conseillées : au minimum 500px de largeur ou de hauteur.
= render Attachment::EditComponent.new(attached_file: @attestation_template.signature, direct_upload: false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
%h2.fr-h3 Informations de contact
.card.mt-2
.card-title Informations de contact
- service = groupe_instructeur.contact_information
- if service.nil?
= "Le groupe #{groupe_instructeur.label} n'a pas d'informations de contact. Les informations de contact affichées à l'usager seront celles du service de la procédure"
%p.mt-3
- if groupe_instructeur.instructeurs.include?(current_administrateur.user.instructeur)
= link_to "+ Ajouter des informations de contact", new_instructeur_groupe_contact_information_path(procedure_id: procedure.id, groupe_id: groupe_instructeur.id, from_admin: true), class: "fr-btn"
- else
Si vous souhaitez créer un service pour ce groupe, vous devez faire partie du groupe instructeur
%span Le groupe
%strong= groupe_instructeur.label
%span n’a pas d’informations de contact spécifiques.
%p Les informations de contact affichées à l’usager seront celles du service porteur de la démarche.
- if groupe_instructeur.instructeurs.include?(current_administrateur.user.instructeur)
= link_to "Personnaliser les informations de contact", new_instructeur_groupe_contact_information_path(procedure_id: procedure.id, groupe_id: groupe_instructeur.id, from_admin: true), class: "fr-btn"
- else
%p Si vous souhaitez créer un service pour ce groupe, vous devez faire partie du groupe instructeur
- else
%p.mt-3
- if groupe_instructeur.instructeurs.include?(current_administrateur.user.instructeur)
= link_to "Modifier les informations de contact", edit_instructeur_groupe_contact_information_path(procedure_id: procedure.id, groupe_id: groupe_instructeur.id, from_admin: true), class: "fr-btn"
- else
Si vous souhaitez modifier ce service, vous devez faire partie du groupe instructeur
%p.mt-3= service.nom
%p= service.nom
= render SimpleFormatComponent.new(service.adresse, class_names_map: {paragraph: 'fr-footer__content-desc'})
= service.email
- if service.telephone.present?
%p= service.telephone
- if service.horaires.present?
%p= service.horaires
- if groupe_instructeur.instructeurs.include?(current_administrateur.user.instructeur)
= link_to "Modifier les informations de contact", edit_instructeur_groupe_contact_information_path(procedure_id: procedure.id, groupe_id: groupe_instructeur.id, from_admin: true), class: "fr-btn"
- else
%p Si vous souhaitez modifier ce service, vous devez faire partie du groupe instructeur
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@

%h2.fr-h3= t('.instructeur_assignation')

.card
.card-title= t('.title')
- if procedure.routing_enabled?
.fr-icon-mail-line.fr-alert.fr-mb-3w
- if @procedure.publiee?
= t(".notification_alert_publiee_html")
- else
= t(".notification_alert_html")

= render Procedure::InvitationWithTypoComponent.new(maybe_typos: @maybe_typos, url: add_instructeur_admin_procedure_groupe_instructeur_path(@procedure, groupe_instructeur.id), title: "Avant d'ajouter l'email, veuillez confirmer" )
.card-title= t('.instructeur_assignation')
= form_for :instructeur, url: { action: :add_instructeur, id: groupe_instructeur.id }, html: { class: 'form' } do |f|
.instructeur-wrapper
- if !procedure.routing_enabled?
%p= t('.instructeur_emails')
%p.fr-hint-text= t('.copy_paste_hint')
%p= t('.instructeur_emails')
%p.fr-hint-text= t('.copy_paste_hint')

- if disabled_as_super_admin
= f.select :emails, available_instructeur_emails, {}, disabled: disabled_as_super_admin, id: 'instructeur_emails'
Expand All @@ -20,32 +28,33 @@

.flex.justify-between.align-baseline
.card-title= t('.assigned_instructeur', count: instructeurs.total_count)
= button_to export_groupe_instructeurs_admin_procedure_groupe_instructeurs_path(procedure, format: :csv), method: :get, class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-download-line' do
Exporter la liste (.csv)
- if [email protected]_enabled?
= button_to export_groupe_instructeurs_admin_procedure_groupe_instructeurs_path(procedure, format: :csv), method: :get, class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-download-line' do
Exporter la liste (.csv)

.fr-table
.fr-table.fr-table--bordered.fr-table--no-caption
.fr-table__wrapper
.fr-table__container
.fr-table__content
%table
%thead
%tr
%th{ scope: 'col' }= t('.title')
%th{ scope: 'col' }= t('.actions')
%th.fr-col-11{ scope: 'col' }= t('.table_title')
%th.fr-col-1.fr-cell--center{ scope: 'col' }= t('.actions')
%tbody
- instructeurs.each do |instructeur|
%tr
%td
%td.fr-col-11{ scope: 'col' }
= dsfr_icon('fr-icon-user-line')
#{instructeur.email}

- confirmation_message = procedure.routing_enabled? ? "Êtes-vous sûr de vouloir retirer l’instructeur « #{instructeur.email} » du groupe « #{groupe_instructeur.label} » ?" : "Êtes-vous sûr de vouloir retirer l’instructeur « #{instructeur.email} » de la démarche ?"
%td.actions= button_to t('.remove'),
%td.fr-col-1.fr-cell--center.actions{ scope: 'col' }= button_to t('.remove'),
{ action: :remove_instructeur, id: groupe_instructeur.id },
{ method: :delete,
data: { confirm: confirmation_message },
params: { instructeur: { id: instructeur.id }},
class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-subtract-line' }
class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-subtract-line fr-cell---right' }

.fr-table__footer
.fr-table__footer--start
Expand Down
12 changes: 7 additions & 5 deletions app/views/shared/groupe_instructeurs/_signature_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
%h2.fr-h3 Tampon de l’attestation d’acceptation
.card.mt-2
%h2.fr-h3 Tampon de l'attestation
= render NestedForms::FormOwnerComponent.new
= form_with url: { action: :add_signature }, method: :post, html: { multipart: true } do |f|
%p.fr-text--sm.fr-text-mention--grey
Vous pouvez apposer sur l’attestation un tampon (ou signature) dédié à ce groupe d’instructeurs.
%p
Vous pouvez apposer sur l’attestation d’acceptation du dossier un tampon (ou signature) dédié à ce groupe d’instructeurs.
Si vous n’en fournissez pas, celui de la démarche sera utilisé, le cas échéant.

.fr-upload-group.fr-mb-4w
%p.fr-text--sm.fr-text-mention--grey.fr-mb-1w
.fr-upload-group.fr-mb-2w
.card-title
Tampon
.fr-hint-text
Dimensions conseillées : au minimum 500px de largeur ou de hauteur.
= render Attachment::EditComponent.new(attached_file: groupe_instructeur.signature, direct_upload: false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ en:
one: "%{count} group exist"
other: "%{count} groups exist"
instructeurs:
title: Instructors
title: Assign a new instructor
assigned_instructeur:
one: "%{count} instructor assigned"
other: "%{count} instructors assigned"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ fr:
one: "%{count} groupe existe"
other: "%{count} groupes existent"
instructeurs:
title: Instructeurs
title: Affecter un nouvel instructeur
table_title: Instructeurs
assigned_instructeur:
one: "%{count} instructeur affecté"
other: "%{count} instructeurs affectés"
instructeur_assignation: Affectation des instructeurs
assign: Affecter
remove: Retirer
instructeur_emails: Adresse électronique des instructeurs que vous souhaitez affecter à cette démarche
instructeur_emails: Adresse(s) électronique(s)
copy_paste_hint: "Vous pouvez saisir les adresses individuellement, ou bien copier-coller dans le champ ci-dessous une liste d’adresses séparées par des points-virgules (exemple : [email protected]; [email protected]; [email protected])."
actions: Retirer
actions: Action
notification_alert_html: Même si votre démarche est encore en test / non publiée, tous les instructeurs que vous ajouterez à la démarche <strong>seront notifiés par email</strong>.
notification_alert_publiee_html: Tous les instructeurs que vous ajouterez à la démarche <strong>seront notifiés par email</strong>.
import:
groupe:
one: "%{count} groupe"
Expand Down
Loading