From fe22e6c7dcbd9055f69d0cd5c1914b1976a306f8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 25 Jun 2021 14:26:42 +0200 Subject: [PATCH] activity: create new vue subcomponent socialIssuesAcc --- .../ChillActivityBundle/Form/ActivityType.php | 30 +++++++++++-------- .../Resources/public/vuejs/Activity/App.vue | 6 ++-- .../Activity/components/SocialIssuesAcc.vue | 14 +++++++++ .../Resources/views/Activity/edit.html.twig | 8 +++-- .../Resources/views/Activity/new.html.twig | 9 +++--- 5 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 8af7a204c..55c68972e 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -105,7 +105,11 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) { - $builder->add('socialIssues', EntityType::class, [ + $builder->add('socialIssues', + /* + HiddenType::class + */ + EntityType::class, [ 'label' => $activityType->getLabel('socialIssues'), 'required' => $activityType->isRequired('socialIssues'), 'class' => SocialIssue::class, @@ -115,11 +119,16 @@ class ActivityType extends AbstractType 'multiple' => true, 'choices' => $accompanyingPeriod->getRecursiveSocialIssues(), 'expanded' => true, - ]); + ] + ); } if ($activityType->isVisible('socialActions') && $accompanyingPeriod) { - $builder->add('socialActions', EntityType::class, [ + $builder->add('socialActions', + /* + HiddenType::class + */ + EntityType::class, [ 'label' => $activityType->getLabel('socialActions'), 'required' => $activityType->isRequired('socialActions'), 'class' => SocialAction::class, @@ -129,7 +138,8 @@ class ActivityType extends AbstractType 'multiple' => true, 'choices' => $accompanyingPeriod->getRecursiveSocialActions(), 'expanded' => true, - ]); + ] + ); } if ($activityType->isVisible('date')) { @@ -203,9 +213,7 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('persons')) { - $builder->add('persons', HiddenType::class, [ - //'data_class' => Person::class, - ]); + $builder->add('persons', HiddenType::class); $builder->get('persons') ->addModelTransformer(new CallbackTransformer( function (iterable $personsAsIterable): string { @@ -226,9 +234,7 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('thirdParties')) { - $builder->add('thirdParties', HiddenType::class, [ - //'data_class' => ThirdParty::class, - ]); + $builder->add('thirdParties', HiddenType::class); $builder->get('thirdParties') ->addModelTransformer(new CallbackTransformer( function (iterable $thirdpartyAsIterable): string { @@ -260,9 +266,7 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('users')) { - $builder->add('users', HiddenType::class, [ - //'data_class' => User::class, - ]); + $builder->add('users', HiddenType::class); $builder->get('users') ->addModelTransformer(new CallbackTransformer( function (iterable $usersAsIterable): string { diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue index f8d3556e9..1ef31cc2e 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue @@ -1,15 +1,17 @@ diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue new file mode 100644 index 000000000..093c3ec6b --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig index 3024148e1..b8ba44419 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig @@ -19,13 +19,15 @@ {{ form_row(edit_form.scope) }} {% endif %} +{%- if edit_form.socialIssues is defined -%} + {{ form_row(edit_form.socialIssues) }} +{% endif %} + {%- if edit_form.socialActions is defined -%} {{ form_row(edit_form.socialActions) }} {% endif %} -{%- if edit_form.socialIssues is defined -%} - {{ form_row(edit_form.socialIssues) }} -{% endif %} +
{%- if edit_form.reasons is defined -%} {{ form_row(edit_form.reasons) }} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig index 2cca7ad2e..35e466915 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig @@ -24,14 +24,15 @@ {{ form_row(form.scope) }} {% endif %} -{%- if form.socialActions is defined -%} - {{ form_row(form.socialActions) }} -{% endif %} - {%- if form.socialIssues is defined -%} {{ form_row(form.socialIssues) }} {% endif %} +{%- if form.socialActions is defined -%} + {{ form_row(form.socialActions) }} +{% endif %} + +
{%- if form.reasons is defined -%} {{ form_row(form.reasons) }}