feat(routing): add departements options to value tag
This commit is contained in:
parent
ac823c1b25
commit
4be9352781
2 changed files with 20 additions and 4 deletions
|
@ -58,8 +58,18 @@ class Procedure::OneGroupeManagementComponent < ApplicationComponent
|
|||
|
||||
def available_values_for_select(targeted_champ)
|
||||
return [] if targeted_champ.is_a?(Logic::Empty)
|
||||
targeted_champ
|
||||
.options(@revision.types_de_champ_public)
|
||||
.map { |(label, value)| [label, constant(value).to_json] }
|
||||
|
||||
case @revision.types_de_champ_public.find_by(stable_id: targeted_champ.stable_id).type_champ
|
||||
when TypeDeChamp.type_champs.fetch(:departements)
|
||||
departements_for_select
|
||||
when TypeDeChamp.type_champs.fetch(:drop_down_list)
|
||||
targeted_champ
|
||||
.options(@revision.types_de_champ_public)
|
||||
.map { |(label, value)| [label, constant(value).to_json] }
|
||||
end
|
||||
end
|
||||
|
||||
def departements_for_select
|
||||
APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", constant("#{_1[:code]} – #{_1[:name]}").to_json] }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue