{% set competitionDate = competition.fecha %}
{% set competitionName = competition.nombre %}
{% set competitionStatus = competition.estado|default(null) %}
{% set competitionOrganiser = competition.organizer is defined ? competition.organizer : competition.organizador.id %}
{% set competitionPlayerByTeam = competition.jugadores|default(null) %}
{% set competitionId = competition.id %}
{% set competitionMode = competition.mode is defined ? competition.mode|default(null) : competition.modo.id|default(null) %}
<div class="item">
<div class="ui grid">
<div class="three wide column ">
{% set colorCalendar = "blue" %}
{% set claseTransition = "" %}
{% set claseLong = "longshadow" %}
{% set claseOverflow = "hide-overflow" %}
{% if isFuture %}
{% if competitionDate == 'now'|date('Y-m-d') %}
{% set colorCalendar = "red" %}
{% set claseLong = "longshadow-red" %}
{% set claseOverflow = "hide-overflow-today" %}
{% endif %}
{% else %}
{% if rounds[competitionId] is defined %}
{% for round in rounds[competitionId] %}
{% if round.fecha == 'now'|date('Y-m-d') %}
{% set colorCalendar = "red" %}
{% set claseLong = "longshadow-red" %}
{% set claseTransition = "transition hidden" %}
{% set claseOverflow = "hide-overflow-today" %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
<div class="ui tiny inverted statistics {{ claseTransition }}">
<div class="ui compact segments noMarginTop noBorder noShadow">
<div class="ui tertiary segment noPaddingBottom noPaddingLeft noPaddingRight noPaddingTop center aligned">
{{ competitionDate|format_date(pattern='E', locale=locale) }}
</div>
<div class="ui basic segment noPaddingBottom noPaddingLeft noPaddingRight noPaddingTop ">
<div class="ui {{ colorCalendar }} mini label {{ claseOverflow }}">
<div class="statistic">
<div class="value">
<span class="day {{ claseLong }}">{{ competitionDate|format_date(pattern='dd', locale=locale) }} </span>
</div>
<div class="label">
<span class="month {{ claseLong }}">{{ competitionDate|format_date(pattern='MMM', locale=locale) }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="thirteen wide column">
{% set popup = "" %}
{% if competitionName|length > 35 %}
{% set popup = competitionName %}
{% endif %}
<a class="ui header truncate" id="nombreTorDis{{ competitionId }}"
href="{{ not competition.grouping ? path('_tournament', {'id': competitionId, 'publi': publi }) : path('frontend_grouping_show', {'id': competitionId}) }}"
data-content="{{ popup }}" data-variation="inverted">
{% if "cancelada" != competitionStatus %}
{{ competitionName }}
{% else %}
<em><s><span class="ui grey text">{{ competitionName }}</span></s></em>
{% endif %}
</a>
<div class="row padding10top {% if not isFuture %}name-container{% endif %}">
{% if entity.id != "AM00" and competitionOrganiser == "AM00" %}
<div class="ui tiny basic green label">RFGA</div>
{% elseif entity.id != "CM00" and competitionOrganiser == "CM00" %}
<div class="ui tiny basic green label">FGM</div>
{% elseif (("M00" in entity.id) and ("M00" in competitionOrganiser)) %}
<div class="ui tiny basic green label">
{{ competition.club }}
</div>
{% endif %}
{% if competition.wagr is defined and competition.wagr %}
<div class="ui tiny basic teal label">WAGR</div>
{% endif %}
{% if competition.calculationName is defined %}
<div class="ui tiny label">{{ competition.calculationName }}</div>
{% endif %}
{% if not isFuture and bestResults[competitionId] is defined and bestResults[competitionId] and competition.livescoring == 'publico' %}
{% set bestResultValue = bestResults[competitionId].result %}
{% set claseContraPar = 'basic blue' %}
{% if bestResults[competitionId].formula != 'P' %}
{% if bestResultValue < 0 %}
{% set claseContraPar = 'red' %}
{% elseif bestResultValue > 0 %}
{% set claseContraPar = 'blue' %}
{% if competitionPlayerByTeam == 1 %}
{% set bestResultValue = '+'~bestResults[competitionId].result %}
{% endif %}
{% else %}
{% set bestResultValue = 'PAR' %}
{% endif %}
{% endif %}
{% if bestResults[competitionId].result is defined and bestResults[competitionId].result is not null %}
<span class="ui {{ claseContraPar }} circular label">
{{ bestResultValue }}
</span>
{% endif %}
<span class="cinema">
{{ bestResults[competitionId].player }}
</span>
{% endif %}
{% if isFuture and competitionMode == 3 %}
{% if competitionStatus == 'abierta' %}
{% if competition.plazas != 0 %}
{% if competitionPlayerByTeam == 1 %}
<a href="{{ path('competicion_inscritos_new', {'id': competitionId }) }}"
role="button" class="ui primary button right floated">
{{ 'competicion.inscritos.inscripcion'|trans({}, 'FrontendBundle') }}
</a>
{% elseif competitionPlayerByTeam == 2 %}
<a href="{{ path('competicion_inscritos_pareja_new', {'id': competitionId }) }}"
class="ui primary button right floated" role="button">
{{ 'competicion.inscritos.inscripcion'|trans({}, 'FrontendBundle') }}
</a>
{% else %}
<a href="{{ path('competicion_inscritos_equipo_new', {'id': competitionId }) }}"
class="ui primary button right floated" role="button">
{{ 'competicion.inscritos.inscripcion'|trans({}, 'FrontendBundle') }}
</a>
{% endif %}
{% else %}
<button class="ui grey basic button boton-modal right floated"
data-texto="No tenemos plazas disponibles">
{{ 'competicion.inscritos.inscripcion'|trans({}, 'FrontendBundle') }}
</button>
{% endif %}
{% else %}
{% set mensaje_boton = "" %}
{% if competitionStatus == 'congelada' %}
{% set mensaje_boton = 'messages.inscripcion.congelada'|trans({}, 'FrontendBundle') %}
{% elseif competitionStatus == 'cancelada' %}
{% set mensaje_boton = 'messages.inscripcion.cancelada'|trans({}, 'FrontendBundle') %}
{% else %}
{% set mensaje_boton = 'messages.inscripcion.finalizada'|trans({}, 'FrontendBundle') %}
{% endif %}
<button class="ui grey basic button boton-modal right floated"
data-texto="{{ mensaje_boton }}">
{{ 'competicion.inscritos.inscripcion'|trans({}, 'FrontendBundle') }}
</button>
{% endif %}
{% elseif isFuture %}
{% set mensaje_boton = 'messages.inscripcion.offline'|trans({}, 'FrontendBundle') %}
{% if competitionMode == 5 %}
{% set mensaje_boton = 'Debe realizar la inscripción en el correo torneos@rfga.org' %}
{% endif %}
<button class="ui grey basic button boton-modal right floated"
data-texto="{{ mensaje_boton }}">
{{ 'competicion.inscritos.inscripcion'|trans({}, 'FrontendBundle') }}
</button>
{% endif %}
</div>
<div class="description">
<p></p>
</div>
</div>
</div>
</div>