templates/front/service/step4/recapitulatif.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %} Récapitulatif de devis : {{ service.title }} | {{ parent() }} {% endblock %}
  3. {% block body %}
  4. <section class="grey-blue-bg small-padding">
  5.     <div class="container">
  6.         <div class="row">
  7.             <div class="col-md-8">
  8.                 {{ include('base-default/message-flash-devis.html.twig') }}
  9.                 <div class="list-single-main-container pl-0">
  10.                     <div class="title-devis">
  11.                         <span>Devis immédiat pour {{ service.title }}</span>
  12.                     </div>
  13.                     <div class="etape-demande-devis fl-wrap mb-4">
  14.                         <div class="flex-center-wrap">
  15.                             <a href="{{ url('app_client_service', {'slug': service.slug}) }}"><span>1</span> Type de trajet</a>
  16.                             <a href="{{ url('app_client_service_route_description', {'slug': service.slug}) }}"><span>2</span> Description trajet</a>
  17.                             <a href="{{ url('app_client_service_login_info', {'slug': service.slug}) }}"><span>3</span> Vos informations</a>
  18.                             <a href="#" class="active"><span>4</span> Récapitulatif/Validation</a>
  19.                         </div> 
  20.                         <div class="box-widget-list text-left mt-3">
  21.                             <div class="d-flex align-items-center">
  22.                                 <img src="{{ asset('front/images/bot-recap.png') }}" class="img-recap-devis" alt="" />
  23.                                 <p class="p-recap-devis">Nous allons faire un récapitulatif ensemble.</p>
  24.                             </div>
  25.                         </div>
  26.                         <div class="box-widget-list text-left mt-1">
  27.                             <p>Vous avez besoin <span class="text-theme-bleu-marine fw-bold text-uppercase">{{ service.title }}</span> pour <span class="text-theme-bleu-marine fw-bold">{{ devis.numberOfPeople }}</span> personne(s) au départ de <span class="text-theme-bleu-marine fw-bold">{{ devis.departureAddress }}</span>{% if devis.typeOfTrip == 'Séjours' %}, le <span class="text-theme-bleu-marine fw-bold">{{ devis.departureDate|date('d/m/Y') }}</span>{% endif %} à <span class="text-theme-bleu-marine fw-bold">{{ devis.departureTime|date('H\\hi') }}</span> en destination de <span class="text-theme-bleu-marine fw-bold">{{ devis.arrivalAddress }}</span>. </p>
  28.                             {% if devis.distance and devis.distancePerTrip %}
  29.                                 <p>Vous allez parcourir une distance approximative de <span class="text-theme-bleu-marine fw-bold">{{ devis.distance }} ({{ devis.distancePerTrip }} par trajet)</span>.</p>
  30.                             {% else %}
  31.                                 <p>Vous allez parcourir une distance approximative de <span class="text-theme-bleu-marine fw-bold">{{ devis.distance }}</span>.</p>
  32.                             {% endif %}
  33.                             {% if devis.needVehicleOnSite == 'Non' %}
  34.                                 <p>Sur place, vous n'aurez pas besoin du véhicule.</p>
  35.                             {% elseif devis.needVehicleOnSite == 'Oui' %}
  36.                                 {% if devis.typeOfTrip == 'Séjours' %}
  37.                                     <p class="pb-0">Voici le détail des destinations pendant votre séjour :</p>
  38.                                 {% elseif devis.typeOfTrip == 'Aller-Retour' %}
  39.                                     <p class="pb-0">Voici le détail des destinations pendant votre trajet :</p>
  40.                                 {% endif %}
  41.                                 {% for vehicleDetail in devis.vehicleDetails %}
  42.                                     {% if devis.typeOfTrip == 'Séjours' %}
  43.                                         <p {% if vehicleDetail.infos %}class="pb-0"{% else %}{% if loop.last %}{% else %}class="pb-0"{% endif %}{% endif %}><i class="fas fa-circle font-size-04 vertical-align-middle"></i> Le <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.day|date('d/m/Y') }}</span>, départ de <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.departureAddress }}</span> à destination de <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.destinationAddress }}</span>. Départ à <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.departureTime|date('H\\hi') }}</span> et retour à <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.returnTime|date('H\\hi') }}</span>. </p>
  44.                                         {% if vehicleDetail.infos %}
  45.                                             <p {% if loop.last %}{% else %}class="pb-0"{% endif %}>Informations supplémentaires : <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.infos }}</span></p>
  46.                                         {% endif %}
  47.                                     {% elseif devis.typeOfTrip == 'Aller-Retour' %}
  48.                                         <p {% if vehicleDetail.infos %}class="pb-0"{% else %}{% if loop.last %}{% else %}class="pb-0"{% endif %}{% endif %}><i class="fas fa-circle font-size-04 vertical-align-middle"></i> Trajet Aller-Retour : départ de <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.departureAddress }}</span> à destination de <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.destinationAddress }}</span>. Départ à <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.departureTime|date('H\\hi') }}</span> et retour à <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.returnTime|date('H\\hi') }}</span>. </p>
  49.                                         {% if vehicleDetail.infos %}
  50.                                             <p {% if loop.last %}{% else %}class="pb-0"{% endif %}>Informations supplémentaires : <span class="text-theme-bleu-marine fw-bold">{{ vehicleDetail.infos }}</span></p>
  51.                                         {% endif %} 
  52.                                     {% endif %}
  53.                                 {% endfor %}
  54.                             {% endif %}
  55.                             {% if devis.addPdfDocument == 'Oui' %}
  56.                                 <p class="pb-0">Vous souhaitez envoyer le(s) document(s) suivant(s) au transporteur :</p>
  57.                                 {% for attachment in devis.attachments %}
  58.                                     <p {% if loop.last %}{% else %}class="pb-0"{% endif %}><i class="fas fa-circle font-size-04 vertical-align-middle"></i> <span class="xt-theme-bleu-marine fw-bold text-italic">{{ attachment.originalName }}</span></p>
  59.                                 {% endfor %}
  60.                             {% endif %}
  61.                             {% if devis.typeOfTrip == 'Aller-Retour' or devis.typeOfTrip == 'Séjours' %}
  62.                                 <p>Votre retour s'effectuera {% if devis.typeOfTrip == 'Séjours' %}le <span class="text-theme-bleu-marine fw-bold">{{ devis.returnDate|date('d/m/Y') }}</span>{% endif %} à <span class="text-theme-bleu-marine fw-bold">{{ devis.returnTime|date('H\\hi') }}</span> depuis le <span class="text-theme-bleu-marine fw-bold">{{ devis.arrivalAddress }}</span> vers <span class="text-theme-bleu-marine fw-bold">{{ devis.departureAddress }}</span>. </p>
  63.                             {% endif %}
  64.                             <p>Vous {% if devis.devisLuggage.name == 'Aucun bagage' %}ne{% endif %} disposerez d{% if devis.devisLuggage.name == 'Aucun bagage' %}'{% else %}e{% endif %} <span class="text-theme-bleu-marine fw-bold">{{ devis.devisLuggage.name }}</span>, et le type de déplacement sera <span class="text-theme-bleu-marine fw-bold">{{ devis.devisTravelReason.name }}</span>.</p>
  65.                             {% if devis.devisEquipment and devis.devisEquipment is not empty %}
  66.                                 <p class="pb-0">Vous avez besoin d'équipements particuliers dans le véhicule ci-dessous :</p>
  67.                                 {% for equipment in devis.devisEquipment %}
  68.                                 <p {% if loop.last %}{% else %}class="pb-0"{% endif %}><i class="fas fa-circle font-size-04 vertical-align-middle"></i> {{ equipment.name }}</p>
  69.                                 {% endfor %}
  70.                             {% else %}
  71.                                 <p>Vous n'avez pas besoin d'équipements particuliers dans le véhicule.</p>
  72.                             {% endif %}
  73.                         </div>
  74.                         <div class="box-widget-list">
  75.                             <hr class="my-2">
  76.                         </div>
  77.                         <div class="box-widget-list text-left mt-4 mb-1">
  78.                             <h1 class="text-theme-bleu-marine text-uppercase text-center fw-bold">Option de diffusion</h1>
  79.                         </div>
  80.                         <div class="devis-currency-wrap">
  81.                             <div class="show-currency-devis">
  82.                                 <span class="text-theme-orange text-uppercase fw-bold mr-1">
  83.                                     <img src="{{ asset('front/images/money_8366606.png') }}" class="img-crab-devis mr-2" alt=""> {{ app.user.creditBalance | number_format(2, ',', ' ') }} Crédit(s) 
  84.                                 </span>
  85.                                 <span class="text-theme-gray text-uppercase fw-bold mr-1"> Restant</span>
  86.                                 <span class="text-uppercase btn-recharger-devis modal-open">Recharger</span>
  87.                             </div>
  88.                         </div>
  89.                         
  90.                         {{ form_start(form) }}
  91.                         <div class="form-diffusion-option">
  92.                             <div class="mb-1">
  93.                                 {{ form_widget(form.miseEnAvance) }}
  94.                                 <img src="{{ asset('front/images/views.png') }}" class="ml-1" alt="">
  95.                                 <label for="sg_devis_miseEnAvance">Mise en avant de votre demande <span class="dot-mise-en-avance">:</span> <span class="ml-2">6 Crédits</span></label>
  96.                             </div>
  97.                             <div class="mb-1">
  98.                                 {{ form_widget(form.remonteEnTeteDeListe) }}
  99.                                 <img src="{{ asset('front/images/up_annonce.png') }}" class="ml-1" alt="">
  100.                                 <label for="sg_devis_remonteEnTeteDeListe">Remonter en tête de liste tout les jours : <span class="ml-2">8 Crédits</span></label>
  101.                             </div>
  102.                             <div class="mb-1">
  103.                                 {{ form_widget(form.demandeUrgente) }}
  104.                                 <img src="{{ asset('front/images/annonce_urgente.png') }}" class="ml-1" alt="">
  105.                                 <label for="sg_devis_demandeUrgente">Logo demande urgente <span class="dot-demande-urgente">:</span> <span class="ml-2">3 Crédits</span></label>
  106.                             </div>
  107.                             <div class="div-total-devis">
  108.                                 {% if form.vars.errors is not empty %}
  109.                                     <div class="form-error">
  110.                                         {% for error in form.vars.errors %}
  111.                                             <p class="pb-0">{{ error.message }}</p>
  112.                                         {% endfor %}
  113.                                     </div>
  114.                                 {% endif %}
  115.                                 <div class="">   
  116.                                     <p class="text-uppercase fw-bold">Total : <span id="total-balance" class="text-theme-orange">xx</span><span class="text-theme-orange"> crédit(s)</span></p>
  117.                                 </div>
  118.                             </div>
  119.                         </div>            
  120.                         
  121.                         <div class="book-form">
  122.                             <div class="width-100 d-flex justify-content-between flex-wrap mt-4">
  123.                                 <a href="{{ url('app_client_service_login_info', {'slug': service.slug}) }}" class="btn-prev color3-bg">
  124.                                     <i class="fal fa-angle-double-left"></i> Précédent
  125.                                 </a>
  126.                                 <button type="submit" class="btn-next color2-bg">
  127.                                     {% trans %}Validation{% endtrans %}
  128.                                 </button>
  129.                             </div>
  130.                         </div>
  131.                         {{ form_end(form) }}
  132.                     </div>
  133.                 </div>
  134.             </div>
  135.             <div class="col-md-4">
  136.                 <div class="box-widget-wrap">  
  137.                     <div class="box-widget-item fl-wrap">
  138.                         <div class="box-widget widget-posts">
  139.                             <div class="box-widget-content pb-3">
  140.                                 <div class="box-widget-item-header mb-3">
  141.                                     <h3 class="text-uppercase fw-bold text-theme-bleu-marine">Votre demande</h3>
  142.                                 </div>
  143.                                 <div class="box-widget-list">
  144.                                     <h4 class="text-left mb-3 step-devis-request text-theme-bleu-marine fw-bold"><span>1</span> Type de trajet</h4>
  145.                                 </div>
  146.                                 <div id="map-distance-2address" data-departure-address={{ devis.departureAddress|e('html_attr')  }} data-arrival-address={{ devis.arrivalAddress|e('html_attr')  }} data-start-latitude="{{ devis.startLatitude|e('html_attr')  }}" data-start-longitude="{{ devis.startLongitude|e('html_attr')  }}" data-end-latitude="{{ devis.endLatitude|e('html_attr')  }}" data-end-longitude="{{ devis.endLongitude|e('html_attr')  }}"></div>
  147.                                 <div class="box-widget-list">
  148.                                     <h4 class="text-left text-uppercase text-theme-orange fw-bold mb-1">{{ devis.typeOfTrip }}</h4>
  149.                                 </div>
  150.                                 <div class="box-widget-list">
  151.                                     <ul>
  152.                                         {% if devis.departureAddress %}
  153.                                             <li class="departure-address"><a href="#" class="mx-0"><i class="fal fa-map-marker-alt"></i> {{ devis.departureAddress }}</a></li>
  154.                                         {% endif %}
  155.                                         {% if devis.arrivalAddress %}
  156.                                             <li class="arrival-address"><a href="#" class="mx-0"><i class="fal fa-map-pin"></i> {{ devis.arrivalAddress }}</a></li>
  157.                                         {% endif %}
  158.                                         {% if devis.departureDate and devis.departureTime %}
  159.                                             <li class="mb-2"><span><i class="fal fa-calendar-alt"></i> Aller :</span> <a href="#">{{ devis.departureDate|date('d/m/Y') }} départ à {{ devis.departureTime|date('H\\hi') }}</a></li>
  160.                                         {% endif %}
  161.                                         {% if devis.returnDate and devis.returnTime %}
  162.                                             <li class="mb-2"><span><i class="fal fa-calendar-alt"></i> Retour :</span> <a href="#">{{ devis.returnDate|date('d/m/Y') }} départ à {{ devis.returnTime|date('H\\hi') }} </a></li>
  163.                                         {% elseif devis.returnDate is null and devis.returnTime %}
  164.                                             <li class="mb-2"><span><i class="fal fa-clock"></i> Retour :</span> <a href="#"> {{ devis.returnTime|date('H\\hi') }} </a></li>
  165.                                         {% endif %}
  166.                                         {% if devis.distance and devis.distancePerTrip %}
  167.                                             <li class="mb-2"><span><i class="fal fa-road"></i> Distance :</span> <a href="#">{{ devis.distance }} ({{ devis.distancePerTrip }} par trajet)</a></li>
  168.                                         {% else %}
  169.                                             <li class="mb-2"><span><i class="fal fa-road"></i> Distance :</span> <a href="#">{{ devis.distance }}</a></li>
  170.                                         {% endif %}
  171.                                         {% if devis.numberOfPeople %}
  172.                                             <li><span><i class="fal fa-users"></i> Passagers :</span> <a href="#">{{ devis.numberOfPeople }}</a></li>
  173.                                         {% endif %}
  174.                                     </ul>
  175.                                 </div>
  176.                             </div>
  177.                             <div class="box-widget-content pt-0">
  178.                                 <div class="box-widget-list">
  179.                                     <h4 class="text-left mb-1 step-devis-request text-theme-bleu-marine fw-bold"><span>2</span> Description trajet</h4>
  180.                                 </div>
  181.                                 <div class="box-widget-list">
  182.                                     <ul>
  183.                                         <li class="departure-address mb-0"><a href="#" class="mx-0 text-uppercase"><i class="fal fa-car"></i> Utilisation du véhicule : {% if devis.needVehicleOnSite == 'Oui' %}<strong>Oui</strong>{% else %}<strong>Non</strong>{% endif %}</a></li>
  184.                                         {% if devis.vehicleDetails and devis.vehicleDetails is not empty %}
  185.                                             {% for vehicleDetail in devis.vehicleDetails %}   
  186.                                                 {% if vehicleDetail.day %}                                         
  187.                                                 <li class="departure-address py-0"><a href="#" class="mx-0 text-transform-none">- {{ vehicleDetail.day|date('d/m/Y') }} :</a></li>
  188.                                                 {% endif %}
  189.                                                 {% if vehicleDetail.departureAddress %}           
  190.                                                 <li class="departure-address py-0"><a href="#" class="mx-0 text-transform-none">{{ vehicleDetail.departureAddress }},</a></li>
  191.                                                 {% endif %}
  192.                                                 {% if vehicleDetail.destinationAddress %}
  193.                                                 <li class="departure-address py-0"><a href="#" class="mx-0 text-transform-none">{{ vehicleDetail.destinationAddress }}</a></li>
  194.                                                 {% endif %}
  195.                                                 {% if vehicleDetail.departureTime and vehicleDetail.returnTime %}
  196.                                                 <li class="departure-address {% if vehicleDetail.infos %}py-0{% else %}pt-0{% endif %}"><a href="#" class="mx-0 text-transform-none">Départ {{ vehicleDetail.departureTime|date('H\\hi') }} - Retour {{ vehicleDetail.returnTime|date('H\\hi') }}</a></li>
  197.                                                 {% endif %}
  198.                                                 {% if vehicleDetail.infos %}
  199.                                                 <li class="departure-address pt-0"><a href="#" class="mx-0 text-transform-none">{{ vehicleDetail.infos|raw }}</a></li>
  200.                                                 {% endif %}
  201.                                             {% endfor %}
  202.                                         {% endif %}
  203.                                         <li class="departure-address pt-1 mb-0"><a href="#" class="mx-0 text-uppercase"><i class="fal fa-paperclip"></i> Documents complémentaires : {% if devis.addPdfDocument == 'Oui' %}<strong>Oui</strong>{% else %}<strong>Non</strong>{% endif %}</a></li>
  204.                                         {% if devis.attachments and devis.attachments is not empty %}
  205.                                             {% for attachment in devis.attachments %}    
  206.                                                 {% if attachment.originalName %}                                               
  207.                                                 <li class="departure-address {% if loop.last %}pt-0{% else %}py-0{% endif %}"><a href="#" class="mx-0 text-transform-none text-italic fw-bold text-theme-bleu-marine">{{ attachment.originalName }}</a></li>
  208.                                                 {% endif %}
  209.                                             {% endfor %}
  210.                                         {% endif %}
  211.                                         
  212.                                         {% if devis.devisTravelReason %}
  213.                                             <li class="mb-2"><span><i class="fal fa-road"></i> Motif du déplacement :</span> <a href="#">{{ devis.devisTravelReason.name }}</a></li>
  214.                                         {% endif %}
  215.                                         {% if devis.devisLuggage %}
  216.                                             <li class="mb-2"><span><i class="fal fa-suitcase"></i> Bagages :</span> <a href="#">{{ devis.devisLuggage.name }}</a></li>
  217.                                         {% endif %}
  218.                                         {% if devis.infos %}
  219.                                             <li class="mb-2"><span><i class="fal fa-info-circle"></i> Informations complémentaires :</span></li>
  220.                                             <li class="departure-address py-0"><a href="#" class="mx-0 text-transform-none">{{ devis.infos|raw }}</a></li>
  221.                                         {% endif %}
  222.                                         {% if devis.devisEquipment %}
  223.                                             <li class="mb-2"><span><i class="fal fa-screwdriver"></i> Equipement indispensable :</span></li>
  224.                                             {% for equipment in devis.devisEquipment %}
  225.                                                 <li class="departure-address py-0"><a href="#" class="mx-0 text-transform-none">- {{ equipment.name }}</a></li>
  226.                                             {% endfor %}
  227.                                         {% endif %}
  228.                                         {% if devis.devisBudget %}
  229.                                             <li class="mb-0"><span><i class="fal fa-money-bill-wave"></i> Budget :</span> <a href="#">{{ devis.devisBudget.name }}</a></li>
  230.                                         {% endif %}
  231.                                     </ul>
  232.                                 </div>
  233.                             </div>
  234.                         </div>
  235.                     </div>  
  236.                 </div>      
  237.             </div>
  238.         </div>
  239.     </div>
  240. </section>      
  241. {% endblock %}
  242. {% block javascripts %}
  243.     {{ parent() }}
  244.     <script>
  245.         const stripe = Stripe('{{ stripe_public_key }}');
  246.         const elements = stripe.elements();
  247.         const cardNumber = elements.create('cardNumber', { placeholder: '1234 1234 1234 1234' });
  248.         cardNumber.mount('#sg_credit_reload_card_number');
  249.         const expDate = elements.create('cardExpiry');
  250.         expDate.mount('#sg_credit_reload_expiry');
  251.         const cvc = elements.create('cardCvc', { placeholder: 'CVV' });
  252.         cvc.mount('#sg_credit_reload_cvv');
  253.         cardNumber.addEventListener("change", (event) => {
  254.             const displayError = document.getElementById("sg_credit_reload_card_errors")
  255.             displayError.textContent = event.error ? event.error.message : "";
  256.         })
  257.         expDate.addEventListener("change", (event) => {
  258.             const displayError = document.getElementById("sg_credit_reload_expiry_errors")
  259.             displayError.textContent = event.error ? event.error.message : "";
  260.         })
  261.         cvc.addEventListener("change", (event) => {
  262.             const displayError = document.getElementById("sg_credit_reload_cvv_errors")
  263.             displayError.textContent = event.error ? event.error.message : "";
  264.         })
  265.         const form = document.getElementById('paymentFormRecap');
  266.         form.addEventListener('submit', async (event) => {
  267.             event.preventDefault();
  268.             const cardHolderName = document.getElementById("sg_credit_reload_card_holder_name").value;
  269.             const montant = document.getElementById("sg_credit_reload_amount").value * 100;
  270.             const payButton = document.getElementById("card-button");
  271.             payButton.disabled = true; 
  272.             try {
  273.                 const response = await fetch("{{ path('app_client_credit_reload_modal') }}", {
  274.                     method: 'POST',
  275.                     body: new FormData(form),
  276.                     headers: {
  277.                         'X-Requested-With': 'XMLHttpRequest',
  278.                     }
  279.                 });
  280.                 
  281.                 if (!response.ok) {
  282.                     throw new Error("Erreur de communication avec le serveur.");
  283.                 }
  284.                 const data = await response.json();
  285.                 if (!data.client_secret) {
  286.                     throw new Error("Erreur lors de la création du paiement.");
  287.                 }
  288.                 const clientSecret = data.client_secret;
  289.                 const paymentResult = await stripe.confirmCardPayment(clientSecret, {
  290.                     payment_method: {
  291.                         card: cardNumber,
  292.                         billing_details: {
  293.                             name: cardHolderName,
  294.                         },
  295.                     },
  296.                 });
  297.                 
  298.                 if (paymentResult.error) {
  299.                     document.getElementById("errors").innerText = paymentResult.error.message;
  300.                     payButton.disabled = false;
  301.                 } else if (paymentResult.paymentIntent && paymentResult.paymentIntent.status === 'succeeded') {
  302.                     const completeResponse = await fetch("{{ path('app_client_complete_payment_modal') }}", {
  303.                         method: 'POST',
  304.                         headers: {
  305.                             'Content-Type': 'application/json',
  306.                             'X-Requested-With': 'XMLHttpRequest',
  307.                         },
  308.                         body: JSON.stringify({
  309.                             payment_intent_id: paymentResult.paymentIntent.id,
  310.                             amount: montant, 
  311.                             status: paymentResult.paymentIntent.status
  312.                         })
  313.                     });
  314.                     const completeData = await completeResponse.json();
  315.                     if (completeData.success) {
  316.                         window.scrollTo(0, 0);
  317.                         window.location.reload(true);
  318.                     } else {
  319.                         document.getElementById("errors").innerText = completeData.message || "Erreur lors de la finalisation du paiement.";
  320.                     }
  321.                 } else {                                                                                                                        
  322.                     document.getElementById("errors").innerText = "Le paiement a échoué.";
  323.                     payButton.disabled = false;
  324.                 }
  325.             } catch (error) {
  326.                 document.getElementById("errors").innerText = error.message;
  327.                 payButton.disabled = false;
  328.             }
  329.         }); 
  330.     </script>
  331. {% endblock %}