From bc410b02e778da6899ebb36a11af0d5c055a2bfe Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 25 May 2022 11:45:25 +0200 Subject: [PATCH 1/4] admin: do not use disabled for form widget with collections, see https://github.com/symfony/symfony/issues/18998 --- .../views/SocialWork/SocialAction/edit.html.twig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/edit.html.twig index 49d6635df..9ea984903 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/SocialAction/edit.html.twig @@ -8,9 +8,20 @@ {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% block crud_content_form_rows %} + +
+ +
{{ entity.parent|chill_entity_render_box }}
+
+ +
+ +
{{ entity.issue|chill_entity_render_box }}
+
+ {% for f in form %} {% if f.vars.name == 'parent' or f.vars.name == 'issue' %} - {{ form_row(f, { 'attr':{'disabled':'disabled'}}) }} + {{ form_widget(f, { 'attr':{'hidden':'hidden'}}) }} {% else %} {{ form_row(f) }} {% endif %} From 2ac78a12db30c8ad8191ba9f2fff9237a3971264 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 25 May 2022 11:46:03 +0200 Subject: [PATCH 2/4] admin: fix adding of evaluation to social action --- .../Entity/SocialWork/SocialAction.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 904950489..fbd271b44 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -46,10 +46,8 @@ class SocialAction private $desactivationDate; /** - * @ORM\ManyToMany( - * targetEntity=Evaluation::class, - * mappedBy="socialActions" - * ) + * @ORM\ManyToMany(targetEntity=Evaluation::class, inversedBy="socialActions") + * @ORM\JoinTable(name="chill_person_social_work_evaluation_action") */ private Collection $evaluations; @@ -110,6 +108,15 @@ class SocialAction return $this; } + public function addEvaluation(Evaluation $evaluation): self + { + if (!$this->evaluations->contains($evaluation)) { + $this->evaluations[] = $evaluation; + } + + return $this; + } + public function addGoal(Goal $goal): self { if (!$this->goals->contains($goal)) { @@ -300,6 +307,13 @@ class SocialAction return $this; } + public function removeEvaluation(Evaluation $evaluation): self + { + $this->evaluations->removeElement($evaluation); + + return $this; + } + public function removeGoal(Goal $goal): self { $this->goals->removeElement($goal); From 8863157fc9c8f113d4362dac6d6e514d6ea05bbc Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 25 May 2022 11:47:02 +0200 Subject: [PATCH 3/4] upd CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 077cc0242..8e0d98a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to ## Unreleased +* [admin] repair edit of social action in the admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/601) * [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592) * [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596) * [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587) From d4aba04a52a62bb828f742308841a817698d6bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 27 May 2022 16:41:38 +0200 Subject: [PATCH 4/4] do not show action when editing goals --- .../ChillPersonBundle/Form/SocialWork/GoalType.php | 12 ------------ .../Resources/views/SocialWork/Goal/index.html.twig | 6 ------ 2 files changed, 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php index 5fc77b410..812062137 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php @@ -43,17 +43,6 @@ class GoalType extends AbstractType ->add('title', TranslatableStringFormType::class, [ 'label' => 'Nom', ]) - - ->add('socialActions', EntityType::class, [ - 'class' => SocialAction::class, - 'required' => false, - 'multiple' => true, - 'choice_label' => function (SocialAction $issue) { - return $this->translatableStringHelper->localize($issue->getTitle()); - }, - 'attr' => ['class' => 'select2 '], - ]) - ->add('results', EntityType::class, [ 'class' => Result::class, 'required' => false, @@ -63,7 +52,6 @@ class GoalType extends AbstractType }, 'attr' => ['class' => 'select2 '], ]) - ->add('desactivationDate', ChillDateType::class, [ 'required' => false, 'label' => 'goal.desactivationDate', diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig index 20f944595..14e9bab73 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig @@ -5,7 +5,6 @@ {% block table_entities_thead_tr %} {{ 'Id'|trans }} {{ 'Title'|trans }} - {{ 'Social actions'|trans }} {{ 'goal.results'|trans }} {{ 'goal.desactivationDate'|trans }}   @@ -17,11 +16,6 @@ {{ entity.id }} {{ entity.title|localize_translatable_string }} - {% for sa in entity.socialActions %} - {{ sa.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %} - {% endfor %} - - {% for sa in entity.results %} {{ sa.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %} {% endfor %}