feat(sva): add sva badge on page dossier for instructeur

This commit is contained in:
Lisa Durand 2023-06-08 15:07:43 +02:00 committed by Colin Darie
parent 3607b6c593
commit 786bc64d85
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
5 changed files with 30 additions and 7 deletions

View file

@ -29,3 +29,15 @@
vertical-align: baseline; vertical-align: baseline;
} }
} }
.badge-group {
display: flex;
.fr-badge {
margin-right: $default-spacer;
}
.fr-badge:last-child {
margin-right: 0;
}
}

View file

@ -2,10 +2,12 @@
class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent
attr_reader :object attr_reader :object
attr_reader :with_label
def initialize(projection_or_dossier:, decision:) def initialize(projection_or_dossier:, decision:, with_label: false)
@object = projection_or_dossier @object = projection_or_dossier
@decision = decision.to_sym @decision = decision.to_sym
@with_label = with_label
end end
def render? def render?
@ -43,4 +45,8 @@ class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent
def svr? def svr?
@decision == :svr @decision == :svr
end end
def label_for_badge
sva? ? "SVA :" : "SVR :"
end
end end

View file

@ -3,8 +3,9 @@
= t(sva? ? '.no_sva' : '.no_svr') = t(sva? ? '.no_sva' : '.no_svr')
- else - else
%span{ class: classes } %span{ class: classes }
- if with_label.present?
= label_for_badge
- if pending_correction? - if pending_correction?
= t('.remaining_days_after_correction', count: days_count) = t('.remaining_days_after_correction', count: days_count)
- else - else
= t('.in_days', count: days_count) = t('.in_days', count: days_count)

View file

@ -8,7 +8,7 @@ module ProcedureHelper
def procedure_badge(procedure) def procedure_badge(procedure)
return nil unless procedure.brouillon? return nil unless procedure.brouillon?
tag.span(t('helpers.procedure.testing_procedure'), class: 'fr-badge') tag.span(t('helpers.procedure.testing_procedure'), class: 'fr-badge fr-badge--sm')
end end
def procedure_publish_label(procedure, key) def procedure_publish_label(procedure, key)

View file

@ -4,11 +4,15 @@
%h1.fr-h3.fr-mb-1w %h1.fr-h3.fr-mb-1w
= "Dossier nº #{dossier.id}" = "Dossier nº #{dossier.id}"
= status_badge(dossier.state, 'super')
= pending_correction_badge(:for_instructeur) if dossier.pending_correction?
= link_to dossier.procedure.libelle.truncate_words(10), instructeur_procedure_path(dossier.procedure), title: dossier.procedure.libelle, class: "fr-link" = link_to dossier.procedure.libelle.truncate_words(10), instructeur_procedure_path(dossier.procedure), title: dossier.procedure.libelle, class: "fr-link"
= procedure_badge(dossier.procedure) .fr-mt-2w.badge-group
= procedure_badge(dossier.procedure)
= status_badge(dossier.state)
= pending_correction_badge(:for_instructeur) if dossier.pending_correction?
= render Instructeurs::SVASVRDecisionBadgeComponent.new(projection_or_dossier: dossier, decision: dossier.procedure.sva_svr_configuration.decision, with_label: true)
.header-actions.fr-ml-auto .header-actions.fr-ml-auto
= render partial: 'instructeurs/dossiers/header_actions', locals: { dossier: } = render partial: 'instructeurs/dossiers/header_actions', locals: { dossier: }