accompanying course summary: add social actions

This commit is contained in:
nobohan 2021-06-28 16:16:55 +02:00
parent bc6ba88acd
commit f92d710a26
3 changed files with 107 additions and 2 deletions

View File

@ -7,6 +7,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent; use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@ -35,14 +36,18 @@ class AccompanyingCourseController extends Controller
protected ValidatorInterface $validator; protected ValidatorInterface $validator;
private AccompanyingPeriodWorkRepository $workRepository;
public function __construct( public function __construct(
SerializerInterface $serializer, SerializerInterface $serializer,
EventDispatcherInterface $dispatcher, EventDispatcherInterface $dispatcher,
ValidatorInterface $validator ValidatorInterface $validator,
AccompanyingPeriodWorkRepository $workRepository
) { ) {
$this->serializer = $serializer; $this->serializer = $serializer;
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
$this->validator = $validator; $this->validator = $validator;
$this->workRepository = $workRepository;
} }
/** /**
@ -102,9 +107,16 @@ class AccompanyingCourseController extends Controller
['date' => 'DESC'], ['date' => 'DESC'],
); );
$works = $this->workRepository->findByAccompanyingPeriod(
$accompanyingCourse,
['startDate' => 'DESC', 'endDate' => 'DESC'],
3
);
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [ return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
'accompanyingCourse' => $accompanyingCourse, 'accompanyingCourse' => $accompanyingCourse,
'withoutHousehold' => $withoutHousehold, 'withoutHousehold' => $withoutHousehold,
'works' => $works,
'activities' => $activities 'activities' => $activities
]); ]);
} }

View File

@ -222,11 +222,103 @@
<h2>{{ 'Social actions'|trans }}</h2> <h2>{{ 'Social actions'|trans }}</h2>
{% set person = null %} {% for w in works %}
<div class="item">
<div class="title">
<h2 class="action_title">
{{ w.socialAction|chill_entity_render_box({ 'no-badge': false }) }}
</h2>
</div>
<div class="timeline">
<ul class="timeline">
<li class="completed">
<div class="date">
<span>{{ w.createdAt|format_date('long') }}</span>
</div>
<div class="label">
<span>{{ 'accompanying_course_work.create_date'|trans }}</span>
</div>
</li>
<li class="completed">
<div class="date">
<span>{{ w.startDate|format_date('long') }}</span>
</div>
<div class="label">
<span>{{ 'accompanying_course_work.start_date'|trans }}</span>
</div>
</li>
<li class="{%if date(w.endDate) < date('now') %}completed{% endif %}">
<div class="date">
<span>{{ w.endDate|format_date('long') }}</span>
</div>
<div class="label">
<span>{{ 'accompanying_course_work.end_date'|trans }}</span>
</div>
</li>
</ul>
</div>
{% if w.results|length > 0 %}
<div class="objective_results objective_results__without-objectives">
<div class="obj without_objective">
<p class="title_label">{{ 'accompanying_course_work.goal'|trans }}</p>
<p class="chill-no-data-statement">{{ 'accompanying_course_work.results without objective'|trans }}</p>
</div>
<div class="res results">
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
<ul class="result_list">
{% for r in w.results %}
<li class="badge badge-primary">{{ r.title|localize_translatable_string }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if w.goals|length > 0 %}
{% for g in w.goals %}
<div class="objective_results objective_results--with-objectives">
<div class="objective obj">
<p class="title_label">{{ 'accompanying_course_work.goal'|trans }}</p>
<h3 class="goal_title">{{ g.goal.title|localize_translatable_string }}</h3>
</div>
<div class="results res">
{% if g.results|length == 0 %}
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
<p class="chill-no-data-statement">{{ 'accompanying_course_work.no_results'|trans }}</p>
{% else %}
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
<ul class="result_list">
{% for r in g.results %}
<li class="badge badge-primary">{{ r.title|localize_translatable_string }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
<div class="updatedBy">
{{ 'Last updated by'|trans}}: {{ w.updatedBy|chill_entity_render_box }}, {{ w.updatedAt|format_datetime('long', 'short') }}
</div>
</div>
{% endfor %}
{% block contentActivity %} {% block contentActivity %}
{% set person = null %}
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %} {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %}
{% endblock %} {% endblock %}
{# ==> insert accompanyingCourse vue component #} {# ==> insert accompanyingCourse vue component #}
<div id="accompanying-course"></div> <div id="accompanying-course"></div>
{% endblock %} {% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('accompanying_course_work_list') }}
{% endblock %}

View File

@ -46,6 +46,7 @@ services:
$serializer: '@Symfony\Component\Serializer\SerializerInterface' $serializer: '@Symfony\Component\Serializer\SerializerInterface'
$dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface' $dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
$validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface'
$workRepository: '@Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
Chill\PersonBundle\Controller\AccompanyingCourseApiController: Chill\PersonBundle\Controller\AccompanyingCourseApiController: