2024-04-29 00:17:15 +02:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-07-22 14:58:16 +02:00
|
|
|
|
module AddressableColumnConcern
|
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
|
|
included do
|
2024-10-07 21:46:59 +02:00
|
|
|
|
def columns(procedure_id:, displayable: true, prefix: nil)
|
2024-07-22 14:58:16 +02:00
|
|
|
|
super.concat([
|
2024-08-22 12:37:10 +02:00
|
|
|
|
["code postal (5 chiffres)", ['postal_code'], :text],
|
|
|
|
|
["commune", ['city_name'], :text],
|
|
|
|
|
["département", ['departement_code'], :enum],
|
|
|
|
|
["region", ['region_name'], :enum]
|
|
|
|
|
].map do |(label, value_column, type)|
|
2024-07-22 14:58:16 +02:00
|
|
|
|
Columns::JSONPathColumn.new(
|
2024-10-07 21:46:59 +02:00
|
|
|
|
procedure_id:,
|
2024-08-22 12:37:10 +02:00
|
|
|
|
table: Column::TYPE_DE_CHAMP_TABLE,
|
2024-07-22 14:58:16 +02:00
|
|
|
|
column: stable_id,
|
2024-08-22 12:37:10 +02:00
|
|
|
|
label: "#{libelle_with_prefix(prefix)} – #{label}",
|
2024-09-02 17:22:48 +02:00
|
|
|
|
displayable: false,
|
2024-08-22 12:37:10 +02:00
|
|
|
|
type:,
|
|
|
|
|
value_column:
|
2024-07-22 14:58:16 +02:00
|
|
|
|
)
|
2024-08-22 12:37:10 +02:00
|
|
|
|
end)
|
2024-07-22 14:58:16 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|