{% 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;
}
.mobile.segment > .form{
padding: 0.75em;
}
{% endif %}
</style>
{% endblock %}
{% block container %}
<div class="ui {% if movil %}mobile basic noPaddingLeft noPaddingRight {% else %} very padded {% endif %}segment">
{% include 'mensajes_new.html.twig' with {'layout': 0} %}
{% if movil %}
<h2 class="ui center aligned header">
{{ 'competiciones'|trans({}, 'FrontendBundle') }}
</h2>
{% endif %}
{{ form_start(form) }}
<div class="four fields">
<div class="field">
{{ form_widget(form.anio) }}
</div>
<div class="field">
{{ form_widget(form.comite) }}
</div>
<div class="field">
{{ form_widget(form.provincia) }}
</div>
<div class="field">
<div class="two fields">
<div class="field">
{{ form_rest(form) }}
</div>
<div class="field">
<button class="ui {% if movil %} right floated {% endif %} basic icon button export">
<i class="large middle aligned icon">
<svg fill="currentColor" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 31.425 31.426" style="enable-background:new 0 0 31.425 31.426;" xml:space="preserve">
<path d="M11.15,0L3.011,8.592v22.834h25.403V0H11.15z M10.434,3.613v3.808H6.826L10.434,3.613z M26.449,29.462H4.977V9.385h7.421 V1.964h14.053v27.498H26.449z"/>
<path d="M15.004,14.766h0.491v-1.768H9.444v1.768h0.737c0.202,0,0.402,0.055,0.617,0.168c0.203,0.107,0.396,0.306,0.572,0.585
l2.919,4.738l-2.939,4.21c-0.16,0.229-0.306,0.421-0.438,0.576c-0.113,0.133-0.228,0.242-0.337,0.321
c-0.098,0.07-0.198,0.119-0.307,0.148c-0.127,0.034-0.282,0.051-0.462,0.051H9.198v1.769h5.438v-1.276l-0.055-0.49H14.09
c-0.449,0-0.643-0.057-0.724-0.094c0-0.053,0.01-0.115,0.028-0.186c0.024-0.088,0.055-0.176,0.095-0.264
c0.043-0.097,0.087-0.188,0.138-0.279c0.046-0.084,0.091-0.159,0.139-0.229l1.65-2.44l1.769,2.843
c0.068,0.114,0.123,0.209,0.159,0.289c0.036,0.077,0.05,0.121,0.054,0.139l0.013,0.108c0,0-0.112,0.113-0.625,0.113h-0.592v1.768
h6.033v-1.768h-0.729c-0.144,0-0.3-0.052-0.464-0.151c-0.133-0.08-0.35-0.259-0.616-0.613l-3.272-5.259l2.529-3.646
c0.164-0.238,0.314-0.437,0.452-0.594c0.125-0.142,0.246-0.26,0.362-0.349c0.092-0.069,0.182-0.116,0.272-0.142
c0.104-0.03,0.226-0.045,0.361-0.045h0.655v-1.768h-5.074v1.277l0.055,0.491h0.491c0.125,0,0.237,0.006,0.341,0.02
c0.091,0.011,0.145,0.029,0.173,0.029h0.001c0,0.1-0.027,0.213-0.085,0.336c-0.075,0.168-0.176,0.346-0.301,0.535l-1.349,2.051
l-1.287-2.08c-0.095-0.15-0.17-0.276-0.222-0.375c-0.047-0.09-0.083-0.168-0.107-0.231c-0.017-0.046-0.029-0.087-0.033-0.113
c-0.006-0.039-0.009-0.08-0.031-0.089c0.002-0.001,0.042-0.025,0.162-0.049C14.628,14.776,14.775,14.766,15.004,14.766z"/>
</svg>
</i>
</button>
</div>
</div>
</div>
</div>
{{ form_end(form) }}
<table id="tableComite" class="ui celled striped table">
<thead>
{% if not movil %}
<tr>
<th>
<div class="mobile hidden">
{{ 'Competicion'|trans({}, 'FrontendBundle') }}
</div>
</th>
<th>
<div class="mobile hidden">
{{ 'comite.fecha'|trans({}, 'FrontendBundle') }}
</div>
</th>
<th>
<div class="mobile hidden">
{{ 'comite.inscrito'|trans({}, 'FrontendBundle') }}
</div>
</th>
</tr>
{% endif %}
</thead>
{% set mesAnt = "0" %}
{% for competicion in competiciones %}
{% if competicion.fecha|date('m') != mesAnt %}
<tr class="active cambioMes">
<td {% if not movil %}colspan="2"{% else %}colspan="2"{% endif %}>
{{ (competicion.fecha|format_date(pattern='MMMM', locale=locale))|capitalize }} {% if movil %}<label class="ui basic circular blue disabled label">{{ numCompeticionesMes[competicion.fecha|date('m')] }}</label>{% endif %}
</td>
{% if not movil %}
<td>
<label class="ui basic circular blue disabled label">{{ numCompeticionesMes[competicion.fecha|date('m')] }}</label>
</td>
{% endif %}
</tr>
{% endif %}
<tr>
<td>
<h4 class="ui header">
<div class="content">
<a href="{{ path('_tournament', { 'id': competicion.id }) }}">
{% if "cancelada" != competicion.estado %}
{{ competicion.nombre }}
{% else %}
<em><s><span class="ui grey text">{{ competicion.nombre }}</span></s></em>
{% endif %}
</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.estado == "abierta" and competicion.modo.id == "3"%}
<a href="{{ path('_tournament', { 'id': competicion.id }) }}" class="mobile hidden aInsc ui right floated inverted blue button">Inscripcion</a>
{% endif %}
</h4>
</td>
<td class="collapsing">
<h4 class="ui{% if competicion.fecha|date('Ymd') < 'now'|date('Ymd') %} disabled {% endif %}header">
<div class="content">
{{ (competicion.fecha|format_date(pattern='dd MMM yyyy', 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>
</h4>
</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') %}
{% endfor %}
</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>
{% if comite > 0%}
$("#form_comite").val({{ comite }});
{% endif %}
$(".dropdown").dropdown({placeholder: false});
$(".export").click(function () {
var tempTable = $("#tableComite").clone();
tempTable.find('a').replaceWith(function() {
return $(this).text();
});
tempTable.table2excel({
exclude: ".noExl",
exclude_img: true,
name: "CompeticionesComite",
filename: "CompeticionesComite"
});
});
</script>
{% endblock %}