{% 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-small uk-child-width-1-2@s uk-margin-small-top" uk-grid>
<div>
{% if centre.availibilities|length > 0 %}
<div class="btn-rdv-centre uk-margin-bottom">
<a href="{{ path("formEligibleInscription", {id: centre.id_akimedia}) }}" class="uk-button uk-text-uppercase">{{ "Je prends rendez-vous"|trans }}</a>
</div>
{% endif %}
<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 class="uk-width-1-1 uk-flex-last@s 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 class="section-sites-prelevement-item-image uk-margin-bottom">
{% if centre.infos.site.picture %}
<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>
{% 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 %}