WIP: render entities

This commit is contained in:
2026-02-13 19:22:08 +01:00
parent 32c5f21438
commit 22ace0c66e
20 changed files with 337 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Audit\Displayer;
use Chill\MainBundle\Audit\Subject;
use Chill\MainBundle\Audit\SubjectDisplayerInterface;
use Twig\Environment;
final readonly class AccompanyingPeriodSubjectDisplayer implements SubjectDisplayerInterface
{
public function __construct(private Environment $twig) {}
public function supportsDisplay(Subject $subject, array $optons = []): bool
{
return 'accompanying_period' === $subject->type;
}
public function display(Subject $subject, array $options = []): string
{
return $this->twig->render(
'@ChillPerson/Audit/accompanying_period.html.twig',
['id' => $subject->identifiers['id']]
);
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Audit\Displayer;
use Chill\MainBundle\Audit\Subject;
use Chill\MainBundle\Audit\SubjectDisplayerInterface;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Twig\Environment;
class AccompanyingPeriodWorkSubjectDisplayer implements SubjectDisplayerInterface
{
public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository, private Environment $twig) {}
public function supportsDisplay(Subject $subject, array $optons = []): bool
{
return 'accompanying_period_work' === $subject->type;
}
public function display(Subject $subject, array $options = []): string
{
$work = $this->accompanyingPeriodWorkRepository->find($subject->identifiers['id']);
return $this->twig->render('@ChillPerson/Audit/accompanying_period_work.html.twig', [
'work' => $work, 'id' => $subject->identifiers['id']]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Audit\Displayer;
use Chill\MainBundle\Audit\Subject;
use Chill\MainBundle\Audit\SubjectDisplayerInterface;
use Chill\PersonBundle\Repository\PersonRepository;
use Twig\Environment;
final readonly class PersonSubjectDisplayer implements SubjectDisplayerInterface
{
public function __construct(
private PersonRepository $personRepository,
private Environment $twig,
) {}
public function supportsDisplay(Subject $subject, array $optons = []): bool
{
return 'person' === $subject->type;
}
public function display(Subject $subject, array $options = []): string
{
$person = $this->personRepository->find($subject->identifiers['id']);
return $this->twig->render('@ChillPerson/Audit/person.html.twig', ['id' => $subject->identifiers['id'], 'person' => $person]);
}
}

View File

@@ -0,0 +1 @@
<span>{{ 'audit.accompanying_period.accompanying_period_number'|trans({'{id}': id}) }} <a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': id} ) }}"><i class="bi bi-link"></i></a></span>

View File

@@ -0,0 +1,2 @@
<span>{{ 'audit.accompanying_period_work.accompanying_period_work_number'|trans({'id': id}) }}
{%- if work is not null %}: {{ work.socialAction.title|localize_translatable_string }}{% endif %}</span>

View File

@@ -0,0 +1 @@
<span>{% if person is not null %}{{ person|chill_entity_render_box }} <span><a href="{{ path('chill_person_view', {'person_id': id}) }}"><i class="bi bi-link"></i></a></span>{% else %}{{ 'audit.person.person_not_found_with_id'|trans({'id': id}) }}{% endif %}</span>

View File

@@ -1574,3 +1574,11 @@ my_parcours_filters:
document_duplicate:
to_evaluation_success: "Le document a été dupliquer"
audit:
person:
person_not_found_with_id: "Personne inconnue avec l'identifiant {id}"
accompanying_period:
accompanying_period_number: "Parcours n°{id}"
accompanying_period_work:
accompanying_period_work_number: "Action d'accompagnement n°{id}"