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:
commit
4844696f5c
3 changed files with 22 additions and 20 deletions
|
@ -1,5 +0,0 @@
|
|||
@import "constants";
|
||||
|
||||
.change {
|
||||
width: 300px;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue