Merge pull request #10973 from demarches-simplifiees/etq-admin-bug-affichage-service

ETQ Admin: amélioration de l'affichage des services
This commit is contained in:
Benoit Queyron 2024-10-22 12:04:51 +00:00 committed by GitHub
commit 4844696f5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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_siret_service, only: :edit
skip_before_action :alert_for_missing_service, only: :edit skip_before_action :alert_for_missing_service, only: :edit
def index def index
@services = services.ordered
@procedure = procedure @procedure = procedure
@services = services.ordered.sort_by { |service| service == procedure.service ? 0 : 1 }
end end
def new def new

View file

@ -6,6 +6,8 @@
#services-index.fr-container #services-index.fr-container
%h1.fr-h2 Service %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 .fr-table.fr-table--layout-fixed
%table %table
%caption Liste des services pouvant être affectés à la démarche %caption Liste des services pouvant être affectés à la démarche
@ -13,25 +15,30 @@
%tr %tr
%th{ scope: "col" } %th{ scope: "col" }
Nom Nom
%th.change{ scope: "col" } %th.fr-col-4{ scope: "col" }
= link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--secondary" Actions
%tbody %tbody
- @services.each do |service| - @services.each do |service|
%tr %tr
%td %td
= service.nom = service.nom
%td.change %td.fr-col-4
.fr-container.flex.px-0
.fr-col-4.fr-col--middle
- if @procedure.service == service - if @procedure.service == service
%strong.mr-2 (Assigné) %p.fr-badge.fr-badge--success.fr-badge--sm
ASSIGNÉ
- else - 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' = 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'
= link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'link my-2') .fr-col-4
- if @procedure.service != service = 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')
= link_to 'Supprimer', .fr-col-4
= button_to 'Supprimer',
admin_service_path(service, procedure_id: @procedure.id), admin_service_path(service, procedure_id: @procedure.id),
method: :delete, method: :delete,
data: { confirm: "Confirmez vous la suppression de #{service.nom}" }, data: { confirm: "Confirmez vous la suppression de #{service.nom}" },
class: 'btn btn-link ml-2' 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) = render Procedure::FixedFooterComponent.new(procedure: @procedure)