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)
|
||||||
|
|
|
@ -55,7 +55,7 @@ class DossierProjectionService
|
||||||
.pluck(:id, *fields.map { |f| f[COLUMN].to_sym })
|
.pluck(:id, *fields.map { |f| f[COLUMN].to_sym })
|
||||||
.each do |id, *columns|
|
.each do |id, *columns|
|
||||||
fields.zip(columns).each do |field, value|
|
fields.zip(columns).each do |field, value|
|
||||||
if [state_field, archived_field, hidden_by_user_at_field, hidden_by_administration_at_field, batch_operation_field].include?(field)
|
if [state_field, archived_field, hidden_by_user_at_field, hidden_by_administration_at_field, batch_operation_field, sva_svr_decision_on_field].include?(field)
|
||||||
field[:id_value_h][id] = value
|
field[:id_value_h][id] = value
|
||||||
else
|
else
|
||||||
field[:id_value_h][id] = value&.strftime('%d/%m/%Y') # other fields are datetime
|
field[:id_value_h][id] = value&.strftime('%d/%m/%Y') # other fields are datetime
|
||||||
|
|
|
@ -174,17 +174,10 @@
|
||||||
- status << pending_correction_badge(:for_instructeur, html_class: "fr-mt-1v") if p.pending_correction?
|
- status << pending_correction_badge(:for_instructeur, html_class: "fr-mt-1v") if p.pending_correction?
|
||||||
= link_to_if(p.hidden_by_administration_at.blank?, safe_join(status), path, class: class_names("cell-link": true, "fr-py-0": status.many?))
|
= link_to_if(p.hidden_by_administration_at.blank?, safe_join(status), path, class: class_names("cell-link": true, "fr-py-0": status.many?))
|
||||||
|
|
||||||
- if @procedure.sva?
|
- if @procedure.sva_svr_enabled?
|
||||||
%td
|
%td
|
||||||
- if p.hidden_by_administration_at.present?
|
%span.cell-link
|
||||||
%span.cell-link
|
= link_to_if p.hidden_by_administration_at.blank?, render(Instructeurs::SVASVRDecisionBadgeComponent.new(projection_or_dossier: p, decision: @procedure.sva_svr_configuration.decision), path)
|
||||||
.fr-badge.fr-badge--info.fr-badge--sm
|
|
||||||
= t('views.instructeurs.dossiers.sva_svr_decision_on', time_ago: time_ago_in_words(p.sva_svr_decision_on))
|
|
||||||
|
|
||||||
- else
|
|
||||||
%a.cell-link{ href: path }
|
|
||||||
.fr-badge.fr-badge--info.fr-badge--sm
|
|
||||||
= t('views.instructeurs.dossiers.sva_svr_decision_on', time_ago: time_ago_in_words(p.sva_svr_decision_on))
|
|
||||||
|
|
||||||
%td.action-col.follow-col
|
%td.action-col.follow-col
|
||||||
%ul.inline.fr-btns-group.fr-btns-group--sm.fr-btns-group--inline.fr-btns-group--icon-right
|
%ul.inline.fr-btns-group.fr-btns-group--sm.fr-btns-group--inline.fr-btns-group--icon-right
|
||||||
|
|
|
@ -387,7 +387,6 @@ en:
|
||||||
stop_follow: No longer follow
|
stop_follow: No longer follow
|
||||||
no_file: No file
|
no_file: No file
|
||||||
dossier_synthesis: Summary of files
|
dossier_synthesis: Summary of files
|
||||||
sva_svr_decision_on: "%{time_ago} left"
|
|
||||||
avis:
|
avis:
|
||||||
introduction_file_explaination: "File attached to the request for advice"
|
introduction_file_explaination: "File attached to the request for advice"
|
||||||
search:
|
search:
|
||||||
|
|
|
@ -389,7 +389,6 @@ fr:
|
||||||
save: Enregistrer
|
save: Enregistrer
|
||||||
no_file: Aucun dossier
|
no_file: Aucun dossier
|
||||||
dossier_synthesis: Synthèse des dossiers
|
dossier_synthesis: Synthèse des dossiers
|
||||||
sva_svr_decision_on: "%{time_ago} restant(s)"
|
|
||||||
avis:
|
avis:
|
||||||
introduction_file_explaination: "Fichier joint à la demande d’avis"
|
introduction_file_explaination: "Fichier joint à la demande d’avis"
|
||||||
search:
|
search:
|
||||||
|
|
|
@ -17,7 +17,7 @@ en:
|
||||||
en_construction_since: Submitted since
|
en_construction_since: Submitted since
|
||||||
en_instruction_since: Instructed since
|
en_instruction_since: Instructed since
|
||||||
processed_since: Finished since
|
processed_since: Finished since
|
||||||
sva_svr_decision_on: SVA decision on
|
sva_svr_decision_on: SVA decision
|
||||||
user:
|
user:
|
||||||
email: Requester
|
email: Requester
|
||||||
followers_instructeurs:
|
followers_instructeurs:
|
||||||
|
|
|
@ -17,7 +17,7 @@ fr:
|
||||||
en_construction_since: En construction depuis
|
en_construction_since: En construction depuis
|
||||||
en_instruction_since: En instruction depuis
|
en_instruction_since: En instruction depuis
|
||||||
processed_since: Terminé depuis
|
processed_since: Terminé depuis
|
||||||
sva_svr_decision_on: SVA date de décision
|
sva_svr_decision_on: Décision SVA
|
||||||
user:
|
user:
|
||||||
email: Demandeur
|
email: Demandeur
|
||||||
followers_instructeurs:
|
followers_instructeurs:
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe "procedure filters" do
|
||||||
procedure.update!(sva_svr: SVASVRConfiguration.new(decision: :sva).attributes)
|
procedure.update!(sva_svr: SVASVRConfiguration.new(decision: :sva).attributes)
|
||||||
visit instructeur_procedure_path(procedure)
|
visit instructeur_procedure_path(procedure)
|
||||||
within ".dossiers-table" do
|
within ".dossiers-table" do
|
||||||
expect(page).to have_link("SVA date de décision")
|
expect(page).to have_link("Décision SVA")
|
||||||
expect(page).to have_link(new_unfollow_dossier.user.email)
|
expect(page).to have_link(new_unfollow_dossier.user.email)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue