display sva date and possibility to order in instructeur table
This commit is contained in:
parent
d7b0b1c01f
commit
e43eea7fcf
9 changed files with 57 additions and 3 deletions
|
@ -45,6 +45,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),
|
||||
field_hash('self', 'sva_svr_decision_on', type: :date),
|
||||
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),
|
||||
|
@ -118,11 +119,15 @@ 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')
|
||||
]
|
||||
|
||||
array << field_hash('self', 'sva_svr_decision_on', classname: 'sva-col') if procedure.sva_svr_enabled?
|
||||
|
||||
array
|
||||
end
|
||||
|
||||
def sorted_ids(dossiers, count)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DossierProjectionService
|
||||
class DossierProjection < Struct.new(:dossier_id, :state, :archived, :hidden_by_user_at, :hidden_by_administration_at, :batch_operation_id, :corrections, :columns) do
|
||||
class DossierProjection < Struct.new(:dossier_id, :state, :archived, :hidden_by_user_at, :hidden_by_administration_at, :batch_operation_id, :sva_svr_decision_on, :corrections, :columns) do
|
||||
def pending_correction?
|
||||
return false if corrections.blank?
|
||||
|
||||
|
@ -29,8 +29,9 @@ class DossierProjectionService
|
|||
batch_operation_field = { TABLE => 'self', COLUMN => 'batch_operation_id' }
|
||||
hidden_by_user_at_field = { TABLE => 'self', COLUMN => 'hidden_by_user_at' }
|
||||
hidden_by_administration_at_field = { TABLE => 'self', COLUMN => 'hidden_by_administration_at' }
|
||||
sva_svr_decision_on_field = { TABLE => 'self', COLUMN => 'sva_svr_decision_on' }
|
||||
dossier_corrections = { TABLE => 'dossier_corrections', COLUMN => 'resolved_at' }
|
||||
([state_field, archived_field, hidden_by_user_at_field, hidden_by_administration_at_field, batch_operation_field, dossier_corrections] + fields) # the view needs state and archived dossier attributes
|
||||
([state_field, archived_field, sva_svr_decision_on_field, hidden_by_user_at_field, hidden_by_administration_at_field, batch_operation_field, dossier_corrections] + fields) # the view needs state and archived dossier attributes
|
||||
.each { |f| f[:id_value_h] = {} }
|
||||
.group_by { |f| f[TABLE] } # one query per table
|
||||
.each do |table, fields|
|
||||
|
@ -130,6 +131,7 @@ class DossierProjectionService
|
|||
hidden_by_user_at_field[:id_value_h][dossier_id],
|
||||
hidden_by_administration_at_field[:id_value_h][dossier_id],
|
||||
batch_operation_field[:id_value_h][dossier_id],
|
||||
sva_svr_decision_on_field[:id_value_h][dossier_id],
|
||||
dossier_corrections[:id_value_h][dossier_id],
|
||||
fields.map { |f| f[:id_value_h][dossier_id] }
|
||||
)
|
||||
|
|
|
@ -174,6 +174,18 @@
|
|||
- 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?))
|
||||
|
||||
- if @procedure.sva?
|
||||
%td
|
||||
- if p.hidden_by_administration_at.present?
|
||||
%span.cell-link
|
||||
.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
|
||||
%ul.inline.fr-btns-group.fr-btns-group--sm.fr-btns-group--inline.fr-btns-group--icon-right
|
||||
= render partial: 'instructeurs/procedures/dossier_actions', locals: { procedure_id: @procedure.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue