{% extends '_layouts/base-web-layout' %}

{% set socialArr = [
{
icon: 'fb-share.svg',
url: 'https://www.facebook.com/sharer/sharer.php?u=' ~ entry.url
},
{
icon: 'twitter-share.svg',
url: 'https://twitter.com/intent/tweet?text=' ~ entry.title ~ ' , '
~ entry.url
},
{
icon: 'email-share.svg',
url: 'mailto:?subject=Checa este artículo que vi en ' ~ siteName
~ '&body=El artículo es:'
~ entry.title
~ '. Lo vi en '
~ siteName
~ ' y me pareció excelente. '
~ entry.url
}
] %}

{% set postDateEntry = entry.postDate %}

{% set textDateEntry = (postDateEntry|date('d')) ~ ' De '
~ (postDateEntry|date('F'))
~ ' '
~ (postDateEntry|date('Y'))
%}

{% if craft.app.language == 'en' %}
{% set textDateEntry = (postDateEntry|date('F')) ~ ' '
~ (postDateEntry|date('d'))
~ ', '
~ (postDateEntry|date('Y'))
%}
{% endif %}
{% block main %}
<main>
  {% block content %}
  {% block customCss %}
  <link rel="preload" href="/assets/css/pages/Entryreleases.page.css" as="style"
    onload="this.onload=null;this.rel='stylesheet'" />
  <noscript>
    <link rel="stylesheet" href="/assets/css/pages/Entryreleases.page.css" />
  </noscript>
  {% endblock %}
  {# ----- masterhead -----#}
  {% include "components/_masterHead-blog" with {
  title:entry.title,
  description:entry.description|chop(limit=30, unit='w'),
  image: entry.image,
  textDateEntry,
  autor:entry.fieldAuthor.one() ?? null,
  category: entry.contentPress.one() ?? null,
  } only %}
  {# ---- end masterhead --- #}
  {#------- body --------------- #}
  {% set bodyComponents = entry.bodypress.all() ?? null %}
  <section class="testimonialsEntry__body press__body pt-5 mb-5">
    <ul class="m-0 p-0 d-none d-md-block eventBody__socialList">
      {% for social in socialArr %}
      <li class="py-1">
        <a onclick="window.open(`{{
              social.url
              }}`, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
          <img data-src="/assets/img/{{ social.icon }}" alt="Social" loading="lazy" class="lazyload" />
        </a>
      </li>
      {% endfor %}
    </ul>
    {% if (bodyComponents|length) > 0 %}
    {% for children in bodyComponents %}
    {% include 'components/_pressblock/_' ~ children.type with {
    _block: children
    } only %}
    {% endfor %}
    {% endif %}
    {% if not entry.fieldPdf.isEmpty() %}
    <article class="testimonialsEntry__body press__body container my-4">
      <section class="press__pdf pb-5">
        <p class="press__pdf--title">
          {{ entry.fieldPdf.getCustomText() }}
        </p>
        <div class="press__pdf--content">
          <embed src="{{
            entry.fieldPdf.getUrl()
            }}#toolbar=1&navpanes=1&scrollbar=1" type="application/pdf" width="100%" height="879px" />
        </div>
      </section>
    </article>
    {% endif %}
  </section>
  {# --------------------------------#}
  {% set relatedpress = craft.entries().section('pressReleasesEntries').with(['image']).id('not ' ~ entry.id).orderBy('postDate desc').limit(3).collect()%}
  <section class="my-4">
    <div class="container">
      <div class="row pb-4">
        <div class="col-md-12">
          <p class="press__tags--title">{{'Etiquetas:'}}</p>
          <ul class="press__tags p-0">
            {% for item in entry.pressTags.all %}
            <li class="press__tags--item">{{item.title}}</li>
            {% endfor %}
          </ul>
        </div>
      </div>
      <div class="row">
        <div class="col-md-12 text-center">
          <h2 class="py-3">{{'Artículos recientes'|upper}}</h2>
        </div>
      </div>
      <div class="row">
        {% for card in relatedpress %}
        <div class="col-md-4">
          {% include 'components/_elementCard' with {
            img: card.image[0] ?? null,
            category: card.contentPress[0] ?? null,
            title: (card.title ?? null)|upper,
            url: card.url ?? null,
            date: {
              day: card.postDate|date('j'),
              month: card.postDate|date('F'),
              year: card.postDate|date('Y')
            }
          } only %}
        </div>
        {% endfor %}
      </div>
    </div>
    {% set componentsblog = globalPressComponents.mixSimpleOrIndex.all() ?? [] %}
    {% include '/pages/pagesBuilders/_type/_MixSimpleorIndex' with {Prefilledcomponents:componentsblog}  %} 
  </section>
  {% endblock %}
</main>
{% endblock %}