templates/centres/list-provinces-akimedia.html.twig line 1

Open in your IDE?
  1. {% extends "layout.html.twig" %}
  2. {#
  3.     {% use AppBundle/Helper/Apik %}
  4. #}
  5. {% block content %}
  6. <!-- #main -->
  7. <main id="main" role="main">
  8.     
  9.     <div class="uk-text-center uk-container apk-container-1200">
  10.         {% if editmode %}
  11.             <h1 class="uk-h2 uk-margin-medium-top uk-margin-small-bottom">{{ pimcore_textarea("content-title",{"nl2br" : true}) }}</h1>
  12.             {{ pimcore_wysiwyg("content-text") }}
  13.         {% else %}
  14.             {% if not pimcore_textarea("content-title").isEmpty() %}
  15.                 <h1 class="uk-h2 uk-margin-medium-top uk-margin-small-bottom">{{ pimcore_textarea("content-title",{"nl2br" : true}) }}</h1>
  16.             {% else %}
  17.                 <h1 class="uk-h2 uk-margin-medium-top uk-margin-small-bottom">{{ "Choisissez votre site de prélèvement"|trans }}</h1>
  18.             {% endif %}
  19.             {% if pimcore_wysiwyg("content-text")|striptags %}
  20.                 <div>
  21.                     {{ pimcore_wysiwyg("content-text")|raw }}
  22.                 </div>
  23.             {% endif %}
  24.         {% endif %}
  25.     </div>
  26.   <div class="section-sites-prelevement">
  27.     <div class="uk-container">
  28.         <ul class="uk-accordion" uk-accordion="multiple: true;">
  29.           {% set Province = "" %}
  30.           {% set i = 0 %}
  31.           {% set tabJours = {
  32.               "1" : "Lundi"|trans,
  33.               "2" : "Mardi"|trans,
  34.               "3" : "Mercredi"|trans,
  35.               "4" : "Jeudi"|trans,
  36.               "5" : "Vendredi"|trans,
  37.               "6" : "Samedi"|trans,
  38.               "7" : "Dimanche"|trans,
  39.           } %}
  40.           {% for province,centres in provinces %}
  41.             {#% if loop.first %}
  42.                 <li class="uk-open">
  43.             {% else %}
  44.                 <li>
  45.             {% endif %#}
  46.         <li>
  47.           <a class="uk-accordion-title" href="#">{{province|trans}}</a>
  48.           <div class="uk-accordion-content">
  49.             {% for centre in centres %}
  50.             
  51.               <div class="section-sites-prelevement-item uk-position-relative apk-copy-container" style="cursor:default">
  52.               
  53.                 <h4 class="h-bold">{{ centre.infos.site.name }}</h4>
  54.                 <div class="section-sites-prelevement-item-detail2">
  55.                     <button class="uk-button uk-button-default" type="button" aria-expanded="false">…</button>
  56.                     <div uk-dropdown="mode: click" class="uk-dropdown">
  57.             
  58.                             {% set openHours = "" %}
  59.                             {% for jour, hor in centre.horaires %}
  60.                                 {% if not hor %}
  61.                                     {% set hor = "fermé"|trans %}
  62.                                 {% endif %}
  63.                                 {% set openHours = openHours ~ jour|trans ~ " : " ~ ' ' ~ hor ~ ' ' ~ ' <br/>' %}
  64.                             {% endfor %}
  65.                             {% set emailInfos = {
  66.                                 'Nom' : centre.infos.site.name,
  67.                                 'Rue' : (centre.infos.site.address),
  68.                                 'Cp' : centre.infos.site.zip,
  69.                                 'Ville' : centre.infos.site.city,
  70.                                 'Horaires' : openHours,
  71.                                 'HorairesDate' : 'Horaires'|trans ~ ' ' ~ 'du'|trans ~ ' ' ~  date['weekStartDate'] ~ ' ' ~  'au'|trans ~ ' ' ~  date['weekEndDate']
  72.                             } %}
  73.                             {% set emailId = (centre.id)|slug %}
  74.                             <input type="hidden" id="email-data-{{ emailId }}" value='{{ emailInfos|json_encode() }}'>
  75.                             <a class="send-mail" href="#" onClick="emailModal('{{ emailId }}','centre')">
  76.                                 {{ "M’envoyer les informations par mail"|trans }}
  77.                             </a>
  78.                             <br/>
  79.                             <a href="#" data-apk-copy-button=".apk-copy-data">
  80.                                 {{ "Copier"|trans }}
  81.                                 <span class="copiedtext" aria-hidden="true">
  82.                                     {{ "C'est copié"|trans }}
  83.                                 </span>
  84.                             </a>
  85.                     </div>
  86.                 </div>
  87.                     <textarea class="apk-copy-data">
  88.                     {{ centre.infos.site.name }}
  89.                     {{ centre.infos.site.address }},
  90.                     {{ centre.infos.site.zip }} {{ centre.infos.site.city }}
  91.                     {% for jour, hor in centre.horaires %}
  92.                         {% if not hor %}
  93.                             {% set hor = "fermé"|trans %}
  94.                         {% endif %}
  95.                         {{ jour|trans ~ " : " }}
  96.                         {{ " " ~ hor ~ " " }}
  97.                     {% endfor %}
  98.                 </textarea>
  99.                 <div class="section-sites-prelevement-item-detail">
  100.                     <div class="uk-grid-small uk-child-width-1-2@s uk-margin-small-top" uk-grid>
  101.                         <div>
  102.                             {% if centre.availibilities|length > 0 %}
  103.                             <div class="btn-rdv-centre uk-margin-bottom">
  104.                                 <a href="{{ path("formEligibleInscription", {id: centre.id_akimedia}) }}" class="uk-button uk-text-uppercase">{{ "Je prends rendez-vous"|trans }}</a>
  105.                             </div>
  106.                             {% endif %}
  107.                             <div class="adresse">
  108.                                 <ul class="fa-ul">
  109.                                     <li>
  110.                                         <img uk-svg width="14" height="14" src="/static/img/pictos/position.svg" />
  111.                                         {{ centre.infos.site.name }}<br/>
  112.                                         {{ centre.infos.site.address }},<br/>
  113.                                         {{ centre.infos.site.zip }} {{ centre.infos.site.city }}<br/>
  114.                                     </li>
  115.                                 </ul>
  116.                             </div>
  117.                             <div>
  118.                                 <ul class="fa-ul telephone">
  119.                                     <li><img uk-svg width="14" height="14" src="/static/img/pictos/phone.svg" />
  120.                                         <a href="tel:{{ centre.infos.site.phone|replace({' ' : ''}) }}"
  121.                                            target="_blank">{{ centre.infos.site.phone }}</a>
  122.                                     </li>
  123.                                 </ul>
  124.                             </div>
  125.             
  126.                             
  127.                             <div class="horaires">
  128.                                 <ul class="fa-ul">
  129.                                     <li>
  130.                                         <img uk-svg width="14" height="14" src="/static/img/pictos/horaires.svg" />
  131.                                         {# <strong>{{ 'Horaires'|trans }} {{ 'du'|trans }} {{ date['weekStartDate'] }} {{'au'|trans}} {{ date['weekEndDate'] }}</strong><br/>#}
  132.                                         {% for jour, hor in centre.horaires %}
  133.                                             {{ jour|trans ~ " : " }}
  134.                                             {% if hor %}
  135.                                                 {{ " " ~ hor ~ " " }}<br/>
  136.                                             {% else %}
  137.                                                 {{ "Fermé"|trans }}<br/>
  138.                                             {% endif %}
  139.                                         {% endfor %}
  140.                                     </li>
  141.                                 </ul>
  142.                             </div>
  143.                         </div>
  144.                         <div class="uk-width-1-1 uk-flex-last@s uk-margin-small-bottom">
  145.                             {% if centre.infos.site.informations %}
  146.                                 <div class="note">
  147.                                     <ul class="fa-ul">
  148.                                         <li><img uk-svg width="14" height="14" src="/static/img/pictos/info-circle.svg" />
  149.                                             {{ centre.infos.site.informations|raw }}
  150.                                         </li>
  151.                                     </ul>
  152.                                 </div>
  153.                             {% endif %}
  154.                         </div>
  155.                         <div class="section-sites-prelevement-item-image uk-margin-bottom">
  156.                             {% if centre.infos.site.picture %}
  157.                                 <figure>
  158.                                     <img src="{{ centre.infos.site.picture }}" alt="{{ centre.infos.site.name }}" />
  159.                                     {% if centre.infos.site.copyright %}
  160.                                         <figcaption>{{ centre.infos.site.copyright }}</figcaption>
  161.                                     {% endif %}
  162.                                 </figure>
  163.                             {% endif %}
  164.                         </div>
  165.                     </div>
  166.                 </div>
  167.               </div>
  168.               {% set i = i + 1 %}
  169.               {% endfor %}
  170.                 </div></li>
  171.               {% endfor %}
  172.         </ul>
  173.     </div>
  174.     <div id="modal-infomail" uk-modal>
  175.         <div class="uk-modal-dialog uk-modal-body">
  176.             <input type="hidden" id="mail-data" name="mail-data" value ="">
  177.             <h2 class="uk-modal-title">{{ "Entrez votre email"|trans }} :</h2>
  178.             <input class="uk-input" type="text" id="mail-email" name="mail-email" required placeholder="{{ "Email"|trans }}">
  179.             <p class="uk-text-right">
  180.                 <button class="uk-button uk-button-default uk-modal-close" type="button">{{ "Annuler"|trans }}</button>
  181.                 <button class="uk-button uk-button-primary" type="button" onclick="emailSend()">{{ "Envoyer"|trans }}</button>
  182.             </p>
  183.         </div>
  184.     </div>
  185. </div>
  186.   {{ pimcore_areablock('contentBottom') }}
  187. </main><!-- end #main -->
  188. {% endblock %}
  189. {% block inlinescripts %}
  190.     <script>
  191.         function SaveInscription(element,idModal) {
  192.             var fields = $(element)
  193.                 .find("select, textarea, input").serializeArray();
  194.             var isOK = 1 ;
  195.             $.each(fields, function(i, field) {
  196.                 if (!field.value)
  197.                 {
  198.                     isOK = 0 ;
  199.                 }
  200.             });
  201.             var id = $("#id"+idModal).val();
  202.             var nom = $("#Nom"+idModal).val();
  203.             var prenom = $("#Prenom"+idModal).val();
  204.             var rue = $("#Rue"+idModal).val();
  205.             var cp = $("#CodeP"+idModal).val();
  206.             var ville = $("#VilleIns"+idModal).val();
  207.             var pays = $("#PaysIns"+idModal).val();
  208.             var gsm = $("#Gsm"+idModal).val();
  209.             var email = $("#Email"+idModal).val();
  210.             var code = $("#Code"+idModal).val();
  211.             var date = $("#Date"+idModal).val();
  212.             var horaire = $("#Horaire"+idModal).val();
  213.             var horaire2 = $("#HoraireToDisp"+idModal).val();
  214.             var dejadonner = 0;
  215.             var datenaissance = '';
  216.             if ($('#chkdejadonne'+idModal).prop('checked') == true){
  217.                 dejadonner = 1;
  218.                 datenaissance = $("#dtenaissance"+idModal).val();
  219.             }
  220.             $.ajax({
  221.                 dataType: "json",
  222.                 type: "POST",
  223.                 url: "/saveinscription",
  224.                 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 },
  225.                 success: function (data) {
  226.                     if (data["type"] == "error") {
  227.                         UIkit.notification(data["msg"], {status: 'danger'});
  228.                     } else {
  229.                         UIkit.modal(element).hide();
  230.                         UIkit.notification(data["msg"], {status: 'success'});
  231.                     }
  232.                 },
  233.                 error: function (xhr, textStatus, errorThrown) {
  234.                     UIkit.notification('{{ "Oops! Une erreur s'est produite. Veuillez réessayer."|trans }}', {status: 'danger'});
  235.                     console.log(xhr, textStatus, errorThrown);
  236.                 }
  237.             });
  238.         }
  239.     </script>
  240.     <script src="/static/vendors/jQuery-Mask-Plugin-master/dist/jquery.mask.min.js"></script>
  241.     <script>
  242.         $(function () {
  243.             $(document).ready(function () {
  244.                 $('input[data-toggle="datepicker"]').mask('00/00/0000').on('change input paste', function () {
  245.                     var isValid = isValidDate($(this));
  246.                 });
  247.             });
  248.             // Copy Script pour les infos des collectes
  249.             var $this,
  250.                 toCopy,
  251.                 toCopyVal,
  252.                 btnCopy = $("[data-apk-copy-button]");
  253.             btnCopy.on('click', function (e) {
  254.                 e.preventDefault();
  255.                 $this = $(this);
  256.                 toCopy = $this.attr('data-apk-copy-button');
  257.                 toCopy = $this.parents('.apk-copy-container').find(toCopy);
  258.                 toCopyVal = toCopy.val();
  259.                 toCopyVal = toCopyVal.replace(/^\s+/g, ''); // Remove leading spaces
  260.                 toCopyVal = toCopyVal.replace(/ {1,}/g, " "); // Remove multiple spaces
  261.                 toCopy.val(toCopyVal);
  262.                 toCopy.select();
  263.                 if (document.execCommand('copy')) {
  264.                     $this.addClass('copied');
  265.                     var temp = setInterval(function () {
  266.                         $this.removeClass('copied');
  267.                         clearInterval(temp);
  268.                     }, 1500);
  269.                 } else {
  270.                     console.info('document.execCommand a rencontré un problème')
  271.                 }
  272.                 return false;
  273.             });
  274.         });
  275.     </script>
  276.     <script>
  277.         function chkdejadonneClick(chekbox,object) {
  278.             var x = document.getElementById(object);
  279.             if ($('#'+chekbox).prop('checked') == true){
  280.                 x.style.display = "block";
  281.             }
  282.             if ($('#'+chekbox).prop('checked') == false)
  283.             {
  284.                 x.style.display = "none";
  285.             }
  286.         }
  287.     </script>
  288.     <script>
  289.         function trackGASaveCollect(type_click,type_collecte){
  290.             switch (type_click){
  291.                 case 'mail':
  292.                     var event_label = "Envoi par mail";
  293.                     break;
  294.                 case 'calendrier':
  295.                     var event_label = "Ajout calendrier";
  296.                     break;
  297.                 case 'copier':
  298.                     var event_label = "Copier-coller";
  299.                     break;
  300.                 case 'inscription_collecte':
  301.                     var event_label = "M'inscrire à cette collecte";
  302.                     break;
  303.             }
  304.             window.dataLayer = window.dataLayer || [];
  305.             window.dataLayer.push({
  306.                 'event': 'action_collecte',
  307.                 'detail_action': event_label,
  308.                 'type_collecte' : type_collecte
  309.             });
  310.         }
  311.         function emailModal(id,type){
  312.             let data = $('input#email-data-'+id).val();
  313.             $('input#mail-data').val(data);
  314.             $('input#mail-email').val("");
  315.             $('input#mail-type').val(type);
  316.             UIkit.modal("#modal-infomail").show();
  317.         }
  318.         function emailSend(){
  319.             var values = {
  320.                 data: $('input#mail-data').val(),
  321.                 email: $('input#mail-email').val(),
  322.                 type: $('input#mail-type').val()
  323.             };
  324.             $.ajax({
  325.                 dataType: "json",
  326.                 type: "POST",
  327.                 url: "/api/{{ app.request.locale }}/sendemailinfo",
  328.                 data: values,
  329.                 success: function (data) {
  330.                     if (data["type"] == "error") {
  331.                         UIkit.notification(data["msg"], {status: 'danger'});
  332.                     } else {
  333.                         UIkit.modal("#modal-infomail").hide();
  334.                         UIkit.notification(data["msg"], {status: 'success'});
  335.                         $('input#mail-data').val("");
  336.                         $('input#mail-email').val("");
  337.                         $('input#mail-type').val("");
  338.                     }
  339.                 },
  340.                 error: function (xhr, textStatus, errorThrown) {
  341.                     UIkit.notification("{{ 'Oops! Une erreur s\'est produite. Veuillez réessayer.'|trans }}", {status: "danger"});
  342.                 }
  343.             });
  344.         }
  345.     </script>
  346. {% endblock inlinescripts %}