templates/pages/tariff/tariff.html.twig line 1

Open in your IDE?
  1. {% extends '@App/base.html.twig' %}
  2. {% block pageTitle %}{{ tariff.name }}{% endblock %}
  3. {% block content %}
  4. {#    {{ dump(tariff) }}#}
  5.     {% if isMobile %}
  6.         <figure class="mt-[10px] lg:mt-[40px]">
  7.             {% include '@App/shared/ui/backButton/backButton.html.twig' %}
  8.             {% include '@App/components/header/header.html.twig' with {
  9.                 operator: true,
  10.                 operatorName: tariff.operator.name,
  11.                 operatorType: tariff.operator.type
  12.             } %}
  13.             <div class="mt-[14px] p-[18px] max-w-full md:max-w-[600px] mx-auto rounded-[24px] bg-white">
  14.                 <div class="text-[24px] font-semibold text-[#1B2028]"
  15.                      style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::BLOCK_TITLE_STYLES')) }}"
  16.                 >{% trans from 'tarif_choice' %}Перегляд тарифу{% endtrans %} {{ tariff.name }}</div>
  17.                 <div class="text-[16px] font-medium text-[#A0A4AE] mb-[20px] text-{{ companyStyles.descriptionTextAlign }}">
  18.                     {% if is_granted('ROLE_FRONT_USER') %}{% trans from 'register' %}Крок 1/3{% endtrans %}{% else %}{% trans from 'register' %}Крок 1/5{% endtrans %}{% endif %}
  19.                 </div>
  20.                 <div class="flex flex-col gap-[10px]">
  21.                     {% if esimPresence is defined and esimPresence is not null and esimPresence == false %}
  22.                         <div class="rounded-[16px] p-[18px] border border-[#E2E2E9] bg-[#F7F7FA] mt-[40px]">
  23.                             <div class="text-[24px] font-semibold text-[#1B2028] mx-auto text-{{ companyStyles.descriptionTextAlign }} {% if companyStyles.descriptionTextAlign == 'center' %}max-w-[360px]{% endif %}"
  24.                             >{% trans from 'tarif_choice' %}На жаль, наразі немає доступних номерів. Спробуйте пізніше{% endtrans %}</div>
  25.                         </div>
  26.                     {% else %}
  27.                             <div class="rounded-[16px] p-[18px] border border-[#E2E2E9] bg-[#F7F7FA]">
  28.                                 <div class="flex flex-col items-center content-start gap-[6px]">
  29.                                     {% if tariff.mainImage is not empty %}
  30.                                         <div class="w-full">
  31.                                             {{ sonata_media(tariff.mainImage, 'reference') }}
  32.                                         </div>
  33.                                     {% elseif tariff.imageLink %}
  34.                                         <div class="w-full">
  35.                                             <img src="{{ tariff.imageLink }}"  alt="{{ tariff.name }}"/>
  36.                                         </div>
  37.                                     {% endif %}
  38.                                     <div class="w-full mb-[32px] flex flex-col content-start">
  39.                                         <div class="text-[20px] text-[#1B2028] font-medium">{{ tariff.name }}</div>
  40.                                         <div class="text-[14px] text-[#5B5B5B] font-medium">{% trans from 'tarif_choice' %}Артикул:{% endtrans %} {{ tariff.reference }}</div>
  41.                                     </div>
  42. {#                                    {% if tariff.description is not empty %}#}
  43. {#                                        <button data-modal="#modal_{{ tariff.id }}" class="ml-auto js--modal hover:!opacity-60 transition ease-in-out duration-150">#}
  44. {#                                            <svg class="w-[20px] h-[20px]" style="fill: {{ companyStyles.linkTextColor }}">#}
  45. {#                                                <use href="{{ asset('build/sprite.svg#information-line') }}"></use>#}
  46. {#                                            </svg>#}
  47. {#                                        </button>#}
  48. {#                                    {% endif %}#}
  49.                                 </div>
  50.                                 {% if tariff.shortInfo is not empty %}
  51.                                     {# Accordion: Короткий опис — відкритий за замовчуванням #}
  52.                                     <div class="tariff-mob-accordion mt-[16px] border border-[#E2E2E9] rounded-[16px] overflow-hidden">
  53.                                         <button class="tariff-mob-accordion__toggle w-full flex justify-between items-center p-[14px] bg-[#F7F7FA] text-[16px] font-medium text-[#1B2028]" aria-expanded="true">
  54.                                             <span>Короткий опис</span>
  55.                                             <svg class="tariff-mob-accordion__icon w-[20px] h-[20px] transition-transform duration-300" style="stroke: #5B5B5B; fill: none;" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  56.                                                 <polyline points="6 9 12 15 18 9"/>
  57.                                             </svg>
  58.                                         </button>
  59.                                         <div class="tariff-mob-accordion__body px-[14px] pb-[14px] text-[14px] text-[#5B5B5B] prose break-words">
  60.                                             {{ tariff.shortInfo|raw }}
  61.                                         </div>
  62.                                     </div>
  63.                                 {% endif %}
  64.                                 {% if tariff.detailedInfo is not empty %}
  65.                                     {# Accordion: Детальна інформація — закритий за замовчуванням #}
  66.                                     <div class="tariff-mob-accordion mt-[12px] border border-[#E2E2E9] rounded-[16px] overflow-hidden">
  67.                                         <button class="tariff-mob-accordion__toggle w-full flex justify-between items-center p-[14px] bg-[#F7F7FA] text-[16px] font-medium text-[#1B2028]" aria-expanded="false">
  68.                                             <span>{% trans from 'tarif_choice' %}Детальна інформація{% endtrans %}</span>
  69.                                             <svg class="tariff-mob-accordion__icon w-[20px] h-[20px] transition-transform duration-300" style="stroke: #5B5B5B; fill: none;" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  70.                                                 <polyline points="6 9 12 15 18 9"/>
  71.                                             </svg>
  72.                                         </button>
  73.                                         <div class="tariff-mob-accordion__body hidden px-[14px] pb-[14px] text-[14px] text-[#5B5B5B] prose break-words">
  74.                                             {{ tariff.detailedInfo|raw }}
  75.                                         </div>
  76.                                     </div>
  77.                                 {% endif %}
  78.                                 {# Sentinel — натуральне розташування кнопок (видно = sticky bar зникає) #}
  79.                                 <div id="tariff-mob-sentinel" class="mt-[16px]">
  80.                                     {% if tariff.active %}
  81.                                         <a href="{{ path('tariff_selected_page',{tariff:tariff.id}) }}"
  82.                                            class="drop-shadow-[0_7px_5px_rgba(0,0,0,0.25)] hover:drop-shadow-none disabled:drop-shadow-none transition ease-in-out duration-150 w-full text-center py-[6px] block h-[36px] bg-transparent border rounded-[10px] focus:ring-4 focus:ring-blue-300 font-semibold text-[16px] mt-[12px] focus:outline-none"
  83.                                            style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
  84.                                         >{% trans with {'%price%': tariff.price} from 'tarif_choice' %}Купити за %price%₴{% endtrans %}</a>
  85.                                     {% else %}
  86.                                         <button type="button" disabled
  87.                                            class="opacity-50 cursor-not-allowed pointer-events-none transition ease-in-out duration-150 w-full text-center py-[6px] block h-[36px] bg-transparent border border-[#E2E2E9] text-[#5B5B5B] rounded-[10px] font-semibold text-[16px] mt-[12px] focus:outline-none"
  88.                                         >{% trans from 'tarif_choice' %}Немає в наявності{% endtrans %}</button>
  89.                                     {% endif %}
  90.                                     <a href="{{ path('operator_tariff_page',{slug:tariff.operator.slug}) }}"
  91.                                        class="drop-shadow-[0_7px_5px_rgba(0,0,0,0.25)] hover:drop-shadow-none disabled:drop-shadow-none transition ease-in-out duration-150 w-full text-center py-[6px] block h-[36px] bg-transparent border rounded-[10px] focus:ring-4 focus:ring-blue-300 font-semibold text-[16px] mt-[12px] focus:outline-none"
  92.                                        style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
  93.                                     >{% trans from 'tarif_choice' %}Обрати інший тариф{% endtrans %}</a>
  94.                                 </div>
  95.                                 {# Sticky buttons bar #}
  96.                                 <div id="tariff-mob-sticky-bar" class="fixed bottom-0 left-0 right-0 z-50 bg-white border-t border-[#E2E2E9] px-[16px] py-[12px] transition-all duration-300">
  97.                                     {% if tariff.active %}
  98.                                         <a href="{{ path('tariff_selected_page',{tariff:tariff.id}) }}"
  99.                                            class="drop-shadow-[0_7px_5px_rgba(0,0,0,0.25)] hover:drop-shadow-none disabled:drop-shadow-none transition ease-in-out duration-150 w-full text-center py-[6px] block h-[36px] bg-transparent border rounded-[10px] focus:ring-4 focus:ring-blue-300 font-semibold text-[16px] mt-[12px] focus:outline-none"
  100.                                            style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
  101.                                         >{% trans with {'%price%': tariff.price} from 'tarif_choice' %}Купити за %price%₴{% endtrans %}</a>
  102.                                     {% else %}
  103.                                         <button type="button" disabled
  104.                                            class="opacity-50 cursor-not-allowed pointer-events-none transition ease-in-out duration-150 w-full text-center py-[6px] block h-[36px] bg-transparent border border-[#E2E2E9] text-[#5B5B5B] rounded-[10px] font-semibold text-[16px] mt-[12px] focus:outline-none"
  105.                                         >{% trans from 'tarif_choice' %}Немає в наявності{% endtrans %}</button>
  106.                                     {% endif %}
  107.                                     <a href="{{ path('operator_tariff_page',{slug:tariff.operator.slug}) }}"
  108.                                        class="drop-shadow-[0_7px_5px_rgba(0,0,0,0.25)] hover:drop-shadow-none disabled:drop-shadow-none transition ease-in-out duration-150 w-full text-center py-[6px] block h-[36px] bg-transparent border rounded-[10px] focus:ring-4 focus:ring-blue-300 font-semibold text-[16px] mt-[12px] focus:outline-none"
  109.                                        style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
  110.                                     >{% trans from 'tarif_choice' %}Обрати інший тариф{% endtrans %}</a>
  111.                                 </div>
  112.                             </div>
  113.                     {% endif %}
  114.                     <!-- modal-window fixed hidden top-0 left-0 right-0 z-50 show:opacity-100 w-full p-4 overflow-x-hidden overflow-y-auto mx-auto md:inset-0 max-h-full -->
  115.                     {% for modal in tariff.operator.tariffs %}
  116.                         {% if modal.description is not empty %}
  117.                             {% include '@App/shared/ui/modal/modal.html.twig' with {
  118.                                 id: modal.id,
  119.                                 name: modal.name,
  120.                                 image: modal.mainImage,
  121.                                 imageLink: modal.imageLink,
  122.                                 description: modal.description | raw,
  123.                                 showButton: true,
  124.                             } %}
  125.                         {% endif %}
  126.                     {% endfor %}
  127.                 </div>
  128.                 {% if faqs is defined and faqs is not empty %}
  129.                     {#                <a href="{{ path('how_it_works') }}" class="font-medium text-[#E64829] text-[16px] text-center block hover:underline mt-[30px]">{% trans from 'main' %}Як працює eSIM?{% endtrans %}</a>#}
  130.                     <button data-modal="#modal_faq" class="js--modal hover:underline transition ease-in-out duration-150 w-full block text-center p-[12px] h-[48px] bg-transparent border rounded-[10px] border-none font-semibold text-[16px] mt-[25px] focus:outline-none" style="color: {{ companyStyles.linkTextColor }}">{% trans from 'tarif_choice' %}Поширені питаня та відповіді{% endtrans %}</button>
  131.                 {% endif %}
  132.             </div>
  133.         </figure>
  134.     {% else %}
  135.         {% include '@App/pages/tariff/tariff_web.html.twig' %}
  136.     {% endif %}
  137. {% endblock %}
  138. {% block javascripts %}
  139.     {{ parent() }}
  140.     <script>
  141.     (function () {
  142.         // ── Accordion ──────────────────────────────────────────
  143.         document.querySelectorAll('.tariff-mob-accordion__toggle').forEach(function (btn) {
  144.             var body = btn.nextElementSibling;
  145.             var icon = btn.querySelector('.tariff-mob-accordion__icon');
  146.             var isOpen = btn.getAttribute('aria-expanded') === 'true';
  147.             // початковий стан
  148.             if (!isOpen) {
  149.                 body.classList.add('hidden');
  150.                 icon.style.transform = 'rotate(-90deg)';
  151.             } else {
  152.                 icon.style.transform = 'rotate(0deg)';
  153.             }
  154.             btn.addEventListener('click', function () {
  155.                 var expanded = btn.getAttribute('aria-expanded') === 'true';
  156.                 if (expanded) {
  157.                     btn.setAttribute('aria-expanded', 'false');
  158.                     body.classList.add('hidden');
  159.                     icon.style.transform = 'rotate(-90deg)';
  160.                 } else {
  161.                     btn.setAttribute('aria-expanded', 'true');
  162.                     body.classList.remove('hidden');
  163.                     icon.style.transform = 'rotate(0deg)';
  164.                 }
  165.             });
  166.         });
  167.         // ── Sticky bar ─────────────────────────────────────────
  168.         var stickyBar = document.getElementById('tariff-mob-sticky-bar');
  169.         var sentinel  = document.getElementById('tariff-mob-sentinel');
  170.         if (stickyBar && sentinel) {
  171.             var observer = new IntersectionObserver(function (entries) {
  172.                 entries.forEach(function (entry) {
  173.                     if (entry.isIntersecting) {
  174.                         stickyBar.style.transform    = 'translateY(100%)';
  175.                         stickyBar.style.opacity      = '0';
  176.                         stickyBar.style.pointerEvents = 'none';
  177.                     } else {
  178.                         stickyBar.style.transform    = 'translateY(0)';
  179.                         stickyBar.style.opacity      = '1';
  180.                         stickyBar.style.pointerEvents = '';
  181.                     }
  182.                 });
  183.             }, { threshold: 0.1 });
  184.             observer.observe(sentinel);
  185.         }
  186.     })();
  187.     </script>
  188. {% endblock %}