From 1fe59c165f51d74e23e88f125056f35cc19f876f Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 22 May 2024 16:12:48 +0200 Subject: [PATCH] page service --- .../administrateurs/services/_form.html.haml | 4 +- .../administrateurs/services/edit.html.haml | 17 ++--- .../administrateurs/services/index.html.haml | 63 ++++++++++--------- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/app/views/administrateurs/services/_form.html.haml b/app/views/administrateurs/services/_form.html.haml index c3afc1522..ec4a7233a 100644 --- a/app/views/administrateurs/services/_form.html.haml +++ b/app/views/administrateurs/services/_form.html.haml @@ -39,6 +39,6 @@ .fr-container %ul.fr-btns-group.fr-btns-group--inline-md %li - = f.submit "Enregistrer", class: "fr-btn" + = link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure.id), class: "fr-btn fr-btn--secondary" %li - = link_to "Annuler et revenir à la page de suivi", admin_procedure_path(id: @procedure.id), class: "fr-btn fr-btn--secondary" + = f.submit "Enregistrer", class: "fr-btn" diff --git a/app/views/administrateurs/services/edit.html.haml b/app/views/administrateurs/services/edit.html.haml index 186294bfc..0b056372c 100644 --- a/app/views/administrateurs/services/edit.html.haml +++ b/app/views/administrateurs/services/edit.html.haml @@ -5,21 +5,22 @@ ['Modifier le service']] } -.container +.fr-container + .flex.justify-between.align-center.fr-mb-3w + = link_to "Liste de tous les services", admin_services_path(procedure_id: @procedure.id), class: "fr-link fr-icon-arrow-left-line fr-link--icon-left" + = link_to "+ Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn" + + %h1.fr-h2 + Modifier le service + - other_services = @service.procedures.reject {|procedure| procedure.id == @procedure.id } - if other_services.count > 1 - = render Dsfr::AlertComponent.new(state: :warning, title: "Modifier ce service impactera la ou les démarches qui sont rattachée/s") do |c| + = render Dsfr::AlertComponent.new(state: :warning, title: "Modifier ce service impactera la ou les démarches qui sont rattachée/s", extra_class_names: 'fr-mb-3w') do |c| - c.with_body do %ul - other_services.each do |proc| %li= "#{proc.libelle} (N° #{proc.id})" %p.mt-3 Si vous souhaitez modifier uniquement les informations pour ce service, créez un nouveau service puis associez-le à la démarche - %p.mt-3 - = link_to "+ Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn" - - - %h1.mt-2 Modifier le service - = render partial: 'form', locals: { service: @service, procedure_id: @procedure.id } diff --git a/app/views/administrateurs/services/index.html.haml b/app/views/administrateurs/services/index.html.haml index b0fb75517..a837c14f6 100644 --- a/app/views/administrateurs/services/index.html.haml +++ b/app/views/administrateurs/services/index.html.haml @@ -1,34 +1,41 @@ = render partial: 'administrateurs/breadcrumbs', locals: { steps: [['Démarches', admin_procedures_path], [@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)], - ['Choix du service']] } + ['Service']] } -#services-index.container - %h1.fr-h1 Liste des Services - %h2.fr-h4 La démarche “#{@procedure.libelle}” peut être affectée aux services dans la liste ci-dessous +#services-index.fr-container + %h1.fr-h2 Service - %table.fr-table.width-100.mt-3 - %thead - %tr - %th{ scope: "col" } - Nom - %th.change{ scope: "col" } - = link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--secondary" - - %tbody - - @services.each do |service| + .fr-table.fr-table--layout-fixed + %table + %caption Liste des services pouvant être affectés à la démarche + %thead %tr - %td - = service.nom - %td.change - - if @procedure.service == service - %strong.mr-2 (Assigné) - - else - = button_to "Assigner", add_to_procedure_admin_services_path(procedure: { id: @procedure.id, service_id: service.id, }), method: :patch, class: 'link mr-2', form_class: 'inline' - = link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'link my-2') - - if @procedure.service != service - = link_to 'Supprimer', - admin_service_path(service, procedure_id: @procedure.id), - method: :delete, - data: { confirm: "Confirmez vous la suppression de #{service.nom}" }, - class: 'btn btn-link ml-2' + %th{ scope: "col" } + Nom + %th.change{ scope: "col" } + = link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--secondary" + + %tbody + - @services.each do |service| + %tr + %td + = service.nom + %td.change + - if @procedure.service == service + %strong.mr-2 (Assigné) + - else + = button_to "Assigner", add_to_procedure_admin_services_path(procedure: { id: @procedure.id, service_id: service.id, }), method: :patch, class: 'link mr-2', form_class: 'inline' + = link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'link my-2') + - if @procedure.service != service + = link_to 'Supprimer', + admin_service_path(service, procedure_id: @procedure.id), + method: :delete, + data: { confirm: "Confirmez vous la suppression de #{service.nom}" }, + class: 'btn btn-link ml-2' + +.padded-fixed-footer + .fixed-footer.fr-pb-2w + .fr-container + = link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left' do + Revenir à l'écran de gestion