admin: adapt social work form type and templates

This commit is contained in:
nobohan
2022-05-11 11:50:17 +02:00
parent 629dbb9137
commit fa458c54ec
6 changed files with 73 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\SocialWork\Goal;
use Chill\PersonBundle\Entity\SocialWork\Result;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
@@ -52,6 +53,15 @@ class GoalType extends AbstractType
},
])
->add('results', EntityType::class, [
'class' => Result::class,
'required' => false,
'multiple' => true,
'choice_label' => function (Result $r) {
return $this->translatableStringHelper->localize($r->getTitle());
},
])
->add('desactivationDate', ChillDateType::class, [
'required' => false,
'label' => 'goal.desactivationDate',

View File

@@ -15,6 +15,9 @@ use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\DateIntervalType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Chill\PersonBundle\Entity\SocialWork\Goal;
use Chill\PersonBundle\Entity\SocialWork\Result;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -57,6 +60,34 @@ class SocialActionType extends AbstractType
return $this->translatableStringHelper->localize($issue->getTitle());
},
])
->add('results', EntityType::class, [
'class' => Result::class,
'required' => false,
'multiple' => true,
'choice_label' => function (Result $r) {
return $this->translatableStringHelper->localize($r->getTitle());
},
])
->add('goals', EntityType::class, [
'class' => Goal::class,
'required' => false,
'multiple' => true,
'choice_label' => function (Goal $g) {
return $this->translatableStringHelper->localize($g->getTitle());
},
])
->add('evaluations', EntityType::class, [
'class' => Evaluation::class,
'required' => false,
'multiple' => true,
'choice_label' => function (Evaluation $e) {
return $this->translatableStringHelper->localize($e->getTitle());
},
])
->add('defaultNotificationDelay', DateIntervalType::class, [
'label' => 'socialAction.defaultNotificationDelay',
'required' => false,