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-11-04 10:18:07 +01:00
|
|
|
|
["code postal (5 chiffres)", '$.postal_code', :text],
|
|
|
|
|
["commune", '$.city_name', :text],
|
|
|
|
|
["département", '$.departement_code', :enum],
|
|
|
|
|
["region", '$.region_name', :enum]
|
|
|
|
|
].map do |(label, jsonpath, type)|
|
2024-07-22 14:58:16 +02:00
|
|
|
|
Columns::JSONPathColumn.new(
|
2024-10-07 21:46:59 +02:00
|
|
|
|
procedure_id:,
|
2024-11-04 10:18:07 +01:00
|
|
|
|
stable_id:,
|
2024-11-04 16:34:00 +01:00
|
|
|
|
tdc_type: type_champ,
|
2024-08-22 12:37:10 +02:00
|
|
|
|
label: "#{libelle_with_prefix(prefix)} – #{label}",
|
2024-11-04 10:18:07 +01:00
|
|
|
|
jsonpath:,
|
|
|
|
|
displayable:,
|
|
|
|
|
type:
|
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
|