{% if logged_in or not score.hidden %}
<div id="tema-score-{{ score.id }}">
  <h5 class="text-sm text-beige text-right">
    {{ score.title }}
    {% if logged_in and score.id is not none %}
      {% if score.source == "" %}
        <i>(Partitura buida)</i>
      {% elif score.errors %}
        <i>(Partitura amb errors)</i>
      {% endif %}
      {% if score.hidden %}
        <i>(Privada)</i>
      {% endif %}
    {% endif %}
    {% if logged_in and score.id is not none %}
    {% if score.hidden %}
      <button title="Mostra la partitura"
              class="mx-1"
              hx-put="/api/tema/{{ score.tema_id }}/score/{{ score.id }}/show"
              hx-target="#tema-score-{{ score.id }}"
              hx-swap="outerHTML">
        <i class="fa fa-eye-slash" aria-hidden="true"></i>
      </button>
    {% else %}
      <button title="Amaga la partitura"
              class="mx-1"
              hx-put="/api/tema/{{ score.tema_id }}/score/{{ score.id }}/hide"
              hx-target="#tema-score-{{ score.id }}"
              hx-swap="outerHTML">
        <i class="fa fa-eye" aria-hidden="true"></i>
      </button>
    {% endif %}
    <button title="Modifica la partitura"
            class="mx-1"
            hx-get="/api/tema/{{ score.tema_id }}/editor/score/{{ score.id }}"
            hx-target="#tema-score-{{ score.id }}"
            hx-swap="outerHTML">
      <i class="fa fa-pencil" aria-hidden="true"></i>
    </button>
    <button title="Esborra la partitura"
            class="mx-1"
            hx-delete="/api/tema/{{ score.tema_id }}/score/{{ score.id }}"
            hx-target="#tema-score-{{ score.id }}"
            hx-swap="outerHTML">
      <i class="fa fa-times" aria-hidden="true"></i>
    </button>
    {% endif %}
  </h5>
  <hr class="h-px mt-1 mb-3 bg-beige border-0">
  {% if score.img_url is not none %}
  <div class="flex flex-col items-center
              bg-white rounded-lg ">
    <div class="flex justify-center">
      <a href="{{ score.pdf_url or score.img_url }}" target="_blank">
        <img class="py-4 px-2 max-w-full h-auto" src="{{ score.img_url }}" />
      </a>
    </div>
    {% if score.pdf_url is not none %}
      <div class="bg-beige border rounded border-beige m-2 p-1">
        <a href="{{ score.pdf_url }}" target="_blank">Obre el PDF</a>
      </div>
    {% endif %}
  </div>
  {% elif score.pdf_url is not none %}
  <div class="flex flex-col items-center">
    {% set pdf_url = score.pdf_url %}
    {% include "fragments/pdf_viewer.html" %}
  </div>
  {% endif %}
</div>
{% endif %}
