From fffe446b5be380c87722399c7982cd4d5e2f7f3f Mon Sep 17 00:00:00 2001 From: Adrien Di Pasquale Date: Mon, 16 Dec 2024 18:18:34 +0100 Subject: [PATCH 1/5] wording formulaire edition agent --- app/views/admin/agents/edit.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/agents/edit.html.slim b/app/views/admin/agents/edit.html.slim index 5e6bcf7092..51f5f5f1aa 100644 --- a/app/views/admin/agents/edit.html.slim +++ b/app/views/admin/agents/edit.html.slim @@ -21,7 +21,7 @@ = render "model_errors", model: @agent - allowed_to_change_services = Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? - = f.association :services, collection: @services, disabled: true, input_html: { class: "select2-input" }, wrapper_html: { class: "mb-0" }, hint: allowed_to_change_services ? nil : "Le changement de service est réservé aux admins de territoire" + = f.association :services, collection: @services, disabled: true, input_html: { class: "select2-input" }, wrapper_html: { class: "mb-0" }, hint: allowed_to_change_services ? nil : "Vous n’avez pas les droits nécessaires pour modifier les services de l’agent. Il faut être administrateur de territoire avec gestion des droits d’accès." - if allowed_to_change_services span.small.text-muted | Vous pouvez désormais attribuer plusieurs services à un agent, via votre interface de Configuration - Admin de territoire.  From 3cf9d7f6380470e95da61780445dd38d7bdcb0e8 Mon Sep 17 00:00:00 2001 From: Adrien Di Pasquale Date: Mon, 16 Dec 2024 18:23:03 +0100 Subject: [PATCH 2/5] =?UTF-8?q?Modification=20des=20libell=C3=A9s=20dans?= =?UTF-8?q?=20l=E2=80=99admin=20de=20territoire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/models/agent.fr.yml | 2 +- config/locales/views/admin_territories_agents.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/models/agent.fr.yml b/config/locales/models/agent.fr.yml index f3192a5c41..cd86991d94 100644 --- a/config/locales/models/agent.fr.yml +++ b/config/locales/models/agent.fr.yml @@ -14,7 +14,7 @@ fr: display_cancelled_rdv: Affichage des rendez-vous annulés agent_territorial_access_right: allow_to_manage_teams: Autorisé à créer, supprimer, modifier des équipes - allow_to_manage_access_rights: Autorisé à gérer les droits d'accès + allow_to_manage_access_rights: Autorisé à gérer les droits d'accès et les services des agents allow_to_invite_agents: Autorisé à inviter et affecter des agents sur des organisations agent/rdv_notifications_levels: all: À chaque modification diff --git a/config/locales/views/admin_territories_agents.yml b/config/locales/views/admin_territories_agents.yml index cb182f3415..34f69ff7f7 100644 --- a/config/locales/views/admin_territories_agents.yml +++ b/config/locales/views/admin_territories_agents.yml @@ -15,5 +15,5 @@ fr: submit: Enregistrer delete_agent_role: Retirer hint_allow_to_manage_teams: "Créer, supprimer, modifier toutes les équipes du territoires" - hint_allow_to_manage_access_rights: "Modifier les droits d'accès de tous les agents du territoire" + hint_allow_to_manage_access_rights: "Modifier les droits d'accès et les services de tous les agents du territoire" hint_allow_to_invite_agents: "Inviter d'autre personne sur le territoire, les affecter ou retirer de chacune des organisations du territoire" From ae1e0665b2afe441cb01fe6c24414afa07f1daf0 Mon Sep 17 00:00:00 2001 From: Adrien Di Pasquale Date: Mon, 16 Dec 2024 18:33:51 +0100 Subject: [PATCH 3/5] =?UTF-8?q?Afficher=20les=20formulaires=20d=C3=A9sacti?= =?UTF-8?q?v=C3=A9s=20sur=20admin/territories/agents/edit.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/territories/agents/edit.html.slim | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/app/views/admin/territories/agents/edit.html.slim b/app/views/admin/territories/agents/edit.html.slim index 1c6624c6a6..d986dc9509 100644 --- a/app/views/admin/territories/agents/edit.html.slim +++ b/app/views/admin/territories/agents/edit.html.slim @@ -4,37 +4,44 @@ h1 = @agent.full_name_or_email .container-fluid - - if Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? - .card.m-2.rounded - h2.card-header - = t(".agent_services_legend") - = simple_form_for @agent, url: update_services_admin_territory_agent_path(current_territory, @agent) do |f| - .card-body - = f.input :service_ids, collection: current_territory.services, - label: t(".services"), - label_method: :name, - input_html: { \ - multiple: true, \ - class: "select2-input",\ - } - .card-footer - .row - .col.text-right - = f.submit class: "btn btn-primary", value: "Enregistrer les services" + - can_edit_services = Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? + .card.m-2.rounded + h2.card-header + = t(".agent_services_legend") + = simple_form_for @agent, url: update_services_admin_territory_agent_path(current_territory, @agent) do |f| + .card-body + = f.input :service_ids, collection: current_territory.services, + label: t(".services"), + label_method: :name, + input_html: { \ + multiple: true, \ + class: "select2-input",\ + }, + disabled: !can_edit_services + - unless can_edit_services + .fr-alert.fr-alert--info + | Vous n’avez pas les droits nécessaires pour modifier les services des agents + .card-footer + .row + .col.text-right + = f.submit class: "btn btn-primary", value: "Enregistrer les services", disabled: !can_edit_services - - if Agent::AgentTerritorialAccessRightPolicy.new(current_agent, @agent.agent_territorial_access_rights.find_by(territory: current_territory)).edit? - .card.m-2.rounded - h2.card-header - = t(".agent_access_rights_legend") - = simple_form_for @agent.agent_territorial_access_rights.find_by(territory: current_territory), url: admin_territory_agent_territorial_access_right_path do |f| - .card-body - = f.input :allow_to_manage_teams, as: :boolean, hint: t(".hint_allow_to_manage_teams") - = f.input :allow_to_manage_access_rights, as: :boolean, hint: t(".hint_allow_to_manage_access_rights") - = f.input :allow_to_invite_agents, as: :boolean, hint: t(".hint_allow_to_invite_agents") - .card-footer - .row - .col.text-right - = f.submit class: "btn btn-primary", value: "Enregistrer les droits d'accès" + - can_edit_access_rights = Agent::AgentTerritorialAccessRightPolicy.new(current_agent, @agent.agent_territorial_access_rights.find_by(territory: current_territory)).edit? + .card.m-2.rounded + h2.card-header + = t(".agent_access_rights_legend") + = simple_form_for @agent.agent_territorial_access_rights.find_by(territory: current_territory), url: admin_territory_agent_territorial_access_right_path do |f| + .card-body + = f.input :allow_to_manage_teams, as: :boolean, hint: t(".hint_allow_to_manage_teams"), disabled: !can_edit_access_rights + = f.input :allow_to_manage_access_rights, as: :boolean, hint: t(".hint_allow_to_manage_access_rights"), disabled: !can_edit_access_rights + = f.input :allow_to_invite_agents, as: :boolean, hint: t(".hint_allow_to_invite_agents"), disabled: !can_edit_access_rights + - unless can_edit_access_rights + .fr-alert.fr-alert--info + | Vous n’avez pas les droits nécessaires pour modifier les droits d’accès des agents + .card-footer + .row + .col.text-right + = f.submit class: "btn btn-primary", value: "Enregistrer les droits d'accès", disabled: !can_edit_access_rights - if Agent::AgentTerritorialRolePolicy.new(current_agent, AgentTerritorialRole.new(agent: @agent, territory: current_territory)).create_or_destroy? .card.m-2.rounded.agent-territorial From 18a6d2c58fbeb5d61a41f1e431a396417a9cbb88 Mon Sep 17 00:00:00 2001 From: Adrien Di Pasquale Date: Wed, 18 Dec 2024 14:24:17 +0100 Subject: [PATCH 4/5] =?UTF-8?q?am=C3=A9lioration=20de=20l=E2=80=99affichag?= =?UTF-8?q?e=20du=20formulaire=20territoire=20agent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/territories/agents/edit.html.slim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/admin/territories/agents/edit.html.slim b/app/views/admin/territories/agents/edit.html.slim index d986dc9509..51e50a6c54 100644 --- a/app/views/admin/territories/agents/edit.html.slim +++ b/app/views/admin/territories/agents/edit.html.slim @@ -18,13 +18,14 @@ h1 class: "select2-input",\ }, disabled: !can_edit_services - - unless can_edit_services - .fr-alert.fr-alert--info - | Vous n’avez pas les droits nécessaires pour modifier les services des agents .card-footer .row .col.text-right - = f.submit class: "btn btn-primary", value: "Enregistrer les services", disabled: !can_edit_services + - if can_edit_services + = f.submit class: "btn btn-primary", value: "Enregistrer les services", disabled: !can_edit_services + - else + .fr-mb-0.fr-text--sm.text-muted + | Vous n’avez pas les droits nécessaires pour modifier les services des agents - can_edit_access_rights = Agent::AgentTerritorialAccessRightPolicy.new(current_agent, @agent.agent_territorial_access_rights.find_by(territory: current_territory)).edit? .card.m-2.rounded @@ -35,13 +36,14 @@ h1 = f.input :allow_to_manage_teams, as: :boolean, hint: t(".hint_allow_to_manage_teams"), disabled: !can_edit_access_rights = f.input :allow_to_manage_access_rights, as: :boolean, hint: t(".hint_allow_to_manage_access_rights"), disabled: !can_edit_access_rights = f.input :allow_to_invite_agents, as: :boolean, hint: t(".hint_allow_to_invite_agents"), disabled: !can_edit_access_rights - - unless can_edit_access_rights - .fr-alert.fr-alert--info - | Vous n’avez pas les droits nécessaires pour modifier les droits d’accès des agents .card-footer .row .col.text-right - = f.submit class: "btn btn-primary", value: "Enregistrer les droits d'accès", disabled: !can_edit_access_rights + - if can_edit_access_rights + = f.submit class: "btn btn-primary", value: "Enregistrer les droits d'accès", disabled: !can_edit_access_rights + - else + .fr-mb-0.fr-text--sm.text-muted + | Vous n’avez pas les droits nécessaires pour modifier les droits d’accès des agents - if Agent::AgentTerritorialRolePolicy.new(current_agent, AgentTerritorialRole.new(agent: @agent, territory: current_territory)).create_or_destroy? .card.m-2.rounded.agent-territorial From 97e9d2a095fa60b58f26c8eeaa243080dba5bf2e Mon Sep 17 00:00:00 2001 From: Adrien Di Pasquale Date: Wed, 18 Dec 2024 14:47:52 +0100 Subject: [PATCH 5/5] =?UTF-8?q?am=C3=A9lioration=20du=20formulaire=20simpl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/agents/edit.html.slim | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/views/admin/agents/edit.html.slim b/app/views/admin/agents/edit.html.slim index 51f5f5f1aa..bf554d022f 100644 --- a/app/views/admin/agents/edit.html.slim +++ b/app/views/admin/agents/edit.html.slim @@ -19,16 +19,21 @@ .card-body.js_agent_role_form = simple_form_for [:admin, current_organisation, @agent] do |f| = render "model_errors", model: @agent - - allowed_to_change_services = Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? - = f.association :services, collection: @services, disabled: true, input_html: { class: "select2-input" }, wrapper_html: { class: "mb-0" }, hint: allowed_to_change_services ? nil : "Vous n’avez pas les droits nécessaires pour modifier les services de l’agent. Il faut être administrateur de territoire avec gestion des droits d’accès." - - if allowed_to_change_services - span.small.text-muted - | Vous pouvez désormais attribuer plusieurs services à un agent, via votre interface de Configuration - Admin de territoire.  - = link_to "Accéder à la configuration des agents", edit_admin_territory_agent_path(territory_id: current_territory.id, agent_id: @agent.id) + p + - if @agent.services.count == 1 + | #{@agent.full_name} appartient à un seul service : + - else + | #{@agent.full_name} appartient à #{@agent.services.count} services : + ul.fr-pl-2w + - @agent.services.each do |service| + li.rdv-font-weight-bold= service.name + + - if Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? + = link_to "Ajouter ou retirer des services", edit_admin_territory_agent_path(territory_id: current_territory.id, agent_id: @agent.id), class: "fr-link fr-icon-pencil-line fr-link--icon-left" - else - span.small.text-muted - | En tant qu’agent, vous pouvez désormais être rattaché à plusieurs services d’une même organisation. Pour cela, contacter un agent admin du territoire. + .fr-mb-0.fr-text--sm.text-muted + | Le changement ou l’ajout de service est réservé aux admins de territoire avec ce droit d’accès hr