templates/Slivki/sale/index.html.twig line 1

Open in your IDE?
  1. {% set currentCategoryID = currentCategoryID is defined ? currentCategoryID : 0 %}
  2. {% set yesterday = 'now'|date_modify("-1 day")|date("Y-m-d") %}
  3. {% set statViewer = app.user and app.user.hasRole(constant('Slivki\\Entity\\UserGroup::STATISTICS_VIEWER')) %}
  4. {% extends 'base.html.twig' %}
  5. {% block ogimage %}
  6.     {% if isVideoguideCategory is defined and isVideoguideCategory and currentCategory.category.getHotFeedIconMedia() %}
  7.         <meta property="og:image" content="{{ app.request.getSchemeAndHttpHost() }}{{ getImageURL(currentCategory.category.getHotFeedIconMedia(), 128, 128) }}"/>
  8.         <meta property="og:image:width" content="128"/>
  9.         <meta property="og:image:height" content="128"/>
  10.     {% else %}
  11.         {{ parent() }}
  12.     {% endif %}
  13. {% endblock %}
  14. {% block header %}
  15.     {% if isMobileDevice() %}
  16.         {% include 'header_sales_mobile.html.twig' %}
  17.     {% else %}
  18.         {% include 'header_sales.html.twig' %}
  19.     {% endif %}
  20. {% endblock %}
  21. {% block stylesheets %}
  22.     {% if mainHotFeed is defined and mainHotFeed|length > 0 or (isVideoguideCategory is defined and isVideoguideCategory) %}
  23.         <link rel="stylesheet" href="/css/swiper/swiper.min.css" />
  24.     {% endif %}
  25.     {{ parent() }}
  26. {% endblock %}
  27. {% block javascripts %}
  28.     {% if mainHotFeed is defined and mainHotFeed|length > 0 or (isVideoguideCategory is defined and isVideoguideCategory) %}
  29.         <script src="/js/swiper-js/swiper.min.js"></script>
  30.     {% endif %}
  31.     {% if flierMenu is defined %}
  32.         <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.countdown/2.2.0/jquery.countdown.min.js"></script>
  33.     {% endif %}
  34.     {{ parent() }}
  35.     <script src="//api-maps.yandex.ru/2.1.29/?lang=ru-RU"></script>
  36.     <script src="//mourner.github.io/simplify-js/simplify.js"></script>
  37.     <script src="/js/sales.js?v={{ sales_js_version }}"></script>
  38. {% endblock %}
  39. {% block content %}
  40.     <input type="hidden" id="categoryID" value="{{ currentCategoryID }}"/>
  41.     <div class="content container transparent with-banner sales video-guide-block"  id="contentContainer">
  42.         <div class="{% block mainColumnClass %} {{ parent() }} one-column sales {% endblock %}">
  43.             <div class="content-wrapper">
  44.                 {% if flierMenu is defined %}
  45.                     <div class="stock-group-header with-search">
  46.                         {% if currentCategoryID > 0 %}
  47.                             <div class="breadcrumbs">
  48.                                 <a href="{{ base_url }}">Главная</a>
  49.                                 {% if isChildOfFlier is not defined %}
  50.                                     <i class="fa fa-angle-right"></i> {{ currentCategory.category.getName() }}
  51.                                 {% else %}
  52.                                     <i class="fa fa-angle-right"></i><a href="{{ base_url }}/giper-shop">&nbsp;Листовки</a>
  53.                                     <i class="fa fa-angle-right"></i> {{ currentCategory.category.getName() }}
  54.                                 {% endif %}
  55.                             </div>
  56.                             <div class="title"><h1>{{ currentCategory.category.getName() }}</h1> ({{ currentCategory.entityList|length }})</div>
  57.                         {% else %}
  58.                             <div class="title"><h1>Листовки</h1> ({{ flierMenuCount }})</div>
  59.                         {% endif %}
  60.                         <div class="flier-total-visit-count">
  61.                             <span data-toggle="tooltip" data-placement="left" data-original-title='{{ saleVisitCountTooltip }}"'><i class="slivki-icon-users"></i>{{ saleVisitCount }}</span><br>
  62.                             <span data-toggle="tooltip" data-placement="left" data-original-title='{{ visitedSalesTooltip }}'><i class="slivki-icon-paper"></i>{{ visitedSales }}</span>
  63.                         </div>
  64.                         <div class="clear"></div>
  65.                     </div>
  66.                     <ul id="saleTopMenu" class="capsule-menu expanded">
  67.                         {% set flierCompanyNewsMenuItem = null %}
  68.                         {% if flierMenu|length > 1 %}
  69.                             {% for item in flierMenu %}
  70.                                 {% if item.getEntityID() == constant('Slivki\\Entity\\Category::FLIER_COMPANY_NEWS_CATEGORY_ID') %}
  71.                                     {% set flierCompanyNewsMenuItem = item %}
  72.                                 {% else %}
  73.                                     <li>
  74.                                         <a href="{{ item.getURL() }}{{ selectedCity is defined ? '?city=' ~ selectedCity }}" {{ item.getEntityID() == currentCategoryID ? 'class="active"'}} data-id="{{ item.getEntityID() }}">
  75.                                             {{ item.getAlias() != null ? item.getAlias() : item.getName() }} <span>{{ item.getEntityCount() }}</span>
  76.                                         </a>
  77.                                     </li>
  78.                                 {% endif %}
  79.                             {% endfor %}
  80.                             {% if flierCompanyNewsMenuItem %}
  81.                                 {% set item = flierCompanyNewsMenuItem %}
  82.                                 <li>
  83.                                     <a href="{{ item.getURL() }}" {{ item.getEntityID() == currentCategoryID ? 'class="active"'}} data-id="{{ item.getEntityID() }}">
  84.                                         {{ item.getAlias() != null ? item.getAlias() : item.getName() }} <span>{{ item.getEntityCount() }}</span>
  85.                                     </a>
  86.                                 </li>
  87.                             {% endif %}
  88.                         {% endif %}
  89.                     </ul>
  90.                     <div class="clear"></div>
  91.                     <div id="flierCitySelectBox">
  92.                         <div class="title">Выберите свой город</div>
  93.                         {% apply spaceless %}
  94.                         <ul id="flierFirstLetterCityFilters">
  95.                             {% for char in cityList|keys %}
  96.                                 <li><a href="#" data-char="{{ char }}">{{ char }}</a></li>
  97.                             {% endfor %}
  98.                         </ul>
  99.                         <div id="flierCitySelectList">
  100.                             {% set cityColumnCount = 6 %}
  101.                             {% set itemInColumnCount = (constant('Slivki\\Entity\\City::FLIER_DEFAULT_CITY_LIST')|length / cityColumnCount)|round(1, 'ceil') %}
  102.                             {% for row in constant('Slivki\\Entity\\City::FLIER_DEFAULT_CITY_LIST')|batch(itemInColumnCount) %}
  103.                                 <ul class="char-div">
  104.                                 {% for defaultCity in row %}
  105.                                     <li class="default-city-li {{ selectedCity is defined and selectedCity == defaultCity.name ? 'active' }}" data-char="{{ defaultCity.name|first }}">
  106.                                         <a href="{{ app.request.pathInfo }}?city={{ defaultCity.name|url_encode }}">{{ defaultCity.name }} <span data-toggle="tooltip" data-placement="top" data-original-title="Количество жителей">{{ defaultCity.population }}</span></a>
  107.                                     </li>
  108.                                 {% endfor %}
  109.                                 </ul>
  110.                             {% endfor %}
  111.                             {% set currentChar = cityList|keys|first %}
  112.                             {% for char in cityList|keys %}
  113.                                 {% set itemInColumnCount = (cityList[char]|length / cityColumnCount)|round(1, 'ceil') %}
  114.                                 <div data-char="{{ char }}" class="char-div">
  115.                                     {% for row in cityList[char]|batch(itemInColumnCount) %}
  116.                                         <ul>
  117.                                         {% for city in row %}
  118.                                             <li {{ selectedCity is defined and selectedCity == city.cityName ? 'class=active' }}>
  119.                                                 <a href="{{ app.request.pathInfo }}?city={{ city.cityName|url_encode }}">{{ city.cityName }}</a>
  120.                                             </li>
  121.                                         {% endfor %}
  122.                                         </ul>
  123.                                     {% endfor %}
  124.                                 </div>
  125.                             {% endfor %}
  126.                         </div>
  127.                         {% endapply %}
  128.                     </div>
  129.                     {% include 'Slivki/sale/sale_map.html.twig' %}
  130.                 {% endif %}
  131.                 {% block main_content %}
  132.                     {% if flierMenu is not defined %}
  133.                         <div class="stock-group-header with-search">
  134.                             {% if currentCategoryID > 0 %}
  135.                                 {% if isChildOfVideoGuide is defined and isChildOfVideoGuide %}
  136.                                     <div class="breadcrumbs">
  137.                                         <a href="{{ base_url }}">Главная</a>
  138.                                         <i class="fa fa-angle-right"></i><a href="{{ getURL("Slivki:Sale:category", videoguideCategory.category.getID()) }}"> {{ videoguideCategory.category.getName() }}</a>
  139.                                         <i class="fa fa-angle-right"></i> {{ currentCategory.category.getName() }}
  140.                                     </div>
  141.                                 {% elseif currentCategoryID == constant('Slivki\\Entity\\Category::SALE_VIDEO_GUIDE_CATEGORY_ID') %}
  142.                                     <div class="breadcrumbs">
  143.                                         <a href="{{ base_url }}">Главная</a>
  144.                                         <i class="fa fa-angle-right"></i> {{ currentCategory.category.getName() }}
  145.                                     </div>
  146.                                 {% else %}
  147.                                     <div class="breadcrumbs">
  148.                                         <a href="{{ base_url }}">Главная</a>
  149.                                         <i class="fa fa-angle-right"></i><a href="{{ base_url }}/skidki-i-rasprodazhi">&nbsp;Новости скидок</a>
  150.                                         {% if parentCategory is defined %}
  151.                                             <i class="fa fa-angle-right"></i><a href="{{ getURL("Slivki:Sale:category", parentCategory.category.getID()) }}">&nbsp;{{ parentCategory.category.getName() }}</a>
  152.                                         {% endif %}
  153.                                         <i class="fa fa-angle-right"></i> {{ currentCategory.category.getName() }}
  154.                                     </div>
  155.                                 {% endif %}
  156.                                 <div class="title"><h1>{{ currentCategory.category.getName() }}</h1> ({{ currentCategory.entityList is defined ? currentCategory.entityList|length : 0 }})</div>
  157.                             {% else %}
  158.                                 <div class="breadcrumbs">
  159.                                     <a href="{{ base_url }}">Главная</a>
  160.                                     <i class="fa fa-angle-right"></i> Новости скидок
  161.                                 </div>
  162.                             <div class="clear"></div>
  163.                                     <div class="title-wrap text-center">
  164.                                         <div class="title"><h1>{{ metaInfo.title }} Новости скидок</h1> ({{ getActiveSalesCount() }})</div>
  165.                             {% endif %}
  166.                             {% if not isMobileDevice() %}
  167.                                 <div class="flier-total-visit-count">
  168.                                     <span data-toggle="tooltip" data-placement="left" data-original-title='{{ saleVisitCountTooltip }}'><i class="slivki-icon-users"></i>{{ saleVisitCount }}</span><br>
  169.                                     <span data-toggle="tooltip" data-placement="left" data-original-title='{{ visitedSalesTooltip }}'><i class="slivki-icon-paper"></i>{{ visitedSales }}</span>
  170.                                 </div>
  171.                             {% endif %}
  172.                             <div class="clear"></div>
  173.                                     </div>
  174.                         </div>
  175.                         {% if isVideoguideCategory is not defined or not isVideoguideCategory %}
  176.                             {% set saleMenu = saleMenu is defined ? saleMenu : categoryList %}
  177.                             {% if isMobileDevice() %}
  178.                                 <div id="mustBeFixedContainer">
  179.                                     <div id="mustBeFixed">
  180.                             {% endif %}
  181.                             <ul id="saleTopMenu" class="capsule-menu pb-2">
  182.                                 {% for category in saleMenu %}
  183.                                     <li>
  184.                                         <a href="{{ getURL("Slivki:Sale:category", category.category.getID()) }}" {{ category.category.getID() == currentCategoryID ? 'class="active"'}} data-id="{{ category.category.getID() }}">
  185.                                             {{ category.category.getName() }}
  186.                                             {% if statViewer %}
  187.                                                 ({{ getStatVisitCount(category.category.getID(), constant('Slivki\\Entity\\Visit::TYPE_SALE_CATEGORY'), yesterday, yesterday) }})
  188.                                             {% endif %}
  189.                                             <span>{{ category.category.getEntityCount() }}</span>
  190.                                         </a>
  191.                                     </li>
  192.                                 {% endfor %}
  193.                                 <li class="capsule-menu--collapse-btn">
  194.                                     <a href="javascript:void(0)" class="active">Свернуть</a>
  195.                                 </li>
  196.                                 <li class="capsule-menu--expand-btn">
  197.                                     <a href="javascript:void(0)"><i class="slivki-icon-dot-3"></i></a>
  198.                                 </li>
  199.                             </ul>
  200.                             {% if isMobileDevice() %}
  201.                                     </div>
  202.                                 </div>
  203.                             {% endif %}
  204.                         {% endif %}
  205.                         {% if isVideoguideCategory is defined and isVideoguideCategory %}
  206.                             {% apply spaceless %}
  207.                                 <div id="videoguideCategoryMenu" class="{{ not isMobileDevice() ? 'swiper-container' }}">
  208.                                     <div class="{{ not isMobileDevice() ? 'swiper-wrapper' }}">
  209.                                         {% for category in videoguideCategoryMenu|filter(category => category.getID() != constant('Slivki\\Entity\\Category::SALE_VIDEO_GUIDE_AUTORS_CATEGORY_ID')) %}
  210.                                             {% set categoryUrl = getURL("Slivki:Sale:category", category.getID()) %}
  211.                                             <a class="{{ not isMobileDevice() ? 'swiper-slide' }} {{ categoryUrl == app.request.pathinfo ? 'active' }}" href="{{ categoryUrl }}">
  212.                                                 <img src="{{ getImageURL(category.getHotFeedIconMedia(), 128, 128) }}" alt=''/>
  213.                                                 <br />
  214.                                                 {{ category.getName() }}
  215.                                                 {% if statViewer %}
  216.                                                     ({{ getStatVisitCount(category.getID(), constant('Slivki\\Entity\\Visit::TYPE_SALE_CATEGORY'), yesterday, yesterday) }})
  217.                                                 {% endif %}
  218.                                             </a>
  219.                                         {% endfor %}
  220.                                     </div>
  221.                                     <div class="swiper-button swiper-button-prev"></div>
  222.                                     <div class="swiper-button swiper-button-next"></div>
  223.                                 </div>
  224.                             {% endapply %}
  225.                         {% endif %}
  226.                         {% if isVideoguideCategory is not defined or not isVideoguideCategory %}
  227.                             {% include 'Slivki/sale/sale_map.html.twig' %}
  228.                         {% endif %}
  229.                         {% if mainHotFeed is defined and mainHotFeed|length > 0 %}
  230.                             <div id="mainHotFeed" class="sales-hot-feed">
  231.                                 <div class="title"><i>&nbsp;</i> ГОРЯЧАЯ ЛЕНТА</div>
  232.                                 <div class="swiper-container" id="mainHotFeedSlider" data-offset="0" data-type="{{ constant('Slivki\\Entity\\HotFeed::TYPE_MAIN_PAGE') }}">
  233.                                     <div class="swiper-wrapper">
  234.                                         {{ mainHotFeed|raw }}
  235.                                     </div>
  236.                                     <div class="swiper-button swiper-button-prev"></div>
  237.                                     <div class="swiper-button swiper-button-next"></div>
  238.                                 </div>
  239.                             </div>
  240.                         {% endif %}
  241.                     {% endif %}
  242.                     {% block teaserList %}
  243.                         <div id="saleIndexTeasers">
  244.                             {% include 'Slivki/sale/sale_list_box.html.twig' with {'noCategoryTitle': isVideoguideCategory is defined and isVideoguideCategory } %}
  245.                             {% if currentCategoryID == 0 %}
  246.                                 <div id="saleCategoryListLoader"><i class="fa fa-spinner fa-spin" aria-hidden="true"></i></div>
  247.                             {% endif %}
  248.                         </div>
  249.                     {% endblock %}
  250.                 {% endblock %}
  251.             </div>
  252.         </div>
  253.     </div>
  254.     {{ getFooter() }}
  255. {% endblock %}
  256. {% block popups %}
  257.     {{ parent() }}
  258.     {% include 'Slivki/popups/video_guide_popup.html.twig' %}
  259. {% endblock %}