only show active centers from the reachable centers for creation of person

This commit is contained in:
Julie Lenaerts 2023-09-11 14:43:52 +02:00
parent f30b4ff452
commit 86315b1579
2 changed files with 3 additions and 5 deletions

View File

@ -61,6 +61,8 @@ class PickCenterType extends AbstractType
{ {
$centers = $this->getReachableCenters($options['role'], $options['scopes']); $centers = $this->getReachableCenters($options['role'], $options['scopes']);
$centersActive = array_filter($centers, fn(Center $c) => $c->getIsActive());
if (count($centers) <= 1) { if (count($centers) <= 1) {
$multiple = $options['choice_options']['multiple'] ?? false; $multiple = $options['choice_options']['multiple'] ?? false;
$builder->add('center', HiddenType::class); $builder->add('center', HiddenType::class);
@ -75,7 +77,7 @@ class PickCenterType extends AbstractType
$options['choice_options'], $options['choice_options'],
[ [
'class' => Center::class, 'class' => Center::class,
'choices' => $centers, 'choices' => $centersActive,
] ]
) )
); );

View File

@ -10,10 +10,6 @@ chill_main_admin_scope:
resource: "@ChillMainBundle/config/routes/scope.yaml" resource: "@ChillMainBundle/config/routes/scope.yaml"
prefix: "{_locale}/admin/scope" prefix: "{_locale}/admin/scope"
#chill_main_admin:
# resource: "@ChillMainBundle/config/routes/center.yaml"
# prefix: "{_locale}/admin/center"
chill_main_exports: chill_main_exports:
resource: "@ChillMainBundle/config/routes/exports.yaml" resource: "@ChillMainBundle/config/routes/exports.yaml"
prefix: "{_locale}/exports" prefix: "{_locale}/exports"