feat(routing): add regions options to value tag
This commit is contained in:
parent
5afaa458e2
commit
e9760e5aa3
2 changed files with 8 additions and 0 deletions
|
@ -81,6 +81,8 @@ class Procedure::OneGroupeManagementComponent < ApplicationComponent
|
|||
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(:regions)
|
||||
regions_for_select
|
||||
when TypeDeChamp.type_champs.fetch(:drop_down_list)
|
||||
targeted_champ
|
||||
.options(@revision.types_de_champ_public)
|
||||
|
@ -91,4 +93,8 @@ class Procedure::OneGroupeManagementComponent < ApplicationComponent
|
|||
def departements_for_select
|
||||
APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", constant(_1[:code]).to_json] }
|
||||
end
|
||||
|
||||
def regions_for_select
|
||||
APIGeoService.regions.map { ["#{_1[:code]} – #{_1[:name]}", constant(_1[:code]).to_json] }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,6 +107,8 @@ class GroupeInstructeur < ApplicationRecord
|
|||
options = case routing_tdc.type_champ
|
||||
when TypeDeChamp.type_champs.fetch(:departements)
|
||||
APIGeoService.departements.map { _1[:code] }
|
||||
when TypeDeChamp.type_champs.fetch(:regions)
|
||||
APIGeoService.regions.map { _1[:code] }
|
||||
when TypeDeChamp.type_champs.fetch(:drop_down_list)
|
||||
routing_tdc.options_with_drop_down_other
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue