<html>

{% load static %}

<head>
    <link rel="stylesheet" href="{% static 'scores/style.css' %}">
        <title>Padel</title>
        {% if match.hasEnded %}
          <meta http-equiv="refresh" content='60'/>
        {% else %}
          {% if tv %}
            <meta http-equiv="refresh" content='5'/>
          {% else %}
            <meta http-equiv="refresh" content='{{ match.refreshrate }}'/>
          {% endif %}
        {% endif %}
</head>
{% if tv %}
<div class="wrapper" style="zoom:200%">
{% else %}
<div class="wrapper">
{% endif %}
{% if match.tournament.club.header %}
  {% if tv %}
    <header class="scenter"><a href="/tv/club/{{ match.tournament.club.name }}/">{{ match.tournament.club.header }}</a></header>
  {% else %}
    <header class="scenter"><a href="/club/{{ match.tournament.club.name }}/">{{ match.tournament.club.header }}</a></header>
  {% endif %}
{% endif %}

  <main class="page-body">
      {% autoescape off %}
      {% if tv %}
      <div class="scenter"><a href="/tv/club/{{ match.tournament.club.name }}/tournoi/{{ match.tournament.id }}">{{match.tournament.name}}</a></div>
      {% else %}
      <div class="scenter"><a href="/club/{{ match.tournament.club.name }}/tournoi/{{ match.tournament.id }}">{{match.tournament.name}}</a></div>
      {% endif %}

    <div class="scontainer">
        <div class="smatch">
          <h1 class="scenter" style="padding-bottom:20px">{{ match.title }}</h1>

        {% if match.team3 %}

        <table>
          <tr><td class="steamname">{{ match.team1|linebreaksbr }}</td>
            {% if match.team1scorecolumn1 %}<td class="score">{{ match.team1scorecolumn1 }}</td>{% endif %}
            {% if match.team2scorecolumn1 %}<td class="score">{{ match.team2scorecolumn1 }}</td>{% endif %}
          </tr>
          <tr><td class="steamname">{{ match.team2|linebreaksbr }}</td>
            {% if match.team1scorecolumn2 %}<td class="score">{{ match.team1scorecolumn2 }}</td>{% endif %}
            {% if match.team2scorecolumn2 %}<td class="score">{{ match.team2scorecolumn2 }}</td>{% endif %}
          </tr>
          <tr><td class="steamname">{{ match.team3|linebreaksbr }}</td>
            {% if match.team1scorecolumn3 %}<td class="score">{{ match.team1scorecolumn3 }}</td>{% endif %}
            {% if match.team2scorecolumn3 %}<td class="score">{{ match.team2scorecolumn3 }}</td>{% endif %}
          </tr>
          <tr><td class="steamname">{{ match.team4|linebreaksbr }}</td>
            {% if match.team1scorecolumn4 %}<td class="score">{{ match.team1scorecolumn4 }}</td>{% endif %}
            {% if match.team2scorecolumn4 %}<td class="score">{{ match.team2scorecolumn4 }}</td>{% endif %}
          </tr>

          {% if match.team5 %}

          <tr><td class="steamname">{{ match.team5|linebreaksbr }}</td>
            {% if match.team1scorecolumn5 %}<td class="score">{{ match.team1scorecolumn5 }}</td>{% endif %}
            {% if match.team2scorecolumn5 %}<td class="score">{{ match.team2scorecolumn5 }}</td>{% endif %}
          </tr>
          {% endif %}

        </table>
        {% else %}

        <table>
          <tr>
            <td class="steamname">{{ match.team1|linebreaksbr }}</td>
            {% if match.team1scorecolumn1 %}<td class="bigscore">{{ match.team1scorecolumn1 }}</td>{% endif %}
            {% if match.team1scorecolumn2 %}<td class="bigscore">{{ match.team1scorecolumn2 }}</td>{% endif %}
            {% if match.team1scorecolumn3 %}<td class="bigscore">{{ match.team1scorecolumn3 }}</td>{% endif %}
            {% if match.team1scorecolumn4 %}<td class="bigscore">{{ match.team1scorecolumn4 }}</td>{% endif %}
            {% if match.team1scorecolumn5 %}<td class="bigscore">{{ match.team1scorecolumn5 }}</td>{% endif %}
          </tr>
          <tr>
            <td class="steamname">{{ match.team2|linebreaksbr }}</td>
            {% if match.team2scorecolumn1 %}<td class="bigscore">{{ match.team2scorecolumn1 }}</td>{% endif %}
            {% if match.team2scorecolumn2 %}<td class="bigscore">{{ match.team2scorecolumn2 }}</td>{% endif %}
            {% if match.team2scorecolumn3 %}<td class="bigscore">{{ match.team2scorecolumn3 }}</td>{% endif %}
            {% if match.team2scorecolumn4 %}<td class="bigscore">{{ match.team2scorecolumn4 }}</td>{% endif %}
            {% if match.team2scorecolumn5 %}<td class="bigscore">{{ match.team2scorecolumn5 }}</td>{% endif %}
          </tr>
        </table>

        {% endif %}

        {% if not match.isStatistic and not match.hasWalkOutTeam %}
        <p class="duration">
          <div class="small"> {{ match.durationPrefix }}</div>
          <div class="sbig">{{ match.duration }}</div>
        </p>
        {% endif %}

      </div>

    </div>


    {% if match.teamOne and match.teamTwo %}
    <div class="scontainer">
      <div class="smatch">
        <table>
          <tr style="height:20px">
            <th style="visibility:hidden;"></th>
            <th>Class.</th>
            <th>Poids</th>
            <th>Rang</th>
            <th>Entrée</th>
          </tr>
            <tr>
              <td class="label">
                {% for player in match.teamOne.players.all %}
                <div>{{ player.name }}</div>
                {% endfor %}
              </td>
              <td class="score" style="text-align: right;">
                {% for player in match.teamOne.players.all %}
                <div>({{ player.rank }})</div>
                {% endfor %}
              </td>
              <td class="score">{{ match.teamOne.rank }}</td>
              <td class="score">#{{ match.teamOne.position }}</td>
              <td class="smalllabel">{{ match.teamOne.position_label }}</td>
            </tr>
            <tr>
              <td class="label">
                {% for player in match.teamTwo.players.all %}
                <div>{{ player.name }}</div>
                {% endfor %}
              </td>
              <td class="score" style="text-align: right;">
                {% for player in match.teamTwo.players.all %}
                <div>({{ player.rank }})</div>
                {% endfor %}
              </td>
              <td class="score">{{ match.teamTwo.rank }}</td>
              <td class="score">#{{ match.teamTwo.position }}</td>
              <td class="smalllabel">{{ match.teamTwo.position_label }}</td>
            </tr>
        </table>
      </div>
    </div>
    {% endif %}



    {% endautoescape %}
  </main>

  {% if club.footer %}
  <footer class="page-footer, center">{{ club.footer }}</footer>
  {% endif %}

</div>

</html>
