feat(sva): instructeurs dashboard sva/svr colonnes with multiple use cases
This commit is contained in:
parent
e43eea7fcf
commit
f1504e9724
11 changed files with 83 additions and 16 deletions
|
@ -0,0 +1,46 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent
|
||||
attr_reader :object
|
||||
|
||||
def initialize(projection_or_dossier:, decision:)
|
||||
@object = projection_or_dossier
|
||||
@decision = decision.to_sym
|
||||
end
|
||||
|
||||
def render?
|
||||
[:en_construction, :en_instruction].include? object.state.to_sym
|
||||
end
|
||||
|
||||
def without_date?
|
||||
object.sva_svr_decision_on.nil?
|
||||
end
|
||||
|
||||
def classes
|
||||
class_names(
|
||||
'fr-badge fr-badge--sm': true,
|
||||
'fr-badge--warning': soon?,
|
||||
'fr-badge--info': !soon?
|
||||
)
|
||||
end
|
||||
|
||||
def soon?
|
||||
object.sva_svr_decision_on < 7.days.from_now.to_date
|
||||
end
|
||||
|
||||
def pending_correction?
|
||||
object.pending_correction?
|
||||
end
|
||||
|
||||
def days_count
|
||||
(object.sva_svr_decision_on - Date.current).to_i
|
||||
end
|
||||
|
||||
def sva?
|
||||
@decision == :sva
|
||||
end
|
||||
|
||||
def svr?
|
||||
@decision == :svr
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
en:
|
||||
no_sva: Submitted before SVA
|
||||
no_svr: Submitted before SVR
|
||||
in_days:
|
||||
zero: Today
|
||||
one: Tomorrow
|
||||
other: in %{count} days
|
||||
remaining_days_after_correction:
|
||||
other: "%{count} d. after correction"
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
fr:
|
||||
no_sva: Déposé avant SVA
|
||||
no_svr: Déposé avant SVR
|
||||
in_days:
|
||||
zero: Aujourd’hui
|
||||
one: Demain
|
||||
other: dans %{count} jours
|
||||
remaining_days_after_correction:
|
||||
other: "%{count} j. après correction"
|
|
@ -0,0 +1,10 @@
|
|||
- if without_date?
|
||||
%span.fr-badge.fr-badge--sm
|
||||
= t(sva? ? '.no_sva' : '.no_svr')
|
||||
- else
|
||||
%span{ class: classes }
|
||||
- if pending_correction?
|
||||
= t('.remaining_days_after_correction', count: days_count)
|
||||
- else
|
||||
= t('.in_days', count: days_count)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue