{% extends 'base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" type="text/css" href="{{ asset('vendors/DataTables/DataTables-1.10.18/css/dataTables.bootstrap4.css') }}"/>
<style>
.table td {
padding: .1rem;
}
.dtr-title{
display: none !important;
min-width: 0px !important;
font-weight: bold;
}
.child{
border-top: none !important;
}
table.dataTable thead .sorting:before, table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_asc_disabled:before, table.dataTable thead .sorting_desc_disabled:before {
right: 1em;
content: none;
}
table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after, table.dataTable thead .sorting_asc_disabled:after, table.dataTable thead .sorting_desc_disabled:after {
right: 0.5em;
content: none;
}
.child-container{
padding: 0 !important;
}
table.row-detail {
border-collapse: collapse;
width: 100%;
}
table.row-detail td {
padding: 5px 10px !important;
border-right: 1px solid #ddd;
}
table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child, table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child {
position: relative;
padding-left: 30px;
cursor: pointer;
}
table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child, table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child {
position: relative;
padding-left: 30px;
cursor: pointer;
}
#dtHorses_filter input {
padding: .5rem .75rem;
font-size: 1rem;
line-height: 1.25;
color: #495057;
background-color: #fff;
background-image: none;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: .25rem;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
}
</style>
{% endblock %}
{% block body %}
<section class="fashion-area section-gap pt-10" id="fashion" style="padding-top: 40px;">
<div class="container">
<div class="row">
<div class="col-md-12 col-md-offset-0">
<div class="x_panel">
<div class="x_title">
{% if horse == 'all' %}
<h3>Hestefakta</h3>
<br>
{% endif %}
<div class="clearfix"></div>
</div>
<div class="x_content">
{% if horse == 'all' %}
<div class="row">
<div class="col-12 col-lg-6 col-md-6 col-sm-12">
<form method="post" action="{{ path('app_search', {kind: 'horse' }) }}">
<div class="col-lg-12 col-sm-auto input-group mb-3 pl-0" >
<input type="text" class="form-control" aria-label="Search for horse" aria-describedby="basic-addon2" value="{{ searchfor }}" placeholder="Søk etter hest/kusk/trener" name="horse_name" style="padding: .3rem;font-size: .9rem;">
<div class="input-group-append">
<button class="btn btn-outline-danger" type="submit"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
</div>
</div>
{% if (result['horses'] is defined) %}
{% if ((result['horses'] | length) > 0) %}
<b>Hest</b><br>
{% for r in result['horses'] %}
<a href="{{ path('app_horses', { horse: r.id}) }}">{{ r.hor_name }}</a><br>
{% endfor %}
<br>
{% endif %}
{% if ((result['trainers'] | length) > 0) %}
<b>Trener</b><br>
{% for r in result['trainers'] %}
<a href="{{ path('app_trainer', { trainer: r.id }) }}">{{ r.tra_lastname }}, {{ r.tra_firstname }}</a><br>
{% endfor %}
<br>
{% endif %}
{% if ((result['drivers'] | length) > 0) %}
<b>Kusk</b><br>
{% for r in result['drivers'] %}
<a href="{{ path('app_driver', { driver: r.id }) }}">{{ r.dri_lastname }}, {{ r.dri_firstname }}</a><br>
{% endfor %}
<br>
{% endif %}
{% endif %}
</div>
{% else %}
{% for a in horse %}
<div class="x_title">
<div style="width: 100%;">
<div style="width: 78%;display: inline-block;margin: 0px;padding: 0px;"><h3>{{ a.hor_name }}</h3></div>
<div style="text-align: right;width: 20%; display: inline-block;margin: 0px;padding: 0px;"><h4><span style="text-align: right"><a href="{{ path('app_horses', {horse: 'all' }) }}"><i class="fas fa-search"></i></a></span></h4></div>
</div>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="col-lg-12">
<div class="row">
<div class="col-12 mt-3 pl-0">
{% if father %}
<strong>e</strong> <a href="{{ path('app_horses', { horse: father.getId()}) }}">{{ father.getHorName() }}</a>
{% endif %}
<br>
{% if mother %}
<strong>u</strong> <a href="{{ path('app_horses', { horse: mother.getId()}) }}">{{ mother.getHorName() }}</a>
{% endif %}
{% if grandfather %}
<br>
<strong>e</strong> <a href="{{ path('app_horses', { horse: grandfather.id }) }}">{{ grandfather.getHorName() }}</a>
{% endif %}
<br>
<br>
<strong>Oppdretter: </strong> {{ a.bre_name }}<br>
<strong>Trener: </strong>
{% if a.traid %}
<a href="{{ path('app_trainer', { trainer: a.traid}) }}">{{ a.tra_firstname }} {{ a.tra_lastname }}</a>
{% endif %}
</div>
<!--
<div class="col-sm-2 col-3 pl-0 mt-3">
<strong>Oppdretter</strong>
</div>
<div class="col-sm-10 col-9 mt-3">
{{ a.bre_name }}
</div>
<div class="col-sm-2 col-3 pl-0">
<strong>Trener</strong>
</div>
<div class="col-sm-10 col-9">
{% if a.traid %}
<a href="{{ path('app_trainer', { trainer: a.traid}) }}">{{ a.tra_firstname }} {{ a.tra_lastname }}</a>
{% endif %}
</div>
{% if father %}
<div class="col-sm-2 col-3 pl-0 mt-3">
<strong>e</strong>
</div>
<div class="col-sm-10 col-9 mt-3">
<a href="{{ path('app_horses', { horse: father.getId()}) }}">{{ father.getHorName() }}</a>
</div>
{% endif %}
{% if mother %}
<div class="col-sm-2 col-3 pl-0">
<strong>u</strong>
</div>
<div class="col-sm-10 col-9">
<a href="{{ path('app_horses', { horse: mother.getId()}) }}">{{ mother.getHorName() }}</a>
</div>
{% endif %}
{% if grandfather %}
<div class="col-sm-2 col-3 pl-0">
<strong>e</strong>
</div>
<div class="col-sm-10 col-9">
<a href="{{ path('app_horses', { horse: grandfather.id }) }}">{{ grandfather.getHorName() }}</a>
</div>
{% endif %}
-->
<div class="col-lg-12 pl-0 mt-30" style="width: 100%; overflow: auto">
<div class="row">
<div class="col-6 col-lg-2 col-sm-6 test1 mb-3"></div>
<div class="col-6 col-lg-2 col-sm-6 test3 mb-3"></div>
<div class="col-6 col-lg-2 col-sm-6 test8 mb-3"></div>
<div class="col-6 col-lg-2 col-sm-6 test10 mb-3"></div>
<div class="col-6 col-lg-2 col-sm-6 test15 mb-3"></div>
</div>
<table class="table table-hover table-responsive-sm display responsive" id="dtHorses">
<thead>
<tr>
<th class="all">Løpsdag</th>
<th class="all"></th>
<th class="all">Bane</th>
<th class="all"></th>
<th class="all">Kusk</th>
<th class="all">Trener</th>
<th class="all">Spor</th>
<th class="all">Dist</th>
<th class="all"></th>
<th class="all">Start</th>
<th class="all"></th>
<th class="all" style="text-align: center;">Plass</th>
<th class="all">Tid</th>
<th class="all" style="text-align: right;">Fpr</th>
<th class="all" style="text-align: center;">Odds</th>
<th class="all" style="text-align: center;">Forhold</th>
<th class="all" style="white-space: nowrap;">M-tider</th>
<th class="all">Monté</th>
<th class="none"></th>
</tr>
</thead>
<tbody>
{% set c = 0 %}
{% for i in info %}
<!--
{% if i.res_scratched == '1' or i.res_disq == '1' %}
{% set st = 'background-color:#FDD' %}
{% else %}
{% set st = '' %}
{% endif %}
-->
{% if i.res_disq == '1' %}
{% set pl = '-' %}
{% set km = i.res_displaykmtime %}
{% set st = '' %}
{% elseif i.res_scratched == '1' %}
{% set pl = '-' %}
{% set km = 'str' %}
{% set st = 'background-color:#FDD' %}
{% elseif i.res_earnedmoney == '0' %}
{% set pl = '0' %}
{% else %}
{% set pl = i.res_place %}
{% set km = i.res_displaykmtime %}
{% set st = '' %}
{% endif %}
<tr style="{{ st }}" >
<td style="white-space: nowrap;">
{% if i.mee_id %}
<span id="{{ i.mee_date|date('ymd') }}" style="display: none">{{ i.mee_date|date('ymd') }}</span><a href="/tips/{{ i.mee_id }}?resultat=&lop={{ i.res_raceno}}">{{ i.mee_date|date('dmy') }}-{{ i.res_raceno}}</a>
{% else %}
{{ i.mee_date|date('dmy') }}-{{ i.res_raceno}}
{% endif %}
</td>
<td style="text-align: left">
{% if (i.mee_date|date('m') == 12) or (i.mee_date|date('m') < 3 )%}
Vinter
{% elseif (i.mee_date|date('m') < 6 )%}
Vår
{% elseif (i.mee_date|date('m') < 9 )%}
Sommer
{% else %}
Høst
{% endif %}
</td>
<td style="white-space: nowrap;">
{{ i.trk_code }}
</td>
<td style="white-space: nowrap;">
{{ i.trk_trackname|replace({' Travbane': '', ' Travpark': '', ' Tråvpark': '', ' Galoppbane': '', }) }}
</td>
<td style="white-space: nowrap;">
{% set first = i.dri_firstname|slice(0, 2) %}
{% set last = i.dri_lastname|slice(0, 3) %}
<a href="/driver/{{ i.driid }}">{{ first }} {{ last }}</a>
</td>
<td style="white-space: nowrap;">
<a href="{{ path('app_trainer', { trainer: i.traid}) }}">{{ i.tra_shortname }}</a>
</td>
<td style="white-space: nowrap;">
{{ i.res_startnumber}}
</td>
<td style="white-space: nowrap;">
{{ i.res_distance }}
</td>
<td style="white-space: nowrap;" class="none">
{% if i.res_distance > 2399 %}
Lang
{% elseif i.res_distance > 1799 %}
Mellom
{% else %}
Sprint
{% endif %}
</td>
<td style="white-space: nowrap; text-align: center;">
{{ i.rac_startmethod_code|upper}}
</td>
<td style="white-space: nowrap;" class="">
{% if i.rac_startmethod_code == 'v' %}
Volte
{% else %}
Auto
{% endif %}
</td>
<td style="text-align:center;white-space: nowrap;">
{{ pl }}
</td>
<td style="white-space: nowrap;">
{{ i.res_displaykmtime }}
</td>
<td style="text-align:right;white-space: nowrap;">
{{ arr[c]|number_format(0, ',', ' ') }}
</td>
<td style="text-align:center;white-space: nowrap;">
{{ i.res_odds }}
</td>
<td style="text-align:left;white-space: nowrap;">
{{ i.trc_condition }}
</td>
<td style="white-space: nowrap;">
{{ i.sta_pass500 }}-{{ i.sta_pass1000 }}
{% if i.sta_pass500 %}
<!-- COULD BE HERE -->
{% endif %}
</td>
<td style="white-space: nowrap;text-align: center">
{% if i.rac_monterace %}
<i class="fas fa-times"></i>
{% endif %}
</td>
<td>{{ i.sta_comment }}</td>
</tr>
{% set c = c+1 %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>
</div>
</section>
{% endblock %}
{% block javascripts_end %}
{{ parent() }}
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
<script>
$(document).ready(function() {
$('#dtHorses').DataTable( {
responsive: {
details: {
display: $.fn.dataTable.Responsive.display.childRowImmediate,
type: 'none',
target: ''
}
},
order: [[ 0, "desc" ]],
dom: 'Bfrtip',
language: {
buttons: {
pageLength: {
_: "Vis %d",
'-1': "Alle"
}
}
},
paging: false,
info: false,
pageLength: -1,
oLanguage: {
"sSearch": ""
},
columnDefs: [
{
"targets": [ 1,3,8,10 ],
"visible": false,
}
],
initComplete: function () {
$i = 0;
this.api().columns().every( function () {
var title = '';
if($i == 1 || $i == 3 || $i == 8 || $i == 10 || $i == 15){
if($i == 1){
title = 'Årstid';
} else if($i == 3) {
title = 'Bane';
} else if($i == 8) {
title = 'Distanse';
} else if ($i == 10){
title = 'Starttype';
} else if ($i == 15){
title = 'Baneforhold';
}
var column = this;
var select = $('<select class="form-control"><option value="">'+title+'</option></select>')
.appendTo( $('.test'+$i).empty() )
// .appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
}
$i++;
} );
}
});
});
/*
*/
</script>
{% endblock %}