templates/homepage/search.html.twig line 1

  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.     {% if  activeManufacturer %}{{ activeManufacturer.name }} {% if activeModel %}{{ activeModel.name }} {% endif %}{% else %}{% if activeKind and activeKind.url == 'osobni-vozidla' or activeKind and activeKind.url == 'uzitkova-vozidla' or  activeKind and activeKind.url == 'nakladni-vozidla' or  activeKind and activeKind.url == 'obytna-vozidla' %}{{ activeKind.name|trans }} vozidla {% elseif(activeKind) %} {{ activeKind.name }} {% elseif(app.request.get('urlKind') ==  'nahradni-dily') %} Náhradní díly {% elseif(app.request.get('urlKind') ==  'prislusenstvi') %} Příslušenství {% endif %}  {% endif %} na prodej | Autanet.cz
  4. {% endblock %}
  5. {% block desc %}
  6.     {% if  activeManufacturer %}
  7.         Aktuální nabídka osobních vozidel  {{ activeManufacturer.name }} {% if activeModel %} {{ activeModel.name }}   {% endif %}  na prodej z autobazarů a autosalonů. Na prodej nová, předváděcí a ojetá auta všech značek.
  8.     {% else %}
  9.         {% if app.request.get('urlKind') == 'osobni-vozidla' %}
  10.             Aktuální nabídka osobních vozidel z autobazarů a autosalonů. Na prodej nová, předváděcí a ojetá auta všech značek.
  11.         {% elseif(app.request.get('urlKind') == 'uzitkova-vozidla') %}
  12.             Aktuální nabídka užitkových vozidel z autobazarů a autosalonů. Na prodej nová a ojetá vozidla značek Volkswagen, Ford, Fiat, Citroën a dalších.
  13.         {% elseif(app.request.get('urlKind') ==  'nakladni-vozidla') %}
  14.             Aktuální nabídka nákladních vozidel z autobazarů a autosalonů. Na prodej nová a ojetá vozidla všech značek.
  15.         {% elseif(app.request.get('urlKind') ==  'obytna-vozidla') %}
  16.             Aktuální nabídka obytných vozidel z autobazarů a autosalonů. Na prodej nová a ojetá vozidla značek Adria, Fiat, Volkswagen a dalších.
  17.         {% elseif(app.request.get('urlKind') ==  'motorky') %}
  18.             Aktuální nabídka motorek, čtyřkolek a skútrů z autobazarů a autosalonů. Na prodej motorky značek Honda, Ymaha, BMW, Can-Am a dalších.
  19.         {% elseif(app.request.get('urlKind') ==  'privesy-a-navesy') %}
  20.             Nabídka přívěsů a návěsů na prodej z autobazarů v inzerci na inzertním portálu Autanet.cz.
  21.         {% elseif(app.request.get('urlKind') ==  'autobusy') %}
  22.             Nabídka pracovních strojů na prodej z autobazarů v inzerci na inzertním portálu Autanet.cz.
  23.         {% elseif(app.request.get('urlKind') ==  'pracovni-stroje') %}
  24.             Nabídka autobusů na prodej z autobazarů v inzerci na inzertním portálu Autanet.cz.
  25.         {% elseif(app.request.get('urlKind') ==  'nahradni-dily') %}
  26.             Nabídka náhradních dílů na prodej z autobazarů v inzerci na inzertním portálu Autanet.cz.
  27.         {% elseif(app.request.get('urlKind') ==  'prislusenstvi') %}
  28.             Nabídka příslušenství na prodej z autobazarů v inzerci na inzertním portálu Autanet.cz.
  29.         {% endif %}
  30.     {% endif %}
  31. {% endblock %}
  32. {% block body %}
  33.     
  34.     {#
  35.     <section class="info">
  36.         <a class="info__item" href="">
  37.             <i class="icon icon-heart"></i>
  38.             Oblíbené inzeráty
  39.             <div class="info__number">0</div>
  40.         </a>
  41.         <a class="info__item" href="">
  42.             <i class="icon icon-search"></i>
  43.             Naposledy hledané
  44.             <div class="info__number">26</div>
  45.         </a>
  46.     </section>
  47.     #}
  48.     <form id="form-search" class="form form--mobile-sticky">
  49.         <div class="form__hidden-mobile">
  50.             <button class="form__toggler-mobile js-form__show-filter-desktop button" type="button">
  51.                 <span class="form__toggler-mobile-more">Zobrazit filtr</span>
  52.                 <span class="form__toggler-mobile-less">Skrýt filtr</span>
  53.                 <i class="icon icon-chevron-down"></i>
  54.             </button>
  55.         </div>
  56.         <div class="form__hidden-desktop">
  57.             <button class="form__toggler-mobile js-form__toggler-mobile button" type="button">
  58.                 <span class="form__toggler-mobile-more">Zobrazit filtr</span>
  59.                 <span class="form__toggler-mobile-less">Skrýt filtr</span>
  60.                 <i class="icon icon-chevron-down"></i>
  61.             </button>
  62.         </div>
  63.         <div class="form__collapse-mobile js-form__collapse-mobile" style="display: none;">
  64.             <div class="form__checkboxes">
  65.                 {% for c in categories %}
  66.                     {% if loop.index == 3 %}
  67.                         <div class="form__check-radio form__check-radio--strong">
  68.                             <input type="checkbox" id="condition-2" name="condition[]" value="2"
  69.                                     {% if app.request.get('condition') and 2 in  app.request.get('condition')  or not app.request.get('condition') and   not  app.request.get('category') %}   checked   {% endif %} >
  70.                             <label for="condition-2">Předváděcí</label>
  71.                         </div>
  72.                     {% endif %}
  73.                     {% if  c.name != 'Náhradní díl' and c.name != 'Příslušenství' %}
  74.                         <div class="form__check-radio form__check-radio--strong">
  75.                             <input type="checkbox" id="cat-{{ c.id }}" name="category[]" value="{{ c.id }}"
  76.                                     {% if app.request.get('category') and  c.id in  app.request.get('category')  or (not app.request.get('condition') and not  app.request.get('category')) %}   checked    {% endif %} >
  77.                             <label for="cat-{{ c.id }}">{{ c.name }}  </label>
  78.                         </div>
  79.                     {% endif %}
  80.                 {% endfor %}
  81.                 <div class="form__check-radio form__check-radio--strong">
  82.                     <input type="checkbox" id="condition-14" name="condition[]" value="14"
  83.                             {% if app.request.get('condition') and  14 in  app.request.get('condition')  == 14 or  not app.request.get('condition') and  not  app.request.get('category') %}   checked   {% endif %} >
  84.                     <label for="condition-14">Havarované</label>
  85.                 </div>
  86.             </div>
  87.             <div class="form__columns form__columns--3">
  88.                 <fieldset>
  89.                     <div class="form__group">
  90.                         <label>Značka</label>
  91.                         <!-- if you need a search input in select 2 use class .js-select2-search -->
  92.                         <select id="manufacturer" class="js-select2" name="manufacturer">
  93.                             <option value="">Nezadáno</option>
  94.                             {% for m in manufacturers %}
  95.                                 <option value="{{ m.url }}" {% if activeManufacturer and m.id == activeManufacturer.id %}  selected  {% endif %} >{{ m.name }}</option>
  96.                             {% endfor %}
  97.                         </select>
  98.                     </div>
  99.                     <div class="form__group">
  100.                         <label>Model</label>
  101.                         <select class="js-select2" name="model">
  102.                             <option value="">Nezadáno</option>
  103.                             {% for m in models %}
  104.                                 <option value="{{ m.url }}" {% if activeModel and  m.id == activeModel.id %}  selected  {% endif %} >{{ m.name }}</option>
  105.                             {% endfor %}
  106.                         </select>
  107.                     </div>
  108.                     <script>
  109.                         const modelSelect = document.querySelector('select[name="model"]')
  110.                         $('#manufacturer').on("select2:select", function (e) {
  111.                             fetch('/api/vehicle-models?vehicles.visible=true&vehicles.manufacturer.url=' + e.target.value, {
  112.                                 method: 'GET',
  113.                                 headers: {
  114.                                     'Accept': 'application/json',
  115.                                 },
  116.                             })
  117.                                 .then(response => response.json())
  118.                                 .then(
  119.                                     function (response) {
  120.                                         //add to select values
  121.                                         modelSelect.innerHTML = '<option value="">Model</option>'
  122.                                         response.forEach(function (item) {
  123.                                             modelSelect.innerHTML += '<option value="' + item.url + '">' + item.name + '</option>'
  124.                                         })
  125.                                     })
  126.                         });
  127.                     </script>
  128.                     {#
  129.                     <div class="form__controls">
  130.                         <button class="button form__plus">
  131.                             Přidat značku
  132.                         </button>
  133.                     </div>
  134.                     #}
  135.                 </fieldset>
  136.                 <fieldset>
  137.                     <div class="form__row">
  138.                         <div class="form__group">
  139.                             <label>Rok od</label>
  140.                             <select class="js-select2" name="yearFrom">
  141.                                 <option value="">Nezadáno</option>
  142.                                 {% for i in 2023..1990 %}
  143.                                     <option value="{{ i }}" {% if i == app.request.get('yearFrom') %}  selected  {% endif %} >{{ i }}</option>
  144.                                 {% endfor %}
  145.                                 <option value="1980" {% if 1980 == app.request.get('yearFrom') %}  selected  {% endif %} >
  146.                                     1980
  147.                                 </option>
  148.                                 <option value="1970" {% if 1970 == app.request.get('yearFrom') %}  selected  {% endif %} >
  149.                                     1970
  150.                                 </option>
  151.                                 <option value="1930" {% if 1930 == app.request.get('yearFrom') %}  selected  {% endif %} >
  152.                                     1930
  153.                                 </option>
  154.                             </select>
  155.                         </div>
  156.                         <div class="form__group">
  157.                             <label>Rok do</label>
  158.                             <select class="js-select2" name="yearTo">
  159.                                 <option value="">Nezadáno</option>
  160.                                 {% for i in 2023..1990 %}
  161.                                     <option value="{{ i }}" {% if i == app.request.get('yearTo') %}  selected  {% endif %} >{{ i }}</option>
  162.                                 {% endfor %}
  163.                                 <option value="1980" {% if 1980 == app.request.get('yearTo') %}  selected  {% endif %} >
  164.                                     1980
  165.                                 </option>
  166.                                 <option value="1970" {% if 1970 == app.request.get('yearTo') %}  selected  {% endif %} >
  167.                                     1970
  168.                                 </option>
  169.                                 <option value="1930" {% if 1930 == app.request.get('yearTo') %}  selected  {% endif %} >
  170.                                     1930
  171.                                 </option>
  172.                             </select>
  173.                         </div>
  174.                     </div>
  175.                     <div class="form__row">
  176.                         <div class="form__group">
  177.                             <label>Cena od</label>
  178.                             <select class="js-select2" name="priceFrom">
  179.                                 <option value="">Nezadáno</option>
  180.                                 <option value="25000" {% if "25000" == app.request.get('priceFrom') %}  selected  {% endif %} >
  181.                                     25 000
  182.                                 </option>
  183.                                 <option value="50000" {% if "50000" == app.request.get('priceFrom') %}  selected  {% endif %} >
  184.                                     50 000
  185.                                 </option>
  186.                                 <option value="75000" {% if "75000" == app.request.get('priceFrom') %} selected {% endif %}>
  187.                                     75 000
  188.                                 </option>
  189.                                 <option value="100000" {% if "100000" == app.request.get('priceFrom') %} selected {% endif %}>
  190.                                     100 000
  191.                                 </option>
  192.                                 <option value="125000" {% if "125000" == app.request.get('priceFrom') %} selected {% endif %}>
  193.                                     125 000
  194.                                 </option>
  195.                                 <option value="150000" {% if "150000" == app.request.get('priceFrom') %} selected {% endif %}>
  196.                                     150 000
  197.                                 </option>
  198.                                 <option value="175000" {% if "175000" == app.request.get('priceFrom') %} selected {% endif %}>
  199.                                     175 000
  200.                                 </option>
  201.                                 <option value="200000" {% if "200000" == app.request.get('priceFrom') %} selected {% endif %}>
  202.                                     200 000
  203.                                 </option>
  204.                                 <option value="225000" {% if "225000" == app.request.get('priceFrom') %} selected {% endif %}>
  205.                                     225 000
  206.                                 </option>
  207.                                 <option value="250000" {% if "250000" == app.request.get('priceFrom') %} selected {% endif %}>
  208.                                     250 000
  209.                                 </option>
  210.                                 <option value="275000" {% if "275000" == app.request.get('priceFrom') %} selected {% endif %}>
  211.                                     275 000
  212.                                 </option>
  213.                                 <option value="300000" {% if "300000" == app.request.get('priceFrom') %} selected {% endif %}>
  214.                                     300 000
  215.                                 </option>
  216.                                 <option value="325000" {% if "325000" == app.request.get('priceFrom') %} selected {% endif %}>
  217.                                     325 000
  218.                                 </option>
  219.                                 <option value="350000" {% if "350000" == app.request.get('priceFrom') %} selected {% endif %}>
  220.                                     350 000
  221.                                 </option>
  222.                                 <option value="375000" {% if "375000" == app.request.get('priceFrom') %} selected {% endif %}>
  223.                                     375 000
  224.                                 </option>
  225.                                 <option value="400000" {% if "400000" == app.request.get('priceFrom') %} selected {% endif %}>
  226.                                     400 000
  227.                                 </option>
  228.                                 <option value="500000" {% if "500000" == app.request.get('priceFrom') %} selected {% endif %}>
  229.                                     500 000
  230.                                 </option>
  231.                                 <option value="600000" {% if "600000" == app.request.get('priceFrom') %} selected {% endif %}>
  232.                                     600 000
  233.                                 </option>
  234.                                 <option value="700000" {% if "700000" == app.request.get('priceFrom') %} selected {% endif %}>
  235.                                     700 000
  236.                                 </option>
  237.                                 <option value="800000" {% if "800000" == app.request.get('priceFrom') %} selected {% endif %}>
  238.                                     800 000
  239.                                 </option>
  240.                                 <option value="900000" {% if "900000" == app.request.get('priceFrom') %} selected {% endif %}>
  241.                                     900 000
  242.                                 </option>
  243.                                 <option value="1000000" {% if "1000000" == app.request.get('priceFrom') %} selected {% endif %}>
  244.                                     1 mil
  245.                                 </option>
  246.                                 <option value="1250000" {% if "1250000" == app.request.get('priceFrom') %} selected {% endif %}>
  247.                                     1.25 mil
  248.                                 </option>
  249.                                 <option value="1500000" {% if "1500000" == app.request.get('priceFrom') %} selected {% endif %}>
  250.                                     1.5 mil
  251.                                 </option>
  252.                                 <option value="2000000" {% if "2000000" == app.request.get('priceFrom') %} selected {% endif %}>
  253.                                     2 mil
  254.                                 </option>
  255.                                 <option value="5000000" {% if "5000000" == app.request.get('priceFrom') %} selected {% endif %}>
  256.                                     5 mil
  257.                                 </option>
  258.                             </select>
  259.                         </div>
  260.                         <div class="form__group">
  261.                             <label>Cena do</label>
  262.                             <select class="js-select2" name="priceTo">
  263.                                 <option value="">Nezadáno</option>
  264.                                 <option value="25000" {% if "25000" == app.request.get('priceTo') %}  selected  {% endif %} >
  265.                                     25 000
  266.                                 </option>
  267.                                 <option value="50000" {% if "50000" == app.request.get('priceTo') %}  selected  {% endif %} >
  268.                                     50 000
  269.                                 </option>
  270.                                 <option value="75000" {% if "75000" == app.request.get('priceTo') %} selected {% endif %}>
  271.                                     75 000
  272.                                 </option>
  273.                                 <option value="100000" {% if "100000" == app.request.get('priceTo') %} selected {% endif %}>
  274.                                     100 000
  275.                                 </option>
  276.                                 <option value="125000" {% if "125000" == app.request.get('priceTo') %} selected {% endif %}>
  277.                                     125 000
  278.                                 </option>
  279.                                 <option value="150000" {% if "150000" == app.request.get('priceTo') %} selected {% endif %}>
  280.                                     150 000
  281.                                 </option>
  282.                                 <option value="175000" {% if "175000" == app.request.get('priceTo') %} selected {% endif %}>
  283.                                     175 000
  284.                                 </option>
  285.                                 <option value="200000" {% if "200000" == app.request.get('priceTo') %} selected {% endif %}>
  286.                                     200 000
  287.                                 </option>
  288.                                 <option value="225000" {% if "225000" == app.request.get('priceTo') %} selected {% endif %}>
  289.                                     225 000
  290.                                 </option>
  291.                                 <option value="250000" {% if "250000" == app.request.get('priceTo') %} selected {% endif %}>
  292.                                     250 000
  293.                                 </option>
  294.                                 <option value="275000" {% if "275000" == app.request.get('priceTo') %} selected {% endif %}>
  295.                                     275 000
  296.                                 </option>
  297.                                 <option value="300000" {% if "300000" == app.request.get('priceTo') %} selected {% endif %}>
  298.                                     300 000
  299.                                 </option>
  300.                                 <option value="325000" {% if "325000" == app.request.get('priceTo') %} selected {% endif %}>
  301.                                     325 000
  302.                                 </option>
  303.                                 <option value="350000" {% if "350000" == app.request.get('priceTo') %} selected {% endif %}>
  304.                                     350 000
  305.                                 </option>
  306.                                 <option value="375000" {% if "375000" == app.request.get('priceTo') %} selected {% endif %}>
  307.                                     375 000
  308.                                 </option>
  309.                                 <option value="400000" {% if "400000" == app.request.get('priceTo') %} selected {% endif %}>
  310.                                     400 000
  311.                                 </option>
  312.                                 <option value="500000" {% if "500000" == app.request.get('priceTo') %} selected {% endif %}>
  313.                                     500 000
  314.                                 </option>
  315.                                 <option value="600000" {% if "600000" == app.request.get('priceTo') %} selected {% endif %}>
  316.                                     600 000
  317.                                 </option>
  318.                                 <option value="700000" {% if "700000" == app.request.get('priceTo') %} selected {% endif %}>
  319.                                     700 000
  320.                                 </option>
  321.                                 <option value="800000" {% if "800000" == app.request.get('priceTo') %} selected {% endif %}>
  322.                                     800 000
  323.                                 </option>
  324.                                 <option value="900000" {% if "900000" == app.request.get('priceTo') %} selected {% endif %}>
  325.                                     900 000
  326.                                 </option>
  327.                                 <option value="1000000" {% if "1000000" == app.request.get('priceTo') %} selected {% endif %}>
  328.                                     1 mil
  329.                                 </option>
  330.                                 <option value="1250000" {% if "1250000" == app.request.get('priceTo') %} selected {% endif %}>
  331.                                     1.25 mil
  332.                                 </option>
  333.                                 <option value="1500000" {% if "1500000" == app.request.get('priceTo') %} selected {% endif %}>
  334.                                     1.5 mil
  335.                                 </option>
  336.                                 <option value="2000000" {% if "2000000" == app.request.get('priceTo') %} selected {% endif %}>
  337.                                     2 mil
  338.                                 </option>
  339.                                 <option value="5000000" {% if "5000000" == app.request.get('priceTo') %} selected {% endif %}>
  340.                                     5 mil
  341.                                 </option>
  342.                             </select>
  343.                         </div>
  344.                     </div>
  345.                     {% if  app.request.get('urlKind') != 'privesy-a-navesy' and app.request.get('urlKind') != 'nahradni-dily' and app.request.get('urlKind') != 'prislusenstvi' %}
  346.                         <div class="form__group">
  347.                             <label>Stav tachometru</label>
  348.                             <select class="js-select2" name="millage">
  349.                                 <option value="">Nezadáno</option>
  350.                                 {% for k,  mv in mileageValues %}
  351.                                     <option value="{{ k }}" {% if k == app.request.get('millage') %} selected {% endif %}>{{ mv }}</option>
  352.                                 {% endfor %}
  353.                             </select>
  354.                         </div>
  355.                         <div class="form__group">
  356.                             <label>Karoserie</label>
  357.                             <select class="js-select2" name="body">
  358.                                 <option value="">Nezadáno</option>
  359.                                 {% for b in bodies %}
  360.                                     <option value="{{ b.id }}" {% if b.id == app.request.get('body') %}  selected  {% endif %} >{{ b.name }}</option>
  361.                                 {% endfor %}
  362.                             </select>
  363.                         </div>
  364.                     {% endif %}
  365.                 </fieldset>
  366.                 <fieldset>
  367.                     {% if  app.request.get('urlKind') != 'privesy-a-navesy' and app.request.get('urlKind') != 'nahradni-dily' and app.request.get('urlKind') != 'prislusenstvi' %}
  368.                         <div class="form__group">
  369.                             <label>Palivo</label>
  370.                             <select class="js-select2" name="fuel">
  371.                                 <option value="">Nezadáno</option>
  372.                                 {% for f in fuels %}
  373.                                     <option value="{{ f.id }}" {% if f.id == app.request.get('fuel') %}  selected  {% endif %} >{{ f.name }}</option>
  374.                                 {% endfor %}
  375.                             </select>
  376.                         </div>
  377.                         <div class="form__group">
  378.                             <label>Převodovka</label>
  379.                             <select class="js-select2" name="gearbox">
  380.                                 <option value="">Nezadáno</option>
  381.                                 {% for g in gearbox %}
  382.                                     <option value="{{ g }}" {% if g  == app.request.get('gearbox') %}  selected  {% endif %} >{{ g }}</option>
  383.                                 {% endfor %}
  384.                             </select>
  385.                         </div>
  386.                         <div class="form__group">
  387.                             <label>Výkon</label>
  388.                             <select class="js-select2" name="engine_power">
  389.                                 <option value="">Nezadáno</option>
  390.                                 {% for k,  mv in powerValues %}
  391.                                     <option value="{{ k }}" {% if k == app.request.get('engine_power') %} selected {% endif %}>{{ mv }}</option>
  392.                                 {% endfor %}
  393.                             </select>
  394.                         </div>
  395.                     {% endif %}
  396.                     {% if  app.request.get('urlKind') == 'prislusenstvi' or app.request.get('urlKind') == 'nahradni-dily' %}
  397.                         <div class="form__group">
  398.                             <label>Kategorie</label>
  399.                             <select class="js-select2" name="partKind">
  400.                                 <option value="">Nezadáno</option>
  401.                                 {% for pk in vehiclePartKindValues %}
  402.                                     <option value="{{ pk.id }}" {% if  pk.id  == app.request.get('partKind') %}  selected  {% endif %} >{{ pk.name }}</option>
  403.                                 {% endfor %}
  404.                             </select>
  405.                         </div>
  406.                     {% endif %}
  407.                     <div class="form__group">
  408.                         <label>Kraj / okres</label>
  409.                         <select class="js-select2" name="place">
  410.                             <option value="">Nezadáno</option>
  411.                             {% for p in selectPlaceValues %}
  412.                                 <option value="{{ p.url }}" {% if  p.url  == app.request.get('place') %}  selected  {% endif %} >{{ p.name }}</option>
  413.                             {% endfor %}
  414.                         </select>
  415.                     </div>
  416.                 </fieldset>
  417.             </div>
  418.             <footer class="form__footer">
  419.                 <div class="form__footer-cell"></div>
  420.                 <div class="form__footer-cell">
  421.                     <button class="form__submit" type="submit">
  422.                         Zobrazit vozidla
  423.                     </button>
  424.                 </div>
  425.             </footer>
  426.             <div class="form__sticky">
  427.                 <button class="form__submit" type="submit">
  428.                     Zobrazit vozidla
  429.                 </button>
  430.             </div>
  431.         </div>
  432.         <input type="hidden" name="order" value="{{ app.request.get('order') }}">
  433.         <input type="hidden" name="kind" value="{{ app.request.get('kind') }}">
  434.     </form>
  435.     <section class="grid grid--padding40 grid--gap20" id="order">
  436.         <div>
  437.             <div class="grid__results">
  438.                 <h2 class="grid__title">
  439.                     {% if  activeManufacturer %}
  440.                         {{ activeManufacturer.name }}
  441.                         {% if activeModel %} {{ activeModel.name }}   {% endif %}
  442.                     {% else %}
  443.                         {% if activeKind and activeKind.url == 'osobni-vozidla' or
  444.                             activeKind and activeKind.url == 'uzitkova-vozidla' or  activeKind and activeKind.url == 'nakladni-vozidla'
  445.                             or  activeKind and activeKind.url == 'obytna-vozidla' %}
  446.                             {{ activeKind.name|trans }} vozidla
  447.                         {% elseif(activeKind) %}
  448.                             {{ activeKind.name }}
  449.                         {% elseif(app.request.get('urlKind') ==  'nahradni-dily') %}
  450.                             Náhradní díly
  451.                         {% elseif(app.request.get('urlKind') ==  'prislusenstvi') %}
  452.                             Příslušenství
  453.                         {% endif %}
  454.                     {% endif %}
  455.                     na prodej</h2>
  456.                 <div class="grid__results-label">{{ vehicles.totalItemCount }} inzerátů</div>
  457.                 <form class="grid__results-form" style="min-width: 220px">
  458.                     <select id="select-order" class="js-select2" name="order">
  459.                         <option value="1" {% if app.request.get('order') == '1' %} selected {% endif %}>Nejlevnější
  460.                         </option>
  461.                         <option value="2" {% if app.request.get('order') == '2' %} selected {% endif %}>Nejdražší
  462.                         </option>
  463.                         <option value="3" {% if app.request.get('order') == '3' %} selected {% endif %}>Stav
  464.                             tachometru
  465.                         </option>
  466.                         <option value="4" {% if app.request.get('order') == '4' %} selected {% endif %}>Rok výroby
  467.                         </option>
  468.                         <option value="5" {% if app.request.get('order') == '5' %} selected {% endif %}>Nejnovější
  469.                         </option>
  470.                     </select>
  471.                 </form>
  472.             </div>
  473.             <script>
  474.                 const formSearch = document.getElementById('form-search')
  475.                 $(document).ready(function () {
  476.                     const hasActiveFilters = checkActiveFilters();
  477.                     const wasFormSubmitted = sessionStorage.getItem('formSubmitted') === 'true';
  478.                     if (!hasActiveFilters && !wasFormSubmitted) {
  479.                         $('.js-form__collapse-mobile').show();
  480.                         $('.js-form__show-filter').hide();
  481.                         $('.js-form__show-filter-desktop').show();
  482.                         $('.form__toggler-mobile-more').hide();
  483.                         $('.form__toggler-mobile-less').show();
  484.                         $('.js-form__toggler-mobile').addClass('active');
  485.                         if ($('.form__hidden-desktop').is(':visible')) {
  486.                             $('.form').addClass('fixed');
  487.                             $('body').addClass('no-scroll');
  488.                         }
  489.                     } else {
  490.                         $('.js-form__collapse-mobile').hide();
  491.                         $('.js-form__show-filter').show();
  492.                         $('.form__toggler-mobile-more').show();
  493.                         $('.form__toggler-mobile-less').hide();
  494.                         $('.js-form__toggler-mobile').removeClass('active');
  495.                     }
  496.                     if (wasFormSubmitted) {
  497.                         sessionStorage.removeItem('formSubmitted');
  498.                     }
  499.                 });
  500.                 function checkActiveFilters() {
  501.                     const pathData = window.location.pathname.split('/');
  502.                     return pathData.length > 2;
  503.                 }
  504.                 formSearch.addEventListener('submit', (e) => {
  505.                     e.preventDefault();
  506.                     const formData = new FormData(document.getElementById('form-search'))
  507.                     formData.delete('order')
  508.                     formData.append('order', e.target.value)
  509.                     let manufacturer = formData.get('manufacturer')
  510.                     let model = formData.get('model')
  511.                     formData.delete('manufacturer')
  512.                     formData.delete('model')
  513.                     const asString = new URLSearchParams(formData).toString();
  514.                     sessionStorage.setItem('formSubmitted', 'true');
  515.                     $('.js-form__collapse-mobile').slideUp();
  516.                     $('.js-form__toggler-mobile').parent().hide();
  517.                     $('.js-form__toggler-mobile').removeClass('active');
  518.                     $('.js-form__show-filter').show();
  519.                     $('.form').removeClass('fixed');
  520.                     $('body').removeClass('no-scroll');
  521.                     if (manufacturer && model) {
  522.                         window.location.href = "/{{ app.request.get('urlKind') }}/" + manufacturer + "/" + model + "/?" + asString;
  523.                     } else if (manufacturer) {
  524.                         window.location.href = "/{{ app.request.get('urlKind') }}/" + manufacturer + "/?" + asString;
  525.                     } else {
  526.                         window.location.href = "/{{ app.request.get('urlKind') }}/?" + asString;
  527.                     }
  528.                 })
  529.                 $('.js-form__show-filter-btn').click(function () {
  530.                     $('.js-form__show-filter').hide();
  531.                     $('.js-form__toggler-mobile').parent().show();
  532.                     $('.js-form__collapse-mobile').slideDown();
  533.                 });
  534.                 $('.js-form__show-filter-desktop').click(function () {
  535.                     const $btn = $(this);
  536.                     const $collapse = $('.js-form__collapse-mobile');
  537.                     if ($collapse.is(':visible')) {
  538.                         $collapse.slideUp();
  539.                         $btn.find('.form__toggler-mobile-more').show();
  540.                         $btn.find('.form__toggler-mobile-less').hide();
  541.                         $btn.removeClass('active');
  542.                     } else {
  543.                         $collapse.slideDown();
  544.                         $btn.find('.form__toggler-mobile-more').hide();
  545.                         $btn.find('.form__toggler-mobile-less').show();
  546.                         $btn.addClass('active');
  547.                     }
  548.                 });
  549.                 $('#select-order').on("select2:select", function (e) {
  550.                     const formData = new FormData(document.getElementById('form-search'))
  551.                     formData.append('order', e.target.value)
  552.                     let manufacturer = formData.get('manufacturer')
  553.                     let model = formData.get('model')
  554.                     formData.delete('manufacturer')
  555.                     formData.delete('model')
  556.                     const asString = new URLSearchParams(formData).toString();
  557.                     if (manufacturer && model) {
  558.                         window.location.href = "/{{ app.request.get('urlKind') }}/" + manufacturer + "/" + model + "/?" + asString;
  559.                     } else if (manufacturer) {
  560.                         window.location.href = "/{{ app.request.get('urlKind') }}/" + manufacturer + "/?" + asString;
  561.                     } else {
  562.                         window.location.href = "/{{ app.request.get('urlKind') }}/?" + asString;
  563.                     }
  564.                 });
  565.             </script>
  566.             {% for v in vehicles %}
  567.                 {% if loop.index == 4 %}
  568.                     <article class="pre-purchase">
  569.                         <img class="pre-purchase__image" src="{{ asset('img/pre-purchase__image.png') }}" alt="">
  570.                         <h2 class="pre-purchase__title">Kupujete ojeté auto?</h2>
  571.                         <div class="pre-purchase__text">
  572.                             <p>Prověřením historie vozu před koupí vyřešíte případné problémy po koupi.</p>
  573.                             <ul class="pre-purchase__list">
  574.                                 <li>Upravený tachometr</li>
  575.                                 <li>Problémová historie</li>
  576.                                 <li>Oprava po havárií</li>
  577.                                 <li>Nepravidelný servis</li>
  578.                             </ul>
  579.                             <a class="pre-purchase__button" href="/proverit-auto#cenik">
  580.                                 Prověřit auto
  581.                                 <i class="icon icon-arrow-right"></i>
  582.                             </a>
  583.                         </div>
  584.                     </article>
  585.                 {% endif %}
  586.                 {% include 'vehicle/_vehicle.html.twig' with { vehicle: v } %}
  587.                 {% if loop.index == 1 %}
  588.                     <div id="banner-mobile-container" class="banner-mobile"></div>
  589.                 {% endif %}
  590.                 {% if loop.index == 5 %}
  591.                     <div id="adform_squarem"></div>
  592.                 {% endif %}
  593.                 {% if loop.index == 10 %}
  594.                     <div id="AdTrackGenericInterscrollerMobile"></div>
  595.                 {% endif %}
  596.                 {% if loop.index == 15 %}
  597.                     <div id="adform_squarem2"></div>
  598.                 {% endif %}
  599.             {% endfor %}
  600.             <div class="navigation">
  601.                 {{ knp_pagination_render(vehicles) }}
  602.             </div>
  603.         </div>
  604.         <div>
  605.             <div id="adform_halfpage"></div>
  606.             <br>
  607.             <div id="banner-container" class="banner"></div>
  608.             {{ render(controller( 'App\\Controller\\VehicleTipController::tip' )) }}
  609.             <div id="adform_halfpage2"></div>
  610.         </div>
  611.     </section>
  612.     <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  613.     <script>
  614.         $(".js-select2").select2({
  615.             language: "cs",
  616.             minimumResultsForSearch: -1,
  617.             width: "100%",
  618.         });
  619.     </script>
  620. {% endblock %}