{% extends "torneios/base.html" %} {% load static %} {% block head %} {% endblock %} {% block contents %} {{ block.super }} {%if torneio.inscricoes_aprovadas.count < 2 %}

Ainda não existem pelo menos dois participantes homologados

{%else%}
{% if torneio.partidas.count > 0 %} {%if edit_mode %} {% if perms.torneio.can_change_partida or perms.torneio.can_definir_numero_time or perms.torneio.can_definir_resultado_partida %} Modo simples {% endif %} {% else %} {% if perms.torneio.can_change_partida %} Alterar chaveamento {% endif %} {% if perms.torneio.can_definir_numero_time %} Definir times manualmente {% endif %} {% if perms.torneio.can_definir_resultado_partida %} Definir resultados {% endif %} {% endif %} Modo chave {% else %} {% if perms.torneio.can_create_partida %} Gerar chaveamento Mata-Mata {% endif %} {% endif %}

{{ torneio.nome }}

{{ torneio.esporte.nome }} {{ torneio.naipe }} / {{ torneio.edicao }} {% if edit_mode == 'team_assignment' and perms.torneio.can_definir_numero_time %}

Definição {%if torneio.individual %}dos participantes{%elif torneio.em_duplas%}das duplas{%else%}dos times{%endif%} no chaveamento

{% elif edit_mode == 'bracket' and perms.torneio.can_change_partida %}

Modificação no chaveamento

{% elif edit_mode == 'results' and perms.torneio.can_definir_resultado_partida %}

Declaração dos resultados

{% else %}

Partidas

{% endif %} {% if user.is_authenticated %}
{% if not partidas or partidas.count <= 0 %} {% if torneio.inscricoes_aprovadas.count < torneio.times_minimo %} Não atingiu a quantidade mínima de times ({{ torneio.times_minimo }}) {% elif torneio.inscricoes_aprovadas.count > torneio.times_maximo %} Ultrapassou a quantidade máxima de times ({{ torneio.times_maximo }}) {% endif %} {% if torneio.inscricoes_aprovadas.count >= 2 %}

Gerar chaveamento de eliminatórias para {{ torneio.inscricoes_aprovadas.count }} times homologados ({{torneio.inscricoes_aprovadas.count|add:"-1"}} partidas).

{% endif %} {% endif %}
{% endif %} {% if partidas and partidas.count > 0 %} {% if perms.torneio.can_definir_numero_time and torneio.times_sem_numero.count != 0 %}

Ainda há participantes sem número no chaveamento: {{ torneio.times_sem_numero | dictsort:'nome' | join:', ' }}

{% endif %} {% for k,g in partidas_hierarquia.items %}

{% if k == 0 %}Final {%elif k == 1 %} {% if g|length == 2 %}Semifinais{%else%}Fase classificatória{%endif%} {%elif k == 2 %} {% if g|length == 4 %}Quartas de final{%else%}Fase classificatória{%endif%} {%elif k == 3 %} {% if g|length == 8 %}Oitavas de final{%else%}Fase classificatória{%endif%} {%elif k == 4 %} {% if g|length == 16 %}Fase 16 avos{%else%}Fase classificatória{%endif%} {%else%} Fase classificatória {%endif%}

{% for partida in g %} {% if edit_mode and perms.torneio.can_change_partida %}
{% else %}
{% endif %}

Partida #{{partida.numero}}

{% if edit_mode == "bracket" and perms.torneio.can_change_partida %}
{% if partida.numero != g.0.numero %}
{% csrf_token %}
{% endif %}
{% csrf_token %}
{% if partida.numero != g.0.numero %}
{% csrf_token %}
{% endif %}
{% endif %}
{% if edit_mode == 'team_assignment' and perms.torneio.can_definir_numero_time and not partida.finalizada %} {% if partida.numero_time1 == 0 or torneio.times_sem_numero.count == 0 %}

{{ partida.rotulo_time1 }}

{% else %}
{% csrf_token %} {% if partida.time1 %} {% endif %}
{% endif %}
{% if partida.numero_time2 == 0 or torneio.times_sem_numero.count == 0 %}

{{ partida.rotulo_time2 }}

{% else %}
{% csrf_token %} {% if partida.time2 %} {% endif %}
{% endif %} {% else %}

{{ partida.rotulo_time1 }}{%if partida.finalizada%}{{partida.resultado_time1}}{%endif%}


{{ partida.rotulo_time2 }}{%if partida.finalizada%}{{partida.resultado_time2}}{%endif%}

{% endif %}
{% if edit_mode == 'results' and perms.torneio.can_definir_resultado_partida %} {% if not partida.finalizada and not torneio.times_sem_numero %}
{% csrf_token %}
{% endif %} {% endif %}
{% endfor %}
{% endfor %} {% endif %} {% endif %} {% endblock %}