templates/front/product/listSearch.html.twig line 1

Open in your IDE?
  1. {% extends 'base_front.html.twig' %}
  2. {% block meta %}
  3.     <title>Les resultats</title>
  4.     <meta name="description" content="Les produits disponibles. Actuellement, {{ countProducts }} produits disponibles.">
  5. {% endblock %}
  6. {% block style %}
  7.     <link rel="stylesheet" href="{{ asset('css/styleFiltreHebergement.css') }}">
  8.     <link rel="stylesheet" href="{{ asset('css/front/promo.css') }}">
  9. {% endblock %}
  10. {% block body %}
  11.     <div class="page-header heor-section-style mine" style="
  12.             height: 100%;
  13.             {% if categoryBackground is defined and categoryBackground is not null and categoryBackground.image is not null %}
  14.                 background: url({{ asset(constant('App\\Services\\File::IMAGE_CATEGORY_DIR') ~ categoryBackground.image) }})
  15.             {% else %}
  16.                 background: url({{ asset('images/vacance_background.jpg') }})
  17.             {% endif %}
  18.             no-repeat center;background-size: cover">
  19.         <div class="container">
  20.             <div
  21.                 class="row">
  22.                 <!-- page caption -->
  23.                 <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 ">
  24.                     <div class="page-caption">
  25.                         <h1 class="page-title">Resultat</h1>
  26.                     </div>
  27.                 </div>
  28.                 <!-- /.page caption -->
  29.             </div>
  30.         </div>
  31.         <!-- page caption -->
  32.         <div class="page-breadcrumb">
  33.             <div class="container">
  34.                 <div class="row">
  35.                     <nav aria-label="breadcrumb">
  36.                         <ol class="breadcrumb">
  37.                             <li class="breadcrumb-item">
  38.                                 <a href="{{ path('front_home') }}" class="breadcrumb-link">Accueil</a>
  39.                             </li>
  40.                             <li class="breadcrumb-item active text-white" aria-current="page">Recherche :
  41.                                 {% if app.session.get('categoryName') %}
  42.                                     {{ app.session.get('categoryName') }}
  43.                                 {% endif %}
  44.                                 {% if app.session.get('departmentName') %}-
  45.                                     {{ app.session.get('departmentName') }}
  46.                                 {% endif %}
  47.                                 {% if app.session.get('weddingdate') %}-
  48.                                     {{ app.session.get('weddingdate') }}
  49.                                 {% endif %}
  50.                                 {% if app.session.get('weddingdate_start') and app.session.get('weddingdate_end') %}
  51.                                     - {{ app.session.get('weddingdate_start') }} - {{ app.session.get('weddingdate_end') }}
  52.                                 {% endif %}
  53.                             </li>
  54.                         </ol>
  55.                     </nav>
  56.                 </div>
  57.             </div>
  58.         </div>
  59.         <!-- page breadcrumb -->
  60.     </div>
  61.     <!-- /.page-header -->
  62.     {% if isPromoAdmin %}
  63.     <div class="bannier-promo mt-5">
  64.         <div class="cont">
  65.             Promotion
  66.             <span class="percent">{{ isPromoAdmin.value }}%</span>
  67.             {# <svg class="outlined-text" width="80%" height="200" viewBox="0 0 800 200" preserveAspectRatio="xMidYMid meet">
  68.                 <text x="50" y="140">-20%</text>
  69.             </svg> #}
  70.             de commission en cours jusqu'au <span class="date-fin-prom">{{ isPromoAdmin.endAt|format_date('long', locale='fr') }}</span>
  71.             pour tous les serveices
  72.         </div>
  73.     </div>
  74.     {% endif %}
  75.     <!-- vendor-section -->
  76.     <div class="content">
  77.         <div class="container">
  78.             <div class="row">
  79.                 <div class="col-xl-8 col-lg-8 col-md-7 col-sm-12 col-12">
  80.                     {% for message in app.flashes('success') %}
  81.                         <div class="alert alert-success">
  82.                             {{ message }}
  83.                         </div>
  84.                     {% endfor %}
  85.                     <div id="allProduct" class="row">
  86.                         {% if products|length > 0 %}
  87.                         {# <div class="col-12">
  88.                             <button type="button" class="btn btn-primary mb-2" data-toggle="modal" data-target="#modalFilter">Filter</button>
  89.                         </div> #}
  90.                             {% for product in products %}
  91.                                 {% set subCategorySlug = product.subCategories.toArray()[0].subCategorySlug %}
  92.                                 <div class="col-lg-6 col-sm-12 col-12">
  93.                                     <div class="container-block-Pcompanies mb-3">
  94.                                         {# <div class="container-imageP zoomimg"> #}
  95.                                         <div class="container-slide-image">
  96.                                             {% if product.photos.first != false %}
  97.                                                 {% for imgHebmt in product.photos.toArray() %}
  98.                                                     <img src="{{ asset(constant('App\\Services\\File::IMAGE_PRODUCT_DIR') ~ imgHebmt.url) }}" alt="default image" class="img-fluid" style="height: 213px;object-fit: cover; border-radius: .5rem .5rem 0 0;">
  99.                                                 {% endfor %}
  100.                                             {% else %}
  101.                                                 <img src="{{ asset('images/vecteezy_vector-gear-logo-design-with-multi-colors-range_6172776.jpg') }}" alt="default image" class="img-fluid" style="height: 213px;object-fit: cover; border-radius: .5rem .5rem 0 0;">
  102.                                             {% endif %}
  103.                                         </div>
  104.                                         <div class="container-info-presta" style="padding-bottom: 80px;">
  105.                                             <h2 class="vendor-title">
  106.                                                 {# <a href="{{ path('front_product_single', {'slug': product.subCategories[0].categories[0].slug, 'subCategorySlug': product.subCategories[0].subCategorySlug, 'product_id': product.id, 'productSlug': product.productSlug}) }}" class="title">{{ product.name }}</a> #}
  107.                                                 {% set subCategory = product.subCategories.toArray()[0] %}
  108.                                                 {# <pre>
  109.                                                     {{ dump(subCategory.categories.toArray[0].slug) }}
  110.                                                 </pre> #}
  111.                                                 {% set slug = "" %}
  112.                                                 {% if product.typeActivity is not null %}
  113.                                                     {% set slug = product.typeActivity.slug %}
  114.                                                 {% elseif product.typeHebergements is not null %}
  115.                                                     {% set slug = product.typeHebergements.slugTypeHebergm %}
  116.                                                 {% else %}
  117.                                                     {% set slug = subCategory.categories.toArray[0].slug %}
  118.                                                 {% endif %}
  119.                                                 
  120.                                                 <a href="{{ path('front_product_single', {
  121.                                                     'slug': slug,
  122.                                                     'subCategorySlug': subCategory.subCategorySlug,
  123.                                                     'product_id': product.id,
  124.                                                     'productSlug': product.productSlug
  125.                                                 }) }}" class="title">{{ product.name }}</a>
  126.                                             </h2>
  127.                                             <p class="vendor-address">
  128.                                                 {% for department in product.departments %}
  129.                                                     {{ department.name }}
  130.                                                     {% if not loop.last %},
  131.                                                     {% endif %}
  132.                                                 {% else %}
  133.                                                     Toute la France
  134.                                                 {% endfor %}
  135.                                             </p>
  136.                                             <p>
  137.                                                 {% if product.typeHebergements is null or product.typeHebergements.slugTypeHebergm != 'hotel' %}
  138.                                                     <i class="fas fa-money-bill-wave"></i>
  139.                                                     Prix :
  140.                                                         {% set today = "now"|date('Y-m-d') %}
  141.                                                         {% set customPriceFound = false %}
  142.                                                         {% set customPrice = 0 %}
  143.                                                         {% set currentPrice = 0 %}
  144.                                                         {% set price = 0 %}
  145.                                                         {% set difference = null %}
  146.                                                         {% set reductionPercentage = 0 %}
  147.                                                         {% set duration = null %}
  148.                                                         {% set countdown = null %}
  149.                                                         {% set reductionValid = false %}
  150.                                                         
  151.                                                         {% for dayPrice in product.dayPrice %}
  152.                                                             {% set formattedDate = dayPrice.customDate|date('Y-m-d') %}
  153.                                                             {% if formattedDate == today %}
  154.                                                                 {% set customPriceFound = true %}
  155.                                                                 {% set customPrice = dayPrice.customPrice|number_format(2, '.') %}
  156.                                                             {% endif %}
  157.                                                         {% endfor %}
  158.                                                         
  159.                                                         {% set month = "now"|date('n') %}
  160.                                                         {% if month >= 3 and month <= 5 %}
  161.                                                             {% set springPrice = product.springPrice %}
  162.                                                             {% if springPrice is not null %}
  163.                                                                 {% set currentPrice = product.springPrice %}
  164.                                                             {% else %}
  165.                                                                 {% set currentPrice = 0 %}                                                                
  166.                                                             {% endif %}
  167.                                                         {% elseif month >= 6 and month <= 8 %}
  168.                                                             {% set summerPrice = product.summerPrice %}
  169.                                                             {% if summerPrice is not null %}
  170.                                                                 {% set currentPrice = product.summerPrice %}
  171.                                                             {% else %}
  172.                                                                 {% set currentPrice = 0 %}                                                                
  173.                                                             {% endif %}
  174.                                                         {% elseif month >= 9 and month <= 11 %}
  175.                                                             {% set autumnPrice = product.autumnPrice %}
  176.                                                             {% if autumnPrice is not null %}
  177.                                                                 {% set currentPrice = product.autumnPrice %}
  178.                                                             {% else %}
  179.                                                                 {% set currentPrice = 0 %}                                                                
  180.                                                             {% endif %}
  181.                                                         {% else %}
  182.                                                             {% set winterPrice = product.winterPrice %}
  183.                                                             {% if winterPrice is not null %}
  184.                                                                 {% set currentPrice = product.winterPrice %}
  185.                                                             {% else %}
  186.                                                                 {% set currentPrice = 0 %}                                                                
  187.                                                             {% endif %}
  188.                                                         {% endif %}
  189.                                                         {% set day = "now"|date('N') %}
  190.                                                         {% if day == 6 or day == 7 %}
  191.                                                             {% set weekEndPrice = product.weekEndPrice %}
  192.                                                             {% if weekEndPrice is not null %}
  193.                                                                 {% set currentPrice = product.weekEndPrice %}    
  194.                                                             {% else %}
  195.                                                                 {% set currentPrice = 0 %}                                                            
  196.                                                             {% endif %}
  197.                                                         {% endif %}
  198.                                                         
  199.                                                             
  200.                                                         {% set periodPrice = 0 %}
  201.                                                         {% for period in product.periodPrice.toArray() %}
  202.                                                             {% set startDate = period.startDate|date("Y-m-d") %}
  203.                                                             {% set endDate = period.endDate|date("Y-m-d") %}
  204.                                                             {% if today >= startDate and today <= endDate and period.price is not null %}
  205.                                                                 {% set periodPrice = period.price %}
  206.                                                             {% else %}
  207.                                                                 {% set currentPrice = 0 %}
  208.                                                             {% endif %}
  209.                                                         {% endfor %}
  210.                                                         {% if periodPrice != 0 %}
  211.                                                             {% set currentPrice = periodPrice %}
  212.                                                         {% endif %}
  213.                                                         
  214.                                                         {% if customPriceFound and customPrice != 0%}
  215.                                                             {% set price = customPrice %}
  216.                                                         {% elseif currentPrice != 0 and currentPrice is not null and customPrice == 0 %}
  217.                                                             {% set price = currentPrice %}
  218.                                                         {% elseif currentPrice == 0 or currentPrice is null and customPrice == 0 %}
  219.                                                             {% set price = product.price %}
  220.                                                         {% endif %}
  221.                                                         {% for autoReduce in product.productAutoReduction.toArray %}
  222.                                                             {% if autoReduce.createdAt is not null and autoReduce.countdown is not null and autoReduce.duration is not null  and autoReduce.reductionPercentage is not null %}
  223.                                                                 {% set difference = date(today).diff(autoReduce.createdAt).days %}
  224.                                                                 {% set duration = autoReduce.duration %}
  225.                                                                 {% set countdown = autoReduce.countdown %}
  226.                                                                 {% set reductionPercentage = autoReduce.reductionPercentage %}
  227.                                                                 {% set durationout = duration + countdown %}
  228.                                                                 {# {{ dump(countdown,difference,durationout,duration) }} #}
  229.                                                                 {% set reductionValid = difference > countdown and difference <= durationout %}
  230.                                                             {% endif %}
  231.                                                         {% endfor %}
  232.                                                         {# {{ dump(reductionValid) }} #}
  233.                                                         {% if product.company.type != "service" %}
  234.                                                             <span class="vendor-price">
  235.                                                                 {{ product.price|number_format(2, '.', '') }}€
  236.                                                             </span>
  237.                                                         {% elseif reductionValid %}
  238.                                                             {% set priceReduced = price - ((price * reductionPercentage) / 100) %}
  239.                                                             <strong>{{ priceReduced|number_format(2, '.') }}</strong>€                                                
  240.                                                         {% else %}
  241.                                                             <strong>{{ price|number_format(2, '.') }}</strong>€
  242.                                                         {% endif %}
  243.                                                 {% else %}
  244.                                                     {% set lengthRoomNight = 0 %}
  245.                                                     {% set statusByNight = false %}
  246.                                                     {% set allPriceByNight = 0 %}
  247.                                                     {% set lengthRoomDay = 0 %}
  248.                                                     {% set statusByDay = false %}
  249.                                                     {% set allPriceByDay = 0 %}
  250.                                                     {% if product.chambres is defined %}
  251.                                                         {% for roomOption in product.chambres.toArray %}
  252.                                                             {% if roomOption.tarifNuit is defined %}
  253.                                                                 {% set lengthRoomNight = lengthRoomNight + 1 %}
  254.                                                                 {% set statusByNight = true %}
  255.                                                                 {% set allPriceByNight = allPriceByNight + roomOption.tarifNuit %}
  256.                                                             {% endif %}
  257.                                                             {% if roomOption.tarifJour is not null %}
  258.                                                                 {% set lengthRoomDay = lengthRoomDay + 1 %}
  259.                                                                 {% set statusByDay = true %}
  260.                                                                 {% set allPriceByDay = allPriceByDay + roomOption.tarifJour %}
  261.                                                             {% endif %}
  262.                                                         {% endfor %}
  263.                                                         {% if statusByDay or statusByNight %}
  264.                                                             <p>Prix moyen d'une chambre:</p>
  265.                                                         {% endif %}
  266.                                                         {% if statusByNight %}
  267.                                                             <p>
  268.                                                                 <i class="fas fa-money-bill-wave"></i>
  269.                                                                 par nuit 
  270.                                                                 <strong>{{ (allPriceByNight / lengthRoomNight)|number_format(2, '.') }}</strong>€
  271.                                                             </p>
  272.                                                         {% endif %}
  273.                                                         {% if statusByDay %}
  274.                                                             {# <p>
  275.                                                                 <i class="fas fa-money-bill-wave"></i>
  276.                                                                 par jour 
  277.                                                                 <strong>{{ (allPriceByDay / lengthRoomDay)|number_format(2, '.') }}</strong>€
  278.                                                             </p> #}
  279.                                                         {% endif %}
  280.                                                     {% endif %}
  281.                                                     {% if not statusByNight and not statusByDay %}
  282.                                                         <p>
  283.                                                             Prix : <strong>Prix en attente</strong>
  284.                                                         </p>
  285.                                                     {% endif %}
  286.                                                     {# <i class="fas fa-money-bill-wave"></i>
  287.                                                     Prix :
  288.                                                     <strong>{{ product.price|number_format(2, '.') }}</strong>€ #}
  289.                                                 {% endif %}
  290.                                             </p>
  291.                                             <p>
  292.                                                 <i class="fa fa-star rated"></i>
  293.                                                 {% set notes = 0 %}
  294.                                                 {% for avi in product.avis %}
  295.                                                     {% set notes = notes + avi.globalNote %}
  296.                                                 {% endfor %}
  297.                                                 {% set noteTotal = (notes > 0) ? notes / product.avis|length : 0 %}
  298.                                                 {{ product.avis|length }} Avis</p>
  299.                                             <p>{{ product.quantity }}
  300.                                                 Quantité restante</p>
  301.                                         </div>
  302.                                         <div class="wishlist-sign">
  303.                                             <a href="#" class="btn-wishlist">
  304.                                                 <i class="fa fa-heart"></i>
  305.                                             </a>
  306.                                         </div>
  307.                                         {% if product.subCategories[0].categories[0] is defined %}
  308.                                         <a href="{{ path('front_product_single', {
  309.                                                 'slug': slug, 
  310.                                                 'subCategorySlug': product.subCategories[0].subCategorySlug, 
  311.                                                 'product_id': product.id, 
  312.                                                 'productSlug': product.productSlug
  313.                                             }) }}" class="title">
  314.                                             
  315.                                                 <button class="btnVoirP btn">Voir {% if subCategorySlug == "hebergements"%}l'hébergement{% else %}plus{% endif %}
  316.                                                     </button>
  317.                                             
  318.                                         </a>
  319.                                         {% endif %}
  320.                                         
  321.                                     </div>
  322.                                 </div>
  323.                             {% endfor %}
  324.                         {% else %}
  325.                             <div class="col-12">
  326.                                 <button type="button" class="btn btn-primary mb-2" data-toggle="modal" data-target="#modalFilter">Filter</button>
  327.                             </div>
  328.                             <div class="vendor-thumbnail list-view p-4">Aucun service correspondant</div>
  329.                         {% endif %}
  330.                     </div>
  331.                     <div class="pagination">
  332.                         <nav aria-label="Page navigation example">
  333.                             {{ knp_pagination_render(products) }}
  334.                         </nav>
  335.                     </div>
  336.                     <!-- /.paginations -->
  337.                 </div>
  338.                 <!-- sidebar-section -->
  339.                 {{ include('front/inc/filter_sidebar.html.twig') }}
  340.                 <!-- /.sidebar-section -->
  341.             </div>
  342.         </div>
  343.     </div>
  344. {% endblock %}
  345. {% block javascript %}
  346.     <script 
  347.         type="text/javascript" 
  348.         src="https://cdn.jsdelivr.net/gh/maxshuty/accessible-web-components@latest/dist/simpleRange.min.js">
  349.     </script>
  350.     <script src="{{ asset('js/jsForHebergementFilter.js') }}"></script>
  351.     <script src="{{ asset('js/getCommune.js') }}"></script>
  352. {% endblock %}