Layout for the email to external

This commit is contained in:
Julien Fastré 2024-10-10 12:41:57 +02:00
parent 292034d64d
commit 8589bada3f
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
4 changed files with 105 additions and 6 deletions

View File

@ -1,6 +1,88 @@
Un message vous a été envoyé. Vous pouvez le consulter à cette adresse
{{ absolute_url(path('chill_main_workflow_send_view_public', {'uuid': send.uuid, 'verificationKey': send.privateToken})) }}
{{ 'workflow.send_external_message.document_available_until'|trans({ 'expiration': send.expireAt}, null, lang) }}
<!doctype html>
<html>
<body>
{%- set previous = send.entityWorkflowStepChained.previous -%}
{%- if previous.transitionBy is not null -%}
{%- set sender = previous.transitionBy|chill_entity_render_string -%}
{%- else -%}
{%- set sender = 'workflow.send_external_message.sender_system_user'|trans -%}
{%- endif -%}
<script type="application/ld+json">
{%- set data = {
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"url": absolute_url(path('chill_main_workflow_send_view_public', {'uuid': send.uuid, 'verificationKey': send.privateToken})),
"name": 'workflow.send_external_message.see_docs_action_name'|trans
},
"description": 'workflow.send_external_message.see_doc_action_description'|trans({'sender': sender}),
} -%}
{{- data|json_encode|raw -}}
</script>
<div
style='background-color:#F5F5F5;color:#262626;font-family:"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif;font-size:16px;font-weight:400;letter-spacing:0.15008px;line-height:1.5;margin:0;padding:32px 0;min-height:100%;width:100%'
>
<table
align="center"
width="100%"
style="margin:0 auto;max-width:600px;background-color:#FFFFFF"
role="presentation"
cellspacing="0"
cellpadding="0"
border="0"
>
<tbody>
<tr style="width:100%">
<td>
<div style="font-weight:normal;padding:16px 24px 16px 24px">
{{ 'workflow.send_external_message.greeting'|trans }},
</div>
<div style="font-weight:normal;padding:16px 24px 16px 24px">
{{ 'workflow.send_external_message.explanation'|trans({'sender': sender}) }}
</div>
<div style="font-weight:normal;padding:16px 24px 16px 24px">
{{ 'workflow.send_external_message.confidentiality'|trans }}
</div>
<div style="text-align:center;padding:16px 24px 16px 24px">
<a
href="{{ absolute_url(path('chill_main_workflow_send_view_public', {'uuid': send.uuid, 'verificationKey': send.privateToken})) }}"
style="color:#FFFFFF;font-size:16px;font-weight:bold;background-color:#334d5c;border-radius:4px;display:inline-block;padding:12px 20px;text-decoration:none"
target="_blank"
><span
><!--[if mso
]><i
style="letter-spacing: 20px;mso-font-width:-100%;mso-text-raise:30"
hidden
>&nbsp;</i
><!
[endif]--></span
><span>
{{ 'workflow.send_external_message.button_content'|trans({'sender': sender}) }}
</span><span
><!--[if mso
]><i
style="letter-spacing: 20px;mso-font-width:-100%"
hidden
>&nbsp;</i
><!
[endif]--></span
></a
>
</div>
<div style="font-weight:normal;padding:16px 24px 16px 24px">
{{ 'workflow.send_external_message.document_available_until'|trans({ 'expiration': send.expireAt}, null, lang) }}
</div>
<div style="font-weight:normal;padding:16px 24px 16px 24px">
{{ 'workflow.send_external_message.or_see_link'|trans }}&nbsp;:
</div>
<div style="font-size:16px;padding:16px 24px 16px 24px">
<code>{{ absolute_url(path('chill_main_workflow_send_view_public', {'uuid': send.uuid, 'verificationKey': send.privateToken})) }}</code>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

View File

@ -13,6 +13,7 @@ namespace Chill\MainBundle\Workflow\Messenger;
use Chill\MainBundle\Entity\Workflow\EntityWorkflowSend;
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
use Chill\MainBundle\Workflow\EntityWorkflowManager;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
@ -25,6 +26,7 @@ final readonly class PostSendExternalMessageHandler implements MessageHandlerInt
private EntityWorkflowRepository $entityWorkflowRepository,
private MailerInterface $mailer,
private BodyRendererInterface $bodyRenderer,
private EntityWorkflowManager $workflowManager,
) {}
public function __invoke(PostSendExternalMessage $message): void
@ -42,9 +44,12 @@ final readonly class PostSendExternalMessageHandler implements MessageHandlerInt
private function sendEmailToDestinee(EntityWorkflowSend $send, PostSendExternalMessage $message): void
{
$entityWorkflow = $send->getEntityWorkflowStep()->getEntityWorkflow();
$title = $this->workflowManager->getHandler($entityWorkflow)->getEntityTitle($entityWorkflow);
$email = new TemplatedEmail();
$email
->to($send->getDestineeThirdParty()?->getEmail() ?? $send->getDestineeEmail())
->subject($title)
->htmlTemplate('@ChillMain/Workflow/workflow_send_external_email_to_destinee.html.twig')
->context([
'send' => $send,

View File

@ -69,6 +69,11 @@ workflow:
}
send_external_message:
document_available_until: Le lien sera valable jusqu'au {expiration, date, long} à {expiration, time, short}.
explanation: '{sender} vous fait parvenir des documents.'
button_content: 'Consulter les documents envoyés par {sender}'
confidentiality: Nous attirons votre attention sur le fait que ces documents sont confidentiels.
see_doc_action_description: 'Voir les documents confidentiels envoyés par {sender}'
external_views:
last_view_at: Dernière vue le {at, date, long} à {at, time, short}
number_of_views: >-

View File

@ -571,6 +571,13 @@ workflow:
expired_link_title: Lien expiré
expired_link_explanation: Le lien a expiré, vous ne pouvez plus visualiser ce document.
send_external_message:
greeting: Bonjour
or_see_link: 'Si le clic sur le bouton ne fonctionnait pas, vous pouvez consulter les documents en copiant le lien ci-dessous, et en l''ouvrant dans votre navigateur'
use_button: Pour accéder à ces documents, vous pouvez utiliser le bouton ci-dessous
see_docs_action_name: Voir les documents confidentiels
sender_system_user: le logiciel chill
signature_zone:
title: Signatures électroniques
button_sign: Signer