<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8">
  <title>{{ event.name }}</title>
</head>
<body style="margin:0; padding:0; background-color:#f0f4f8;">
<center style="width:100%; background-color:#f0f4f8;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">

<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="background:#ffffff;">

<!-- HEADER -->
<tr>
<td style="padding:20px; text-align:center; background:#0066cc; color:#ffffff; font-family:Arial, Helvetica, sans-serif;">
<h1 style="margin:0; font-size:24px;">✨ {{ event.name }} ✨</h1>
</td>
</tr>

<!-- EVENT IMAGE -->
<tr>
<td>
<img src="{{ ('/events/' ~ (event.picture ?: 'placeholder.webp'))|base64img }}"
     width="600" height="200"
     style="display:block; border:0;">
</td>
</tr>

<!-- EVENT CONTENT -->
<tr>
<td style="padding:20px; border-bottom:1px solid #e0e0e0;">

<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="background:#e6f2ff; padding:15px;">
<p style="margin:0 0 6px 0; font-size:14px; color:#004080;">
<strong>Lieu :</strong> A COMPLETER
</p>
<p style="margin:0; font-size:14px; color:#004080;">
<strong>Date :</strong> du {{ event.startOn|date('d/m/Y \\à H:i') }} au {{ event.endOn|date('d/m/Y \\à H:i') }}
</p>
</td>
</tr>
</table>

<p style="margin:16px 0; font-size:14px; color:#555; line-height:1.5;">
{{ event.description }}
</p>

{% set authors = [] %}
{% for party in event.parties %}
  {% if party.gamemasterIsAuthor and party.gamemaster not in authors %}
    {% set authors = authors|merge([party.gamemaster]) %}
  {% endif %}
{% endfor %}

{% if authors|length > 0 %}
<p style="margin:16px 0; font-size:16px; color:#333;">
<strong>Les auteur(rice)s présent(e)s</strong>
</p>

{% for gamemaster in authors %}
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f5f5f5; margin-bottom:16px;">
<tr>
<td width="128" valign="top" style="padding:12px;">
<img src="{{ ('/gamemasters/' ~ (gamemaster.picture ?: 'placeholder.webp'))|base64img }}"
     width="128"
     style="display:block; border-radius:6px;">
</td>
<td valign="top" style="padding:12px;">
<p style="margin:0; font-size:16px; color:#004080;">
<strong>{{ gamemaster.preferedName }}</strong>
</p>
<p style="margin:6px 0 0 0; font-size:13px; color:#555;">
{{ gamemaster.description }}
</p>
<p style="margin:6px 0 0 0; font-size:13px; color:#555;">
Auteur(rice) de : {{ gamemaster.authorOfGames|map(game => game.name)|join(', ') }}
</p>
</td>
</tr>
</table>
{% endfor %}
{% endif %}

</td>
</tr>

<!-- GAMES LOOP -->
{% for party in event.parties %}

<tr>
<td>

<!-- Game image -->
<img src="{{ ('/games/' ~ (party.game.picture ?: 'placeholder.webp'))|base64img }}"
     width="600" height="200"
     style="display:block; border:0;">

</td>
</tr>

<tr>
<td style="padding:20px; border-bottom:1px solid #e0e0e0;">

<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="background:#e6f2ff; padding:15px;">
<h2 style="margin:0 0 6px 0; font-size:18px; color:#004080;">
{{ party.game.name }}
</h2>
<p style="margin:0; font-size:14px; color:#004080;">
<strong>Date :</strong> du {{ party.startOn|date('d/m/Y \\à H:i') }} au {{ party.endOn|date('d/m/Y \\à H:i') }}
</p>
</td>
</tr>
</table>

<h3 style="margin:16px 0 6px 0; font-size:14px; color:#004080;">Le jeu</h3>
<p style="margin:0 0 16px 0; font-size:14px; color:#555; line-height:1.5;">
{{ party.game.description }}
</p>

{% if party.description %}
<h3 style="margin:0 0 6px 0; font-size:14px; color:#004080;">La partie proposée</h3>
<p style="margin:0; font-size:14px; color:#555; line-height:1.5;">
{{ party.description }}
</p>
{% endif %}

</td>
</tr>

{% endfor %}
<!-- END GAMES LOOP -->

<tr>
<td style="padding:20px; text-align:center;">

<p style="margin:0 0 16px 0; font-size:14px; color:#555;">
Vous pouvez vous inscrire dès à présent à nos animations !
</p>

<table role="presentation" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td style="background:#0066cc; padding:10px 18px;">
<a href="{{ app_url ~ path('app_main_booking', {'id': event.id, 'view': 'pictures'})}}"
   style="color:#ffffff; text-decoration:none; font-size:14px;">
Voir le détail et m'inscrire
</a>
</td>
<td width="10"></td>
<td style="background:#0099cc; padding:10px 18px;">
<a href="{{ app_url|replace({'https://' : 'webcal://'}) ~ path('app_main_ics', {'id': event.id}) }}"
   style="color:#ffffff; text-decoration:none; font-size:14px;">
Ajouter à mon agenda
</a>
</td>
</tr>
</table>

</td>
</tr>

<!-- FOOTER -->
<tr>
<td style="padding:20px; text-align:center; font-size:12px; color:#888;">
Réalisé à partir de ORGASSO : une application pour tous vos événements rôlistiques !
</td>
</tr>

</table>

</td>
</tr>
</table>
</center>
</body>
</html>