templates/inscription/inscription-centre.html.twig line 1

Open in your IDE?
  1. {% extends "layout.html.twig" %}
  2. {% block content %}
  3. <div class="page-collect-centre-inscription-form apk-page-inscription">
  4.     <div class="uk-container uk-margin-large-top">
  5.         <h2 class="h-big-lowcase-grey">{{ "Prendre un rendez-vous dans un centre de prélèvement"|trans }}</h2>
  6.         <div class="uk-grid" uk-grid>
  7.             <div class="uk-width-2-3@s">
  8.                 <div class="uk-text-uppercase uk-width-1-1" style="border-bottom: 1px solid grey;">{{ 'Votre Centre'|trans }}</div>
  9.                 <div class="adresse uk-margin-top">
  10.                     <ul class="fa-ul">
  11.                         <li>
  12.                             <img uk-svg width="14" height="14" src="/static/img/pictos/position.svg" />
  13.                             <strong>{{ centre.site.name }}</strong><br>
  14.                             {{ centre.site.address }}<br>
  15.                             {{ centre.site.zip }} {{ centre.site.city }}
  16.                         </li>
  17.                     </ul>
  18.                 </div>
  19.                 <div>
  20.                     <ul class="fa-ul telephone">
  21.                         <li>
  22.                             <img uk-svg width="14" height="14" src="/static/img/pictos/phone.svg" />
  23.                             <a href="tel:{{ centre.site.phone}}"
  24.                                target="_blank">{{ centre.site.phone}}</a>
  25.                         </li>
  26.                     </ul>
  27.                 </div>
  28.                 <div class="horaires">
  29.                     <ul class="fa-ul">
  30.                         <li>
  31.                             <img uk-svg width="14" height="14" src="/static/img/pictos/horaires.svg" />
  32.                             {# <strong>{{ 'Horaires'|trans }} {{ 'du'|trans }} {{ date['weekStartDate'] }} {{'au'|trans}} {{ date['weekEndDate'] }}</strong><br/> #}
  33.                             {% for jour,horaire in centre.days %}
  34.                                 {% if horaire %}
  35.                                     {{ jour|trans }} : {{ horaire }}
  36.                                     <br/>
  37.                                 {% else %}
  38.                                     {{ jour|trans }} : {{ "Fermé"|trans }}
  39.                                     <br/>
  40.                                 {% endif %}
  41.                             {% endfor %}
  42.                         </li>
  43.                     </ul>
  44.                 </div>
  45.                 {% if centre.site.informations %}
  46.                 <div class="apk-special-container">
  47.                     {{ centre.site.informations|raw }}
  48.                 </div>    
  49.                 {% endif %}
  50.                 <div>
  51.                 </div>
  52.             </div>
  53.             <div class="uk-width-1-3@s">
  54.                 {% if centre.site.picture %}
  55.                     <figure class="uk-margin-top">
  56.                         <img src="{{ centre.site.picture }}" alt="{{ centre.site.name }}" />
  57.                         {% if centre.site.copyright %}
  58.                             <figcaption>{{ centre.site.copyright }}</figcaption>
  59.                         {% endif %}
  60.                     </figure>
  61.                 {% else %}
  62.                     <img src="/static/img/logos/logo-crb.svg" alt="Croix-Rouge de Belgique"/>
  63.                 {% endif %}
  64.             </div>
  65.         </div>
  66.     </div>
  67.     <div class="uk-container uk-margin-medium-top">
  68.         <form class="uk-form" role="form" name="form-validation" id="form-validation" method="POST">
  69.             <div class="uk-text-uppercase uk-width-1-1" style="border-bottom: 1px solid grey;">{{ "A quelle date souhaitez-vous vous inscrire ?"|trans }}</div>
  70.             <div uk-slider>
  71.                 <div class="uk-position-relative">
  72.                     <div class="uk-slider-container uk-padding">
  73.                         <ul class="uk-slider-items uk-grid-small" uk-grid>
  74.                             {% for i in 0..5 %}
  75.                                 <li class=" uk-width-1-4@m">
  76.                                     <div class="apk-calendar">
  77.                                         {{ calendriers[i]|raw }}
  78.                                     </div>
  79.                                 </li>
  80.                             {% endfor %}
  81.                         </ul>
  82.                     </div>
  83.                     <div class="uk-visible@s">
  84.                         <a class="uk-position-center-left-out uk-position-small" href="#" uk-slidenav-previous uk-slider-item="previous"></a>
  85.                         <a class="uk-position-center-right-out uk-position-small" href="#" uk-slidenav-next uk-slider-item="next"></a>
  86.                     </div>
  87.                 </div>
  88.                 <ul class="uk-slider-nav uk-dotnav uk-margin-bottom uk-margin-left"></ul>
  89.             </div>
  90.             <div class="uk-grid-small" uk-grid>
  91.                 <div class="uk-width-1-1">
  92.                     <div class="uk-text-uppercase" style="border-bottom: 1px solid grey;">
  93.                         <label class="control-label">
  94.                             {{ "A quelle heure souhaitez-vous prendre rendez-vous le"|trans }} <span id="dateSelect" name="dateSelect" class="date-selected">...</span> ?
  95.                         </label>
  96.                     </div>
  97.                     <div class="uk-width-1-1@m" id="resultats">
  98.                         <div class="resultats-placeholder">
  99.                             <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>
  100.                             {{ "Veuillez sélectionner d'abord une date dans le calendrier au-dessus"|trans }}
  101.                         </div>
  102.                     </div>
  103.                 </div>
  104.             </div>
  105.             <div class="uk-grid">
  106.                 <div class="uk-width-1-1">
  107.                     <div class="uk-text-uppercase" style="border-bottom: 1px solid grey;">
  108.                         {{ "Avant de terminer votre inscription,"|trans }}<br/>
  109.                         {{ "Nous avons besoin de ces quelques informations"|trans }}
  110.                     </div>
  111.                 </div>
  112.             </div>
  113.             <div class="uk-grid">
  114.                 {% if errorMessage or errorMessage != "" %}
  115.                     <div class="uk-width-1-1">
  116.                         <div class="uk-margin-bottom uk-alert uk-alert-warning" id="error-msg" uk-alert>{% if errorMessage %}{{ errorMessage|trans }}{% endif %}</div>
  117.                     </div>
  118.                 {% endif %}
  119.                 <input type="hidden" name="akimedia-centre" value="{{ centre.site.id }}">
  120.                 <div class="uk-grid-medium" uk-grid>
  121.                     <div class="uk-width-1-2@s ">
  122.                         <label class="control-label required" for="collecte_centre_form_lastname">{{ 'Nom'|trans }}</label><br/>
  123.                         <input type="text" id="collecte_centre_form_lastname" name="lastname" required="required" class="uk-input">
  124.                     </div>
  125.                     <div class="uk-width-1-2@s">
  126.                         <label class="control-label required" for="collecte_centre_form_firstname">{{ 'Prénom'|trans }}</label><br/>
  127.                         <input type="text" id="collecte_centre_form_firstname" name="firstname" required="required" class="uk-input">
  128.                     </div>
  129.                     <div class="uk-width-1-2@s">
  130.                         <label class="control-label required" for="collecte_centre_form_email">{{ 'Adresse mail'|trans }}</label><br/>
  131.                         <input type="email" id="collecte_centre_form_email" name="email" required="required" class="uk-input">
  132.                     </div>
  133.                     <div class="uk-width-1-2@s">
  134.                         <label class="control-label required" for="collecte_centre_form_email2">{{ 'Confirmez votre adresse mail'|trans }}</label><br/>
  135.                         <input type="email" id="collecte_centre_form_email2" name="email2" required="required" class="uk-input">
  136.                     </div>
  137.                     <div class="uk-width-1-2@s">
  138.                         <label class="control-label required" for="collecte_centre_form_phone">{{ 'Téléphone'|trans }}</label>
  139.                         <input type="text" id="collecte_centre_form_phone" name="phone" required="required" class="uk-input">
  140.                     </div>
  141.                     <div class="uk-width-1-2@s">
  142.                         <label class="control-label required" for="dtenaissance">{{ 'Date de naissance jj/mm/aaaa'|trans }}</label>
  143.                         <input class="uk-input" type="date" name="dtenaissance"  id ="dtenaissance"
  144.                             data-min="{{yearAllowed.min|date('Y-m-d')}}" data-max="{{yearAllowed.max|date('Y-m-d')}}"
  145.                             value="" autocomplete="false" maxlength="10" required>
  146.                     </div>
  147.                     <div class="uk-width-1-1 apk-choix uk-margin-top uk-grid-margin uk-first-column">
  148.                         <div class="uk-grid uk-grid-small uk-child-width-1-2@s" uk-grid>
  149.                             <div>
  150.                                 <div class="apk-sang">
  151.                                     <div class="uk-margin-top uk-position-relative">
  152.                                         <div>
  153.                                             <label class="required">{{ 'Déjà donné du sang'|trans }}</label>
  154.                                             <div id="inscription_form_plasma">
  155.                                                 <input type="radio" id="collecte_centre_form_alreadyBlood_0" name="alreadyBlood" required="required" value="OUI">
  156.                                                 <label for="collecte_centre_form_alreadyBlood_0" class="required apk-label-is-linked-to-field">{{ "Oui"|trans }}</label>
  157.                                                 <input type="radio" id="collecte_centre_form_alreadyBlood_1" name="alreadyBlood" required="required" value="non" checked="checked" class="apk-field-is-checked">
  158.                                                 <label for="collecte_centre_form_alreadyBlood_1" class="required apk-label-is-linked-to-field">{{ "Non"|trans }}</label>
  159.                                             </div>
  160.                                         </div>
  161.                                     </div>
  162.                                 </div>
  163.                             </div>
  164.                             <div>
  165.                                 <div class="apk-plasma">
  166.                                     <div class="uk-margin-top uk-position-relative">
  167.                                         <div>
  168.                                             <label class="required">{{ 'Déjà donné du plasma'|trans }}</label>
  169.                                             <div id="inscription_form_plasma">
  170.                                                 <input type="radio" id="collecte_centre_form_alreadyPlasma_0" name="alreadyPlasma" required="required" value="OUI">
  171.                                                 <label for="collecte_centre_form_alreadyPlasma_0" class="required apk-label-is-linked-to-field">{{ "Oui"|trans }}</label>
  172.                                                 <input type="radio" id="collecte_centre_form_alreadyPlasma_1" name="alreadyPlasma" required="required" value="non" checked="checked" class="apk-field-is-checked">
  173.                                                 <label for="collecte_centre_form_alreadyPlasma_1" class="required apk-label-is-linked-to-field">{{ "Non"|trans }}</label>
  174.                                             </div>
  175.                                         </div>
  176.                                     </div>
  177.                                 </div>
  178.                             </div>
  179.                         </div>
  180.                     </div>
  181.                     <div class="uk-width-1-1">
  182.                         <label class="gdpr-label">
  183.                             <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>
  184.                     </div>
  185.                     <div class="uk-width-1-1">
  186.                         <div class="uk-display-inline-block">
  187.                             <button type="submit" id="collecte_centre_form_submit" class="uk-button">{{"Envoyer"|trans}}</button>
  188.                         </div>
  189.                     </div>
  190.                 </div>
  191.             </div>
  192.             <input id="collecte_centre_form_centre" name="centre" type="hidden" value="{{ centre.site.id }}">
  193.             <input id="collecte_centre_form_date" name="date" type="hidden" value="">
  194.             <input id="collecte_centre_form_horaire" name="horaire" type="hidden" value="">
  195.             <input id="collecte_centre_form_heure" name="heure" type="hidden" value="">
  196.         </form>
  197.     </div>
  198. </div>
  199.     
  200. {% endblock %}
  201. {% block inlinescripts %}
  202. <link href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.css" rel="stylesheet">
  203. <script src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.js"></script>
  204. <script src="https://npmcdn.com/flatpickr@4.6.13/dist/l10n/{{app.request.locale}}.js"></script>
  205.     {% if not editmode %}
  206. <script>
  207.     var borne = [];
  208.     {% set now = "now"|date("Y-m-d") %}
  209.     {% for date in dates %}
  210.         {% set d = date|date("Y-m-d") %}
  211.         {% if d >= now %}
  212.             borne.push('{{ d }}');
  213.         {% endif %}
  214.     {% endfor %}
  215.     
  216.     $( document ).ready(function() {
  217.         //gestion de la birthDate
  218.         newMaxDate = false;
  219.         const BirthMaxOri = new Date($('#dtenaissance').attr('data-max'));
  220.         const BirthMinOri = new Date($('#dtenaissance').attr('data-min'));
  221.         let inputBirthDate = $("#dtenaissance").flatpickr({
  222.             locale : "{{app.request.locale}}",
  223.             dateFormat : "d/m/Y",
  224.             minDate : BirthMinOri,
  225.             maxDate : BirthMaxOri,
  226.             allowInput: true,
  227.         });
  228.         function setDateMax () {
  229.             let BirthMax = BirthMaxOri;
  230.             let BirthMin = BirthMinOri;
  231.             let newMaxDate = null;
  232.             let radioSelected = null;
  233.             let found = false;
  234.             $('.schedule-item').each(function(el){
  235.                 if($(this).is('.is-selected')) {
  236.                     found = true;
  237.                     radioSelected = $(this).find('input:checked');
  238.                 }
  239.             });
  240.             if(found) {
  241.                 newMaxDate = radioSelected.attr('data-id');
  242.                 BirthMax18 = new Date(newMaxDate);
  243.                 newBirthMax = new Date(BirthMax18.setFullYear(BirthMax18.getFullYear() - parseFloat({{yearAllowed.year}})));
  244.                 inputBirthDate.set('maxDate', newBirthMax);
  245.             } else {
  246.                 inputBirthDate.set('maxDate', BirthMaxOri);
  247.             }
  248.             inputBirthDate.clear();
  249.         }
  250.         setDateMax();
  251.         
  252.         $("form").on("submit", function() {
  253.             if($("#collecte_centre_form_email").val() != $("#collecte_centre_form_email2").val()){
  254.                 $("#error-msg").text("{{ 'Les adresses e-mails sont différentes, veuillez corriger'|trans }}");
  255.                 $("#error-msg").addClass("uk-padding-small uk-margin-bottom");
  256.                 console.log('in');
  257.                 return false;
  258.             }
  259.             
  260.             if($("#collecte_centre_form_horaire").val() == 'zzzzz'){
  261.             $("#error-msg").text("{{ 'Veuillez choisir une date et une heure.'|trans }}");
  262.             return false;
  263.         }
  264.         
  265.         // Ajout du test de validiter de l'horaire pour eviter les doublon
  266.         var horaire = $("#collecte_centre_form_horaire").val()+'|'+$("#collecte_centre_form_heure").val();
  267.         var codeCentre = $("#collecte_centre_form_centre").val();
  268.         });        
  269.         $("form").on("submit", function() {
  270.         });
  271.         $('.day').each(function () {
  272.             console.log ($(this).attr('data-date'));
  273.             if(borne.includes($(this).attr('data-date'))){
  274.                 $(this).addClass('date_actif');
  275.             }
  276.             else {
  277.                 $(this).addClass('not-active');
  278.             }
  279.         });
  280.         $('.day.date_actif').on("click", function () {
  281.             $('.day.is-selected').removeClass('is-selected');
  282.             $(this).addClass('is-selected');
  283.             var date = $(this).attr('data-date');
  284.             var centreid = $(this).attr('data-centre-id');
  285.             $("#dateSelect").html($(this).attr('data-date-format'));
  286.             $("#collecte_centre_form_date").val(date);
  287.             var lang = '{{ app.request.locale }}';
  288.             
  289.             $.ajax({
  290.                 dataType: "json",
  291.                 type: "GET",
  292.                 url: "{{ path('getHoraireCentreAkimedia') }}",
  293.                 data: {'date': date ,'centreid':centreid, 'lang':lang},
  294.                 success: function (data) {
  295.                     
  296.                     $('#resultats').html(data["msg"]);
  297.                     $("input[name='inscription']").on("click", function(){ 
  298.                         $("#collecte_centre_form_heure").val($(this).val());
  299.                         $("#collecte_centre_form_horaire").val($(this).attr("data-id"));
  300.                     });                    
  301.                     console.log(data);
  302.                     inputBirthDate.clear();
  303.                     
  304.                     $('.schedule-item').on("click", function () {
  305.                         var $radioSelected = $(this).find('.uk-radio');
  306.                         if($radioSelected.attr("data-id")){
  307.                                 
  308.                         $('.schedule-item').removeClass('is-selected');
  309.                         $(this).addClass('is-selected');
  310.                         $radioSelected.prop('checked', true);
  311.                         setDateMax();
  312.                         $("#collecte_centre_form_heure").val($radioSelected.val());
  313.                         $("#collecte_centre_form_horaire").val($radioSelected.attr("data-id"));
  314.                         }
  315.                         else{
  316.                                 $('.schedule-item').removeClass('is-selected');
  317.                         }
  318.                     });
  319.                 },
  320.                 error: function (xhr, textStatus, errorThrown) {
  321.                     UIkit.notification('{{ "Oops! Une erreur s'est produite. Veuillez réessayer."|trans }}', {status: 'danger'});
  322.                     console.log(xhr, textStatus, errorThrown);
  323.                 }
  324.             });
  325.         })
  326.     });
  327. </script>
  328.     {% endif %}
  329. {% endblock inlinescripts %}