{% extends "layout.html.twig" %}
{% block content %}
<!-- #main -->
<main id="main" role="main">
{{ pimcore_areablock('contentTop') }}
<div class="apk-page-contact">
<div class="uk-container apk-container-800">
<div class="apk-contact-container">
{# editmode pour le titre #}
{% if editmode %}
<p>
{{ pimcore_textarea("infos-text",{
"nl2br" : true,
"placeholder" : 'Texte de la section infos'
}) }}
</p>
{% else %}
<div>
<h5>{{ pimcore_textarea("infos-text",{"nl2br" : true}) }}</h5>
</div>
{% endif %}
<div>
<div class="apk-contact-snippets-container">
{% if formStatus == "required-empty" %}
<div class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>{{ "Veuillez remplir tout les champs requis. (*)"|trans }}</p>
</div>
{% elseif formStatus == "invalid-email" %}
<div class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>{{ "Votre adresse email est invalide. Merci de recommencer."|trans }}</p>
</div>
{% elseif formStatus == "robot" %}
<div class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>{{ "Une erreur Recaptcha est survenue. Merci de recommencer."|trans }}</p>
</div>
{% endif %}
{% if formStatus != "success" %}
{{ form_start(form, {'action': '#contact', 'method': 'POST'}) }}
<div uk-grid>
<div class="uk-width-1-2@s uk-margin-small-top">
{{ form_row(form.lastname, { 'attr': {'class' : 'uk-input'}}) }}
</div>
<div class="uk-width-1-2@s uk-margin-small-top">
{{ form_row(form.firstname, { 'attr': {'class' : 'uk-input'}}) }}
</div>
<div class="uk-width-1-2@s uk-margin-top">
{{ form_row(form.email, { 'attr': {'class' : 'uk-input'}}) }}
</div>
<div class="uk-width-1-2@s uk-margin-top">
{{ form_row(form.phone, { 'attr': {'class' : 'uk-input'}}) }}
</div>
<div class="uk-width-1-1 uk-margin-top">
{{ form_row(form.message, { 'attr': {'class' : 'uk-textarea'}}) }}
</div>
<div class="uk-width-1-2@s">
<div class="form-group">
<div class="apk-birthday-date" data-apk-label-day="{{'Jour'|trans}}" data-apk-label-month="{{'Mois'|trans}}" data-apk-label-year="{{'Année'|trans}}">
{{ form_row(form.birthday) }}
</div>
</div>
</div>
<div class="uk-width-1-1 apk-choix uk-margin-top">
<div>
<div class="apk-sang">
<div class="uk-margin-top">
{{ form_row(form.sang) }}
</div>
</div>
</div>
<div>
<div class="apk-plasma">
<div class="uk-margin-top">
{{ form_row(form.plasma) }}
</div>
</div>
</div>
</div>
<div class="uk-width-1-1 apk-conscent uk-margin-top">
<div class="uk-grid-small" uk-grid>
<div class="uk-width-auto">{{ form_widget(form.gdpr, { 'attr': {'class' : 'uk-checkbox'}}) }}</div>
<div class="uk-width-expand"><label id="contact_form_gdpr_label" for="contact_form_gdpr">{{ "contact.conscent"|trans }}</label></div>
</div>
</div>
{{ form_widget(form.recaptcha) }}
<div class="uk-width-1-1 uk-margin-small-top">
<div class="uk-margin-top uk-text-right">
{{ form_widget(form.submit) }}
</div>
</div>
</div>
{{ form_end(form) }}
{% else %}
<div class="uk-alert-success" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>{{ "Message envoyé. Nous vous recontacterons dans les plus brefs délais."|trans }}</p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{{ pimcore_areablock('contentBottom') }}
</main>
{% endblock %}
{% block inlinescripts %}
{% set recaptchaKeyPublic = pimcore_website_config('recaptchaKeyPublic') %}
<script src="https://www.google.com/recaptcha/api.js?onload=onloadRecaptchaCallback&render={{ recaptchaKeyPublic }}"></script>
<script>
function onloadRecaptchaCallback(){
grecaptcha.ready(function() {
grecaptcha.execute('{{ recaptchaKeyPublic }}', {action: 'contact'}).then(function(token) {
//alert('recaptcha is loaded');
var recaptcha = document.getElementById('contact_form_recaptcha');
recaptcha.value = token;
});
});
}
</script>
{% endblock inlinescripts %}