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

Open in your IDE?
  1. <!doctype html>
  2. <html lang="fr">
  3. <head>
  4.   {% if site_mode is defined and site_mode == 'prod' %}
  5.     <!-- Google Tag Manager -->
  6.     <!-- Google tag (gtag.js) -->
  7.     <!-- Google Tag Manager -->
  8.     <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  9.                 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  10.               j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  11.               'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  12.       })(window,document,'script','dataLayer','GTM-P6WW2D7');</script>
  13.     <!-- End Google Tag Manager -->
  14.     <!-- End Google Tag Manager -->
  15.   {% endif %}
  16.   <meta http-equiv="X-UA-Compatible" content="IE=edge">
  17.   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  18.   <meta http-equiv="Content-Language" content="fr" />
  19.   <meta name="viewport" content="width=device-width, initial-scale=1">
  20.   <title>Étape 1</title>
  21.   <!--Favicon-->
  22.   <link rel="icon" type="image/png" href="/static/img/tunnel/favicon.png" />
  23.   <!--Script pour l'accordéon-->
  24.   <script type="text/javascript" src="//unpkg.com/alpinejs" defer></script>
  25.   <!-- TrustBox script -->
  26.   <script type="text/javascript" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" async></script>
  27.   {% block stylesheets %}
  28.     {{ encore_entry_link_tags('tunnel') }}
  29.   {% endblock %}
  30.   <script>
  31.     !function(f,b,e,v,n,t,s)
  32.     {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  33.             n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  34.       if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  35.       n.queue=[];t=b.createElement(e);t.async=!0;
  36.       t.src=v;s=b.getElementsByTagName(e)[0];
  37.       s.parentNode.insertBefore(t,s)}(window, document,'script',
  38.             'https://connect.facebook.net/en_US/fbevents.js');
  39.     fbq('init', '334520913601498');
  40.   </script>
  41.   <noscript><img height="1" width="1" style="display:none"
  42.                  src="https://www.facebook.com/tr?id=334520913601498&ev=PageView&noscript=1"
  43.     /></noscript>
  44. </head>
  45. <body class="font-poppins">
  46.  <!-- Google Tag Manager (noscript) -->
  47. <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P6WW2D7"
  48.                   height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  49. <!-- End Google Tag Manager (noscript) --> ⁠
  50.   <!-- En Tête -->
  51.   <header class="flex px-4 py-4 justify-center lg:justify-between flex-wrap items-center">
  52.     <div class="flex">
  53.       <a href="https://lesbonsprofs.com" target="_blank" aria-label="Les Bons Profs"><img src="/static/img/tunnel/les-bons-profs-logo.svg" alt="Les bons profs - Paiement" /></a>
  54.     </div>
  55.     <div class="flex items-center mt-2 sm:mt-0">
  56.       <div class="text-bleu font-bold sm:mr-2 xl:mr-5 text-xs sm:text-[15px] xl:text[20px] text-center sm:text-left">Besoin d'aide ? Sabrina vous répond au 01 86 95 72 01 du lundi au jeudi de 9h à 17h.</div>
  57.     </div>
  58.   </header>
  59.   <!-- Titre -->
  60.   <section class="py-4 text-center bg-bleu">
  61.     <h1 class="font-muller font-bold text-[45px] sm:text-[90px] text-white">
  62.       Offre {{ typeOffer.title }}
  63.     </h1>
  64.     <h2 class="font-muller text-jaunefonce text-[25px] sm:text-[40px]">
  65.       Sélectionnez votre durée
  66.     </h2>
  67.   </section>
  68.   <!-- Timeline -->
  69.   <section class="flex justify-center sm:pt-16">
  70.     <ol
  71.         class="border-s border-bleu border-opacity-30 md:flex md:justify-evenly md:gap-6 md:border-s-0 md:border-t w-9/12">
  72.       <!--First item-->
  73.       <li>
  74.         <div class="flex items-center pt-3 md:block md:pt-0">
  75.           <div
  76.               class="md:mx-auto h-[20px] w-[20px] rounded-full bg-white border-bleu border-8 md:-mt-[10px] -ms-[10px] me-3"></div>
  77.           <p class="sm:mt-2 text-sm xl:text-base text-bleu font-bold">
  78.             1. Choisissez votre offre
  79.           </p>
  80.         </div>
  81.       </li>
  82.       <!--Second item-->
  83.       <li>
  84.         <div class="flex items-center pt-3 md:block md:pt-0">
  85.           <div
  86.               class="md:mx-auto h-[9px] w-[9px] rounded-full bg-bleu opacity-50 md:-mt-[5px] -ms-[5px] me-3"></div>
  87.           <p class="sm:mt-2 ml-1.5 sm:ml-0 text-sm xl:text-base text-bleu opacity-50">
  88.             2. Accédez à votre compte
  89.           </p>
  90.         </div>
  91.       </li>
  92.       <!--Third item-->
  93.       <li>
  94.         <div class="flex items-center pt-3 md:block md:pt-0">
  95.           <div
  96.               class="md:mx-auto h-[9px] w-[9px] rounded-full bg-bleu opacity-50 md:-mt-[5px] -ms-[5px] me-3"></div>
  97.           <p class="sm:mt-2 ml-1.5 sm:ml-0 text-sm xl:text-base text-bleu opacity-50">
  98.             3. Procédez au paiement
  99.           </p>
  100.         </div>
  101.       </li>
  102.     </ol>
  103.   </section>
  104. {% if mode_free %}
  105.   <section class="flex justify-center py-8 sm:py-16">
  106.     <div class="text-center w-11/12 lg:w-9/12 bg-jaunefonce text-bleu py-2 px-4 rounded-full sm:text-xl">
  107.       Vous ne serez pas débité avant la fin de votre essai de 7 jours
  108.     </div>
  109.   </section>
  110. {% endif %}
  111.   <!--Offres-->
  112.   <section class="flex justify-center{% if mode_tunnel %} pt-8 sm:pt-16{% endif %}">
  113.     <div class="flex flex-col lg:flex-row justify-between w-11/12 xl:w-9/12">
  114.       <!--Colonne gauche-->
  115.       <div class="flex flex-col lg:w-6/12">
  116.         {% if not mode_tunnel %}
  117.         <div>
  118.           <label for="enfants" class="font-bold tracking-tight sm:tracking-normal">
  119.             Combien d’enfants souhaitez-vous inscrire&nbsp;?
  120.           </label>
  121.           <div class="flex items-center mt-2">
  122.             <div>
  123.               <select id="nbr-child" name="enfants" class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 sm:max-w-xs sm:text-sm/6">
  124.                 <option value="1">1 enfant</option>
  125.                 <option value="2">2 enfants</option>
  126.                 <option value="3">3 enfants</option>
  127.                 <option value="4">4 enfants</option>
  128.                 <option value="5">5 enfants</option>
  129.               </select>
  130.             </div>
  131.             <div class="italic text-xs text-gray-500 ml-5">
  132.               <p>-20% pour le 2<sup>ème</sup> enfant</p>
  133.               <p>-30% pour le 3<sup>ème</sup> enfant</p>
  134.             </div>
  135.           </div>
  136.         </div>
  137.           {% else %}
  138.           <input type="hidden" name="enfants" value="1" id="nbr-child">
  139. {% endif %}
  140.         {% for row in listOffer %}
  141.         <!--Carte 24 mois-->
  142.         <div class="{% if loop.first %}sm:flex{% else %}flex{% endif%} justify-between border-gray-400 border-solid border-4 rounded-md mt-6">
  143.           {% if row.discount is null or (row.discountDate is not null and row.discountDate|date('U') < "now"|date('U') ) %}
  144.             <div>{% if row.monthValid>1 %}
  145.               <span class="text-xs bg-red-600 text-white absolute rounded px-1 py-0.5">{{ (((((row.price/row.monthValid) - priceMark)/priceMark) * 100)|number_format(0, ',', '.')|abs) }}% de réduction</span>
  146.               {% endif %}
  147.             <div class="flex flex-col pt-5 pb-5 pl-5">
  148.               <div class="flex items-center gap-x-3">
  149.                 <input id="p-{{ loop.index }}" name="price" value="{{ row.slug }}" type="radio" class="h-4 w-4 border-gray-300" 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">
  150.                 <label for="p-{{ loop.index }}" class="block font-medium text-gray-900">
  151.                   <span class="font-bold text-xl mr-5">{{ row.monthValid }} mois</span><br class="sm:hidden"/>
  152.                   <span class="font-bold">{{ (row.price/row.monthValid)|round(2, 'floor')|number_format(2, ',', '.') }} € / mois</span>
  153.                 </label>
  154.               </div>
  155.               <div class="mt-5 text-xs text-gray-500">
  156.                 {% if row.monthValid>1 %}En un paiement de {{ row.price|number_format(2, ',', '.') }} €.{% endif%} {% if row.monthValid<13 %}Renoulevé tous les {% if row.monthValid>1 %}{{ row.monthValid }}{% endif %}  mois.{% endif %} Annulable à tout moment
  157.               </div>
  158.             </div>
  159.           </div>
  160.           {% else %}
  161.             <div>
  162.               <span class="text-xs bg-red-600 text-white absolute rounded px-1 py-0.5">{% if row.percentDiscount is null %}{{ (((((row.getAmount()/row.monthValid) - priceMark)/priceMark) * 100)|number_format(0, ',', '.')|abs) }}{% else %}{{ row.percentDiscount }}{% endif %}% de réduction</span>
  163.               <div class="flex flex-col pt-10 pb-5 pl-5">
  164.                 <div class="flex items-center gap-x-3">
  165.                   <input id="p-{{ loop.index }}" name="price" value="{{ row.slug }}" type="radio" class="h-4 w-4 border-gray-300 js-auto-discount" data-title="{{ row.title }}" data-discount="{{ row.discount.codePromo }}" data-price="{{ row.price }}" data-month="{{ row.monthValid }}" data-period="{% if row.monthValid>1 %}{{ row.monthValid }}{% endif %} mois">
  166.                   <label for="p-{{ loop.index }}" class="block font-medium text-gray-900">
  167.                     <span class="font-bold text-xl mr-5">{{ row.monthValid }} mois</span><br class="sm:hidden"/>
  168.                     <span class="font-bold">{{ (row.getAmount()/row.monthValid)|round(2, 'floor')|number_format(2, ',', '.') }} € / mois <span class="line-through text-gray-500">( au lieu de {{ priceMark|number_format(2, ',', '.') }}€)</span></span>
  169.                   </label>
  170.                 </div>
  171.                 <div class="mt-5 text-xs text-gray-500">
  172.                   {% if row.monthValid>1 %}En un paiement de {{ row.getAmount()|number_format(2, ',', '.') }} € (<span class="text-decoration-line-through" style="text-decoration: line-through">{{ row.oldPrice }} €</span>) avec le code {{ row.discount.codePromo|upper }}.{% endif%} {% if row.monthValid<13 %}Renoulevé tous les {% if row.monthValid>1 %}{{ row.monthValid }}{% endif %}  mois.{% endif %} Annulable à tout moment
  173.                 </div>
  174.               </div>
  175.             </div>
  176.           {% endif %}
  177.           {% if loop.first %}
  178.           <div class="flex flex-col justify-center bg-jaunefonce sm:w-5/12 sm:p-5 p-3">
  179.             <div class="flex flex-wrap font-bold items-center justify-center sm:justify-start">Coup de<img src="/static/img/tunnel/coeur-rouge.png" alt="Coup de coeur des parents" class="px-1 sm:px-2 w-5 h-4 sm:w-auto" />des parents</div>
  180.             <div class="mt-5 text-xs text-center sm:text-justify">Inclus les annales du Bac et du Brevet corrigées en vidéo</div>
  181.           </div>
  182.           {% endif %}
  183.         </div>
  184.         {% endfor %}
  185.         {% set titre_faq  = "Comment fonctionne l’essai gratuit de 7&nbsp;jours&nbsp;:" %}
  186.         {% set faq = [
  187.           {
  188.             "titre":"Pendant la période d’essai",
  189.             "texte":"Je teste tous les contenus compris dans mon abonnement, les stages de révision pendant les vacances et les boost matière."
  190.           },{
  191.             "titre":"Comment arrêter l’essai gratuit",
  192.             "texte": "Avant la fin des 7 jours d’essai, rendez-vous dans la rubrique “gestion du compte” de votre espace parents et cliquez sur “mettre fin à la période d’essai”."
  193.         }]  %}
  194.         {% if mode_free %}
  195.         <!--L'essai gratuit pour PC-->
  196.         <div class="mt-12 text-gray-500 hidden lg:block text-justify">
  197.           <p class="font-bold">
  198.               {{ titre_faq|raw }}
  199.           </p>
  200.             {% for row in faq %}
  201.               <p class="mt-5">
  202.                 <span class="font-bold">{{ row.titre }}</span>
  203.                 <br />
  204.                 {{ row.texte }}
  205.               </p>
  206.             {% endfor %}
  207.         </div>
  208.         <!--Accordéon pour mobile-->
  209.         <div class="mt-12 py-2 px-3 border-gray-400 border-solid border rounded-md lg:hidden" x-data="{selected: null}">
  210.           <div>
  211.             <div>
  212.               <div class="w-full flex justify-between items-center cursor-pointer"
  213.                    @click="selected !== 1 ? selected = 1 : selected = null"
  214.               >
  215.                 <h4 class="font-bold text-gray-500">{{ titre_faq|raw }}</h4>
  216.                 <div class="pl-2">
  217.                   <img class="transition-all ease-in-out duration-700 min-w-4" :class="selected === 1 ? 'rotate-180' : ''" alt="chevron" src="/static/img/tunnel/chevron.svg" />
  218.                 </div>
  219.               </div>
  220.               <div class="relative overflow-hidden max-h-0 transition-all ease-in-out duration-700" x-ref="container1" :style="selected === 1 ? 'max-height: ' + $refs.container1.scrollHeight + 'px' : ''">
  221.                 <div class="pt-4 flex flex-col space-y-3">
  222.                   <div class="text-gray-500 text-justify">
  223.                     {% for row in faq %}
  224.                       <p class="mt-5">
  225.                         <span class="font-bold">{{ row.titre }}</span>
  226.                         <br />
  227.                         {{ row.texte }}
  228.                       </p>
  229.                     {% endfor %}
  230.                   </div>
  231.                 </div>
  232.               </div>
  233.             </div>
  234.           </div>
  235.         </div>
  236. {% endif %}
  237.       </div>
  238.       <!--Colonne droite-->
  239.       <div class="flex flex-col lg:w-5/12 my-16 lg:mt-0">
  240.         <!--Encadré bleu-->
  241.         <div class="flex flex-col bg-bleu rounded-2xl">
  242.           <div class="text-white font-bold text-center text-2xl py-5">Ce que comprend l'offre {{ typeOffer.title }}</div>
  243.           <div class="flex flex-col bg-white m-2 rounded-2xl p-5">
  244.            <div>
  245.              {% if typeOffer is not null %}
  246.                {{ typeOffer.textPaid|raw }}
  247.              {% endif %}
  248.            </div>
  249.             <label for="promo" class="mt-8 sm:mt-16">Vous disposez d'un code promotionel ? Indiquez-le ici :</label>
  250.             <div class="flex mt-5">
  251.               <input type="text" name="promo" id="promo" autocomplete="username" class="flex-1 border-0 py-1.5 pl-5 placeholder:text-gray-400 placeholder:text-[3.5vw] sm:placeholder:text-[16px] rounded-l-md shadow-sm ring-1 ring-inset ring-gray-300 w-[2vw]" placeholder="Entrez le code promo">
  252.               <button type="submit" class="bg-jaunefonce px-3 py-2 text-xl font-bold text-white shadow-sm hover:bg-rouge rounded-r-3xl" id="button-code-promo">Valider</button>
  253.             </div>
  254.             <div class="" id="tr-code">
  255.               <div style="padding: 2%;" class="mt-2">
  256.                 <div class="remise-appliquee font-bold"></div>
  257.                 <div id="text-percent"></div>
  258.               </div>
  259.             </div>
  260.             <div class="grid grid-cols-[repeat(2,minmax(auto,auto))] gap-4 border-jaunefonce border-solid border-8 rounded-3xl mt-8 sm:mt-16 p-6 items-center">
  261.               {% if mode_free %}
  262.               <span>Montant dû aujourd'hui</span>
  263.               <span>0 €</span>
  264.               <span>Montant dû {{ "now"|date_modify("+8 day")|format_datetime(locale='fr',pattern="dd MMMM YYYY") }}</span>
  265.               <span id="som-toto"></span>
  266.               {% else %}
  267.                 <span>Montant dû aujourd'hui</span>
  268.                 <span id="som-toto"></span>
  269.               {% endif %}
  270.             </div>
  271.           </div>
  272.         </div>
  273.         <!--Bouton-->
  274.         <div class="flex justify-center mt-10 cursor-pointer">
  275.           <button type="submit" class="bg-jaunefonce btn-form text-bleu rounded-3xl text-3xl font-muller py-3 px-20">OK j'essaie</button>
  276.           <img src="/static/img/tunnel/clic-hand.png" alt="Essayer l'offre" class="absolute pl-60 pt-5 btn-form" />
  277.         </div>
  278.         <!-- TrustBox widget - List pour PC-->
  279.         <div class="trustpilot-widget mt-20 hidden lg:block" data-locale="fr-FR" data-template-id="539ad60defb9600b94d7df2c" data-businessunit-id="5c9c8063164d370001824ce4" data-style-height="500px" data-style-width="100%" data-stars="4,5" data-review-languages="fr">
  280.           <a href="https://fr.trustpilot.com/review/lesbonsprofs.com" target="_blank" rel="noopener">Trustpilot</a>
  281.         </div>
  282.         <!-- TrustBox widget - Mini pour mobiles-->
  283.         <div class="trustpilot-widget lg:hidden mt-16" data-locale="fr-FR" data-template-id="53aa8807dec7e10d38f59f32" data-businessunit-id="5c9c8063164d370001824ce4" data-style-height="150px" data-style-width="100%">
  284.           <a href="https://fr.trustpilot.com/review/lesbonsprofs.com" target="_blank" rel="noopener">Trustpilot</a>
  285.         </div>
  286.       </div>
  287.     </div>
  288.   </section>
  289.   <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 %}">
  290.   </form>
  291.   <div class="u-spinner h-100 vh-100">
  292.     <svg class="svg-icon svg-loader" version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg"
  293.          xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 50 100" enable-background="new 0 0 0 0"
  294.          xml:space="preserve">
  295.         <circle cx="0" cy="50" r="6">
  296.           <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate>
  297.         </circle>
  298.       <circle cx="20" cy="50" r="6">
  299.         <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate>
  300.       </circle>
  301.       <circle cx="41" cy="50" r="6">
  302.         <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate>
  303.       </circle>
  304.     </svg>
  305.   </div>
  306.   {% block javascripts %}
  307.     {{ encore_entry_script_tags('tunnel') }}
  308.   {% endblock %}
  309. <script type="text/javascript">
  310.   $(document).ready(function(){
  311.     function calculPrice(){
  312.       var nbrChild = parseInt($('#nbr-child').val());
  313.       var som = 0;
  314.       if($('input[name="price"]:checked').length==1){
  315.         var period = $('input[name="price"]:checked').attr('data-period');
  316.         var month  = $('input[name="price"]:checked').attr('data-month');
  317.         var price  = $('input[name="price"]:checked').attr('data-price');
  318.         var realPrice = parseFloat(price);
  319.         for(var i = 0;i<nbrChild;i++){
  320.           if(i==0){
  321.             if($('#button-code-promo').is("[data-percent]")){
  322.               var percent = $('#button-code-promo').attr('data-percent');
  323.               if($('#button-code-promo').hasClass('js-calculate-auto')){
  324.                 som = som + (realPrice - realPrice*(parseFloat(percent)/100));
  325.               }else{
  326.                 som= som + realPrice
  327.               }
  328.             }else{
  329.               som= som + realPrice
  330.             }
  331.           }
  332.           if(i==1){
  333.             if(!$('#button-code-promo').hasClass('js-calculate-auto')){
  334.               som = som + (realPrice - realPrice*0.2);
  335.             }else{
  336.               som = som + (realPrice - realPrice*0.35);
  337.             }
  338.           }
  339.           if(2<=i){
  340.             if(!$('#button-code-promo').hasClass('js-calculate-auto')){
  341.               som = som + (realPrice - realPrice*0.3);
  342.             }else{
  343.               som = som + (realPrice - realPrice*0.45);
  344.             }
  345.           }
  346.         }
  347.         $('#som-toto').text('').text((som.toFixed(2)).replaceAll('.',',')+' €');
  348.         $('#som-toto').attr('data-som',som.toFixed(2))
  349.         $('.total-price').text(' / '+period);
  350.       }
  351.     }
  352.     $('#nbr-child').change(function(){
  353.       var val = $(this).val();
  354.       calculPrice();
  355.       if($('.form-next-step-2').find('input[name="child"]').length==0){
  356.         $('.form-next-step-2').append('<input type="hidden" name="child" value="'+val+'"/>')
  357.       }else{
  358.         $('.form-next-step-2').find('input[name="child"]').val(val);
  359.       }
  360.     })
  361.     var percent = 0;
  362.     var coupon
  363.     $('#button-code-promo').click(function(){
  364.       if ($('input[name="price"]:checked').length==1){
  365.         var priceId  = $('input[name="price"]:checked').attr('data-id');
  366.         var self = $(this);
  367.         $(this).prev().removeClass('is-invalid');
  368.         coupon = $(this).prev().val();
  369.         self.parent().parent().find('.invalid-feedback').text('')
  370.         $.ajax({
  371.           url:"{{ path('valid_coupon') }}",
  372.           data:"coupon="+coupon,
  373.           success:function(elem){
  374.             var verif= true;
  375.             self.parent().find('input').val('');
  376.             if(elem.success){
  377.               if(elem.data.allowOffer.length>0 && !elem.data.allowOffer.includes(parseInt(priceId))){
  378.                 verif = false;
  379.               }
  380.               if(verif){
  381.                 if($('.form-next-step-2').find('input[name="discount"]').length==0){
  382.                   $('.form-next-step-2').append('<input type="hidden" name="discount" value="'+elem.data.code+'"/>')
  383.                 }else{
  384.                   $('.form-next-step-2').find('input[name="discount"]').val(elem.data.code);
  385.                 }
  386.                 percent = elem.data.percent;
  387.                 self.attr('data-percent',percent);
  388.                 //$('#text-percent').text('').text('reduction de '+percent+'%')
  389.                 $('.remise-appliquee').text('').text('Promotion appliquée : '+elem.data.description);
  390.                 self.addClass('js-calculate-auto')
  391.                 calculPrice();
  392.               }
  393.             }
  394.             if(!elem.success || !verif){
  395.               self.parents('.input-group').parent().find('.invalid-feedback').text('').text('Ce code promo est invalide !');
  396.               if(!self.parents('.input-group').find('input').hasClass('is-invalid')){
  397.                 self.parents('.input-group').find('input').addClass('is-invalid');
  398.               }
  399.             }
  400.           }
  401.         })
  402.       }else{
  403.         alert('Veuillez choisir une durée de votre offre')
  404.       }
  405.     })
  406.     $('input[name="price"]').change(function(){
  407.       if($(this).is(':checked')){
  408.         var price = parseFloat($(this).attr('data-price'));
  409.         var period = $(this).attr('data-period');
  410.         var offer = $(this).val();
  411.         var month = $(this).attr('data-month');
  412.         if($(this).hasClass('js-auto-discount')){
  413.           var coupon = $(this).attr('data-discount');
  414.           $('.u-spinner').addClass('open')
  415.           $.ajax({
  416.             url:"{{ path('valid_coupon') }}",
  417.             data:"coupon="+coupon,
  418.             success:function(elem){
  419.               if(elem.success){
  420.                 //$('#tr-code').removeClass('d-none')
  421.                 if($('.form-next-step-2').find('input[name="discount"]').length==0){
  422.                   $('.form-next-step-2').append('<input type="hidden" name="discount" value="'+elem.data.code+'"/>')
  423.                 }else{
  424.                   $('.form-next-step-2').find('input[name="discount"]').val(elem.data.code);
  425.                 }
  426.                 percent = elem.data.percent;
  427.                 $('#button-code-promo').attr('data-percent',percent);
  428.                 if(!$('#button-code-promo').hasClass('js-calculate-auto')){
  429.                   $('#button-code-promo').addClass('js-calculate-auto')
  430.                 }
  431.                 // self.attr('data-percent',percent);
  432.                 //$('#text-percent').text('').text('reduction de '+percent+'%')
  433.                 $('.remise-appliquee').text('').text('Promotion appliquée : '+elem.data.description);
  434.                 calculPrice();
  435.                 $('.u-spinner').removeClass('open')
  436.               }
  437.             }
  438.           })
  439.         }else{
  440.           $('#button-code-promo').attr('data-percent',0);
  441.           if($('.form-next-step-2').find('input[name="discount"]').length==1){
  442.             $('.form-next-step-2').find('input[name="discount"]').remove()
  443.           }
  444.           //$('#text-percent').text('')
  445.           $('.remise-appliquee').text('');
  446.           calculPrice()
  447.         }
  448.         if($('.form-next-step-2').find('input[name="offer"]').length==0){
  449.           $('.form-next-step-2').append('<input type="hidden" name="offer" value="'+offer+'"/>')
  450.         }else{
  451.           $('.form-next-step-2').find('input[name="offer"]').val(offer);
  452.         }
  453.         // $('#text-toto-offer-period').removeClass('d-none').addClass('d-block')
  454.         //  $('#toto-offer-period').text(period.toLowerCase())
  455.       }
  456.     })
  457.     $('input[name="price"]').change()
  458.     $('.btn-form').click(function(){
  459.       if($('.form-next-step-2').find('input[name="offer"]').length==0){
  460.       }else{
  461.         fbq('track', 'AddToCart', {
  462.           content_name: $('input[name="price"]:checked').data('title'),
  463.           content_category: '{{ typeOffer.title|upper }}',
  464.           content_ids: [$('input[name="price"]:checked').val()],
  465.           content_type: 'product',
  466.           value: $('#som-toto').data('som'),
  467.           currency: 'EUR'
  468.         });
  469.         $('.form-next-step-2').submit();
  470.       }
  471.     })
  472.     {% if not getPrice %}
  473.     $('.show-mentor #p-1').click();
  474.     {% endif %}
  475.   })
  476. </script>
  477. </body>