{% extends '@App/base.html.twig' %}
{% block pageTitle %}{{ tariff.name }}{% endblock %}
{% block content %}
{# {{ dump(tariff) }}#}
{% if isMobile %}
<figure class="mt-[10px] lg:mt-[40px]">
{% include '@App/shared/ui/backButton/backButton.html.twig' %}
{% include '@App/components/header/header.html.twig' with {
operator: true,
operatorName: tariff.operator.name,
operatorType: tariff.operator.type
} %}
<div class="mt-[14px] p-[18px] max-w-full md:max-w-[600px] mx-auto rounded-[24px] bg-white">
<div class="text-[24px] font-semibold text-[#1B2028]"
style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::BLOCK_TITLE_STYLES')) }}"
>{% trans from 'tarif_choice' %}Перегляд тарифу{% endtrans %} {{ tariff.name }}</div>
<div class="text-[16px] font-medium text-[#A0A4AE] mb-[20px] text-{{ companyStyles.descriptionTextAlign }}">
{% if is_granted('ROLE_FRONT_USER') %}{% trans from 'register' %}Крок 1/3{% endtrans %}{% else %}{% trans from 'register' %}Крок 1/5{% endtrans %}{% endif %}
</div>
<div class="flex flex-col gap-[10px]">
{% if esimPresence is defined and esimPresence is not null and esimPresence == false %}
<div class="rounded-[16px] p-[18px] border border-[#E2E2E9] bg-[#F7F7FA] mt-[40px]">
<div class="text-[24px] font-semibold text-[#1B2028] mx-auto text-{{ companyStyles.descriptionTextAlign }} {% if companyStyles.descriptionTextAlign == 'center' %}max-w-[360px]{% endif %}"
>{% trans from 'tarif_choice' %}На жаль, наразі немає доступних номерів. Спробуйте пізніше{% endtrans %}</div>
</div>
{% else %}
<div class="rounded-[16px] p-[18px] border border-[#E2E2E9] bg-[#F7F7FA]">
<div class="flex flex-col items-center content-start gap-[6px]">
{% if tariff.mainImage is not empty %}
<div class="w-full">
{{ sonata_media(tariff.mainImage, 'reference') }}
</div>
{% elseif tariff.imageLink %}
<div class="w-full">
<img src="{{ tariff.imageLink }}" alt="{{ tariff.name }}"/>
</div>
{% endif %}
<div class="w-full mb-[32px] flex flex-col content-start">
<div class="text-[20px] text-[#1B2028] font-medium">{{ tariff.name }}</div>
<div class="text-[14px] text-[#5B5B5B] font-medium">{% trans from 'tarif_choice' %}Артикул:{% endtrans %} {{ tariff.reference }}</div>
</div>
{# {% if tariff.description is not empty %}#}
{# <button data-modal="#modal_{{ tariff.id }}" class="ml-auto js--modal hover:!opacity-60 transition ease-in-out duration-150">#}
{# <svg class="w-[20px] h-[20px]" style="fill: {{ companyStyles.linkTextColor }}">#}
{# <use href="{{ asset('build/sprite.svg#information-line') }}"></use>#}
{# </svg>#}
{# </button>#}
{# {% endif %}#}
</div>
{% if tariff.shortInfo is not empty %}
{# Accordion: Короткий опис — відкритий за замовчуванням #}
<div class="tariff-mob-accordion mt-[16px] border border-[#E2E2E9] rounded-[16px] overflow-hidden">
<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">
<span>Короткий опис</span>
<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">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
<div class="tariff-mob-accordion__body px-[14px] pb-[14px] text-[14px] text-[#5B5B5B] prose break-words">
{{ tariff.shortInfo|raw }}
</div>
</div>
{% endif %}
{% if tariff.detailedInfo is not empty %}
{# Accordion: Детальна інформація — закритий за замовчуванням #}
<div class="tariff-mob-accordion mt-[12px] border border-[#E2E2E9] rounded-[16px] overflow-hidden">
<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">
<span>{% trans from 'tarif_choice' %}Детальна інформація{% endtrans %}</span>
<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">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
<div class="tariff-mob-accordion__body hidden px-[14px] pb-[14px] text-[14px] text-[#5B5B5B] prose break-words">
{{ tariff.detailedInfo|raw }}
</div>
</div>
{% endif %}
{# Sentinel — натуральне розташування кнопок (видно = sticky bar зникає) #}
<div id="tariff-mob-sentinel" class="mt-[16px]">
{% if tariff.active %}
<a href="{{ path('tariff_selected_page',{tariff:tariff.id}) }}"
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"
style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
>{% trans with {'%price%': tariff.price} from 'tarif_choice' %}Купити за %price%₴{% endtrans %}</a>
{% else %}
<button type="button" disabled
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"
>{% trans from 'tarif_choice' %}Немає в наявності{% endtrans %}</button>
{% endif %}
<a href="{{ path('operator_tariff_page',{slug:tariff.operator.slug}) }}"
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"
style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
>{% trans from 'tarif_choice' %}Обрати інший тариф{% endtrans %}</a>
</div>
{# Sticky buttons bar #}
<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">
{% if tariff.active %}
<a href="{{ path('tariff_selected_page',{tariff:tariff.id}) }}"
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"
style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
>{% trans with {'%price%': tariff.price} from 'tarif_choice' %}Купити за %price%₴{% endtrans %}</a>
{% else %}
<button type="button" disabled
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"
>{% trans from 'tarif_choice' %}Немає в наявності{% endtrans %}</button>
{% endif %}
<a href="{{ path('operator_tariff_page',{slug:tariff.operator.slug}) }}"
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"
style="{{ inlineStyles(app.request.get('companyInner'), constant('App\\Constants\\SettingConstants::NOT_FILLED_BUTTON_STYLES')) }}"
>{% trans from 'tarif_choice' %}Обрати інший тариф{% endtrans %}</a>
</div>
</div>
{% endif %}
<!-- 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 -->
{% for modal in tariff.operator.tariffs %}
{% if modal.description is not empty %}
{% include '@App/shared/ui/modal/modal.html.twig' with {
id: modal.id,
name: modal.name,
image: modal.mainImage,
imageLink: modal.imageLink,
description: modal.description | raw,
showButton: true,
} %}
{% endif %}
{% endfor %}
</div>
{% if faqs is defined and faqs is not empty %}
{# <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>#}
<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>
{% endif %}
</div>
</figure>
{% else %}
{% include '@App/pages/tariff/tariff_web.html.twig' %}
{% endif %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
(function () {
// ── Accordion ──────────────────────────────────────────
document.querySelectorAll('.tariff-mob-accordion__toggle').forEach(function (btn) {
var body = btn.nextElementSibling;
var icon = btn.querySelector('.tariff-mob-accordion__icon');
var isOpen = btn.getAttribute('aria-expanded') === 'true';
// початковий стан
if (!isOpen) {
body.classList.add('hidden');
icon.style.transform = 'rotate(-90deg)';
} else {
icon.style.transform = 'rotate(0deg)';
}
btn.addEventListener('click', function () {
var expanded = btn.getAttribute('aria-expanded') === 'true';
if (expanded) {
btn.setAttribute('aria-expanded', 'false');
body.classList.add('hidden');
icon.style.transform = 'rotate(-90deg)';
} else {
btn.setAttribute('aria-expanded', 'true');
body.classList.remove('hidden');
icon.style.transform = 'rotate(0deg)';
}
});
});
// ── Sticky bar ─────────────────────────────────────────
var stickyBar = document.getElementById('tariff-mob-sticky-bar');
var sentinel = document.getElementById('tariff-mob-sentinel');
if (stickyBar && sentinel) {
var observer = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
stickyBar.style.transform = 'translateY(100%)';
stickyBar.style.opacity = '0';
stickyBar.style.pointerEvents = 'none';
} else {
stickyBar.style.transform = 'translateY(0)';
stickyBar.style.opacity = '1';
stickyBar.style.pointerEvents = '';
}
});
}, { threshold: 0.1 });
observer.observe(sentinel);
}
})();
</script>
{% endblock %}