templates/FrontBundle/Page/contact.html.twig line 1

Open in your IDE?
  1. {% extends 'FrontBundle/layout.html.twig' %}
  2. {% block title %}{{ app_sitename }} - {{ page.metaTitle }}{% endblock %}
  3. {% block description %}{{ page.metaDescription }}{% endblock %}
  4. {% block json_ld %}
  5.     <script type="application/ld+json">
  6.         {
  7.           "@context": "https://schema.org",
  8.           "@type": "WebPage",
  9.           "name": "{{ page.metaTitle | escape('js') }}",
  10.           "description": "{{ page.metaDescription | escape('js') }}",
  11.           "thumbnailUrl": "{{ asset ('/front/img/contact-bg.jpg') }}"
  12.          }
  13.     </script>
  14. {% endblock %}
  15. {% block body %}
  16.         <div class="shadow"></div>
  17.     <section class="contact">
  18.         <div class="container">
  19.           <h1>{{ 'contact_title'|tr(tr)|raw }}</h1>
  20.           <h3>{{ 'contact_subtitle'|tr(tr)|raw  }}</h3>
  21.           <form id="contact">
  22.               <div class="row">
  23.                   <div class="col-md-6">
  24.                       <input type="text" placeholder="{{ 'contact_nom'|tr(tr)|raw  }}*" name="lastname" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('lastname') }}{% endif %}" />
  25.                       <input type="text" placeholder="{{ 'contact_prenom'|tr(tr)|raw  }}*" name="firstname" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('firstname') }}{% endif %}"  />
  26.                       <input type="text" placeholder="{{ 'contact_societe'|tr(tr)|raw  }}" name="company" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('company') }}{% endif %}"  />
  27.                       <input type="tel" placeholder="{{ 'contact_tel'|tr(tr)|raw  }}*" name="phone" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('phone') }}{% endif %}"  />
  28.                       <input type="email" placeholder="{{ 'contact_email'|tr(tr)|raw  }}*" name="email" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.email }}{% endif %}"  />
  29.                       <input type="text" placeholder="{{ 'contact_adresse'|tr(tr)|raw  }}*" name="address" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('address1') }}{% endif %}"  />
  30.                   </div>
  31.                   <div class="col-md-6">
  32.                       <input type="text" placeholder="{{ 'contact_code'|tr(tr)|raw  }}*" name="zipcode" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('zipcode') }}{% endif %}"  />
  33.                       <input type="text" placeholder="{{ 'contact_ville'|tr(tr)|raw  }}*" name="city" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('city') }}{% endif %}"  />
  34.                       <input type="text" placeholder="{{ 'contact_pays'|tr(tr)|raw  }}*" name="country" value="{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}{{ app.user.info('country') }}{% endif %}"  />
  35.               <input type="text" placeholder="{{ 'contact_sujet'|tr(tr)|raw  }}*" name="subject" />
  36. {#                       <div class="select-wrapper">
  37.                           <select name="subject">
  38.                               <option value="0">SUJET*</option>
  39.                           </select>
  40.                       </div> #}
  41.                       <textarea placeholder="{{ 'contact_message'|tr(tr)|raw  }}*" name="message"></textarea>
  42.                   </div>
  43.             <div class="row contact-response">
  44.               <p class="text-center mt-0 mb-5"></p>
  45.             </div>
  46.                   <button id="sendform" class="send">{{ 'contact_envoyer'|tr(tr)|raw  }}</button>
  47.               </div>
  48.           </form>
  49.         </div>
  50.         <h2>{{ 'general_royal_palace'|tr(tr)|raw  }}</h2>
  51.         <p>20 Rue de Hochfelden, 67330 KIRRWILLER - FRANCE</p>
  52.         <p class="tel">+33 (0)3 88 70 71 81</p>
  53.     </section>
  54. {% endblock %}
  55. {% block javascripts %}
  56.   <script src="https://www.google.com/recaptcha/api.js?render={{ recaptcha_public_key }}"></script>
  57.   <script type="text/javascript">
  58.     $(document).ready(function() {
  59.       // alert(window.outerWidth+'x'+window.outerHeight);
  60.       $('#sendform').on('click', function(e){
  61.         e.preventDefault();
  62.           grecaptcha.ready(function() {
  63.             grecaptcha.execute('{{ recaptcha_public_key }}', {action: 'submit'}).then(function(token) {
  64.           var form = {
  65.             token: token,
  66.             firstname: $('#contact [name="firstname"').val(),
  67.             lastname: $('#contact [name="lastname"').val(),
  68.             company: $('#contact [name="company"').val(),
  69.             phone: $('#contact [name="phone"').val(),
  70.             email: $('#contact [name="email"').val(),
  71.             address: $('#contact [name="address"').val(),
  72.             zipcode: $('#contact [name="zipcode"').val(),
  73.             city: $('#contact [name="city"').val(),
  74.             country: $('#contact [name="country"').val(),
  75.             subject: $('#contact [name="subject"').val(),
  76.             message: $('#contact [name="message"').val(),
  77.           };
  78.           $.post('/contact/send/{{app.request.locale}}', form, function( data ) {
  79.             $('.contact-response').hide();
  80.             if(data.success == true){
  81.               $('#sendform').hide();
  82.               $('.contact-response').show();
  83.               $('.contact-response p').html('Merci pour votre message. <br> Nous vous répondrons dans les plus brefs délais.');
  84.             } else {
  85.               $('.contact-response').show();
  86.               $('.contact-response p').text(data.error);
  87.             }
  88.           }, "json");
  89.             });
  90.           });
  91.       });
  92.     });
  93.   </script>
  94. {% endblock %}