{% if answerSaved is defined and result is not defined %}
<div class="convert-to-alert">
{% if poll.msgSent %}
<h2 class="text-center button-text font-bold mid-section-pb">{{ poll.msgSent }}</h2>
{% else %}
<h2 class="text-center button-text font-bold mid-section-pb">{{'poll success'|trans}}</h2>
{% endif %}
</div>
{% endif %}
<poll-form-wrapper
label="{{ poll.msgOpenButton ?: 'Show poll'|trans }}"
{% if poll.displayType == 'onclick' and answerSaved is not defined %}
:show-button="true"
{% endif %}
:server-errors="JSON.parse('{{ inputErrors|json_encode|e('js') }}')"
>
<section
{% if poll.displayType == 'onclick' and answerSaved is not defined %}
class="hidden"
{% endif %}
>
{% if poll.dateStart|date('U', 'UTC') > 'now'|date('U', 'UTC') %}
<h2 class="text-center button-text font-bold mid-section-pb">{{poll.msgNotStarted}}</h2>
{% elseif poll.dateEnd|date('U', 'UTC') < 'now'|date('U', 'UTC') %}
<h2 class="text-center button-text font-bold mid-section-pb">{{poll.msgEnded}}</h2>
{% elseif answerSaved is not defined %}
{% if alreadyAnswered is defined and alreadyAnswered %}
{% if alreadyAnswered.created is defined %}
<h2 class="text-center button-text font-bold mid-section-pb">
{{'You have answered this poll at'|trans}} {{alreadyAnswered.created|date('d. m. Y')}}
</h2>
{% else %}
<h2 class="text-center button-text font-bold mid-section-pb">{{'You have already answered this poll anoynmously.'|trans}}</h2>
{% endif %}
{% else %}
<form class="container mx-auto" method="post" enctype="multipart/form-data">
{% for question in poll.questions %}
{% set hasDropdownAnswer = false %}
{% set hasCheckboxAnswer = false %}
{% set hasRadioAnswer = false %}
{% set hasRequiredAnswer = false %}
{% for answer in question.answers %}
{% if answer.type == 'dropdown' %}
{% set hasDropdownAnswer = true %}
{% endif %}
{% if answer.type == 'checkbox' %}
{% set hasCheckboxAnswer = true %}
{% endif %}
{% if answer.type == 'radio' %}
{% set hasRadioAnswer = true %}
{% endif %}
{% if answer.required %}
{% set hasRequiredAnswer = true %}
{% endif %}
{% endfor %}
<div class="flex flex-col items-center {% if loop.last %}last{% endif %}">
<p class="flex items-center justify-center font-bold text-center
gap-x-2 lg:gap-x-5 mb-10 font-bold sm-text-card"
>
{{question.title}}
{% if hasRequiredAnswer %}
<span class="text-frMagenta">*</span>
{% endif %}
</p>
{% if question.description %}
<div class="poll-content-desc mb-10 sm-text-card">
{{ question.description|raw }}
</div>
{% endif %}
{% include 'BaitPollBundle:Poll:fragments/photo.html.twig' with {'photo': question.photo, 'source': question.photoSource, 'link': question.photoSourceLink} %}
{% if question.embed %}
<div class="embed-responsive card-rounded mb-15">
<iframe class="embed-responsive__item" width="560" height="315" src="{{ question.embed }}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
{% endif %}
{% if hasDropdownAnswer %}
{% include 'BaitPollBundle:Poll:fragments/dropdown.html.twig' %}
{% endif %}
{% if hasCheckboxAnswer %}
{% include 'BaitPollBundle:Poll:fragments/checkbox.html.twig' %}
{% endif %}
{% if hasRadioAnswer %}
{% include 'BaitPollBundle:Poll:fragments/radio.html.twig' %}
{% endif %}
{% for answer in question.answers if answer.type != 'dropdown' and answer.type != 'checkbox' and answer.type != 'radio' %}
{% if answer.embed %}
<div class="embed-responsive card-rounded mb-15">
<iframe class="embed-responsive__item" width="560" height="315" src="{{ answer.embed }}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
{% endif %}
{% include 'BaitPollBundle:Poll:fragments/photo.html.twig' with {'photo': answer.photo, 'source': answer.photoSource, 'link': answer.photoSourceLink} %}
{% include 'BaitPollBundle:Poll:fragments/' ~ answer.type ~ '.html.twig' ignore missing %}
{{answer.trackingCode|raw}}
{% endfor %}
</div>
{% endfor %}
{% if poll.multiEntry and poll.multiEntryInterval == 'without_limit' %}
<div id="recaptcha-{{poll.id}}" style="width: 304px; margin: 0 auto 16px;"></div>
{% endif %}
<div class="flex justify-center mid-section-pb">
<input type="hidden" name="submit" value="{{ poll.id }}">
<button
type="submit"
id="{{ poll.id }}"
{% if poll.multiEntry and poll.multiEntryInterval == 'without_limit' %}
disabled
data-recaptcha="{{ poll.id }}"
{% endif %}
class="flex items-center justify-center
px-15 lg:px-25 h-[32px] lg:h-[50px]
bg-frMagenta border-frMagenta rounded-full
hover:bg-frDarkBlue hover:border-frDarkBlue
transition duration-300 font-bold gap-x-10 lg:gap-x-15"
>
<span class="flex items-center h-full text-white sm-text-card !leading-none">
{{ 'Submit'|trans }}
</span>
<img
src="{{ asset('vue/icons/arrow-link-white.svg', 'img') }}"
alt="Send"
class="w-12 h-12 lg:w-20 lg:h-20"
/>
</button>
</div>
</form>
{% endif %}
{% endif %}
</section>
</poll-form-wrapper>
{# quiz result #}
{% if result is defined %}
<div class="flex flex-col items-center mid-section-pb sm-text-card">
<div class="{{ "funradio" in site_url ? "container" : "" }}">
<h2 class="text-center button-text font-bold mid-section-pb">{{'quiz result'|trans}}</h2>
{% if result.embed %}
<div class="embed">
<div class="youtube">
{{ result.embed|raw }}
</div>
</div>
{% endif %}
{% include 'BaitPollBundle:Poll:fragments/photo.html.twig' with {'photo': result.photo, 'source': result.photoSource, 'link': result.photoSourceLink} %}
<h2 style="padding-top:1em; font-weight:normal; text-align: center">
{{ result.description|raw}}
</h2>
</div>
</div>
{% endif %}