page service

This commit is contained in:
Lisa Durand 2024-05-22 16:12:48 +02:00
parent 10ac3fe693
commit 1fe59c165f
3 changed files with 46 additions and 38 deletions

View file

@ -39,6 +39,6 @@
.fr-container .fr-container
%ul.fr-btns-group.fr-btns-group--inline-md %ul.fr-btns-group.fr-btns-group--inline-md
%li %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 %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"

View file

@ -5,21 +5,22 @@
['Modifier le service']] } ['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 } - other_services = @service.procedures.reject {|procedure| procedure.id == @procedure.id }
- if other_services.count > 1 - 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 - c.with_body do
%ul %ul
- other_services.each do |proc| - other_services.each do |proc|
%li= "#{proc.libelle} (N° #{proc.id})" %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 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', = render partial: 'form',
locals: { service: @service, procedure_id: @procedure.id } locals: { service: @service, procedure_id: @procedure.id }

View file

@ -1,34 +1,41 @@
= render partial: 'administrateurs/breadcrumbs', = render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Démarches', admin_procedures_path], locals: { steps: [['Démarches', admin_procedures_path],
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)], [@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
['Choix du service']] } ['Service']] }
#services-index.container #services-index.fr-container
%h1.fr-h1 Liste des Services %h1.fr-h2 Service
%h2.fr-h4 La démarche “#{@procedure.libelle}” peut être affectée aux services dans la liste ci-dessous
%table.fr-table.width-100.mt-3 .fr-table.fr-table--layout-fixed
%thead %table
%tr %caption Liste des services pouvant être affectés à la démarche
%th{ scope: "col" } %thead
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 %tr
%td %th{ scope: "col" }
= service.nom Nom
%td.change %th.change{ scope: "col" }
- if @procedure.service == service = link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--secondary"
%strong.mr-2 (Assigné)
- else %tbody
= 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' - @services.each do |service|
= link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'link my-2') %tr
- if @procedure.service != service %td
= link_to 'Supprimer', = service.nom
admin_service_path(service, procedure_id: @procedure.id), %td.change
method: :delete, - if @procedure.service == service
data: { confirm: "Confirmez vous la suppression de #{service.nom}" }, %strong.mr-2 (Assigné)
class: 'btn btn-link ml-2' - 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