{% extends 'base_frontend_new.html.twig' %}
{% block title %}Listado de Competiciones{% endblock %}
{% block stylesheets %}
<style>
.aWAGR{
vertical-align: top !important;
}
.diaSemana{
text-transform: capitalize !important;
}
#tableComite .cambioYear{
background: #e4e4e4 !important;
color: black !important;
}
{% if movil %}
#tableComite tr td {
text-align: left;
padding-left: 0.75em;
}
{% endif %}
</style>
{% endblock %}
{% block container %}
<div class="ui {% if movil %} basic noPaddingLeft noPaddingRight {% else %} very padded {% endif %}segment">
<h2 class="ui {% if movil %} center aligned {% endif %} header">
{{ 'titles.inscripcion.time-limit'|trans({}, 'FrontendBundle') }}
<span class="ui sub header">{{ cliente.nombre|default("") }}</span>
</h2>
<table id="tableComite" class="ui basic padded table">
{% if not movil %}
<tr>
<th>
<span class="mobile hidden">
{{ 'comite.fecha'|trans({}, 'FrontendBundle') }}
</span>
</th>
<th>
<span class="mobile hidden">
{{ 'Competicion'|trans({}, 'FrontendBundle') }}
</span>
</th>
<th></th>
<th>
<span class="mobile hidden">
{{ 'comite.inscrito'|trans({}, 'FrontendBundle') }}
</span>
</th>
</tr>
{% endif %}
{% if competiciones|length > 0 %}
{% set mesAnt = "0" %}
{% set yearAnt = "0" %}
{% for competicion in competiciones %}
{% if competicion.fecha|date('y') != yearAnt and not loop.first %}
<tr class="active cambioYear">
<td class='center aligned' colspan="4">
{{ (competicion.fecha|date('Y', null, locale))|capitalize }}
</td>
</tr>
{% endif %}
{% if competicion.fecha|date('m') != mesAnt %}
<tr class="active cambioMes">
<td class='center aligned' colspan="4">
{{ competicion.fecha|format_date(pattern='MMMM', locale=locale)|capitalize }}
</td>
</tr>
{% endif %}
<tr>
<td class="collapsing">
<h5 class="ui header">
<div class="content">
{{ (competicion.fecha|format_date(pattern='dd MMM', locale=locale))|capitalize }}
{% set numjor = jornadas[competicion.id] %}
{% if numjor > 1 %}
<span class="ui tiny basic label">
{{ numjor }} {{ 'competicion.clasificacion.rounds'|trans({}, 'FrontendBundle') }}
</span>
{% endif %}
<div class="diaSemana sub header">
{{ competicion.fecha|format_date(pattern='E', locale=locale) }}
</div>
</div>
</h5>
</td>
<td>
<h4 class="ui header">
<div class="content">
<a href="{{ path('_tournament', { 'id': competicion.id }) }}">{{ competicion.nombre }}</a>
{% if competicion.wagr == 1 %}
<div class="aWAGR ui tiny right teal basic label" data-tooltip="Puntuable para el World Amateur Golf Ranking" data-position="bottom left">
WAGR
</div>
{% endif %}
<div class="sub header">
{{ competicion.club.nombre }}
</div>
</div>
{% if competicion.inicio|date("U") <= 'now'|date("U") %}
<a href="{{ path('_tournament', { 'id': competicion.id }) }}" class="mobile hidden aInsc ui right floated inverted blue button">Inscripcion</a>
{% endif %}
</h4>
</td>
<td class="center aligned collapsing">
{% if competicion.modo.id == 5 %}
{{ 'messages.inscription-by-email'|trans({}, 'FrontendBundle') }}
{% else %}
{% if competicion.inicio != null %}
{% if competicion.inicio|date("U") <= 'now'|date("U") %}
{{ 'titles.inscripcion.to'|trans({}, 'FrontendBundle') }} {{ (competicion.fin|format_date(pattern='dd MMM', locale=locale))|capitalize }}
{% elseif 'now'|date("U") <= competicion.inicio|date("U") %}
{{ 'titles.inscripcion.from'|trans({}, 'FrontendBundle') }} {{ (competicion.inicio|format_date(pattern='dd MMM', locale=locale))|capitalize }}
{% else %}
{{ 'messages.segun-reglamento'|trans({}, 'FrontendBundle') }}
{% endif %}
{% else %}
{{ 'messages.segun-reglamento'|trans({}, 'FrontendBundle') }}
{% endif %}
{% endif %}
</td>
<td class="center aligned collapsing">
<div class="mobile hidden">
{% set numIns = numInscritos[competicion.id][1] %}
{% if numIns > 0 %}
<div class="ui circular {% if competicion.estado == "abierta" and competicion.modo.id == "3"%}blue{% endif %} label">
{{ numIns }}
</div>
{% endif %}
</div>
</td>
</tr>
{% set mesAnt = competicion.fecha|date('m') %}
{% set yearAnt = competicion.fecha|date('y') %}
{% endfor %}
{% else %}
<tr>
<td class='center aligned' colspan="4">
{{ 'error.no-data'|trans({}, 'FrontendBundle') }}
</td>
</tr>
{% endif %}
</table>
</div>
{% endblock %}
{% block javascripts %}
{#<script type="text/javascript" src="{{ asset('js/frontend/jquery.table2excel.min.js')}}"></script>#}
<script src="//cdn.rawgit.com/rainabba/jquery-table2excel/1.1.0/dist/jquery.table2excel.min.js"></script>
<script>
$(".export").click(function () {
$("#tableComite").table2excel({
exclude: ".noExl",
name: "CompeticionesComite",
filename: "CompeticionesComite"
});
});
</script>
{% endblock %}