{% extends "_layouts/main.html" %} {% import 'macros.twig' as macros %} {% block main %} {# Listagens dinâmicas usadas nas secções 3 e 5 #} {% set projects = craft.entries() .section('projects') .orderBy('postDate desc') .all()|filter(p => p.situation.value == '0')|slice(0, 8) %} {% set solutions = craft.entries() .section('solutions') .orderBy('postDate asc') .all() %} {# ========================= SEC 1 — HERO (vídeo) home_section_1: - section_title (RTE) - short_video (asset) ========================= #} {% set sec1 = entry.home_section_1.one() ?? null %} {% if sec1 %} {% set sec1_video = sec1.short_video.one() ?? null %}
{% if sec1.section_title %}

{{ macros.limpar_paragrafos(sec1.section_title) }}

{% endif %}
{% endif %} {# ========================= SEC 2 — SOBRE home_section_2: - section_title (RTE) - btn_text (plain text) - btn_link (entry link) - image (asset) - text (RTE) - text_2 (RTE) - text_3 (RTE) ========================= #} {% set sec2 = entry.home_section_2.one() ?? null %} {% if sec2 %} {% set sec2_img = sec2.image.one() ?? null %} {% set sec2_btn_href = sec2.btn_link.url ?? (sec2.btn_link ?? '#') %}
{% if sec2.section_title %}

{{ macros.limpar_paragrafos(sec2.section_title) }}

{% endif %} {% if sec2.btn_text %} {{ macros.limpar_paragrafos(sec2.btn_text) }} {% endif %}
{% if sec2_img %} {{ sec2_img.title }} {% endif %}
{% if sec2.text %}

{{ macros.limpar_paragrafos(sec2.text) }}

{% endif %} {% if sec2.text_2 %}

{{ macros.limpar_paragrafos(sec2.text_2) }}

{% endif %} {% if sec2.text_3 %}

{{ macros.limpar_paragrafos(sec2.text_3) }}

{% endif %}
{% endif %} {# ========================= SEC 3 — PORTFÓLIO (últimos 5 projetos) home_section_3: - section_title (RTE) - btn_text (plain text) - btn_link (entry link) Listagem: channel `projects` (postDate desc, limit 5) - title, location, image, state ========================= #} {% set sec3 = entry.home_section_3.one() ?? null %} {% if sec3 %} {% set sec3_btn_href = sec3.btn_link.url ?? (sec3.btn_link ?? '#') %}
{% if sec3.section_title %}

{{ macros.limpar_paragrafos(sec3.section_title) }}

{% endif %} {% if sec3.btn_text %} {{ macros.limpar_paragrafos(sec3.btn_text) }} {% endif %}
{% if projects|length %} {% endif %}
{% endif %} {# ========================= SEC 4 — O QUE FAZEMOS home_section_4: - section_title (RTE) - text (RTE) - image (asset) - image_3 (asset, "Imagem 2" na UI) - text_2 (RTE) - gallery (assets — logos) ========================= #} {% set sec4 = entry.home_section_4.one() ?? null %} {% if sec4 %} {% set sec4_img = sec4.image.one() ?? null %} {% set sec4_img_2 = sec4.image_2.one() ?? null %} {% set sec4_gallery = sec4.gallery.all() ?? [] %}
{% if sec4.section_title %}

{{ macros.limpar_paragrafos(sec4.section_title) }}

{% endif %} {% if sec4.text %}

{{ macros.limpar_paragrafos(sec4.text) }}

{% endif %}
{% if sec4_img %} {{ sec4_img.title }} {% endif %} {% if sec4_img_2 %} {{ sec4_img_2.title }} {% endif %}
{% if sec4.text_2 %}
{{ sec4.text_2 }}
{% endif %} {% if sec4_gallery|length %}
{% for logo in sec4_gallery %} {{ logo.title }} {% endfor %}
{% endif %}
{% endif %} {# ========================= SEC 5 — SOLUÇÕES (todas as soluções) home_section_5: - section_title (RTE) Listagem: channel `solutions` (postDate asc) - title, text_2 (curto), image, image_2 ========================= #} {% set sec5 = entry.home_section_5.one() ?? null %} {% if sec5 %} {% set services_page = craft.entries().section('services').one() ?? null %}
{% if sec5.section_title %}

{{ macros.limpar_paragrafos(sec5.section_title) }}

{% endif %}
{% if solutions|length %}
{% for solution in solutions %} {% set sol_img_1 = solution.image.one() ?? null %} {% set sol_img_2 = solution.image_2.one() ?? null %} {% set sol_text = solution.text_2 ?: solution.text %}
{% if sol_img_1 %} {{ sol_img_1.title ?: solution.title }} {% endif %}

{{ macros.limpar_paragrafos(solution.title) }}

{{ 'btn.saber_mais'|t }}
{% if sol_text %}

{{ macros.limpar_paragrafos(sol_text) }}

{% endif %} {% if sol_img_2 %} {{ sol_img_2.title }} {% endif %}
{% endfor %}
{% endif %}
{% endif %} {# ========================= SEC 6 — CONTACTO DIRETO home_section_6: - section_title (RTE) - image (asset) ========================= #} {% set sec6 = entry.home_section_6.one() ?? null %} {% if sec6 %} {% set sec6_img = sec6.image.one() ?? null %}
{% if sec6.section_title %}

{{ macros.limpar_paragrafos(sec6.section_title) }}

{% endif %} {# Formulário carregado de forma lazy (lógica em js/custom.js): o fragmento só é pedido quando se aproxima da viewport (IntersectionObserver, rootMargin 1500px) ou, no máximo, após 10s. Fica fora de qualquer cache — o CSRF é gerado a cada pedido AJAX. #}
{% if sec6_img %}
{{ sec6_img.title }}
{% endif %}
{% endif %} {% endblock %}