use Columns::DossierColumn

This commit is contained in:
simon lehericey 2024-10-30 18:30:38 +01:00
parent 96cd4fda72
commit 5981de90a2
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -51,21 +51,21 @@ module ColumnsConcern
columns.filter { _1.id.in?(self.columns.map(&:id)) }
end
def dossier_id_column = Column.new(procedure_id: id, table: 'self', column: 'id', type: :number)
def dossier_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'id', type: :number)
def dossier_state_column = Column.new(procedure_id: id, table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)
def dossier_state_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)
def notifications_column = Column.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)
def notifications_column = Columns::DossierColumn.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)
def sva_svr_columns(for_export: false)
scope = [:activerecord, :attributes, :procedure_presentation, :fields, :self]
columns = [
Column.new(procedure_id: id, table: 'self', column: 'sva_svr_decision_on', type: :date,
Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'sva_svr_decision_on', type: :date,
label: I18n.t("#{sva_svr_decision}_decision_on", scope:, type: sva_svr_configuration.human_decision))
]
if !for_export
columns << Column.new(procedure_id: id, table: 'self', column: 'sva_svr_decision_before', type: :date, displayable: false,
columns << Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'sva_svr_decision_before', type: :date, displayable: false,
label: I18n.t("#{sva_svr_decision}_decision_before", scope:))
end
columns
@ -79,35 +79,35 @@ module ColumnsConcern
private
def groupe_instructeurs_id_column = Column.new(procedure_id: id, table: 'groupe_instructeur', column: 'id', type: :enum)
def groupe_instructeurs_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'groupe_instructeur', column: 'id', type: :enum)
def followers_instructeurs_email_column = Column.new(procedure_id: id, table: 'followers_instructeurs', column: 'email')
def followers_instructeurs_email_column = Columns::DossierColumn.new(procedure_id: id, table: 'followers_instructeurs', column: 'email')
def dossier_archived_column = Column.new(procedure_id: id, table: 'self', column: 'archived', type: :text, displayable: false, filterable: false);
def dossier_archived_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'archived', type: :text, displayable: false, filterable: false);
def dossier_motivation_column = Column.new(procedure_id: id, table: 'self', column: 'motivation', type: :text, displayable: false, filterable: false);
def dossier_motivation_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'motivation', type: :text, displayable: false, filterable: false);
def user_email_for_display_column = Column.new(procedure_id: id, table: 'self', column: 'user_email_for_display', filterable: false, displayable: false)
def user_email_for_display_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'user_email_for_display', filterable: false, displayable: false)
def user_france_connected_column = Column.new(procedure_id: id, table: 'self', column: 'user_from_france_connect?', filterable: false, displayable: false)
def user_france_connected_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'user_from_france_connect?', filterable: false, displayable: false)
def procedure_chorus_columns
['domaine_fonctionnel', 'referentiel_prog', 'centre_de_cout']
.map { |column| Column.new(procedure_id: id, table: 'procedure', column:, displayable: false, filterable: false) }
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'procedure', column:, displayable: false, filterable: false) }
end
def dossier_non_displayable_dates_columns
['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since']
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :date, displayable: false) }
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:, type: :date, displayable: false) }
end
def dossier_dates_columns
['created_at', 'updated_at', 'last_champ_updated_at', 'depose_at', 'en_construction_at', 'en_instruction_at', 'processed_at']
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :date) }
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:, type: :date) }
end
def email_column
Column.new(procedure_id: id, table: 'user', column: 'email')
Columns::DossierColumn.new(procedure_id: id, table: 'user', column: 'email')
end
def dossier_columns
@ -127,26 +127,26 @@ module ColumnsConcern
user_email_for_display_column,
followers_instructeurs_email_column,
groupe_instructeurs_id_column,
Column.new(procedure_id: id, table: 'avis', column: 'question_answer', filterable: false),
Columns::DossierColumn.new(procedure_id: id, table: 'avis', column: 'question_answer', filterable: false),
user_france_connected_column
]
end
def individual_columns
['gender', 'nom', 'prenom'].map { |column| Column.new(procedure_id: id, table: 'individual', column:) }
.concat ['for_tiers', 'mandataire_last_name', 'mandataire_first_name'].map { |column| Column.new(procedure_id: id, table: 'self', column:) }
['gender', 'nom', 'prenom'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'individual', column:) }
.concat ['for_tiers', 'mandataire_last_name', 'mandataire_first_name'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:) }
end
def moral_columns
etablissements = ['entreprise_forme_juridique', 'entreprise_siren', 'entreprise_nom_commercial', 'entreprise_raison_sociale', 'entreprise_siret_siege_social']
.map { |column| Column.new(procedure_id: id, table: 'etablissement', column:) }
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:) }
etablissement_dates = ['entreprise_date_creation'].map { |column| Column.new(procedure_id: id, table: 'etablissement', column:, type: :date) }
etablissement_dates = ['entreprise_date_creation'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:, type: :date) }
for_export = ["siege_social", "naf", "adresse", "numero_voie", "type_voie", "nom_voie", "complement_adresse", "localite", "code_insee_localite", "entreprise_siren", "entreprise_capital_social", "entreprise_numero_tva_intracommunautaire", "entreprise_forme_juridique_code", "entreprise_code_effectif_entreprise", "entreprise_etat_administratif", "entreprise_nom", "entreprise_prenom", "association_rna", "association_titre", "association_objet", "association_date_creation", "association_date_declaration", "association_date_publication"]
.map { |column| Column.new(procedure_id: id, table: 'etablissement', column:, displayable: false, filterable: false) }
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:, displayable: false, filterable: false) }
other = ['siret', 'libelle_naf', 'code_postal'].map { |column| Column.new(procedure_id: id, table: 'etablissement', column:) }
other = ['siret', 'libelle_naf', 'code_postal'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:) }
[etablissements, etablissement_dates, other, for_export].flatten
end