add ordering on some social work + minor improves

This commit is contained in:
Julien Fastré 2022-05-13 15:36:20 +02:00
parent b26fcc4566
commit a9df9f4880
8 changed files with 24 additions and 54 deletions

View File

@ -19,7 +19,7 @@ class SocialActionController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
$query->addOrderBy('e.ordering', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}

View File

@ -19,7 +19,7 @@ class SocialIssueController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
$query->addOrderBy('e.ordering', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}

View File

@ -22,6 +22,7 @@ use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -60,11 +61,15 @@ class SocialActionType extends AbstractType
return $this->translatableStringHelper->localize($issue->getTitle());
},
])
->add('ordering', NumberType::class, [
'required' => true,
'scale' => 6,
])
->add('results', EntityType::class, [
'class' => Result::class,
'required' => false,
'multiple' => true,
'attr' => ['class' => 'select2'],
'choice_label' => function (Result $r) {
return $this->translatableStringHelper->localize($r->getTitle());
},
@ -74,6 +79,7 @@ class SocialActionType extends AbstractType
'class' => Goal::class,
'required' => false,
'multiple' => true,
'attr' => ['class' => 'select2'],
'choice_label' => function (Goal $g) {
return $this->translatableStringHelper->localize($g->getTitle());
},
@ -83,6 +89,7 @@ class SocialActionType extends AbstractType
'class' => Evaluation::class,
'required' => false,
'multiple' => true,
'attr' => ['class' => 'select2'],
'choice_label' => function (Evaluation $e) {
return $this->translatableStringHelper->localize($e->getTitle());
},

View File

@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -41,6 +42,10 @@ class SocialIssueType extends AbstractType
'required' => false,
'choice_label' => fn (SocialIssue $issue): ?string => $this->translatableStringHelper->localize($issue->getTitle()),
])
->add('ordering', NumberType::class, [
'required' => true,
'scale' => 6,
])
->add('desactivationDate', ChillDateType::class, [
'label' => 'goal.desactivationDate',
'required' => false,

View File

@ -39,7 +39,7 @@ class AdminAccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 2200,
'icons' => ['road'],
'icons' => ['random'],
]);
$menu->addChild('person_admin.closing motives', [

View File

@ -5,13 +5,9 @@
{% block table_entities_thead_tr %}
<th>{{ 'Id'|trans }}</th>
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Parent'|trans }}</th>
<th>{{ 'Social issue'|trans }}</th>
<th>{{ 'Results'|trans }}</th>
<th>{{ 'Goals'|trans }}</th>
<th>{{ 'Evaluations'|trans }}</th>
<th>{{ 'Ordering'|trans }}</th>
<th>{{ 'goal.desactivationDate'|trans }}</th>
<th>{{ 'socialAction.defaultNotificationDelay'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
@ -19,50 +15,14 @@
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if entity.parent is not null %}
{{ entity.parent.title|localize_translatable_string }}
{% endif %}
</td>
<td>
{% for e in entity.issue %}
{{ e.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
{% endfor %}
</td>
<td>
{% for e in entity.results %}
{{ e.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
{% endfor %}
</td>
<td>
{% for e in entity.goals %}
{{ e.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
{% endfor %}
</td>
<td>
{% for e in entity.evaluations %}
{{ e.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
{% endfor %}
</td>
<td>{{ entity|chill_entity_render_box }}</td>
<td>{{ entity.issue|chill_entity_render_box }}</td>
<td>{{ entity.ordering }}</td>
<td>
{% if entity.desactivationDate is not null %}
{{ entity.desactivationDate|date('Y-m-d') }}
{% endif %}
</td>
<td>
{% if entity.defaultNotificationDelay is not null %}
{% if entity.defaultNotificationDelay.d > 0 %}
{{ entity.defaultNotificationDelay.d }} {{'days'|trans}}
{% endif %}
{% if entity.defaultNotificationDelay.m > 0 %}
{{ entity.defaultNotificationDelay.m }} {{'months'|trans}}
{% endif %}
{% if entity.defaultNotificationDelay.y > 0 %}
{{ entity.defaultNotificationDelay.y }} {{'years'|trans}}
{% endif %}
{% endif %}
</td>
<td>
<ul class="record_actions">
<li>

View File

@ -5,7 +5,7 @@
{% block table_entities_thead_tr %}
<th>{{ 'Id'|trans }}</th>
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Parent'|trans }}</th>
<th>{{ 'Ordering'|trans }}</th>
<th>{{ 'goal.desactivationDate'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
@ -14,12 +14,10 @@
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.title|localize_translatable_string }}</td>
<td>
{% if entity.parent is not null %}
{{ entity.parent.title|localize_translatable_string }}
{% endif %}
{{ entity|chill_entity_render_box }}
</td>
<td>{{ entity.ordering }}</td>
<td>
{% if entity.desactivationDate is not null %}
{{ entity.desactivationDate|date('Y-m-d') }}

View File

@ -462,7 +462,7 @@ socialAction:
household:
allowHolder: Peut être titulaire
shareHousehold: Peut être partagé
shareHousehold: Membre du ménage
relation:
title: Premier membre