templates/app/Section/templates/base_online_store.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block page_container %}
  3.   <section class="bg-white">
  4.     <div class="page-wrapper section-content-group">
  5.         {% include "app/OnlineStore/_breadcrumb.html.twig" %}
  6.     </div>
  7.   </section>
  8.   <div class="page-wrapper">
  9.     <div class="row mt-1r">
  10.         <div class="col-sm-12 col-md-12 col-xs-12 mb-4 mx-0">
  11.             <div class="row">
  12.                 <div class="col-sm-3 col-md-3 col-xs-12 mb-4 mx-0">
  13.                     <a href="{{ path('app_online_store') }}" class="link-online">
  14.                         <p class="ff-os-semibold ct-blue fs-22">{{ "section.templates.store_online.content.categories"|trans }}</p>
  15.                     </a>
  16.                     {% include "app/OnlineStore/_childs.html.twig" with {
  17.                         'parentGroup': parentGroup
  18.                     } %}
  19.                 </div>
  20.                 <div class="offset-1 col-sm-8 col-md-8 col-xs-12 section-online">
  21.                     <div id="results">
  22.                         <div class="row">
  23.                         {% for offer in offers|reverse|slice(-1, 1) %}
  24.                             <div class="col-md-12 col-xs-12 {% if not is_mobile() %}col-pa-7{% endif %}">
  25.                                 {% if offer.url|default(0) %}
  26.                                     <a href="{{ offer.url }}">
  27.                                         <img src="{{ vich_uploader_asset(offer, 'imageFile') }}" class="img-fluid">
  28.                                     </a>
  29.                                 {% else %}
  30.                                     <img src="{{ vich_uploader_asset(offer, 'imageFile') }}" class="img-fluid">
  31.                                 {% endif %}
  32.                             </div>
  33.                         {% endfor %}
  34.                         </div>
  35.                         <div class="row mt-1r">
  36.                             {% for offer in offers|slice(1, 3) %}
  37.                                 <div class="col-md-4 col-xs-12 {% if not is_mobile() %}col-pa-7{% endif %} mb-1r">
  38.                                     {% if offer.url|default(0) %}
  39.                                         <a href="{{ offer.url }}">
  40.                                             <img src="{{ vich_uploader_asset(offer, 'imageFile') }}" class="img-fluid">
  41.                                         </a>
  42.                                     {% else %}
  43.                                         <img src="{{ vich_uploader_asset(offer, 'imageFile') }}" class="img-fluid">
  44.                                     {% endif %}
  45.                                 </div>
  46.                             {% endfor %}
  47.                         </div>
  48.                         {# render Ajax template #}
  49.                     </div>
  50.                 </div>
  51.             </div>
  52.         </div>
  53.     </div>
  54.   </div>
  55. {% endblock %}
  56. {% block javascripts %}
  57.     {{ parent() }}
  58.     {{ encore_entry_script_tags('accordion') }}
  59.     <script>
  60.         function getResults(groupId, order = '', attribute = '') {
  61.             $.ajax({
  62.                 type: "GET",
  63.                 url: '{{ path('app_results_products') }}',
  64.                 data: {
  65.                     parentGroup: groupId,
  66.                     order: order,
  67.                     attribute: attribute
  68.                 }
  69.             })
  70.             .done(function(response){
  71.                 template = response;
  72.                 $('#results').html(template);
  73.             })
  74.             .fail(function(jqXHR, textStatus, errorThrown){
  75.                 alert('Error : ' + errorThrown);
  76.             });
  77.         }
  78.         $('.myaccordion').click(function() {
  79.             let id = $(this).attr('id');
  80.         });
  81.         $('.myaccordion a').click(function(event) {
  82.             getResults($(this).data().groupId);
  83.         });
  84.         $(document).on('click', '.order', function() {
  85.             let order = $(this).data().order;
  86.             let attribute = $(this).data().attribute;
  87.             let parentGroupId = $('#parent_group_result').data().groupId;
  88.             getResults(parentGroupId, order, attribute);
  89.         });
  90.     </script>
  91. {% endblock %}