Merge branch 'issue601_admin_social_work_social_action' into 'master'

admin: repair social action edit

See merge request Chill-Projet/chill-bundles!434
This commit is contained in:
Julien Fastré 2022-05-27 14:42:03 +00:00
commit 9511d6eaee
5 changed files with 31 additions and 24 deletions

View File

@ -11,12 +11,12 @@ and this project adheres to
## Unreleased
<!-- write down unreleased development here -->
* [admin] repair edit of social action in the admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/601)
* [admin]: add select2 to Goal form type entity fields (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/702)
* [main] allow hide permissions group list menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
* [main] allow hide change user password menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
* [main] filter user jobs by active jobs (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
* [main] add civility to User (entity, migration and form type) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
* [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)

View File

@ -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);

View File

@ -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',

View File

@ -5,7 +5,6 @@
{% block table_entities_thead_tr %}
<th>{{ 'Id'|trans }}</th>
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Social actions'|trans }}</th>
<th>{{ 'goal.results'|trans }}</th>
<th>{{ 'goal.desactivationDate'|trans }}</th>
<th>&nbsp;</th>
@ -17,11 +16,6 @@
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% for sa in entity.socialActions %}
{{ sa.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
{% endfor %}
</td>
<td>
{% for sa in entity.results %}
{{ sa.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
{% endfor %}

View File

@ -8,9 +8,20 @@
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block crud_content_form_rows %}
<div class="mb-3 row">
<label class="col-form-label col-sm-4 required" for="social_action_ordering">{{ 'Parent'|trans }}</label>
<div class="col-sm-8">{{ entity.parent|chill_entity_render_box }}</div>
</div>
<div class="mb-3 row">
<label class="col-form-label col-sm-4 required" for="social_action_ordering">{{ 'Social issue'|trans }}</label>
<div class="col-sm-8">{{ entity.issue|chill_entity_render_box }}</div>
</div>
{% 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 %}