mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
make familial situations and professionnal situations configurable
This commit is contained in:
@@ -44,9 +44,7 @@ class FamilyMemberType extends AbstractType
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$professionnalSituations = \array_flip(AbstractDiagnosticNIAssignment::PROFESSIONNAL_SITUATIONS);
|
||||
$professionnalSituations["Scolarité"] = 'scolarite';
|
||||
|
||||
|
||||
$builder
|
||||
->add('lastname', TextType::class, [
|
||||
'label' => 'Last name'
|
||||
@@ -58,23 +56,35 @@ class FamilyMemberType extends AbstractType
|
||||
->add('birthdate', ChillDateType::class, [
|
||||
'required' => false
|
||||
])
|
||||
->add('professionnalSituation', ChoiceType::class, [
|
||||
'required' => false,
|
||||
'choices' => $professionnalSituations
|
||||
])
|
||||
->add('link', ChoiceType::class, [
|
||||
'choices' => $this->getLinks(),
|
||||
'choices' => $this->buildChoices($this->configRepository->getLinksLabels()),
|
||||
'placeholder' => 'Choose a link',
|
||||
'label' => 'Relationship'
|
||||
])
|
||||
->add('maritalStatus', Select2MaritalStatusType::class, [
|
||||
'required' => false
|
||||
])
|
||||
->add('familialSituation', ChoiceType::class, [
|
||||
'label' => 'Familial situation',
|
||||
'required' => false,
|
||||
'choices' => \array_flip(AbstractFamilyMember::FAMILIAL_SITUATION)
|
||||
]);
|
||||
;
|
||||
|
||||
if ($this->configRepository->hasProfessionalSituation()) {
|
||||
$builder
|
||||
->add('professionnalSituation', ChoiceType::class, [
|
||||
'required' => false,
|
||||
'choices' => $this->buildChoices(
|
||||
$this->configRepository->getProfessionalSituationsLabels()
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
if ($this->configRepository->hasProfessionalSituation()) {
|
||||
$builder
|
||||
->add('familialSituation', ChoiceType::class, [
|
||||
'required' => false,
|
||||
'choices' => $this->buildChoices(
|
||||
$this->configRepository->getFamilialSituationsLabels()
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
if ($options['show_start_date']) {
|
||||
$builder
|
||||
@@ -108,17 +118,18 @@ class FamilyMemberType extends AbstractType
|
||||
;
|
||||
}
|
||||
|
||||
private function getLinks()
|
||||
private function buildChoices($els)
|
||||
{
|
||||
$links = $this->configRepository
|
||||
->getLinksLabels();
|
||||
$choices = [];
|
||||
|
||||
// rewrite labels to filter in language
|
||||
foreach ($links as $key => $labels) {
|
||||
$links[$key] = $this->translatableStringHelper->localize($labels);
|
||||
foreach ($els as $key => $labels) {
|
||||
$choices[$this->translatableStringHelper->localize($labels)] = $key;
|
||||
}
|
||||
|
||||
return \array_flip($links);
|
||||
return $choices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user