{% extends 'base.html.twig' %}
{% block body %}
<section class="fashion-area mt-5">
<div class="container" style="width:100%;">
<div class="row">
<div class="col-md-12 col-md-offset-0">
<div class="x_panel">
<div class="x_title">
<div class="row">
{% if title == 'all' %}
<div class="col-12 mb-15" style="text-align: left;">
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Velg løpsdag
</button>
<div class="dropdown-menu" style="background-color: #CCC;border-radius: 4px;">
{% for a in races %}
{% set active = 0 %}
{% set NoSpill = 0 %}
{% for l in leg %}
{% if l.mee_id == a.rac_mee_id %}
{% set NoSpill = 1 %}
{% if l.leg_code == 'V75' %}
{% if a.mee_date|date('l') == 'Saturday' %}
{% set active = 1 %}
{% elseif a.mee_date|date('l') == 'Sunday'%}
{% set active = 1 %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% set viewmee = 0 %}
{% if active == 1 %}
{% if date(a.mee_date) < intwodays %}
{% set viewmee = 1 %}
{% endif %}
{% else %}
{% if date(a.mee_date) < tomorrow %}
{% set viewmee = 1 %}
{% endif %}
{% endif %}
<!--if viewmee == 1 -->
{% if NoSpill %}
<a class="dropdown-item" href="{{ path('app_tips', {race: a.rac_mee_id }) }}">{{ a.trk_trackname }} {{ a.mee_date|date('d.m') }}</a>
{% endif %}
<!-- endif -->
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>
{% if title == 'all' %}
<div class="row">
<div class="col-12">
<p>Velg løpsdag for å se mere.</p>
</div>
</div>
<div class="clearfix"></div>
{% else %}
<div class="row">
<div class="col-8">
<h3 class="mb-1">{{ all[0].trk_shortname }}</h3>
</div>
<div class="col-4" style="text-align: right">
{{ all[0].mee_date | date('Y-m-d')}}
</div>
</div>
<p><strong>{{ all[0].mee_legtypes }} </strong><br>
{% if all[0].trk_lenght_2 %}
Banelengde ytre sving: {{ all[0].trk_length }} m - Oppløp: {{ all[0].trk_extra }} m<br>
Banelengde indre sving: {{ all[0].trk_lenght_2 }} m - Oppløp: {{ all[0].trk_extra_2 }} m<br>
{% else %}
Banelengde: {{ all[0].trk_length }} m - Oppløp: {{ all[0].trk_extra }} m<br>
Dosering: {{ all[0].trk_info_1 }} - Svingradius: {{ all[0].trk_info_2 }}
{% endif %}
</p>
{% endif %}
</div>
{% if title == 'all' %}
{% else %}
<input type="hidden" id="rce" value="{{ title }}">
<div class="x_content mt-20">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active pl-1 pr-1" data-toggle="tab" id="ti" href="#tips">Tips</a>
</li>
<li class="nav-item">
<a class="nav-link pl-1 pr-1 pro" data-toggle="tab" id="pr" href="#program">Program</a>
</li>
<li class="nav-item" style="padding: 0px 4px;">
<a class="nav-link pl-1 pr-1" data-toggle="tab" id="re" href="#resultat">Resultater</a>
</li>
</ul>
<div class="tab-content mt-20">
<div id="tips" class="tab-pane active">
{% if info %}
<div class="row">
<div class="col-lg-7">
{% if info[0].getChtReady() == 1 %}
<img src="{{ info[0].getChtImage() }}" style="width: 100%" class="mb-2">
<p>{{ info[0].getChtImageCaption() }} </p>
{{ info[0].getChtText() | raw }}
{% else %}
<p>Tips kommer</p>
{% endif %}
</div>
<div class="col-lg-5">
{% if info[0].getChtReady() == 1 %}
{% for t,g in gambling %}
<div class="row">
<div class="col-lg-12">
{% if (t != 'DD') %}
<div class="gamblingtitle">
<div class="mb-2 ml-1">{{ t }}-forslag</div>
{% if (t == 'V75') %}{% set rowfactor = 0.5 %}{% endif %}
{% if ((t == 'V65') or (t == 'V64') or (t == 'V5')) %}{% set rowfactor = 1 %}{% endif %}
{% if (t == 'V4') %}{% set rowfactor = 2 %}{% endif %}
<table class="gamblingtable">
{% for size,s in g %}
<tr>
{% set numcols = s | length %}
{% set product = 1 %}
{% for c,t in s %}
<td class="tdnumber">{{ t }}</td>
{% set product = product * t %}
<td class="tdx">
{% if (c < numcols) %}x{% else %}={% endif %}
</td>
{% endfor %}
<td class="tdproduct">
{{ (product * rowfactor) }}
</td>
<td>{% if size == 'liten' %}KR{% else %}kr{% endif %}</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% if (((t == 'V65') or (t == 'V75')) and ('DD' in gambling | keys)) %}
{{ render(controller(
'App\\Controller\\MainController::getDDbet', {'meeting':title}
)) }}
{% endif %}
</div>
</div>
{% if (t != 'DD') %}
{{ render(controller(
'App\\Controller\\MainController::getStartlist', {'meeting':title,'legtype':t}
)) }}
{% endif %}
{% if (t == 'V75' or (t == 'V65')) %}
<div class="mb-5">
<a href="https://www.rikstoto.no/Andelstorget/Butikker/00747" target="_blank">
<img class="w-100" src="/assets/img/Andelstorg_TGN 320x250.jpg">
</a>
{# <iframe class="mb-5" frameborder='0' scrolling='no' style='border:none;width:100%;height:100%;' src='https://old.rikstoto.no/App/Partner/Module/NewGameModule.aspx?partner=00747&sublocid=' class='rikstoto-static-module'></iframe>#}
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{% else %}
<p>Tipstekst kommer...</p>
{% endif %}
</div>
<div id="program" class="tab-pane fade">
</div>
<div id="resultat" class="tab-pane fade">
<p>Ingen resultater er klare for dette løpet</p>
</div>
</div>
</div>
{% endif%}
</div>
</div>
</div>
</div>
</section>
<div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog" id="infoModalDialog">
<div class="modal-content">
<div class="modal-body" id="infoModalBody" style="text-align:center;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div id="infoModalText" style="overflow: scroll; max-height:800px;min-height: 500px;">
<i class="fa fa-spinner fa-spin fa-3x"></i>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascript_end %}
{{ parent ()}}
{% endblock %}