feat(svr): instructor filters with svr wording specific
This commit is contained in:
parent
d7a9bee63e
commit
680919a68f
6 changed files with 46 additions and 16 deletions
|
@ -1227,7 +1227,7 @@ class Dossier < ApplicationRecord
|
|||
['Dernière mise à jour le', :updated_at],
|
||||
['Déposé le', :depose_at],
|
||||
['Passé en instruction le', :en_instruction_at],
|
||||
procedure.sva_svr_enabled? ? ["Date #{procedure.sva_svr_configuration.human_decision}", :sva_svr_decision_on] : nil,
|
||||
procedure.sva_svr_enabled? ? ["Date décision #{procedure.sva_svr_configuration.human_decision}", :sva_svr_decision_on] : nil,
|
||||
['Traité le', :processed_at],
|
||||
['Motivation de la décision', :motivation],
|
||||
['Instructeurs', followers_instructeurs.map(&:email).join(' ')]
|
||||
|
|
|
@ -26,8 +26,6 @@ class ProcedurePresentation < ApplicationRecord
|
|||
validate :check_filters_max_length
|
||||
|
||||
def self_fields
|
||||
sva_svr_enabled = procedure.sva_svr_enabled?
|
||||
|
||||
[
|
||||
field_hash('self', 'created_at', type: :date),
|
||||
field_hash('self', 'updated_at', type: :date),
|
||||
|
@ -35,8 +33,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
field_hash('self', 'en_construction_at', type: :date),
|
||||
field_hash('self', 'en_instruction_at', type: :date),
|
||||
field_hash('self', 'processed_at', type: :date),
|
||||
sva_svr_enabled && field_hash('self', 'sva_svr_decision_on', type: :date),
|
||||
sva_svr_enabled && field_hash('self', 'sva_svr_decision_before', type: :date, virtual: true),
|
||||
*sva_svr_fields(for_filters: true),
|
||||
field_hash('self', 'updated_since', type: :date, virtual: true),
|
||||
field_hash('self', 'depose_since', type: :date, virtual: true),
|
||||
field_hash('self', 'en_construction_since', type: :date, virtual: true),
|
||||
|
@ -112,15 +109,32 @@ class ProcedurePresentation < ApplicationRecord
|
|||
end
|
||||
|
||||
def displayed_fields_for_headers
|
||||
array = [
|
||||
[
|
||||
field_hash('self', 'id', classname: 'number-col'),
|
||||
*displayed_fields,
|
||||
field_hash('self', 'state', classname: 'state-col')
|
||||
field_hash('self', 'state', classname: 'state-col'),
|
||||
*sva_svr_fields
|
||||
]
|
||||
end
|
||||
|
||||
array << field_hash('self', 'sva_svr_decision_on', classname: 'sva-col') if procedure.sva_svr_enabled?
|
||||
def sva_svr_fields(for_filters: false)
|
||||
return if !procedure.sva_svr_enabled?
|
||||
|
||||
array
|
||||
i18n_scope = [:activerecord, :attributes, :procedure_presentation, :fields, :self]
|
||||
|
||||
fields = []
|
||||
fields << field_hash('self', 'sva_svr_decision_on',
|
||||
type: :date,
|
||||
label: I18n.t("#{procedure.sva_svr_decision}_decision_on", scope: i18n_scope),
|
||||
classname: for_filters ? '' : 'sva-col')
|
||||
|
||||
if for_filters
|
||||
fields << field_hash('self', 'sva_svr_decision_before',
|
||||
label: I18n.t("#{procedure.sva_svr_decision}_decision_before", scope: i18n_scope),
|
||||
type: :date, virtual: true)
|
||||
end
|
||||
|
||||
fields
|
||||
end
|
||||
|
||||
def sorted_ids(dossiers, count)
|
||||
|
|
|
@ -17,8 +17,10 @@ en:
|
|||
en_construction_since: Submitted since
|
||||
en_instruction_since: Instructed since
|
||||
processed_since: Finished since
|
||||
sva_svr_decision_on: SVA decision date
|
||||
sva_svr_decision_before: SVA decision date before
|
||||
sva_decision_on: SVA decision date
|
||||
sva_decision_before: SVA decision date before
|
||||
svr_decision_on: SVR decision date
|
||||
svr_decision_before: SVR decision date before
|
||||
user:
|
||||
email: Requester
|
||||
followers_instructeurs:
|
||||
|
|
|
@ -17,8 +17,10 @@ fr:
|
|||
en_construction_since: En construction depuis
|
||||
en_instruction_since: En instruction depuis
|
||||
processed_since: Terminé depuis
|
||||
sva_svr_decision_on: Date décision SVA
|
||||
sva_svr_decision_before: Date décision SVA avant
|
||||
sva_decision_on: Date décision SVA
|
||||
sva_decision_before: Date décision SVA avant
|
||||
svr_decision_on: Date décision SVR
|
||||
svr_decision_before: Date décision SVR avant
|
||||
user:
|
||||
email: Demandeur
|
||||
followers_instructeurs:
|
||||
|
|
|
@ -2049,13 +2049,13 @@ describe Dossier, type: :model do
|
|||
context 'procedure sva' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, procedure: create(:procedure, :sva)) }
|
||||
|
||||
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["Date SVA", :sva_svr_decision_on]) }
|
||||
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["Date décision SVA", :sva_svr_decision_on]) }
|
||||
end
|
||||
|
||||
context 'procedure svr' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, procedure: create(:procedure, :svr)) }
|
||||
|
||||
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["Date SVR", :sva_svr_decision_on]) }
|
||||
it { expect(dossier.spreadsheet_columns(types_de_champ: [])).to include(["Date décision SVR", :sva_svr_decision_on]) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ describe ProcedurePresentation do
|
|||
it { is_expected.to include(name_field, surname_field, gender_field) }
|
||||
end
|
||||
|
||||
context 'when the procedure is sva/svr' do
|
||||
context 'when the procedure is sva' do
|
||||
let(:procedure) { create(:procedure, :for_individual, :sva) }
|
||||
let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) }
|
||||
|
||||
|
@ -127,6 +127,18 @@ describe ProcedurePresentation do
|
|||
|
||||
it { is_expected.to include(decision_on, decision_before_field) }
|
||||
end
|
||||
|
||||
context 'when the procedure is svr' do
|
||||
let(:procedure) { create(:procedure, :for_individual, :svr) }
|
||||
let(:procedure_presentation) { create(:procedure_presentation, assign_to: assign_to) }
|
||||
|
||||
let(:decision_on) { { "label" => "Date décision SVR", "table" => "self", "column" => "sva_svr_decision_on", 'classname' => '', 'virtual' => false, "type" => :date, "scope" => '', "value_column" => :value, 'filterable' => true } }
|
||||
let(:decision_before_field) { { "label" => "Date décision SVR avant", "table" => "self", "column" => "sva_svr_decision_before", 'classname' => '', 'virtual' => true, "type" => :date, "scope" => '', "value_column" => :value, 'filterable' => true } }
|
||||
|
||||
subject { procedure_presentation.fields }
|
||||
|
||||
it { is_expected.to include(decision_on, decision_before_field) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#displayable_fields_for_select" do
|
||||
|
|
Loading…
Reference in a new issue