templates/front/tunnel/step1a.html.twig line 1

Open in your IDE?
  1. {% extends 'front/tunnel/layout.html.twig' %}
  2. {% block head %}
  3.   <title>Étape 1</title>
  4. {% endblock %}
  5. {% block body %}
  6.   <!-- Timeline -->
  7.   <section class="w-full py-10 sm:py-20">
  8.     <ol class="flex flex-row w-full">
  9.       <!--first item-->
  10.       <li class="relative flex-1">
  11.         <div class="absolute top-2 left-1/2 w-full h-1.25 bg-lavande"></div>
  12.         <div class="relative z-10 flex flex-col items-center">
  13.           <div class="size-5 rounded-full bg-bleuindigo border-4 border-bleuindigo"></div>
  14.           <p class="mt-4 sm:mt-2 text-sm sm:text-lg font-bold text-bleuindigo text-center px-2">
  15.             1. Je sélectionne la durée
  16.           </p>
  17.         </div>
  18.       </li>
  19.       <!--Second item-->
  20.       <li class="relative flex-1">
  21.         <div class="absolute top-2 left-1/2 w-full h-1.25 bg-lavande"></div>
  22.         <div class="relative z-10 flex flex-col items-center">
  23.           <div class="size-5 rounded-full bg-lavande"></div>
  24.           <p class="mt-4 text-sm font-bold text-lavande text-center px-2">
  25.             2. J'accède à mon compte
  26.           </p>
  27.         </div>
  28.       </li>
  29.       <!--Third item-->
  30.       <li class="relative flex-1">
  31.         <div class="relative z-10 flex flex-col items-center">
  32.           <div class="size-5 rounded-full bg-lavande"></div>
  33.           <p class="mt-4 text-sm font-bold text-lavande text-center px-2">
  34.             3. Je procède au paiement
  35.           </p>
  36.         </div>
  37.       </li>
  38.     </ol>
  39.   </section>
  40. {% if mode_free %}
  41.   <section class="flex justify-center mb-8 sm:mb-16">
  42.     <div class="text-center bg-jaune text-bleuindigo font-bold py-2 px-4 rounded-full text-sm sm:text-lg">
  43.       Vous ne serez pas débité avant la fin de votre essai de 7 jours, résiliable à tout moment.
  44.     </div>
  45.   </section>
  46. {% endif %}
  47.   <!--Offres-->
  48.   <section class="flex justify-center">
  49.     <div class="flex flex-col lg:flex-row justify-between">
  50.       <!--Colonne gauche-->
  51.       <div class="flex flex-col lg:w-6/12 xl:w-7/12">
  52.         {% if not fromDashboardParent %}
  53.         <div>
  54.           <label for="enfants" class="text-bleuindigo tracking-tight sm:tracking-normal">
  55.             Combien d’enfants souhaitez-vous inscrire&nbsp;?
  56.           </label>
  57.           <div class="flex items-center mt-2">
  58.             <div>
  59.               <select id="nbr-child" name="nbr-child" class="block rounded-3xl border-lavande py-1.5 text-gris text-sm">
  60.                 <option value="1">1 enfant</option>
  61.                 <option value="2">2 enfants</option>
  62.                 <option value="3">3 enfants</option>
  63.                 <option value="4">4 enfants</option>
  64.                 <option value="5">5 enfants</option>
  65.               </select>
  66.             </div>
  67.             <div class="text-xs text-framboise font-bold ml-5">
  68.               <p>-50% pour chaque enfant supplémentaire</p>
  69.             </div>
  70.           </div>
  71.         </div>
  72.         {% else %}
  73.           <input type="hidden" name="nbr-child" value="1" id="nbr-child">
  74.         {% endif %}
  75.         <div>
  76.           <p class="text-bleuindigo mt-14">Sélectionnez la durée</p>
  77.         </div>
  78.         {% for row in listOffer %}
  79.           {% set noDiscountAuto = row.discount is null or (row.discountDate is not null and row.discountDate|date('U') < "now"|date('U') ) %}
  80.           {% if not noDiscountAuto %}
  81.             {% set priceReducePercent = (((((row.price/row.monthValid) - priceMark)/priceMark) * 100)|number_format(0, ',', '.')|abs) %}
  82.           {% else %}
  83.             {% set priceReducePercent = row.percentDiscount is null?(((((row.getAmount()/row.monthValid) - priceMark)/priceMark) * 100)|number_format(0, ',', '.')|abs) : row.percentDiscount %}
  84.             {% endif %}
  85.           {% set amount = noDiscountAuto ? row.price : row.getAmount() %}
  86.         <!--Carte 24 mois-->
  87.         <div class="flex flex-col sm:flex-row lg:flex-col xl:flex-row items-start relative justify-between border-lavande border rounded-lg p-5 mt-2">
  88.           {% if loop.first %}
  89.           <div class="flex items-center absolute text-bleuindigo text-[10px] font-bold bg-jaune rounded-xl px-2 -top-[8px] right-[20px]"><span class="text-lg -my-1 pr-1">♥</span> LE CHOIX DES PARENTS</div>
  90.           {% endif %}
  91.           <div class="flex items-center gap-x-3">
  92.             <input id="p-{{ loop.index }}" name="price" type="radio" value="{{ row.slug }}" class="input-price h-4 w-4 border-lavande{% if not noDiscountAuto %} js-auto-discount{% endif %}" {% if not noDiscountAuto%}data-discount="{{ row.discount.codePromo }}" data-multi-discount="{% if row.discount.moreChildReduce is not null %}{{ row.discount.moreChildReduce.percent }}{% endif %}"{% endif%} data-id="{{ row.id }}" data-title="{{ row.title }}" data-price="{{ row.price }}" data-month="{{ row.monthValid }}" data-period="{% if row.monthValid>1 %}{{ row.monthValid }}{% endif %} mois">
  93.             <label for="p-{{ loop.index }}" class="flex flex-row items-center text-nowrap">
  94.               <span class="text-bleuindigo font-bold text-xl mr-5">{{ row.monthValid }} mois</span>
  95.               {% if row.monthValid>1 or row.percentDiscount %}
  96.               <span class="text-white bg-pervenche text-[10px] rounded-4xl py-1 px-2">{% if row.percentDiscount is not null and row.percentDiscount is not empty %}{{ row.percentDiscount }}{% else %}{{ priceReducePercent }}{% endif %}% DE RÉDUCTION</span>
  97.               {% endif%}
  98.             </label>
  99.           </div>
  100.           <div class="flex flex-col sm:items-end sm:w-full sm:size-auto lg:w-full xl:size-auto sm:text-right mt-4 sm:mt-0">
  101.             <span class="text-xl">
  102.               <span class="text-pervenche sm:text-bleuindigo font-bold">{{ (amount/row.monthValid)|round(2, 'floor')|number_format(2, ',', '.') }}€/mois</span>
  103.             </span>
  104.             {% if not noDiscountAuto %}
  105.             <span class="text-base line-through">{{ priceMark|round(2, 'floor')|number_format(2, ',', '.') }}{#{{ (row.price/row.monthValid)|round(2, 'floor')|number_format(2, ',', '.') }}#}€/mois</span>
  106.             {% endif %}
  107.             <span class="text-xs">{% if row.monthValid>1 %}Paiement unique de {{ amount|number_format(2, ',', '.') }} €{% if row.monthValid<13 %}, reconduction tacite, annulable à tout moment{% else %}.{% endif %}{% else %}Sans engagement, reconduction tacite{% endif%}</span>
  108.             {% if row.monthValid > 1 and row.displayEcoText %} <span class="text-xs text-pervenche">soit {{ (priceMark * row.monthValid - amount)|number_format(2, ',', '.') }}€ économisés</span>{% endif%}
  109.           </div>
  110.         </div>
  111.         {% endfor %}
  112.       </div>
  113.       <!--Colonne droite-->
  114.       <div class="flex flex-col lg:w-5/12 xl:w-4/12 my-16 lg:mt-0">
  115.         <!--Encadré lavande-->
  116.         <div class="flex flex-col bg-lavandeclair rounded-2xl text-sm sm:text-base gap-y-2 p-5 sm:p-10">
  117.           <div class="text-bleuindigo font-bold text-xl">
  118.             Vous avez choisi l’offre
  119.           </div>
  120.           <div class="text-pervenche font-bold text-2xl sm:text-3xl">
  121.             {{ typeOffer.title|upper }}
  122.           </div>
  123.           <div class="text-lavande text-xs font-bold">
  124.             <a href="https://www.lesbonsprofs.com/nos-offres/" class="flex items-center hover:underline"><img src="/static/img/tunnel/stylo.webp" alt="Changer d'offre" class="w-3 mr-1">Changer d'offre</a>
  125.           </div>
  126.           <div class="font-bold mt-2">
  127.             {{ typeOffer.textPaid|raw }}
  128.           </div>
  129.           <div class="flex justify-between items-center mt-4">
  130.             <span class="flex text-bleuindigo font-bold">
  131.               <span class="flex items-center bg-jaune rounded-xl px-2 mr-1"><span class="text-lg -my-1 pr-1">&#9733</span> 4,6</span>+ 300 avis Trustpilot
  132.             </span>
  133.             <span class="text-pervenche text-xs hover:underline"><a href="https://fr.trustpilot.com/review/lesbonsprofs.com" target="_blank">Voir les avis</a></span>
  134.           </div>
  135.           {% if mode_free %}
  136.           <div class="flex justify-between text-franboise font-bold mt-4">
  137.             <span>Montant dû aujourd'hui</span>
  138.             <span>0€</span>
  139.           </div>
  140.           <hr class="border-lavande border my-2" />
  141.           <div class="flex justify-between text-bleuindigo">
  142.             <span>Montant dû au {{ "now"|date_modify("+8 day")|format_datetime(locale='fr',pattern="dd MMMM YYYY") }}</span>
  143.             <span class="font-bold" id="som-toto"></span>
  144.           </div>
  145.           {% else %}
  146.             <div class="flex justify-between text-franboise font-bold mt-4">
  147.               <span>Montant dû aujourd'hui</span>
  148.               <span id="som-toto"></span>
  149.             </div>
  150.           {% endif %}
  151.           <button type="submit" class="bg-framboise hover:bg-bleuindigo hover:cursor-pointer text-white rounded-3xl font-bold py-3 mt-4 btn-form">Démarrer l'essai gratuit</button>
  152.           <div class="flex items-center text-pervenche font-bold mt-4">
  153.             <img src="/static/img/tunnel/coupon.webp" alt="Code promo" class="w-5 mr-2">Vous avez un code promo ?
  154.           </div>
  155.           <div class="flex mt-1">
  156.             <input type="text" name="promo" id="promo" autocomplete="username" class="flex-1 py-1.5 pl-5 placeholder:text-[3.5vw] sm:placeholder:text-[16px] rounded-l-3xl border-lavande border" placeholder="Entrez votre code promo">
  157.             <button type="submit" class="bg-pervenche px-3 py-2 text-3xl font-bold text-white shadow-xs hover:bg-framboise hover:cursor-pointer rounded-r-3xl" id="button-code-promo">&#65515;</button>
  158.           </div>
  159.           <div class="" id="tr-code">
  160.             <div style="padding: 2%;" class="mt-2">
  161.               <div class="remise-appliquee font-bold"></div>
  162.               <div id="text-percent"></div>
  163.             </div>
  164.           </div>
  165.         </div>
  166.       </div>
  167.     </div>
  168.   </section>
  169. <form class="form-next-step-2" action="{{ path('choix-formule-step') }}?offre={{ getOffer }}" method="post" id="parents_registration_first_step_{% if getOffer == "essentielle" %}essentielle{% else %}assistancevisio{% endif %}">
  170. </form>
  171. {% endblock %}
  172. {% block javascripts %}
  173.   <!--footer-->
  174. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  175. <script type="text/javascript">
  176.   $(document).ready(function(){
  177.     function calculPrice(){
  178.       var nbrChild = parseInt($('#nbr-child').val());
  179.       var som = 0;
  180.       if($('input[name="price"]:checked').length==1){
  181.         var period = $('input[name="price"]:checked').attr('data-period');
  182.         var month  = $('input[name="price"]:checked').attr('data-month');
  183.         var price  = $('input[name="price"]:checked').attr('data-price');
  184.         var realPrice    = parseFloat(price);
  185.         var multiPercent = 50;
  186.         var percent      = 'null';
  187.         var moreChildrenActive = {{ moreChildrenActive?1:0 }};
  188.         if($('#button-code-promo').is("[data-percent]")){
  189.           percent      = $('#button-code-promo').attr('data-percent');
  190.           multiPercent = $('#button-code-promo').attr('data-multi-percent')
  191.         }
  192.         if($('input[name="price"]:checked').is('[data-multi-discount]')){
  193.           multiPercent = $('input[name="price"]:checked').attr('data-multi-discount');
  194.         }
  195.         var priceMoreChild  = (realPrice - realPrice*(parseFloat(multiPercent)/100));
  196.         for(var i = 0;i<nbrChild;i++){
  197.           if(percent != 'null' && percent != 0){
  198.             if( moreChildrenActive || i>0){
  199.               som = som + priceMoreChild;
  200.             }else{
  201.               som = som + (realPrice - realPrice*(parseFloat(percent)/100));
  202.             }
  203.           }else{
  204.             if(moreChildrenActive || i>0){
  205.               som = som + priceMoreChild;
  206.             }else{
  207.               som = som + realPrice;
  208.             }
  209.           }
  210.         }
  211.         $('#som-toto').text('').text((som.toFixed(2)).replaceAll('.',',')+' €');
  212.         $('#som-toto').attr('data-som',som.toFixed(2))
  213.         $('.total-price').text(' / '+period);
  214.       }
  215.     }
  216.     $('#nbr-child').change(function(){
  217.       var val = $(this).val();
  218.       calculPrice();
  219.       if($('.form-next-step-2').find('input[name="child"]').length==0){
  220.         $('.form-next-step-2').append('<input type="hidden" name="child" value="'+val+'"/>')
  221.       }else{
  222.         $('.form-next-step-2').find('input[name="child"]').val(val);
  223.       }
  224.     })
  225.     var percent = 0;
  226.     var coupon
  227.     $('#button-code-promo').click(function(){
  228.       if ($('input[name="price"]:checked').length==1){
  229.         var priceId  = $('input[name="price"]:checked').attr('data-id');
  230.         var self = $(this);
  231.         $(this).prev().removeClass('is-invalid');
  232.         coupon = $(this).prev().val();
  233.         self.parent().parent().find('.invalid-feedback').text('')
  234.         $.ajax({
  235.           url:"{{ path('valid_coupon') }}",
  236.           data:"coupon="+coupon,
  237.           success:function(elem){
  238.             var verif= true;
  239.             self.parent().find('input').val('');
  240.             if(elem.success){
  241.               if(elem.data.allowOffer.length>0 && !elem.data.allowOffer.includes(parseInt(priceId))){
  242.                 verif = false;
  243.               }
  244.               if(verif){
  245.                 if($('.form-next-step-2').find('input[name="discount"]').length==0){
  246.                   $('.form-next-step-2').append('<input type="hidden" name="discount" value="'+elem.data.code+'"/>')
  247.                 }else{
  248.                   $('.form-next-step-2').find('input[name="discount"]').val(elem.data.code);
  249.                 }
  250.                 percent = elem.data.percent;
  251.                 self.attr('data-percent',percent);
  252.                 self.attr('data-multi-percent',elem.data.percentMulti);
  253.                 //$('#text-percent').text('').text('reduction de '+percent+'%')
  254.                 $('.remise-appliquee').text('').html('<span class="font-bold me-2">Promotion appliquée :</span>'+elem.data.description);
  255.                 self.addClass('js-calculate-auto');
  256.                 calculPrice();
  257.               }
  258.             }
  259.             if(!elem.success || !verif){
  260.               self.parents('.input-group').parent().find('.invalid-feedback').text('').text('Ce code promo est invalide !');
  261.               if(!self.parents('.input-group').find('input').hasClass('is-invalid')){
  262.                 self.parents('.input-group').find('input').addClass('is-invalid');
  263.               }
  264.             }
  265.           }
  266.         })
  267.       }else{
  268.         alert('Veuillez choisir une durée de votre offre')
  269.       }
  270.     })
  271.     $('input[name="price"]').change(function(){
  272.       if($(this).is(':checked')){
  273.         var price = parseFloat($(this).attr('data-price'));
  274.         var period = $(this).attr('data-period');
  275.         var offer = $(this).val();
  276.         var month = $(this).attr('data-month');
  277.         if($(this).hasClass('js-auto-discount')){
  278.           var coupon = $(this).attr('data-discount');
  279.           $('.u-spinner').addClass('open')
  280.           $.ajax({
  281.             url:"{{ path('valid_coupon') }}",
  282.             data:"coupon="+coupon,
  283.             success:function(elem){
  284.               if(elem.success){
  285.                 //$('#tr-code').removeClass('d-none')
  286.                 if($('.form-next-step-2').find('input[name="discount"]').length==0){
  287.                   $('.form-next-step-2').append('<input type="hidden" name="discount" value="'+elem.data.code+'"/>')
  288.                 }else{
  289.                   $('.form-next-step-2').find('input[name="discount"]').val(elem.data.code);
  290.                 }
  291.                 percent = elem.data.percent;
  292.                 $('#button-code-promo').attr('data-percent',percent);
  293.                 if(!$('#button-code-promo').hasClass('js-calculate-auto')){
  294.                   $('#button-code-promo').addClass('js-calculate-auto')
  295.                 }
  296.                 // self.attr('data-percent',percent);
  297.                 //$('#text-percent').text('').text('reduction de '+percent+'%')
  298.                 $('.remise-appliquee').text('').text('Promotion appliquée : '+elem.data.description);
  299.                 calculPrice();
  300.               }
  301.               $('.u-spinner').removeClass('open')
  302.             }
  303.           })
  304.         }else{
  305.           if($('.form-next-step-2').find('input[name="discount"]').length==1){
  306.             $('.form-next-step-2').find('input[name="discount"]').remove()
  307.           }
  308.           //$('#text-percent').text('')
  309.           $('.remise-appliquee').text('');
  310.           calculPrice()
  311.         }
  312.         if($('.form-next-step-2').find('input[name="offer"]').length==0){
  313.           $('.form-next-step-2').append('<input type="hidden" name="offer" value="'+offer+'"/>')
  314.         }else{
  315.           $('.form-next-step-2').find('input[name="offer"]').val(offer);
  316.         }
  317.         // $('#text-toto-offer-period').removeClass('d-none').addClass('d-block')
  318.         //  $('#toto-offer-period').text(period.toLowerCase())
  319.       }
  320.     })
  321.     $('input[name="price"]').change()
  322.     $('.btn-form').click(function(){
  323.       if($('.form-next-step-2').find('input[name="offer"]').length==0){
  324.       }else{
  325.         $('.form-next-step-2').submit();
  326.       }
  327.     })
  328.     {% if not getPrice %}
  329.       $('#p-1').click();
  330.     {% else %}
  331.       $('.input-price[data-id="{{ getPrice }}"]').click();
  332.     {% endif %}
  333.   })
  334. </script>
  335. {% endblock %}