mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 11:18:25 +00:00 
			
		
		
		
	accompanying course summary: add social actions
This commit is contained in:
		@@ -7,6 +7,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
 | 
			
		||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
 | 
			
		||||
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
 | 
			
		||||
use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
 | 
			
		||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
 | 
			
		||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
 | 
			
		||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 | 
			
		||||
@@ -35,14 +36,18 @@ class AccompanyingCourseController extends Controller
 | 
			
		||||
 | 
			
		||||
    protected ValidatorInterface $validator;
 | 
			
		||||
 | 
			
		||||
    private AccompanyingPeriodWorkRepository $workRepository;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        SerializerInterface $serializer,
 | 
			
		||||
        EventDispatcherInterface $dispatcher,
 | 
			
		||||
        ValidatorInterface $validator
 | 
			
		||||
        ValidatorInterface $validator,
 | 
			
		||||
        AccompanyingPeriodWorkRepository $workRepository
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->serializer = $serializer;
 | 
			
		||||
        $this->dispatcher = $dispatcher;
 | 
			
		||||
        $this->validator = $validator;
 | 
			
		||||
        $this->workRepository = $workRepository;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -102,9 +107,16 @@ class AccompanyingCourseController extends Controller
 | 
			
		||||
            ['date' => 'DESC'],
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $works = $this->workRepository->findByAccompanyingPeriod(
 | 
			
		||||
            $accompanyingCourse,
 | 
			
		||||
            ['startDate' => 'DESC', 'endDate' => 'DESC'],
 | 
			
		||||
            3
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
 | 
			
		||||
            'accompanyingCourse' => $accompanyingCourse,
 | 
			
		||||
            'withoutHousehold' => $withoutHousehold,
 | 
			
		||||
            'works' => $works,
 | 
			
		||||
            'activities' => $activities
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -222,11 +222,103 @@
 | 
			
		||||
 | 
			
		||||
    <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 %}
 | 
			
		||||
        {% set person = null %}
 | 
			
		||||
        {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %}
 | 
			
		||||
    {% endblock %}
 | 
			
		||||
 | 
			
		||||
    {#  ==> insert accompanyingCourse vue component  #}
 | 
			
		||||
    <div id="accompanying-course"></div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% block css %}
 | 
			
		||||
  {{ parent() }}
 | 
			
		||||
  {{ encore_entry_link_tags('accompanying_course_work_list') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,7 @@ services:
 | 
			
		||||
            $serializer: '@Symfony\Component\Serializer\SerializerInterface'
 | 
			
		||||
            $dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
 | 
			
		||||
            $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface'
 | 
			
		||||
            $workRepository: '@Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository'
 | 
			
		||||
        tags: ['controller.service_arguments']
 | 
			
		||||
 | 
			
		||||
    Chill\PersonBundle\Controller\AccompanyingCourseApiController:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user