{% extends "layout.html.twig" %}
{% block content %}
<!-- Modal test SANG -->
<div id="apk-modal-test-plasma" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<button class="uk-modal-close-default" type="button" uk-close></button>
{{ pimcore_inc("/" ~ app.request.locale ~ "/Snippets/form-eligibilite-inscription", {'id' : centre.site.id}) }}
</div>
</div>
<!-- Modal si jamais donné SANG et/ou PLASMA -->
<div id="apk-modal-never-give" class="uk-modal-container" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<button class="uk-modal-close-outside" type="button" uk-close></button>
<div class="uk-modal-body">
<div class="uk-flex uk-flex-middle">
<div class="uk-width-1-1">
<h3>{{"Attention !"|trans}}</h3>
<p>
{{"En tant que nouveau donneur, une procédure de première inscription vous sera demandée lors de votre premier rendez-vous."|trans}}<br>
{{"Nous vous demandons de vous présenter 15 min à l'avance."|trans}}<br>
{{"Merci."|trans}}
</p>
</div>
</div>
</div>
<div class="uk-modal-footer uk-text-right">
<button class="uk-button uk-modal-close" type="button">{{"Fermer"|trans}}</button>
</div>
</div>
</div>
<div class="page-collect-centre-inscription-form apk-page-inscription">
<div class="uk-container apk-container-1400 uk-margin-large-top">
<div class="section-sites-prelevement-item">
<h2 class="h-big-lowcase-grey">{{ "Prendre un rendez-vous dans un centre de prélèvement"|trans }}</h2>
<div class="uk-grid" uk-grid>
<div class="uk-width-2-3@s">
<div class="uk-text-uppercase uk-width-1-1 uk-margin-bottom" style="border-bottom: 1px solid grey;">{{ 'Votre Centre'|trans }}</div>
<div class="uk-grid uk-grid-small uk-child-width-1-2@s" uk-grid>
<div>
<div class="adresse">
<ul class="fa-ul">
<li>
<img uk-svg width="14" height="14" src="/static/img/pictos/position.svg" />
<strong>{{ centre.site.name }}</strong><br>
{{ centre.site.address }}<br>
{{ centre.site.zip }} {{ centre.site.city }}
</li>
</ul>
</div>
<div>
<ul class="fa-ul telephone">
<li>
<img uk-svg width="14" height="14" src="/static/img/pictos/phone.svg" />
<a href="tel:{{ centre.site.phone}}"
target="_blank">{{ centre.site.phone}}</a>
</li>
</ul>
</div>
<div class="horaires">
<ul class="fa-ul">
<li>
<img uk-svg width="14" height="14" src="/static/img/pictos/horaires.svg" />
{# <strong>{{ 'Horaires'|trans }} {{ 'du'|trans }} {{ date['weekStartDate'] }} {{'au'|trans}} {{ date['weekEndDate'] }}</strong><br/> #}
{% for jour,horaire in centre.days %}
{% if horaire %}
{{ jour|trans }} : {{ horaire }}
<br/>
{% else %}
{{ jour|trans }} : {{ "Fermé"|trans }}
<br/>
{% endif %}
{% endfor %}
</li>
</ul>
</div>
</div>
<!-- <div>
{% if not centre.site.info is empty %}
<div>
<ul class="fa-ul">
<li>
<i class="fa-li fa"><svg width="17" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M255.989 0C114.623 0 0 114.623 0 255.989 0 397.355 114.623 512 255.989 512 397.355 512 512 397.355 512 255.989 512 114.623 397.355 0 255.989 0Zm53.292 396.749c-13.177 5.201-23.666 9.145-31.533 11.876a83.188 83.188 0 0 1-27.35 4.096c-15.951 0-28.369-3.901-37.211-11.681-8.842-7.781-13.242-17.641-13.242-29.626 0-4.659.326-9.427.976-14.282a178.126 178.126 0 0 1 3.185-16.449l16.493-58.254c1.452-5.591 2.709-10.901 3.706-15.842.997-4.985 1.473-9.558 1.473-13.719 0-7.411-1.538-12.613-4.594-15.538-3.099-2.926-8.929-4.356-17.619-4.356-4.248 0-8.626.628-13.112 1.95-4.443 1.365-8.3 2.601-11.464 3.814l4.356-17.944c10.792-4.4 21.13-8.17 30.991-11.291a91.567 91.567 0 0 1 27.956-4.725c15.843 0 28.066 3.858 36.669 11.486 8.561 7.651 12.874 17.598 12.874 29.821 0 2.536-.304 7-.889 13.372a89.462 89.462 0 0 1-3.294 17.576l-16.406 58.08a164.502 164.502 0 0 0-3.619 15.951 84.402 84.402 0 0 0-1.582 13.567c0 7.715 1.712 12.981 5.18 15.777 3.424 2.796 9.427 4.204 17.922 4.204 4.01 0 8.496-.715 13.567-2.102 5.028-1.387 8.669-2.622 10.966-3.684l-4.399 17.923Zm-2.905-235.748a39.172 39.172 0 0 1-27.631 10.663c-10.75 0-20.025-3.555-27.74-10.663a34.044 34.044 0 0 1-11.552-25.855c0-10.077 3.901-18.746 11.552-25.919a39.28 39.28 0 0 1 27.74-10.771c10.771 0 20.003 3.576 27.631 10.771 7.651 7.173 11.487 15.842 11.487 25.919 0 10.121-3.836 18.747-11.487 25.855Z" style="fill:#F9B123;fill-rule:nonzero" transform="scale(.03125)"/></svg></i>
{{ centre.site.info|raw }}
</li>
</ul>
</div>
{% endif %}
{% if not centre.site.parking is empty %}
<div>
<ul class="fa-ul">
<li>
<i class="fa-li fa"><svg width="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M287 167h-62v60h62c16.538 0 30-13.462 30-30s-13.462-30-30-30Z" style="fill:#F9B123;fill-rule:nonzero" transform="scale(.03125)"/><path d="M437 0H75C33.647 0 0 33.647 0 75v362c0 41.353 33.647 75 75 75h362c41.353 0 75-33.647 75-75V75c0-41.353-33.647-75-75-75ZM287 287h-62v105c0 8.284-6.716 15-15 15h-30c-8.284 0-15-6.716-15-15V122c0-8.284 6.716-15 15-15h107c49.629 0 90 40.371 90 90s-40.371 90-90 90Z" style="fill:#F9B123;fill-rule:nonzero" transform="scale(.03125)"/></svg></i>
{{"Parking"|trans}}
<br>
{{ centre.site.parking|raw }}
</li>
</ul>
</div>
{% endif %}
{% if not centre.site.transports_commun is empty %}
<div>
<ul class="fa-ul">
<li>
<i class="fa-li fa"><svg width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path d="M4.266 0c-1.455 0-3.2.793-3.2 2.93v9.87s0 1.067 1.067 1.067v1.066S2.133 16 3.2 16c1.066 0 1.066-1.067 1.066-1.067v-1.066h7.467v1.066S11.733 16 12.8 16c1.066 0 1.066-1.067 1.066-1.067v-1.066s1.067 0 1.067-1.067V2.93C14.933.747 13.615 0 12.16 0H4.266Zm.267 1.6h6.933a.267.267 0 0 1 0 .533H4.533a.267.267 0 1 1 0-.533ZM3.2 3.2h9.6c1.066 0 1.066 1.031 1.066 1.031v3.236s0 1.066-1.066 1.066H3.2c-1.067 0-1.067-1.066-1.067-1.066v-3.2S2.133 3.2 3.2 3.2Zm0 7.467a1.066 1.066 0 1 1 0 2.132 1.066 1.066 0 0 1 0-2.132Zm9.6 0a1.067 1.067 0 1 1 0 2.133 1.067 1.067 0 0 1 0-2.133Z" fill="#F9B123"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg></i>
{{"Transports en commun"|trans}}
<br>
{{ centre.site.transports_commun|raw }}
</li>
</ul>
</div>
{% endif %}
{% if not centre.site.accessibilite_pmr is empty %}
<div>
<ul class="fa-ul">
<li>
<i class="fa-li fa"><svg width="17" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M234.486 100.91c27.837 0 50.452-22.59 50.452-50.455C284.938 22.582 262.323 0 234.486 0c-27.869 0-50.466 22.582-50.466 50.455 0 27.865 22.597 50.455 50.466 50.455Zm77.967 285.907c-13.407 46.553-56.323 80.741-107.136 80.741-61.532 0-111.573-50.042-111.573-111.556 0-45.535 27.471-84.727 66.674-102.045v-47.294C96.217 226 49.309 285.597 49.309 356.002 49.309 442.015 119.293 512 205.316 512c62.69 0 116.724-37.258 141.5-90.717l-17.614-34.609c-4.945.041-10.673.093-16.749.143Z" style="fill:#F9B123;fill-rule:nonzero" transform="scale(.03125)"/><path d="M459.45 446.708 391.867 313.84a29.625 29.625 0 0 0-26.395-16.2h-86.558v-19.738h74.495c7.439 0 13.692-3.888 17.731-9.489 2.624-3.649 4.491-7.888 4.491-12.734 0-12.269-9.937-22.22-22.222-22.22h-74.495v-66.946c0-18.413-13.652-44.443-44.427-44.443-24.544 0-44.441 19.901-44.441 44.443v145.044c0 25.038 20.297 45.335 45.335 45.335h111.927l59.345 116.68c5.215 10.277 15.622 16.207 26.422 16.207a29.362 29.362 0 0 0 13.408-3.23c14.605-7.408 20.406-25.256 12.967-39.841Z" style="fill:#F9B123;fill-rule:nonzero" transform="scale(.03125)"/></svg></i>
{{"Accessibilité aux PMR"|trans}}
<br>
{{ centre.site.accessibilite_pmr|raw }}
</li>
</ul>
</div>
{% endif %}
</div> -->
</div>
<div class="uk-margin-top uk-text-center apk-container-cta-modal">
<img src="/static/img/icons/questionnaire-plasma.png" style="width:80px" alt="">
<p>
{{"Prenez 2 minutes pour vérifier que vous êtes bien dans les conditions pour donner votre sang"|trans}}
</p>
<button class="uk-button" uk-toggle="target: #apk-modal-test-plasma">{{"Faire le test"|trans}}</button>
</div>
</div>
<div class="uk-width-1-3@s">
{% if centre.site.picture %}
{% if not centre.site.maps_url is empty %} <a href="{{ centre.site.maps_url }}" target="_blank"> {% endif %}
<figure class="uk-margin-top">
<img src="{{ centre.site.picture }}" alt="{{ centre.site.name }}" />
{% if centre.site.copyright %}
<figcaption>{{ centre.site.copyright }}</figcaption>
{% endif %}
</figure>
{% if not centre.site.maps_url is empty %} </a> {% endif %}
{% else %}
<img src="/static/img/logos/logo-crb.svg" alt="Croix-Rouge de Belgique"/>
{% endif %}
</div>
<div class="uk-width-1-1 uk-margin-small-bottom">
{% if centre.site.informations %}
<div class="note">
<ul class="fa-ul">
<li><img uk-svg width="14" height="14" src="/static/img/pictos/info-circle.svg" />
{{ centre.site.informations|raw }}
</li>
</ul>
</div>
{% endif %}
</div>
</div>
<div class="uk-margin-medium-top">
<form class="uk-form" role="form" name="form-validation" id="form-validation" method="POST">
<div class="uk-text-uppercase uk-width-1-1" style="border-bottom: 1px solid grey;">{{ "A quelle date souhaitez-vous vous inscrire ?"|trans }}</div>
<div class="warning-message uk-margin-top">{{"ATTENTION : le délai minimum entre 2 dons est de 15 jours. Si vous venez de donner, assurez-vous que le délai est bien respecté lors de votre prise de rendez-vous."|trans}}</div>
<div uk-slider>
<div class="uk-position-relative">
<div class="uk-slider-container uk-padding">
<ul class="uk-slider-items uk-grid-small" uk-grid>
{% for i in 0..5 %}
<li class=" uk-width-1-4@m">
<div class="apk-calendar">
{{ calendriers[i]|raw }}
</div>
</li>
{% endfor %}
</ul>
</div>
<div class="uk-visible@s">
<a class="uk-position-center-left-out uk-position-small" href="#" uk-slidenav-previous uk-slider-item="previous"></a>
<a class="uk-position-center-right-out uk-position-small" href="#" uk-slidenav-next uk-slider-item="next"></a>
</div>
</div>
<ul class="uk-slider-nav uk-dotnav uk-margin-bottom uk-margin-left"></ul>
</div>
<div class="uk-grid-small" uk-grid>
<div class="uk-width-1-1">
<div class="uk-text-uppercase" style="border-bottom: 1px solid grey;">
<label class="control-label">
{{ "A quelle heure souhaitez-vous prendre rendez-vous le"|trans }} <span id="dateSelect" name="dateSelect" class="date-selected">...</span> ?
</label>
</div>
<div class="uk-width-1-1@m" id="resultats">
<div class="resultats-placeholder">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="info"><path fill="currentColor" d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="currentColor" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
{{ "Veuillez sélectionner d'abord une date dans le calendrier au-dessus"|trans }}
</div>
</div>
</div>
</div>
<div class="uk-grid">
<div class="uk-width-1-1">
<div class="uk-text-uppercase" style="border-bottom: 1px solid grey;">
{{ "Avant de terminer votre inscription,"|trans }}<br/>
{{ "Nous avons besoin de ces quelques informations"|trans }}
</div>
</div>
</div>
<div class="uk-grid">
{% if errorMessage or errorMessage != "" %}
<div class="uk-width-1-1">
<div class="uk-margin-bottom uk-alert uk-alert-warning" id="error-msg" uk-alert>{% if errorMessage %}{{ errorMessage|trans }}{% endif %}</div>
</div>
{% endif %}
<input type="hidden" name="akimedia-centre" value="{{ centre.site.id }}">
<div class="uk-grid-medium" uk-grid>
<div class="uk-width-1-2@s ">
<label class="control-label required" for="collecte_centre_form_lastname">{{ 'Nom'|trans }}</label><br/>
<input type="text" id="collecte_centre_form_lastname" name="lastname" required="required" class="uk-input">
</div>
<div class="uk-width-1-2@s">
<label class="control-label required" for="collecte_centre_form_firstname">{{ 'Prénom'|trans }}</label><br/>
<input type="text" id="collecte_centre_form_firstname" name="firstname" required="required" class="uk-input">
</div>
<div class="uk-width-1-2@s">
<label class="control-label required" for="collecte_centre_form_email">{{ 'Adresse mail'|trans }}</label><br/>
<input type="email" id="collecte_centre_form_email" name="email" required="required" class="uk-input">
</div>
<div class="uk-width-1-2@s">
<label class="control-label required" for="collecte_centre_form_email2">{{ 'Confirmez votre adresse mail'|trans }}</label><br/>
<input type="email" id="collecte_centre_form_email2" name="email2" required="required" class="uk-input">
</div>
<div class="uk-width-1-2@s">
<label class="control-label required" for="collecte_centre_form_phone">{{ 'Téléphone'|trans }}</label>
<input type="text" id="collecte_centre_form_phone" name="phone" required="required" class="uk-input">
</div>
<div class="uk-width-1-2@s">
<label class="control-label required" for="dtenaissance">{{ 'Date de naissance jj/mm/aaaa'|trans }}</label>
<input class="uk-input" type="date" name="dtenaissance" id ="dtenaissance"
data-min="{{yearAllowed.min|date('Y-m-d')}}" data-max="{{yearAllowed.max|date('Y-m-d')}}"
value="" autocomplete="false" maxlength="10" required>
</div>
<div class="uk-width-1-1 apk-choix uk-margin-top uk-grid-margin uk-first-column">
<div class="uk-grid uk-grid-small uk-child-width-1-2@s" uk-grid>
<div>
<div class="apk-sang">
<div class="uk-margin-top uk-position-relative">
<div>
<label class="required">{{ 'Déjà donné du sang'|trans }}</label>
<div id="inscription_form_plasma">
<input type="radio" id="collecte_centre_form_alreadyBlood_0" name="alreadyBlood" required="required" value="OUI">
<label for="collecte_centre_form_alreadyBlood_0" class="required apk-label-is-linked-to-field">{{ "Oui"|trans }}</label>
<input type="radio" id="collecte_centre_form_alreadyBlood_1" name="alreadyBlood" required="required" value="NON">
<label for="collecte_centre_form_alreadyBlood_1" class="required apk-label-is-linked-to-field">{{ "Non"|trans }}</label>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="apk-plasma">
<div class="uk-margin-top uk-position-relative">
<div>
<label class="required">{{ 'Déjà donné du plasma'|trans }}</label>
<div id="inscription_form_plasma">
<input type="radio" id="collecte_centre_form_alreadyPlasma_0" name="alreadyPlasma" required="required" value="OUI">
<label for="collecte_centre_form_alreadyPlasma_0" class="required apk-label-is-linked-to-field">{{ "Oui"|trans }}</label>
<input type="radio" id="collecte_centre_form_alreadyPlasma_1" name="alreadyPlasma" required="required" value="NON">
<label for="collecte_centre_form_alreadyPlasma_1" class="required apk-label-is-linked-to-field">{{ "Non"|trans }}</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="uk-width-1-1">
<label class="gdpr-label">
<input type="checkbox" id="collecte_centre_form_gdpr" name="gdpr" required="required" class="uk-checkbox uk-margin-small-right" value="1">{{ 'En cochant cette case, vous acceptez la manière dont vos données sont traitées.'|trans }} *</label>
</div>
<div class="uk-width-1-1">
<div class="uk-display-inline-block">
<button type="submit" id="collecte_centre_form_submit" class="uk-button">{{"Envoyer"|trans}}</button>
</div>
</div>
</div>
</div>
<input id="collecte_centre_form_centre" name="centre" type="hidden" value="{{ centre.site.id }}">
<input id="collecte_centre_form_date" name="date" type="hidden" value="">
<input id="collecte_centre_form_horaire" name="horaire" type="hidden" value="">
<input id="collecte_centre_form_heure" name="heure" type="hidden" value="">
</form>
</div>
</div>
</div>
</div>
{% endblock %}
{% block inlinescripts %}
<link href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.js"></script>
<script src="https://npmcdn.com/flatpickr@4.6.13/dist/l10n/{{app.request.locale}}.js"></script>
{% if not editmode %}
<script>
var borne = [];
{% set now = "now"|date("Y-m-d") %}
{% for date in dates %}
{% set d = date|date("Y-m-d") %}
{% if d >= now %}
borne.push('{{ d }}');
{% endif %}
{% endfor %}
$( document ).ready(function() {
//gestion de la birthDate
newMaxDate = false;
const BirthMaxOri = new Date($('#dtenaissance').attr('data-max'));
const BirthMinOri = new Date($('#dtenaissance').attr('data-min'));
let inputBirthDate = $("#dtenaissance").flatpickr({
locale : "{{app.request.locale}}",
dateFormat : "d/m/Y",
minDate : BirthMinOri,
maxDate : BirthMaxOri,
allowInput: true,
});
function setDateMax () {
let BirthMax = BirthMaxOri;
let BirthMin = BirthMinOri;
let newMaxDate = null;
let radioSelected = null;
let found = false;
$('.schedule-item').each(function(el){
if($(this).is('.is-selected')) {
found = true;
radioSelected = $(this).find('input:checked');
}
});
if(found) {
newMaxDate = radioSelected.attr('data-id');
BirthMax18 = new Date(newMaxDate);
newBirthMax = new Date(BirthMax18.setFullYear(BirthMax18.getFullYear() - parseFloat({{yearAllowed.year}})));
inputBirthDate.set('maxDate', newBirthMax);
} else {
inputBirthDate.set('maxDate', BirthMaxOri);
}
inputBirthDate.clear();
}
setDateMax();
$("form").on("submit", function() {
if($("#collecte_centre_form_email").val() != $("#collecte_centre_form_email2").val()){
$("#error-msg").text("{{ 'Les adresses e-mails sont différentes, veuillez corriger'|trans }}");
$("#error-msg").addClass("uk-padding-small uk-margin-bottom");
console.log('in');
return false;
}
if($("#collecte_centre_form_horaire").val() == 'zzzzz'){
$("#error-msg").text("{{ 'Veuillez choisir une date et une heure.'|trans }}");
return false;
}
// Ajout du test de validiter de l'horaire pour eviter les doublon
var horaire = $("#collecte_centre_form_horaire").val()+'|'+$("#collecte_centre_form_heure").val();
var codeCentre = $("#collecte_centre_form_centre").val();
});
$("form").on("submit", function() {
});
$('.day').each(function () {
console.log ($(this).attr('data-date'));
if(borne.includes($(this).attr('data-date'))){
$(this).addClass('date_actif');
}
else {
$(this).addClass('not-active');
}
});
$('.day.date_actif').on("click", function () {
$('.day.is-selected').removeClass('is-selected');
$(this).addClass('is-selected');
var date = $(this).attr('data-date');
var centreid = $(this).attr('data-centre-id');
$("#dateSelect").html($(this).attr('data-date-format'));
$("#collecte_centre_form_date").val(date);
var lang = '{{ app.request.locale }}';
$.ajax({
dataType: "json",
type: "GET",
url: "{{ path('getHoraireCentreAkimedia') }}",
data: {'date': date ,'centreid':centreid, 'lang':lang},
success: function (data) {
$('#resultats').html(data["msg"]);
$("input[name='inscription']").on("click", function(){
$("#collecte_centre_form_heure").val($(this).val());
$("#collecte_centre_form_horaire").val($(this).attr("data-id"));
});
console.log(data);
inputBirthDate.clear();
$('.schedule-item').on("click", function () {
var $radioSelected = $(this).find('.uk-radio');
if($radioSelected.attr("data-id")){
$('.schedule-item').removeClass('is-selected');
$(this).addClass('is-selected');
$radioSelected.prop('checked', true);
setDateMax();
$("#collecte_centre_form_heure").val($radioSelected.val());
$("#collecte_centre_form_horaire").val($radioSelected.attr("data-id"));
}
else{
$('.schedule-item').removeClass('is-selected');
}
});
},
error: function (xhr, textStatus, errorThrown) {
UIkit.notification('{{ "Oops! Une erreur s'est produite. Veuillez réessayer."|trans }}', {status: 'danger'});
console.log(xhr, textStatus, errorThrown);
}
});
})
});
</script>
{% endif %}
{% endblock inlinescripts %}