templates/hosting/check_domain.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block body %}
  3.     <br/>
  4.   <main id="main">
  5.     <section id="pricing" class="pricing section-bg">
  6.       <div class="container">
  7.         <div class="section-title" data-aos="fade-up">
  8.             <br/>
  9.             <h3 class="text-center">Hosting solution for your business</h3>
  10.        </div>
  11.         <div class="row">
  12.           <div class="col-md-2">
  13.           </div>
  14.           <div class="col-md-8">
  15.             <div>
  16.                  {{ include('hosting/hosting_search_form.html.twig') }}
  17.             </div>
  18.             <br/>
  19.             <div>
  20.                 <table class="table  table-striped">
  21.                     <thead>
  22.                         <tr>
  23.                             <th class="table-dark">{{ 'entreprise.domain_name' | trans }}</th>
  24.                             <th class="table-dark">{{ 'entreprise.price' | trans }}</th>
  25.                             <th class="table-dark">{{ 'entreprise.status' | trans }}</th>
  26.                             <th class="table-dark">{{ 'entreprise.selection' | trans }}</th>
  27.                         </tr>
  28.                     </thead>
  29.                     <tbody>
  30.                         {% for result in results %}
  31.                         <tr>
  32.                             <td>{{ result.DomainName }}.{{ result.TLD }}</td>
  33.                             <td>{{ result.Price }}</td>
  34.                                 {% set statut = 'entreprise.' ~ result.Status %}
  35.                             <td>{{ statut  | trans }}</td>
  36.                             <td>
  37.                                 {% if result.Status == 'available' %}
  38.                                     <form action="{{ path('add_to_card') }}">
  39.                                         <input value="{{ result.DomainName }}" name="nom_de_domaine" hidden />
  40.                                         <input value="{{ result.TLD }}" name="tld"  hidden />
  41.                                         <input value="{{ result.Price }}" name="prix" hidden />
  42.                                         <span class="btn-bleu-fonce btn-add-to-cart">{{ 'entreprise.add_to_cart' | trans }}</span>
  43.                                     </form>
  44.                                 {% else %}
  45.                                 {% endif %}
  46.                             </td>
  47.                             
  48.                         </tr>
  49.                         {% endfor %}
  50.                     </tbody>
  51.                 </table>
  52.             </div>
  53.           </div>
  54.         </div>
  55.         <div class="row">
  56.             <div class="col">
  57.             </div>
  58.             <div class="col">
  59.                 <div class="col">
  60.                 <a href="" class="btn-bleu-fonce">{{ 'entreprise.select_all' | trans }}</a>
  61.             </div>
  62.             </div>
  63.             <div class="col">
  64.                 <a href="{{ path('choose_hosting_plan') }}" class="btn btn-warning btn-lg btn-block rounded">{{ 'entreprise.order' | trans }}</a>
  65.             </div>
  66.         </div>
  67.       </div>
  68.     </section>
  69. </main>
  70. {% endblock body %}
  71. {% block javascripts %}
  72.     {{ parent() }}
  73.     {% set translate = 'js/' ~ app.request.locale ~ '_translate.js' %}
  74.     <script type="text/javascript" src="{{ asset(translate) }}"></script>
  75.     <script type="text/javascript">
  76.         $(function(){
  77.             var $btnAddToCart = $('.btn-add-to-cart');
  78.             var $checkoutItems = $('.checkoutItems');
  79.             
  80.         
  81.             $btnAddToCart.click(function(e){
  82.                 //e.preventDefault();
  83.                     var $myButton = $(this);
  84.                     $myButton.attr('disabled', true);
  85.                     var $form = $(this).parent();
  86.                       $.ajax({
  87.                         url: $form.attr('action'),
  88.                         method: 'POST',
  89.                         data: $form.serialize(),
  90.                         //processData: false,
  91.                         //contentType: false,
  92.                         success: function (data, textStatus, jqXHR) {
  93.                             var $nb = parseInt($checkoutItems.text());
  94.                             
  95.                             $nb++;
  96.                             toastr.success(t('Added to cart'));
  97.                             $checkoutItems.text($nb);
  98.                         },
  99.                         error: function(jqXHR, textStatus, errorThrown ){
  100.                             toastr.error(t('An error occured, try again'));
  101.                         }
  102.                     });
  103.             });    
  104.             
  105.         });
  106.     </script>
  107. {% endblock javascripts %}