correction affichage service au dsfr

This commit is contained in:
benoitqueyron 2024-10-18 11:29:29 +02:00
parent fcb868c6a8
commit 9a55cd8002
No known key found for this signature in database
GPG key ID: AD3C38C9ACA84135
3 changed files with 22 additions and 20 deletions

View file

@ -1,5 +0,0 @@
@import "constants";
.change {
width: 300px;
}

View file

@ -5,8 +5,8 @@ module Administrateurs
skip_before_action :alert_for_missing_siret_service, only: :edit
skip_before_action :alert_for_missing_service, only: :edit
def index
@services = services.ordered
@procedure = procedure
@services = services.ordered.sort_by { |service| service == procedure.service ? 0 : 1 }
end
def new

View file

@ -6,6 +6,8 @@
#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
@ -13,25 +15,30 @@
%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"
%th.fr-col-4{ scope: "col" }
Actions
%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'
%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)