templates/pages/searchresult.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block stylesheets %}
  3.     {{ parent() }}
  4.     <link rel="stylesheet" type="text/css" href="{{ asset('vendors/DataTables/DataTables-1.10.18/css/dataTables.bootstrap4.css') }}"/>
  5.     <style>
  6.         .table td {
  7.             padding: .1rem;
  8.         }
  9.         .dtr-title{
  10.             display: none !important;
  11.             min-width: 0px !important;
  12.             font-weight: bold;
  13.         }
  14.         .child{
  15.             border-top: none !important;
  16.         }
  17.        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 {
  18.             right: 1em;
  19.             content: none;
  20.         }
  21.         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 {
  22.             right: 0.5em;
  23.             content: none;
  24.         }
  25.         .child-container{
  26.             padding: 0 !important;
  27.         }
  28.         table.row-detail {
  29.             border-collapse: collapse;
  30.             width: 100%;
  31.         }
  32.         table.row-detail td {
  33.             padding: 5px 10px !important;
  34.             border-right: 1px solid #ddd;
  35.         }
  36.         table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child, table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child {
  37.             position: relative;
  38.             padding-left: 30px;
  39.             cursor: pointer;
  40.         }
  41.         table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child, table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child {
  42.             position: relative;
  43.             padding-left: 30px;
  44.             cursor: pointer;
  45.         }
  46.         #dtHorses_filter input {
  47.             padding: .5rem .75rem;
  48.             font-size: 1rem;
  49.             line-height: 1.25;
  50.             color: #495057;
  51.             background-color: #fff;
  52.             background-image: none;
  53.             background-clip: padding-box;
  54.             border: 1px solid rgba(0, 0, 0, 0.15);
  55.             border-radius: .25rem;
  56.             transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
  57.         }
  58.     </style>
  59. {% endblock %}
  60. {% block body %}
  61.     <section class="fashion-area section-gap pt-10" id="fashion" style="padding-top: 40px;">
  62.         <div class="container">
  63.             <div class="row">
  64.                 <div class="col-md-12 col-md-offset-0">
  65.                     <div class="x_panel">
  66.                         <div class="x_title">
  67.                             {% if horse == 'all' %}
  68.                                 <h3>Hestefakta</h3>
  69.                                 <br>
  70.                             {% endif %}
  71.                             <div class="clearfix"></div>
  72.                         </div>
  73.                         <div class="x_content">
  74.                             {% if horse == 'all' %}
  75.                             <div class="row">
  76.                                 <div class="col-12 col-lg-6 col-md-6 col-sm-12">
  77.                                     <form method="post" action="{{ path('app_search', {kind: 'horse' }) }}">
  78.                                         <div class="col-lg-12 col-sm-auto input-group mb-3 pl-0" >
  79.                                             <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;">
  80.                                              <div class="input-group-append">
  81.                                                 <button class="btn btn-outline-danger" type="submit"><i class="fa fa-search"></i></button>
  82.                                             </div>
  83.                                         </div>
  84.                                     </form>
  85.                                 </div>
  86.                             </div>
  87.                             {% if (result['horses'] is defined) %}
  88.                             {%  if ((result['horses'] | length) > 0) %}
  89.                                 <b>Hest</b><br>
  90.                                 {% for r in result['horses'] %}
  91.                                     <a href="{{ path('app_horses', { horse: r.id}) }}">{{ r.hor_name }}</a><br>
  92.                                 {% endfor %}
  93.                                 <br>
  94.                             {% endif %}
  95.                             {%  if ((result['trainers'] | length) > 0) %}
  96.                                 <b>Trener</b><br>
  97.                                 {% for r in result['trainers'] %}
  98.                                     <a href="{{ path('app_trainer', { trainer: r.id }) }}">{{ r.tra_lastname }}, {{ r.tra_firstname }}</a><br>
  99.                                 {% endfor %}
  100.                                 <br>
  101.                             {% endif %}
  102.                             {%  if ((result['drivers'] | length) > 0) %}
  103.                                 <b>Kusk</b><br>
  104.                                 {% for r in result['drivers'] %}
  105.                                     <a href="{{ path('app_driver', { driver: r.id }) }}">{{ r.dri_lastname }}, {{ r.dri_firstname }}</a><br>
  106.                                 {% endfor %}
  107.                                 <br>
  108.                             {% endif %}
  109.                             {% endif %}
  110.                         </div>
  111.                         {% else %}
  112.                             {% for a in horse %}
  113.                         <div class="x_title">
  114.                             <div style="width: 100%;">
  115.                                 <div style="width: 78%;display: inline-block;margin: 0px;padding: 0px;"><h3>{{ a.hor_name }}</h3></div>
  116.                                 <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>
  117.                             </div>
  118.                             <div class="clearfix"></div>
  119.                             </div>
  120.                             <div class="x_content">
  121.                                 <div class="col-lg-12">
  122.                                     <div class="row">
  123.                                         <div class="col-12 mt-3 pl-0">
  124.                                             {% if father %}
  125.                                                 <strong>e</strong> <a href="{{ path('app_horses', { horse: father.getId()}) }}">{{ father.getHorName() }}</a>
  126.                                             {% endif %}
  127.                                             <br>
  128.                                             {% if mother %}
  129.                                                 <strong>u</strong> <a href="{{ path('app_horses', { horse: mother.getId()}) }}">{{ mother.getHorName() }}</a>
  130.                                             {% endif %}
  131.                                             {% if grandfather %}
  132.                                                 <br>
  133.                                                 <strong>e</strong> <a href="{{ path('app_horses', { horse: grandfather.id }) }}">{{ grandfather.getHorName() }}</a>
  134.                                             {% endif %}
  135.                                             <br>
  136.                                             <br>
  137.                                             <strong>Oppdretter: </strong> {{ a.bre_name }}<br>
  138.                                             <strong>Trener: </strong>
  139.                                             {% if a.traid %}
  140.                                                 <a href="{{ path('app_trainer', { trainer: a.traid}) }}">{{ a.tra_firstname }} {{ a.tra_lastname }}</a>
  141.                                             {% endif %}
  142.                                         </div>
  143. <!--
  144.                                         <div class="col-sm-2 col-3 pl-0 mt-3">
  145.                                             <strong>Oppdretter</strong>
  146.                                         </div>
  147.                                         <div class="col-sm-10 col-9 mt-3">
  148.                                                 {{ a.bre_name }}
  149.                                         </div>
  150.                                         <div class="col-sm-2 col-3 pl-0">
  151.                                             <strong>Trener</strong>
  152.                                         </div>
  153.                                         <div class="col-sm-10 col-9">
  154.                                         {% if a.traid %}
  155.                                             <a href="{{ path('app_trainer', { trainer: a.traid}) }}">{{ a.tra_firstname }} {{ a.tra_lastname }}</a>
  156.                                         {% endif %}
  157.                                         </div>
  158.                                         {% if father %}
  159.                                         <div class="col-sm-2 col-3 pl-0 mt-3">
  160.                                             <strong>e</strong>
  161.                                         </div>
  162.                                         <div class="col-sm-10 col-9 mt-3">
  163.                                             <a href="{{ path('app_horses', { horse: father.getId()}) }}">{{ father.getHorName() }}</a>
  164.                                         </div>
  165.                                         {% endif %}
  166.                                         {% if mother %}
  167.                                         <div class="col-sm-2 col-3 pl-0">
  168.                                             <strong>u</strong>
  169.                                         </div>
  170.                                         <div class="col-sm-10 col-9">
  171.                                             <a href="{{ path('app_horses', { horse: mother.getId()}) }}">{{ mother.getHorName() }}</a>
  172.                                         </div>
  173.                                         {% endif %}
  174.                                         {% if grandfather %}
  175.                                             <div class="col-sm-2 col-3 pl-0">
  176.                                                 <strong>e</strong>
  177.                                             </div>
  178.                                             <div class="col-sm-10 col-9">
  179.                                                 <a href="{{ path('app_horses', { horse: grandfather.id }) }}">{{ grandfather.getHorName() }}</a>
  180.                                             </div>
  181.                                         {% endif %}
  182.                                         -->
  183.                                         <div class="col-lg-12 pl-0 mt-30" style="width: 100%; overflow: auto">
  184.                                             <div class="row">
  185.                                                 <div class="col-6 col-lg-2 col-sm-6 test1 mb-3"></div>
  186.                                                 <div class="col-6 col-lg-2 col-sm-6 test3 mb-3"></div>
  187.                                                 <div class="col-6 col-lg-2 col-sm-6 test8 mb-3"></div>
  188.                                                 <div class="col-6 col-lg-2 col-sm-6 test10 mb-3"></div>
  189.                                                 <div class="col-6 col-lg-2 col-sm-6 test15 mb-3"></div>
  190.                                             </div>
  191.                                             <table class="table table-hover table-responsive-sm display responsive" id="dtHorses">
  192.                                                 <thead>
  193.                                                     <tr>
  194.                                                         <th class="all">Løpsdag</th>
  195.                                                         <th class="all"></th>
  196.                                                         <th class="all">Bane</th>
  197.                                                         <th class="all"></th>
  198.                                                         <th class="all">Kusk</th>
  199.                                                         <th class="all">Trener</th>
  200.                                                         <th class="all">Spor</th>
  201.                                                         <th class="all">Dist</th>
  202.                                                         <th class="all"></th>
  203.                                                         <th class="all">Start</th>
  204.                                                         <th class="all"></th>
  205.                                                         <th class="all" style="text-align: center;">Plass</th>
  206.                                                         <th class="all">Tid</th>
  207.                                                         <th class="all" style="text-align: right;">Fpr</th>
  208.                                                         <th class="all" style="text-align: center;">Odds</th>
  209.                                                         <th class="all" style="text-align: center;">Forhold</th>
  210.                                                         <th class="all" style="white-space: nowrap;">M-tider</th>
  211.                                                         <th class="all">Monté</th>
  212.                                                         <th class="none"></th>
  213.                                                     </tr>
  214.                                                 </thead>
  215.                                                 <tbody>
  216.                                                 {% set c = 0 %}
  217.                                                 {% for i in info %}
  218.                                                     <!--
  219.                                                     {% if i.res_scratched == '1' or i.res_disq == '1' %}
  220.                                                         {% set st = 'background-color:#FDD' %}
  221.                                                     {%  else %}
  222.                                                         {% set st = '' %}
  223.                                                     {% endif %}
  224.                                                     -->
  225.                                                     {% if i.res_disq == '1' %}
  226.                                                         {% set pl = '-' %}
  227.                                                         {% set km = i.res_displaykmtime %}
  228.                                                         {% set st = '' %}
  229.                                                     {% elseif i.res_scratched == '1' %}
  230.                                                         {% set pl = '-' %}
  231.                                                         {% set km = 'str' %}
  232.                                                         {% set st = 'background-color:#FDD' %}
  233.                                                     {% elseif i.res_earnedmoney == '0' %}
  234.                                                         {% set pl = '0' %}
  235.                                                     {% else %}
  236.                                                         {% set pl = i.res_place %}
  237.                                                         {% set km = i.res_displaykmtime %}
  238.                                                         {% set st = '' %}
  239.                                                     {% endif %}
  240.                                                     <tr style="{{ st }}" >
  241.                                                         <td style="white-space: nowrap;">
  242.                                                             {% if i.mee_id  %}
  243.                                                                 <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>
  244.                                                             {% else %}
  245.                                                                 {{ i.mee_date|date('dmy') }}-{{ i.res_raceno}}
  246.                                                             {% endif %}
  247.                                                         </td>
  248.                                                         <td style="text-align: left">
  249.                                                             {% if (i.mee_date|date('m')  == 12) or  (i.mee_date|date('m')  < 3 )%}
  250.                                                                 Vinter
  251.                                                             {% elseif (i.mee_date|date('m')  < 6 )%}
  252.                                                                 Vår
  253.                                                             {% elseif (i.mee_date|date('m')  < 9 )%}
  254.                                                                 Sommer
  255.                                                             {% else %}
  256.                                                                 Høst
  257.                                                             {% endif %}
  258.                                                         </td>
  259.                                                         <td style="white-space: nowrap;">
  260.                                                             {{ i.trk_code }}
  261.                                                         </td>
  262.                                                         <td style="white-space: nowrap;">
  263.                                                             {{ i.trk_trackname|replace({' Travbane': '', ' Travpark': '', ' Tråvpark': '',  ' Galoppbane': '', }) }}
  264.                                                         </td>
  265.                                                         <td style="white-space: nowrap;">
  266.                                                             {% set first = i.dri_firstname|slice(0, 2) %}
  267.                                                             {% set last = i.dri_lastname|slice(0, 3) %}
  268.                                                             <a href="/driver/{{ i.driid }}">{{ first }} {{ last }}</a>
  269.                                                         </td>
  270.                                                         <td style="white-space: nowrap;">
  271.                                                             <a href="{{ path('app_trainer', { trainer: i.traid}) }}">{{ i.tra_shortname }}</a>
  272.                                                         </td>
  273.                                                         <td style="white-space: nowrap;">
  274.                                                             {{ i.res_startnumber}}
  275.                                                         </td>
  276.                                                         <td style="white-space: nowrap;">
  277.                                                             {{ i.res_distance }}
  278.                                                         </td>
  279.                                                         <td style="white-space: nowrap;"  class="none">
  280.                                                             {% if i.res_distance > 2399  %}
  281.                                                                 Lang
  282.                                                             {% elseif i.res_distance > 1799 %}
  283.                                                                 Mellom
  284.                                                             {% else %}
  285.                                                                 Sprint
  286.                                                             {% endif %}
  287.                                                         </td>
  288.                                                         <td style="white-space: nowrap; text-align: center;">
  289.                                                             {{ i.rac_startmethod_code|upper}}
  290.                                                         </td>
  291.                                                         <td style="white-space: nowrap;"  class="">
  292.                                                             {% if i.rac_startmethod_code == 'v'  %}
  293.                                                                 Volte
  294.                                                             {% else %}
  295.                                                                 Auto
  296.                                                             {% endif %}
  297.                                                         </td>
  298.                                                         <td style="text-align:center;white-space: nowrap;">
  299.                                                             {{ pl }}
  300.                                                         </td>
  301.                                                         <td style="white-space: nowrap;">
  302.                                                             {{ i.res_displaykmtime }}
  303.                                                         </td>
  304.                                                         <td style="text-align:right;white-space: nowrap;">
  305.                                                             {{ arr[c]|number_format(0, ',', ' ') }}
  306.                                                         </td>
  307.                                                         <td style="text-align:center;white-space: nowrap;">
  308.                                                             {{ i.res_odds }}
  309.                                                         </td>
  310.                                                         <td style="text-align:left;white-space: nowrap;">
  311.                                                             {{ i.trc_condition }}
  312.                                                         </td>
  313.                                                         <td style="white-space: nowrap;">
  314.                                                             {{ i.sta_pass500 }}-{{ i.sta_pass1000 }}
  315.                                                             {% if i.sta_pass500 %}
  316. <!-- COULD BE HERE -->
  317.                                                             {% endif %}
  318.                                                         </td>
  319.                                                         <td style="white-space: nowrap;text-align: center">
  320.                                                             {% if i.rac_monterace %}
  321.                                                                 <i class="fas fa-times"></i>
  322.                                                             {% endif %}
  323.                                                         </td>
  324.                                                         <td>{{ i.sta_comment }}</td>
  325.                                                     </tr>
  326.                                                    {% set c = c+1 %}
  327.                                                 {% endfor %}
  328.                                                 </tbody>
  329.                                             </table>
  330.                                         </div>
  331.                                     </div>
  332.                                 </div>
  333.                             </div>
  334.                         {%  endfor %}
  335.                         {% endif %}
  336.                     </div>
  337.                 </div>
  338.             </div>
  339.         </div>
  340.     </section>
  341. {% endblock %}
  342. {% block javascripts_end %}
  343.     {{ parent() }}
  344.     <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
  345.     <script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
  346.     <script>
  347.         $(document).ready(function() {
  348.             $('#dtHorses').DataTable( {
  349.                 responsive: {
  350.                     details: {
  351.                         display: $.fn.dataTable.Responsive.display.childRowImmediate,
  352.                         type: 'none',
  353.                         target: ''
  354.                     }
  355.                 },
  356.                 order: [[ 0, "desc" ]],
  357.                 dom: 'Bfrtip',
  358.                 language: {
  359.                     buttons: {
  360.                         pageLength: {
  361.                             _: "Vis %d",
  362.                             '-1': "Alle"
  363.                         }
  364.                     }
  365.                 },
  366.                 paging: false,
  367.                 info: false,
  368.                 pageLength: -1,
  369.                 oLanguage: {
  370.                     "sSearch": ""
  371.                 },
  372.                 columnDefs: [
  373.                     {
  374.                         "targets": [ 1,3,8,10 ],
  375.                         "visible": false,
  376.                     }
  377.                 ],
  378.                 initComplete: function () {
  379.                     $i = 0;
  380.                     this.api().columns().every( function () {
  381.                         var title = '';
  382.                         if($i == 1 || $i == 3 || $i == 8 || $i == 10 || $i == 15){
  383.                             if($i == 1){
  384.                                 title = 'Årstid';
  385.                             } else if($i == 3) {
  386.                                 title = 'Bane';
  387.                             } else if($i == 8) {
  388.                                 title = 'Distanse';
  389.                             } else if ($i == 10){
  390.                                 title = 'Starttype';
  391.                             } else if ($i == 15){
  392.                                 title = 'Baneforhold';
  393.                             }
  394.                             var column = this;
  395.                             var select = $('<select class="form-control"><option value="">'+title+'</option></select>')
  396.                                 .appendTo( $('.test'+$i).empty() )
  397.                                 //   .appendTo( $(column.footer()).empty() )
  398.                                 .on( 'change', function () {
  399.                                     var val = $.fn.dataTable.util.escapeRegex(
  400.                                         $(this).val()
  401.                                     );
  402.                                     column
  403.                                         .search( val ? '^'+val+'$' : '', true, false )
  404.                                         .draw();
  405.                                 } );
  406.                             column.data().unique().sort().each( function ( d, j ) {
  407.                                 select.append( '<option value="'+d+'">'+d+'</option>' )
  408.                             } );
  409.                         }
  410.                         $i++;
  411.                     } );
  412.                 }
  413.             });
  414.         });
  415.         /*
  416.                 */
  417.     </script>
  418. {% endblock %}