{% extends "layout.html.twig" %}
{#
{% use AppBundle/Helper/Apik %}
#}
{% block content %}
<!-- #main -->
<main id="main" role="main">
<div class="uk-text-center uk-container apk-container-1200">
{% if editmode %}
<h1 class="uk-h2 uk-margin-medium-top uk-margin-small-bottom">{{ pimcore_textarea("content-title",{"nl2br" : true}) }}</h1>
{{ pimcore_wysiwyg("content-text") }}
{% else %}
{% if not pimcore_textarea("content-title").isEmpty() %}
<h1 class="uk-h2 uk-margin-medium-top uk-margin-small-bottom">{{ pimcore_textarea("content-title",{"nl2br" : true}) }}</h1>
{% else %}
<h1 class="uk-h2 uk-margin-medium-top uk-margin-small-bottom">{{ "Choisissez votre site de prélèvement"|trans }}</h1>
{% endif %}
{% if pimcore_wysiwyg("content-text")|striptags %}
<div>
{{ pimcore_wysiwyg("content-text")|raw }}
</div>
{% endif %}
{% endif %}
</div>
<div class="section-sites-prelevement">
<div class="uk-container">
<ul class="uk-accordion" uk-accordion="multiple: true;">
{% set Province = "" %}
{% set i = 0 %}
{% set tabJours = {
"1" : "Lundi"|trans,
"2" : "Mardi"|trans,
"3" : "Mercredi"|trans,
"4" : "Jeudi"|trans,
"5" : "Vendredi"|trans,
"6" : "Samedi"|trans,
"7" : "Dimanche"|trans,
} %}
{% for province,centres in provinces %}
{#% if loop.first %}
<li class="uk-open">
{% else %}
<li>
{% endif %#}
<li>
<a class="uk-accordion-title" href="#">{{province|trans}}</a>
<div class="uk-accordion-content">
{% for centre in centres %}
<div class="section-sites-prelevement-item uk-position-relative apk-copy-container" style="cursor:default">
<h4 class="h-bold">{{ centre.infos.site.name }}</h4>
<div class="section-sites-prelevement-item-detail2">
<button class="uk-button uk-button-default" type="button" aria-expanded="false">…</button>
<div uk-dropdown="mode: click" class="uk-dropdown">
{% set openHours = "" %}
{% for jour, hor in centre.horaires %}
{% if not hor %}
{% set hor = "fermé"|trans %}
{% endif %}
{% set openHours = openHours ~ jour|trans ~ " : " ~ ' ' ~ hor ~ ' ' ~ ' <br/>' %}
{% endfor %}
{% set emailInfos = {
'Nom' : centre.infos.site.name,
'Rue' : (centre.infos.site.address),
'Cp' : centre.infos.site.zip,
'Ville' : centre.infos.site.city,
'Horaires' : openHours,
'HorairesDate' : 'Horaires'|trans ~ ' ' ~ 'du'|trans ~ ' ' ~ date['weekStartDate'] ~ ' ' ~ 'au'|trans ~ ' ' ~ date['weekEndDate']
} %}
{% set emailId = (centre.id)|slug %}
<input type="hidden" id="email-data-{{ emailId }}" value='{{ emailInfos|json_encode() }}'>
<a class="send-mail" href="#" onClick="emailModal('{{ emailId }}','centre')">
{{ "M’envoyer les informations par mail"|trans }}
</a>
<br/>
<a href="#" data-apk-copy-button=".apk-copy-data">
{{ "Copier"|trans }}
<span class="copiedtext" aria-hidden="true">
{{ "C'est copié"|trans }}
</span>
</a>
</div>
</div>
<textarea class="apk-copy-data">
{{ centre.infos.site.name }}
{{ centre.infos.site.address }},
{{ centre.infos.site.zip }} {{ centre.infos.site.city }}
{% for jour, hor in centre.horaires %}
{% if not hor %}
{% set hor = "fermé"|trans %}
{% endif %}
{{ jour|trans ~ " : " }}
{{ " " ~ hor ~ " " }}
{% endfor %}
</textarea>
<div class="section-sites-prelevement-item-detail">
<div class="uk-grid uk-margin-small-top" uk-grid>
<div class="uk-width-2-3@s">
{% if centre.availibilities|length > 0 %}
<div class="btn-rdv-centre uk-margin-bottom">
<a href="{{ path("inscriptionCentre", {id: centre.id_akimedia}) }}" class="uk-button uk-text-uppercase">{{ "Je prends rendez-vous"|trans }}</a>
</div>
{% endif %}
<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" />
{{ centre.infos.site.name }}<br/>
{{ centre.infos.site.address }},<br/>
{{ centre.infos.site.zip }} {{ centre.infos.site.city }}<br/>
</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.infos.site.phone|replace({' ' : ''}) }}"
target="_blank">{{ centre.infos.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, hor in centre.horaires %}
{{ jour|trans ~ " : " }}
{% if hor %}
{{ " " ~ hor ~ " " }}<br/>
{% else %}
{{ "Fermé"|trans }}<br/>
{% endif %}
{% endfor %}
</li>
</ul>
</div>
</div>
<div>
{% if not centre.infos.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.infos.site.info|raw }}
</li>
</ul>
</div>
{% endif %}
{% if not centre.infos.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.infos.site.parking|raw }}
</li>
</ul>
</div>
{% endif %}
{% if not centre.infos.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.infos.site.transports_commun|raw }}
</li>
</ul>
</div>
{% endif %}
{% if not centre.infos.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.infos.site.accessibilite_pmr|raw }}
</li>
</ul>
</div>
{% endif %}
</div>
</div>
</div>
<div class="uk-width-1-3@s">
<div class="section-sites-prelevement-item-image uk-margin-bottom">
{% if centre.infos.site.picture %}
{% if not centre.infos.site.maps_url is empty %} <a href="{{ centre.infos.site.maps_url }}" target="_blank"> {% endif %}
<figure>
<img src="{{ centre.infos.site.picture }}" alt="{{ centre.infos.site.name }}" />
{% if centre.infos.site.copyright %}
<figcaption>{{ centre.infos.site.copyright }}</figcaption>
{% endif %}
</figure>
{% if not centre.infos.site.maps_url is empty %} </a> {% endif %}
{% endif %}
</div>
</div>
<div class="uk-width-1-1 uk-margin-small-bottom">
{% if centre.infos.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.infos.site.informations|raw }}
</li>
</ul>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% set i = i + 1 %}
{% endfor %}
</div></li>
{% endfor %}
</ul>
</div>
<div id="modal-infomail" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<input type="hidden" id="mail-data" name="mail-data" value ="">
<h2 class="uk-modal-title">{{ "Entrez votre email"|trans }} :</h2>
<input class="uk-input" type="text" id="mail-email" name="mail-email" required placeholder="{{ "Email"|trans }}">
<p class="uk-text-right">
<button class="uk-button uk-button-default uk-modal-close" type="button">{{ "Annuler"|trans }}</button>
<button class="uk-button uk-button-primary" type="button" onclick="emailSend()">{{ "Envoyer"|trans }}</button>
</p>
</div>
</div>
</div>
{{ pimcore_areablock('contentBottom') }}
</main><!-- end #main -->
{% endblock %}
{% block inlinescripts %}
<script>
function SaveInscription(element,idModal) {
var fields = $(element)
.find("select, textarea, input").serializeArray();
var isOK = 1 ;
$.each(fields, function(i, field) {
if (!field.value)
{
isOK = 0 ;
}
});
var id = $("#id"+idModal).val();
var nom = $("#Nom"+idModal).val();
var prenom = $("#Prenom"+idModal).val();
var rue = $("#Rue"+idModal).val();
var cp = $("#CodeP"+idModal).val();
var ville = $("#VilleIns"+idModal).val();
var pays = $("#PaysIns"+idModal).val();
var gsm = $("#Gsm"+idModal).val();
var email = $("#Email"+idModal).val();
var code = $("#Code"+idModal).val();
var date = $("#Date"+idModal).val();
var horaire = $("#Horaire"+idModal).val();
var horaire2 = $("#HoraireToDisp"+idModal).val();
var dejadonner = 0;
var datenaissance = '';
if ($('#chkdejadonne'+idModal).prop('checked') == true){
dejadonner = 1;
datenaissance = $("#dtenaissance"+idModal).val();
}
$.ajax({
dataType: "json",
type: "POST",
url: "/saveinscription",
data: {id: id, nom: nom, prenom: prenom, rue: rue, cp: cp, ville: ville, pays: pays, gsm: gsm, email: email,code: code , date: date , horaire: horaire, horaire2: horaire2, dejadonner:dejadonner ,datenaissance:datenaissance },
success: function (data) {
if (data["type"] == "error") {
UIkit.notification(data["msg"], {status: 'danger'});
} else {
UIkit.modal(element).hide();
UIkit.notification(data["msg"], {status: 'success'});
}
},
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>
<script src="/static/vendors/jQuery-Mask-Plugin-master/dist/jquery.mask.min.js"></script>
<script>
$(function () {
$(document).ready(function () {
$('input[data-toggle="datepicker"]').mask('00/00/0000').on('change input paste', function () {
var isValid = isValidDate($(this));
});
});
// Copy Script pour les infos des collectes
var $this,
toCopy,
toCopyVal,
btnCopy = $("[data-apk-copy-button]");
btnCopy.on('click', function (e) {
e.preventDefault();
$this = $(this);
toCopy = $this.attr('data-apk-copy-button');
toCopy = $this.parents('.apk-copy-container').find(toCopy);
toCopyVal = toCopy.val();
toCopyVal = toCopyVal.replace(/^\s+/g, ''); // Remove leading spaces
toCopyVal = toCopyVal.replace(/ {1,}/g, " "); // Remove multiple spaces
toCopy.val(toCopyVal);
toCopy.select();
if (document.execCommand('copy')) {
$this.addClass('copied');
var temp = setInterval(function () {
$this.removeClass('copied');
clearInterval(temp);
}, 1500);
} else {
console.info('document.execCommand a rencontré un problème')
}
return false;
});
});
</script>
<script>
function chkdejadonneClick(chekbox,object) {
var x = document.getElementById(object);
if ($('#'+chekbox).prop('checked') == true){
x.style.display = "block";
}
if ($('#'+chekbox).prop('checked') == false)
{
x.style.display = "none";
}
}
</script>
<script>
function trackGASaveCollect(type_click,type_collecte){
switch (type_click){
case 'mail':
var event_label = "Envoi par mail";
break;
case 'calendrier':
var event_label = "Ajout calendrier";
break;
case 'copier':
var event_label = "Copier-coller";
break;
case 'inscription_collecte':
var event_label = "M'inscrire à cette collecte";
break;
}
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'action_collecte',
'detail_action': event_label,
'type_collecte' : type_collecte
});
}
function emailModal(id,type){
let data = $('input#email-data-'+id).val();
$('input#mail-data').val(data);
$('input#mail-email').val("");
$('input#mail-type').val(type);
UIkit.modal("#modal-infomail").show();
}
function emailSend(){
var values = {
data: $('input#mail-data').val(),
email: $('input#mail-email').val(),
type: $('input#mail-type').val()
};
$.ajax({
dataType: "json",
type: "POST",
url: "/api/{{ app.request.locale }}/sendemailinfo",
data: values,
success: function (data) {
if (data["type"] == "error") {
UIkit.notification(data["msg"], {status: 'danger'});
} else {
UIkit.modal("#modal-infomail").hide();
UIkit.notification(data["msg"], {status: 'success'});
$('input#mail-data').val("");
$('input#mail-email').val("");
$('input#mail-type').val("");
}
},
error: function (xhr, textStatus, errorThrown) {
UIkit.notification("{{ 'Oops! Une erreur s\'est produite. Veuillez réessayer.'|trans }}", {status: "danger"});
}
});
}
</script>
{% endblock inlinescripts %}