Commit a85f7cfd by Julien Jorry

Fix #136 - La liste groupes locaux désactivés apparaît dans fiche saisie prestataire

parent 96a6b2af
......@@ -90,14 +90,25 @@ class GroupeAdmin extends AbstractAdmin
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true,
])
]);
if (count($groupe->getPrestataires()) > 0) {
$formMapper
->add('enabled', CheckboxType::class, [
'label' => 'Activé ?',
'help' => '(impossible de désactiver un groupe local contenant au moins 1 prestataire',
'required' => false,
'disabled' => true,
'label_attr' => ['class' => 'checkbox-inline'],
])
->end()
;
]);
} else {
$formMapper
->add('enabled', CheckboxType::class, [
'label' => 'Activé ?',
'required' => false,
'label_attr' => ['class' => 'checkbox-inline'],
]);
}
$formMapper->end();
}
/**
......@@ -194,8 +205,7 @@ class GroupeAdmin extends AbstractAdmin
]
)
->add('enabled', null, [
'label' => 'Activé',
'editable' => true,
'label' => 'Activé'
])
->add('_action', null, [
'actions' => $actions,
......
......@@ -181,7 +181,7 @@ class PrestataireAdmin extends AbstractAdmin
->add('groupe', ChoiceType::class, [
'required' => false,
'label' => 'Groupe local :',
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Groupe::class)->findAll(),
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Groupe::class)->findBy(['enabled' => true], ['name' => 'ASC']),
'choice_label' => 'name',
'placeholder' => 'Choisir un groupe',
])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment