{% with var=json.fields varwf=json.workflow.fields %}

  {% if var.utiliser_img_modele is True %}
    <!-- Recup image du modèle -->
    <div style="
      max-width: 100%;
      margin-left: auto;
      margin-right: auto;">
      {% with param=cards|objects:"pn_modelesmessages"|filter_by_internal_id:var.modelemsg_structured.id|get_full|first|get:"fields" %}
        {% with img=param|get:"detail_image" %}
          {% if img %}
            {% with urlimg=img|get:"url" %}
              <img  style="max-width:100%; max-height: 300px; width: 100%; object-fit: cover" src="{% make_public_url url=urlimg %}">
            {% endwith %}
          {% endif %}
        {% endwith %}
      {% endwith %}
    </div>
  {% elif var.imgalerte %}
    <div style="
      max-width: 100%;
      margin-left: auto;
      margin-right: auto;">
      {% with urlimg=var.imgalerte|get:"url" %}
        <img  style="max-width:100%; max-height: 300px; width: 100%; object-fit: cover" src="{% make_public_url url=urlimg %}">
      {% endwith %}
    </div>
  {% endif %}


  <h1 style="padding:0px 20px;" >{{ var.detail_titre }}</h1>

  <div style="padding:0px 20px;" >
    <strong>{{ var.detail_chapeau|linebreaks }}</strong>
    <p>{{ var.detail_description|linebreaks }}</p>

    {% if var.detail_lien1 or var.detail_lien2 or var.detail_lien3 %}
      <p><strong>Liens</strong></p>
      {% if var.detail_lien1 %}<p><a href="{{ var.detail_lien1 }}">{{ var.detail_lien1_libelle }}</a>{% endif %}
      {% if var.detail_lien2 %}<br><a href="{{ var.detail_lien2 }}">{{ var.detail_lien2_libelle }}</a>{% endif %}
      {% if var.detail_lien3 %}<br><a href="{{ var.detail_lien3 }}">{{ var.detail_lien3_libelle }}</a>{% endif %}
      </p>
    {% endif %}
  </div>

  {% if var.detail_encart == True %}
    <div style="padding:20px;background-color:whitesmoke;" >
      <p><strong>{{ var.titre_encart|upper }}</strong></p>
      <p>{{ var.contenu_encart|linebreaksbr }}</p>
      {% if var.lien_encart %}<p><a href="{{ var.lien_encart }}">{{ var.libelle_lien_encart }}</a></p>{% endif %}
    </div>
  {% endif %}

{% endwith %}

{# <pre>{{json|pprint}}</pre> #}
