templates/frontend/frontindex/atelierParticipant.html.twig line 1

Open in your IDE?
  1. {% extends 'frontend/frontindex/add.html.twig' %}
  2. {% block body %}
  3.     <section class="doctors-area doctor-page">
  4.         <div class="container">
  5.             {% if congres.dateFin >= currentDate %}
  6.                 <div class="row">
  7.                     <div class="col-md-12 text-center">
  8.                         <a href="{{path('details_congres',{id:congres.id })}}" class="text-dark"><h1>{{'%Participation-atelier-du-congrès%'|trans}} : {% if app.request.locale =='fr' %} {{congres.label|raw}} {% elseif app.request.locale =='en' %}{{congres.labelEn|raw}} {% endif %}</h1></a>
  9.                     </div>
  10.                 </div>
  11.                 <div class="row">
  12.                     {% for message in app.flashes('success') %}
  13.                         <div class="alert alert-success col-12 text-center">
  14.                             {{ message }}
  15.                         </div>
  16.                     {% endfor %}
  17.                     {% for message in app.flashes('danger') %}
  18.                         <div class="alert alert-danger col-12 text-center">
  19.                             {{ message }}
  20.                         </div>
  21.                     {% endfor %}
  22.                 </div>
  23.                 <form action="{{path('app_participation_atelier',{'id': congres.id})}}" method="post" enctype="multipart/form-data" id="inscriptionForm">
  24.                     <div class="row mb-5 mt-5">
  25.                         <div class="form-group col-md-6">
  26.                             <label for="nom"><strong>{{'%nomAtelier%'|trans|capitalize}}</strong></label>
  27.                             <input class="form-control" type="text" placeholder="{{'%nomAtelier%'|trans}}" required name="nom">
  28.                         </div>
  29.                         <div class="form-group col-md-6">
  30.                             <label for="prenom"><strong>{{'%prenomAtelier%'|trans|capitalize}}</strong></label>
  31.                             <input class="form-control" type="text" placeholder="{{'%prenomAtelier%'|trans}}" required name="prenom">
  32.                         </div>
  33.                         <div class="form-group col-md-6">
  34.                             <label for="email"><strong>{{'%E-mail%'|trans|capitalize}}</strong></label>
  35.                             <input type="email" class="form-control" id="email" placeholder="name@example.com" name="email">
  36.                         </div>
  37.                         <div class="form-group col-md-6">
  38.                             <label for="tel"><strong>{{'%Phone%'|trans|capitalize}}</strong></label>
  39.                             <input type="text" class="form-control" id="tel" placeholder="+21612345678" name="tel">
  40.                         </div>
  41.                         <div class="form-group col-md-6">
  42.                             <label for="atelier"><strong>{{'%Choisissez-un-ou-plusieurs-ateliers%'|trans|capitalize}}</strong></label>
  43.                             {% for key, atelier in ateliers %}
  44.                                 <div class="form-check pt-2">
  45.                                     <input class="form-check-input atelier" type="checkbox" value="{{atelier.id}}" id="atelier{{atelier.id}}" name="atelier{{atelier.id}}" {% if atelier.nbPlaceAtteint == atelier.place %}disabled{% endif %}>
  46.                                     <label class="form-check-label" for="atelier{{atelier.id}}">
  47.                                         {{atelier.titre}} <br>
  48.                                         <i class="fa fa-calendar"></i> {{atelier.date|date('Y-m-d')}} : <i class="fa fa-clock"></i> {{atelier.heureDeb|date('H:i')}} - {{atelier.heureFin|date('H:i')}} <br><i class="fa fa-users"></i> <strong> {{'%Animateur%'|trans}} : {{atelier.animateur}}</strong> 
  49.                                         {% if atelier.nbPlaceAtteint == atelier.place %}<strong class="text-danger"> {{'%messageLimitePlaceAtelier%'|trans|capitalize}} </strong>{% endif %}
  50.                                     </label>
  51.                                 </div>
  52.                             {% endfor %}
  53.                         </div>
  54.                         <div class="form-group col-md-6">
  55.                             <label for="type"> <strong>{{'%Inscrivez-vous-en-tant-que%'|trans|capitalize}} : </strong></label>
  56.                             <div class="form-check">
  57.                                 <input class="form-check-input" type="radio" name="type" id="membre" value="membre" checked>
  58.                                 <label class="form-check-label" for="type">
  59.                                     {{'%membre%'|trans}} ATU 
  60.                                 </label>
  61.                             </div>
  62.                             <div class="form-check">
  63.                                 <input class="form-check-input" type="radio" name="type" id="nonMembre" value="nonMembre">
  64.                                 <label class="form-check-label" for="type">
  65.                                     {{'%nonmembre%'|trans}} ATU
  66.                                 </label>
  67.                             </div>
  68.                             <div class="form-check">
  69.                                 <input class="form-check-input" type="radio" name="type" id="resident" value="resident">
  70.                                 <label class="form-check-label" for="type">
  71.                                     {{'%Résident%'|trans}}
  72.                                 </label>
  73.                             </div>
  74.                         </div>
  75.                         <div class="form-group col-md-8 offset-md-2 text-center">
  76.                             {# <h4 class="text-danger"> <i class="fa fa-triangle-exclamation"></i>  {{'%Total-à-payer%'|trans|capitalize}} : <span id="total">0 DT</span></h4>
  77.                             <h4 class="text-danger">{{'%to-be-paid-on-site-when-registering-for-the-congress%'|trans|capitalize}}</h4> #}
  78.                             <button type="submit" value="Valider" class="btn btn-outline-success btn-lg mt-3">{{'%Valider%'|trans}}</button>
  79.                         </div>
  80.                     </div>
  81.                 </form>
  82.             {% else %}
  83.                 <h1 class="text-center">{{'%congres-termine%'|trans}}</h1>
  84.             {% endif %}
  85.         </div>
  86.     </section>
  87.     <script>
  88.        document.addEventListener('DOMContentLoaded', function() {
  89.         const ateliers = document.querySelectorAll('.atelier');
  90.         const participationRadios = document.querySelectorAll('input[name="type"]');
  91.         const totalDisplay = document.getElementById('total');
  92.         const form = document.getElementById('inscriptionForm');
  93.         const participationPrices = {
  94.             membre: 40,
  95.             nonMembre: 120,
  96.             resident: 40
  97.         };
  98.         function calculateTotal() {
  99.             let totalAteliers = 0;
  100.             let participationType = '';
  101.             ateliers.forEach(atelier => {
  102.                 if (atelier.checked) {
  103.                     totalAteliers++;
  104.                 }
  105.             });
  106.             participationRadios.forEach(radio => {
  107.                 if (radio.checked) {
  108.                     participationType = radio.value;
  109.                 }
  110.             });
  111.             const participationFee = participationPrices[participationType];
  112.             const total = totalAteliers * participationFee;
  113.             totalDisplay.textContent = total + ' DT';
  114.         }
  115.         // Validation avant soumission
  116.         form.addEventListener('submit', function(event) {
  117.             let selectedAtelier = false;
  118.             
  119.             ateliers.forEach(atelier => {
  120.                 if (atelier.checked) {
  121.                     selectedAtelier = true;
  122.                 }
  123.             });
  124.             if (!selectedAtelier) {
  125.                 event.preventDefault(); // Empêcher l'envoi du formulaire
  126.                 alert("Veuillez sélectionner au moins un atelier.");
  127.             }
  128.         });
  129.         ateliers.forEach(atelier => {
  130.             atelier.addEventListener('change', calculateTotal);
  131.         });
  132.         participationRadios.forEach(radio => {
  133.             radio.addEventListener('change', calculateTotal);
  134.         });
  135.     });
  136.     
  137.     </script>
  138. {% endblock %}