{% set main_score = tema.main_score() %}
{% if logged_in or tema.scores or main_score %}
<h4 class="pt-4 text-xl text-beige">Partitures</h4>
{% endif %}

{% if main_score is not none %}
  {% set score = main_score %}
  {% include "fragments/tema/score.html" %}
{% endif %}

{% if tema.scores %}
{% for score in tema.scores %}
  {% if score.id != main_score.id %}
    {% include "fragments/tema/score.html" %}
  {% endif %}
{% endfor %}
{% endif %}

{% if logged_in %}
<div id="new-score-target"></div>
<div class="flex flex-row my-2 justify-end">
  <button title="Afegeix una partitura"
          class="text-sm text-beige text-right"
          hx-post="/api/tema/{{ tema.id }}/score"
          hx-target="#new-score-target"
          hx-swap="beforebegin">
    <i class="fa fa-plus" aria-hidden="true"></i>
    Afegeix una partitura
  </button>
</div>
{% endif %}
