demarches-normaliennes/app/views/administrateurs/services/index.html.haml
2024-10-21 18:36:01 +02:00

44 lines
2 KiB
Text

= render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Démarches', admin_procedures_path],
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
['Service']] }
#services-index.fr-container
%h1.fr-h2 Service
= link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--primary fr-btn--icon-left fr-icon-add-circle-line mb-3"
.fr-table.fr-table--layout-fixed
%table
%caption Liste des services pouvant être affectés à la démarche
%thead
%tr
%th{ scope: "col" }
Nom
%th.fr-col-4{ scope: "col" }
Actions
%tbody
- @services.each do |service|
%tr
%td
= service.nom
%td.fr-col-4
.fr-container.flex.px-0
.fr-col-4.fr-col--middle
- if @procedure.service == service
%p.fr-badge.fr-badge--success.fr-badge--sm
ASSIGNÉ
- else
= button_to "Assigner", add_to_procedure_admin_services_path(procedure: { id: @procedure.id, service_id: service.id, }), method: :patch, class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-checkbox-circle-line'
.fr-col-4
= link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-pencil-line')
.fr-col-4
= button_to 'Supprimer',
admin_service_path(service, procedure_id: @procedure.id),
method: :delete,
data: { confirm: "Confirmez vous la suppression de #{service.nom}" },
class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-delete-line',
disabled: (@procedure.service == service)
= render Procedure::FixedFooterComponent.new(procedure: @procedure)