2024-10-25 14:19:56 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ExportedColumn
|
|
|
|
attr_reader :column, :libelle
|
|
|
|
|
|
|
|
def initialize(column:, libelle:)
|
|
|
|
@column = column
|
|
|
|
@libelle = libelle
|
|
|
|
end
|
|
|
|
|
|
|
|
def id = { id: column.id, libelle: }.to_json
|
2024-11-04 17:00:25 +01:00
|
|
|
|
2024-11-12 17:34:22 +01:00
|
|
|
def libelle_with_value(champ_or_dossier, format:)
|
|
|
|
[libelle, ExportedColumnFormatter.format(column:, champ_or_dossier:, format:), spreadsheet_architect_type]
|
|
|
|
end
|
|
|
|
|
|
|
|
def spreadsheet_architect_type
|
|
|
|
case @column.type
|
|
|
|
when :boolean
|
|
|
|
:boolean
|
2024-11-14 09:12:25 +01:00
|
|
|
when :decimal, :integer
|
2024-11-12 17:34:22 +01:00
|
|
|
:float
|
|
|
|
when :datetime
|
|
|
|
:time
|
|
|
|
when :date
|
|
|
|
:date
|
|
|
|
else
|
|
|
|
:string
|
|
|
|
end
|
2024-11-04 17:00:25 +01:00
|
|
|
end
|
2024-10-25 14:19:56 +02:00
|
|
|
end
|