templates/front/subpage/contact.html.twig line 1

Open in your IDE?
  1. {% extends 'front/base_front.html.twig' %}
  2. {% block title %}
  3.     {{ 'Pages.Contact.Label' | trans({} , 'messages_front') }}
  4. {% endblock %}
  5. {% block stylesheets %}
  6.     {{ parent() }}
  7.     <link rel="preconnect" href="https://fonts.googleapis.com">
  8.     <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
  9.     <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
  10. {% endblock %}
  11. {% block javascripts %}
  12.     {{ parent() }}
  13.     <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
  14. {% endblock %}
  15. {% block container %}
  16.     <section id="contact_main_arae">
  17.         <div class="container">
  18.             <div class="page_heading">
  19.                 <h2>{{ 'Pages.Contact.Messages.ContactUs' | trans({} , 'messages_front') }}</h2>
  20.                 <p>{{ 'Pages.Contact.Messages.ContactSubtitle' | trans({} , 'messages_front') }}</p>
  21.             </div>
  22.             <div class="contact_wrapper">
  23.                 {# ---------------- Agencies + individual maps ---------------- #}
  24.                 <div class="agencies_col">
  25.                     {% for agency in agencies %}
  26.                         <div class="agency_item">
  27.                             <div class="agency_map_box">
  28.                                 <div id="leaflet_{{ agency.id }}" class="agency_map" data-name="{{ agency.name }}"></div>
  29.                             </div>
  30.                             <div class="agency_details">
  31.                                 <h3>{{ agency.name }}</h3>
  32.                                 <ul>
  33.                                     <li>
  34.                                         <span class="icon_badge"><i class="fas fa-map-marker-alt"></i></span>
  35.                                         <span>
  36.                                             <strong>{{ 'Pages.Footer.Messages.Address' | trans({} , 'messages_front') }} :</strong>
  37.                                             {{ agency.address }}, {{ agency.city }}
  38.                                         </span>
  39.                                     </li>
  40.                                     {% if agency.email is defined and agency.email %}
  41.                                         <li>
  42.                                             <span class="icon_badge"><i class="fas fa-envelope"></i></span>
  43.                                             <span>
  44.                                                 <strong>{{ 'Pages.Common.Fields.Email' | trans({} , 'messages_front') }} :</strong> {{ agency.email }}
  45.                                             </span>
  46.                                         </li>
  47.                                     {% endif %}
  48.                                     <li>
  49.                                         <span class="icon_badge"><i class="fas fa-phone"></i></span>
  50.                                         <span>
  51.                                             <strong>{{ 'Pages.Common.Fields.Phone' | trans({} , 'messages_front') }} :</strong>
  52.                                             {{ agency.phone }}
  53.                                         </span>
  54.                                     </li>
  55.                                     {% if agency.whatsapp is defined and agency.whatsapp %}
  56.                                         <li>
  57.                                             <span class="icon_badge"><i class="fab fa-whatsapp"></i></span>
  58.                                             <span>
  59.                                                 <strong>whatsapp :</strong> {{ agency.whatsapp }}
  60.                                             </span>
  61.                                         </li>
  62.                                     {% endif %}
  63.                                 </ul>
  64.                             </div>
  65.                         </div>
  66.                     {% endfor %}
  67.                 </div>
  68.                 {# ---------------- Contact form ---------------- #}
  69.                 <div class="form_col">
  70.                     <h2>{{ 'Pages.Contact.Messages.ContactUs' | trans({} , 'messages_front') }}</h2>
  71.                     <p class="subtitle">{{ 'Pages.Contact.Messages.LeaveMessage' | trans({} , 'messages_front') }}</p>
  72.                     {% for flash_error in app.flashes('error') %}
  73.                         <div class="alert alert-danger" role="alert">{{ flash_error }}</div>
  74.                     {% endfor %}
  75.                     {{ form_start(form) }}
  76.                     {# Last name / First name #}
  77.                     <div class="row_gap">
  78.                         {% if form.civility is defined %}
  79.                             <div style="flex: 0 0 90px;">{{ form_row(form.civility, {label: false}) }}</div>
  80.                         {% endif %}
  81.                         <div>{{ form_row(form.lastName, {label: false, attr: {placeholder: 'Nom'}}) }}</div>
  82.                         <div>{{ form_row(form.firstName, {label: false, attr: {placeholder: 'Prénom'}}) }}</div>
  83.                     </div>
  84.                     {{ form_row(form.email, {label: false, attr: {placeholder: 'Email'}}) }}
  85.                     {# Champ téléphone sans dépendance externe #}
  86.                     {{ form_widget(form.phone, {attr: {placeholder: 'Téléphone'}}) }}
  87.                     {% if form.subject is defined %}
  88.                         {{ form_row(form.subject, {label: false, attr: {placeholder: 'Objet'}}) }}
  89.                     {% endif %}
  90.                     {% if form.service is defined %}
  91.                         {{ form_row(form.service, {label: false}) }}
  92.                     {% endif %}
  93.                     {{ form_row(form.message, {label: false, attr: {placeholder: 'Votre message'}}) }}
  94.                     <button type="submit" class="btn btn_theme btn_md">
  95.                         {{ 'Pages.Contact.Messages.SendMessage' | trans({} , 'messages_front') }}
  96.                     </button>
  97.                     {{ form_end(form) }}
  98.                 </div>
  99.             </div>
  100.         </div>
  101.     </section>
  102.     <script>
  103.         $(document).ready(() => {
  104.             {% for agency in agencies %}
  105.             {% if agency.latitude and agency.longitude %}
  106.             (function () {
  107.                 let mapEl = document.getElementById('leaflet_{{ agency.id }}');
  108.                 let map = L.map(mapEl, {
  109.                     zoomControl: true,
  110.                     scrollWheelZoom: false
  111.                 }).setView([{{ agency.latitude }}, {{ agency.longitude }}], 14);
  112.                 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  113.                     attribution: '&copy; OpenStreetMap contributors'
  114.                 }).addTo(map);
  115.                 // Real Leaflet popup, opened by default, sitting above the
  116.                 // marker with its little tail (native Leaflet behaviour).
  117.                 // maxWidth/minWidth stop it from ever stretching full-width.
  118.                 L.marker([{{ agency.latitude }}, {{ agency.longitude }}])
  119.                     .addTo(map)
  120.                     .bindPopup(mapEl.dataset.name, {
  121.                         closeButton: true,
  122.                         autoClose: false,
  123.                         maxWidth: 220,
  124.                         minWidth: 90
  125.                     })
  126.                     .openPopup();
  127.             })();
  128.             {% endif %}
  129.             {% endfor %}
  130.             // Keep phone values consistent without relying on a third-party CDN.
  131.             let phoneInput = document.querySelector('input[name="phone"]');
  132.             if (phoneInput) {
  133.                 let phoneForm = phoneInput.closest('form');
  134.                 if (phoneForm) {
  135.                     phoneForm.addEventListener('submit', () => {
  136.                         phoneInput.value = phoneInput.value.trim().replace(/\s+/g, ' ');
  137.                     });
  138.                 }
  139.             }
  140.         });
  141.     </script>
  142.     <script src="{{ asset('assets/js/leaflet_map.js') }}"></script>
  143. {% endblock %}