Partage d'export enregistré et génération asynchrone des exports

This commit is contained in:
2025-07-08 13:53:25 +00:00
parent c4cc0baa8e
commit 8bc16dadb0
447 changed files with 14134 additions and 3854 deletions

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Symfony\Component\Clock\ClockInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
@@ -28,6 +29,8 @@ class SocialActionRender implements ChillEntityRenderInterface
self::NO_BADGE => false,
self::SHOW_AND_CHILDREN => false,
self::AND_CHILDREN_MENTION => 'social_action.and children',
self::SHOW_SOCIAL_ISSUE => false,
self::SHOW_DEACTIVATED => false,
];
/**
@@ -43,7 +46,27 @@ class SocialActionRender implements ChillEntityRenderInterface
*/
final public const SHOW_AND_CHILDREN = 'show_and_children';
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {}
/**
* Append the related social issue next to the social action name, in parenthesis.
*
* Currently only in string rendering.
*/
final public const SHOW_SOCIAL_ISSUE = 'show_social_issue';
/**
* Append a mention "deactivated" next to the social action name, in parenthesis, if the social action is deactivated.
*
* Currently only in string rendering.
*/
final public const SHOW_DEACTIVATED = 'show_deactivated';
public function __construct(
private readonly TranslatableStringHelper $translatableStringHelper,
private readonly \Twig\Environment $engine,
private readonly TranslatorInterface $translator,
private readonly SocialIssueRender $socialIssueRender,
private readonly ClockInterface $clock,
) {}
public function renderBox($socialAction, array $options): string
{
@@ -79,6 +102,14 @@ class SocialActionRender implements ChillEntityRenderInterface
$title .= ' ('.$this->translator->trans($options[self::AND_CHILDREN_MENTION]).')';
}
if ($options[self::SHOW_SOCIAL_ISSUE]) {
$title .= ' ('.$this->socialIssueRender->renderString($socialAction->getIssue(), []).')';
}
if ($options[self::SHOW_DEACTIVATED] && $socialAction->isDesactivated(\DateTime::createFromImmutable($this->clock->now()))) {
$title .= ' ('.$this->translator->trans('Disabled').')';
}
return $title;
}