templates/bussness/Panier.html.twig line 1

Open in your IDE?
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="UTF-8">
  5.         <meta name="description" content="Ogani Template">
  6.         <meta name="keywords" content="Ogani, unica, creative, html">
  7.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.         <meta http-equiv="X-UA-Compatible" content="ie=edge">
  9.         <link href="{{asset('uploads/brochures/logo2_1.jpg')}}" rel="icon">
  10.         <title>
  11.             {{ title|raw }}
  12.         </title>
  13.         <!-- Google Font -->
  14.         <link
  15.         href="https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;600;900&display=swap" rel="stylesheet">
  16.         <!-- Css Styles -->
  17.         <link rel="stylesheet" href="{{asset('ogani_master/css/bootstrap.min.css')}}" type="text/css">
  18.         <link rel="stylesheet" href="{{asset('ogani_master/css/font-awesome.min.css')}}" type="text/css">
  19.         <link rel="stylesheet" href="{{asset('ogani_master/css/elegant-icons.css')}}" type="text/css">
  20.         <link rel="stylesheet" href="{{asset('ogani_master/css/nice-select.css')}}" type="text/css">
  21.         <link rel="stylesheet" href="{{asset('ogani_master/css/jquery-ui.min.css')}}" type="text/css">
  22.         <link rel="stylesheet" href="{{asset('ogani_master/css/owl.carousel.min.css')}}" type="text/css">
  23.         <link rel="stylesheet" href="{{asset('ogani_master/css/slicknav.min.css')}}" type="text/css">
  24.         <link
  25.         rel="stylesheet" href="{{asset('ogani_master/css/style.css')}}" type="text/css">
  26.         <!-- Template Main CSS File -->
  27.         <link href="{{asset('Nice-Admin-master/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.css')}}" rel="stylesheet">
  28.         <link href="{{asset('NiceAdmin/assets/vendor/bootstrap-icons/bootstrap-icons.css')}}" rel="stylesheet">
  29.     </head>
  30.     <body>
  31.         <!-- ======= Header ======= -->
  32.         {{ include('Header.html.twig') }}
  33.         <!-- ======= Body   ======= -->
  34.         {{ include('Body-panier.html.twig') }}
  35.         <!-- ======= Footer   ======= -->
  36.         {{ include('Footer.html.twig') }}
  37.         {% block body %}{% endblock %}
  38.         <!-- Js Plugins -->
  39.         <script src="{{asset('ogani_master/js/jquery-3.3.1.min.js')}}"></script>
  40.         <script src="{{asset('ogani_master/js/bootstrap.min.js')}}"></script>
  41.         <script src="{{asset('ogani_master/js/jquery.nice-select.min.js')}}"></script>
  42.         <script src="{{asset('ogani_master/js/jquery-ui.min.js')}}"></script>
  43.         <script src="{{asset('ogani_master/js/jquery.slicknav.js')}}"></script>
  44.         <script src="{{asset('ogani_master/js/mixitup.min.js')}}"></script>
  45.         <script src="{{asset('ogani_master/js/owl.carousel.min.js')}}"></script>
  46.         <script src="{{asset('ogani_master/js/main.js')}}"></script>
  47.         <script src="{{asset('NiceAdmin/assets/vendor/simple-datatables/simple-datatables.js')}}"></script>
  48.         <script src="{{asset('Nice-Admin-master/assets/extra-libs/DataTables/datatables.min.js')}}"></script>
  49.         {% if not app.user %}
  50.             <script>
  51.                 (function () {
  52.                     const PHOTON_BASE_URL = 'https://photon.komoot.io/api/';
  53.                     const NOMINATIM_BASE_URL = 'https://nominatim.openstreetmap.org/search';
  54.                     const DEFAULT_SEARCH_LIMIT = 8;
  55.                     const POI_SEARCH_LIMIT = 12;
  56.                     const DEBOUNCE_DELAY = 300;
  57.                     const REQUEST_TIMEOUT_MS = 6000;
  58.                     const IVORY_COAST_LABEL = "Côte d'Ivoire";
  59.                     const IVORY_COAST_CODE = 'CI';
  60.                     const POI_KEYWORDS = ['mairie', 'hotel de ville', 'hôtel de ville', 'eglise', 'église', 'mosquee', 'mosquée', 'marche', 'marché', 'pharmacie', 'hopital', 'hôpital', 'gare', 'station', 'universite', 'université', 'banque'];
  61.                     let activeRequestId = 0;
  62.                     let debounceTimer = null;
  63.                     function debounce(fn, wait) {
  64.                         return function () {
  65.                             var args = arguments;
  66.                             var context = this;
  67.                             clearTimeout(debounceTimer);
  68.                             debounceTimer = setTimeout(function () {
  69.                                 fn.apply(context, args);
  70.                             }, wait);
  71.                         };
  72.                     }
  73.                     function buildUrl(baseUrl, params) {
  74.                         return baseUrl + '?' + new URLSearchParams(params).toString();
  75.                     }
  76.                     function fetchWithTimeout(url, options, timeoutMs) {
  77.                         var controller = new AbortController();
  78.                         var timeoutId = setTimeout(function () {
  79.                             controller.abort();
  80.                         }, timeoutMs);
  81.                         var fetchOptions = Object.assign({}, options || {}, { signal: controller.signal });
  82.                         return fetch(url, fetchOptions).finally(function () {
  83.                             clearTimeout(timeoutId);
  84.                         });
  85.                     }
  86.                     function setFeedback(feedbackEl, message, level) {
  87.                         if (!feedbackEl) return;
  88.                         feedbackEl.textContent = message || '';
  89.                         feedbackEl.classList.remove('d-none', 'text-muted', 'text-danger', 'text-success');
  90.                         feedbackEl.classList.add(level || 'text-muted');
  91.                         if (!message) feedbackEl.classList.add('d-none');
  92.                     }
  93.                     function normalize(value) {
  94.                         return (value || '')
  95.                             .toString()
  96.                             .normalize('NFD')
  97.                             .replace(/[\u0300-\u036f]/g, '')
  98.                             .replace(/[^a-zA-Z0-9]+/g, ' ')
  99.                             .replace(/\s+/g, ' ')
  100.                             .trim()
  101.                             .toLowerCase();
  102.                     }
  103.                     function isIvoryCoast(countryCode, countryName) {
  104.                         var normalizedCode = normalize(countryCode);
  105.                         var normalizedName = normalize(countryName);
  106.                         return normalizedCode === 'ci' || normalizedName === 'cote d ivoire' || normalizedName === 'ivory coast';
  107.                     }
  108.                     function clearHiddenFields(latEl, lngEl, stateEl, countryEl, countryCodeEl) {
  109.                         if (latEl) latEl.value = '';
  110.                         if (lngEl) lngEl.value = '';
  111.                         if (stateEl) stateEl.value = '';
  112.                         if (countryEl) countryEl.value = '';
  113.                         if (countryCodeEl) countryCodeEl.value = '';
  114.                     }
  115.                     function isPoiQuery(q) {
  116.                         var raw = (q || '').toString().toLowerCase();
  117.                         return POI_KEYWORDS.some(function (keyword) {
  118.                             return raw.indexOf(keyword) !== -1;
  119.                         });
  120.                     }
  121.                     function buildLabelPoi(properties) {
  122.                         var name = (properties && properties.name ? properties.name : '').trim();
  123.                         var street = (properties && properties.street ? properties.street : '').trim();
  124.                         var houseNumber = (properties && properties.housenumber ? properties.housenumber : '').trim();
  125.                         var city = (properties && (properties.city || properties.county) ? (properties.city || properties.county) : '').trim();
  126.                         var main = name;
  127.                         if (!main) {
  128.                             main = [houseNumber, street].filter(Boolean).join(' ').trim() || street || city;
  129.                         }
  130.                         if (!main) return '';
  131.                         if (city && normalize(main) !== normalize(city)) {
  132.                             return main + ', ' + city + ', ' + IVORY_COAST_LABEL;
  133.                         }
  134.                         return main + ', ' + IVORY_COAST_LABEL;
  135.                     }
  136.                     function buildLabelAdmin(properties) {
  137.                         var place = (
  138.                             (properties && properties.district) ||
  139.                             (properties && properties.suburb) ||
  140.                             (properties && properties.neighbourhood) ||
  141.                             (properties && properties.locality) ||
  142.                             (properties && properties.city) ||
  143.                             (properties && properties.name) ||
  144.                             ''
  145.                         ).trim();
  146.                         var city = (
  147.                             (properties && properties.city) ||
  148.                             (properties && properties.county) ||
  149.                             ''
  150.                         ).trim();
  151.                         if (!place) return '';
  152.                         if (normalize(place) !== normalize(city)) {
  153.                             return place + (city ? ', ' + city : '') + ', ' + IVORY_COAST_LABEL;
  154.                         }
  155.                         return place + ', ' + IVORY_COAST_LABEL;
  156.                     }
  157.                     function buildLabelFromPlace(place, city) {
  158.                         var safePlace = (place || '').trim();
  159.                         var safeCity = (city || '').trim();
  160.                         if (!safePlace) return '';
  161.                         if (normalize(safePlace) !== normalize(safeCity)) {
  162.                             return safePlace + (safeCity ? ', ' + safeCity : '') + ', ' + IVORY_COAST_LABEL;
  163.                         }
  164.                         return safePlace + ', ' + IVORY_COAST_LABEL;
  165.                     }
  166.                     function buildLabel(item) {
  167.                         if (!item) return '';
  168.                         return item.label || buildLabelFromPlace(item.place, item.city);
  169.                     }
  170.                     function extractSignificantQuery(query) {
  171.                         var words = normalize(query).split(' ').filter(Boolean);
  172.                         var poiWords = POI_KEYWORDS.map(function (k) { return normalize(k); });
  173.                         var stopwords = ['de', 'du', 'des', 'la', 'le', 'les', 'd'];
  174.                         var filtered = words.filter(function (word) {
  175.                             return poiWords.indexOf(word) === -1 && stopwords.indexOf(word) === -1;
  176.                         });
  177.                         return filtered.join(' ').trim();
  178.                     }
  179.                     function isPoiFeature(properties) {
  180.                         var osmKey = normalize(properties && properties.osm_key);
  181.                         var osmValue = normalize(properties && properties.osm_value);
  182.                         var poiKeys = ['amenity', 'office', 'building', 'shop', 'tourism', 'leisure', 'healthcare', 'public transport', 'railway'];
  183.                         var poiValues = ['townhall', 'pharmacy', 'hospital', 'clinic', 'place of worship', 'church', 'mosque', 'marketplace', 'university', 'bank', 'station'];
  184.                         var keyMatch = poiKeys.indexOf(osmKey) !== -1;
  185.                         var valueMatch = poiValues.some(function (value) { return osmValue.indexOf(value) !== -1; });
  186.                         return keyMatch || valueMatch;
  187.                     }
  188.                     function rankPoi(item, query) {
  189.                         var normalizedQuery = normalize(query);
  190.                         var significant = extractSignificantQuery(query);
  191.                         var normalizedName = normalize(item && item.name ? item.name : '');
  192.                         var normalizedLabel = normalize(item && item.label ? item.label : '');
  193.                         var score = 0;
  194.                         if (normalizedName.indexOf('mairie') !== -1) score += 200;
  195.                         if (normalizedName.indexOf('cocody') !== -1 || (significant && normalizedName.indexOf(significant) !== -1)) score += 150;
  196.                         if (normalizedQuery && normalizedName.indexOf(normalizedQuery) !== -1) score += 100;
  197.                         if (normalizedLabel.indexOf('vieux') !== -1) score -= 80;
  198.                         return score;
  199.                     }
  200.                     function rankAdmin(item, query) {
  201.                         var normalizedQuery = normalize(query);
  202.                         var normalizedLabel = normalize(item && item.label ? item.label : '');
  203.                         var score = 0;
  204.                         if (normalizedQuery && normalizedLabel.indexOf(normalizedQuery) !== -1) score += 100;
  205.                         if (item && item.place && item.city && normalize(item.place) !== normalize(item.city)) score += 20;
  206.                         if (normalize(item && item.place) === 'abidjan' && normalizedQuery && normalizedQuery !== 'abidjan') score -= 40;
  207.                         return score;
  208.                     }
  209.                     function dedupe(items) {
  210.                         var seenLabels = new Set();
  211.                         var deduped = [];
  212.                         (items || []).forEach(function (item) {
  213.                             var label = buildLabel(item);
  214.                             if (!label) return;
  215.                             var normalizedLabel = normalize(label);
  216.                             if (seenLabels.has(normalizedLabel)) return;
  217.                             seenLabels.add(normalizedLabel);
  218.                             item.label = label;
  219.                             deduped.push(item);
  220.                         });
  221.                         return deduped;
  222.                     }
  223.                     function mapPhotonFeatures(features, query) {
  224.                         var poiMode = isPoiQuery(query);
  225.                         return (features || []).map(function (feature) {
  226.                             var properties = feature && feature.properties ? feature.properties : {};
  227.                             if (!isIvoryCoast(properties.countrycode, properties.country)) return null;
  228.                             var coords = feature && feature.geometry && feature.geometry.coordinates ? feature.geometry.coordinates : [];
  229.                             var hasName = !!(properties.name || '').trim();
  230.                             var place = properties.district || properties.suburb || properties.neighbourhood || properties.locality || properties.city || properties.name || '';
  231.                             var city = properties.city || properties.county || '';
  232.                             var label = poiMode ? buildLabelPoi(properties) : buildLabelAdmin(properties);
  233.                             if (!label) return null;
  234.                             if (poiMode) {
  235.                                 if (!hasName) return null;
  236.                                 if (!isPoiFeature(properties) && POI_KEYWORDS.every(function (word) { return normalize(properties.name).indexOf(normalize(word)) === -1; })) return null;
  237.                             } else {
  238.                                 if (isPoiFeature(properties)) return null;
  239.                             }
  240.                             return {
  241.                                 name: properties.name || '',
  242.                                 place: place,
  243.                                 city: city,
  244.                                 label: label,
  245.                                 score: poiMode ? rankPoi({ name: properties.name || '', label: label }, query) : rankAdmin({ place: place, city: city, label: label }, query),
  246.                                 state: properties.state || properties.county || '',
  247.                                 country: IVORY_COAST_LABEL,
  248.                                 countrycode: IVORY_COAST_CODE,
  249.                                 lng: typeof coords[0] === 'number' ? coords[0] : null,
  250.                                 lat: typeof coords[1] === 'number' ? coords[1] : null
  251.                             };
  252.                         }).filter(Boolean).sort(function (a, b) {
  253.                             if (b.score !== a.score) return b.score - a.score;
  254.                             return normalize(a.label).localeCompare(normalize(b.label), 'fr');
  255.                         });
  256.                     }
  257.                     function mapNominatimItems(items, query) {
  258.                         var poiMode = isPoiQuery(query);
  259.                         return (items || []).map(function (item) {
  260.                             var address = item && item.address ? item.address : {};
  261.                             if (!isIvoryCoast(address.country_code, address.country)) return null;
  262.                             var pseudoProperties = {
  263.                                 name: address.amenity || address.building || address.shop || '',
  264.                                 street: address.road || '',
  265.                                 housenumber: address.house_number || '',
  266.                                 city: address.city || address.town || address.village || '',
  267.                                 county: address.county || '',
  268.                                 district: address.city_district || '',
  269.                                 suburb: address.suburb || '',
  270.                                 neighbourhood: address.neighbourhood || '',
  271.                                 locality: address.quarter || ''
  272.                             };
  273.                             var place = pseudoProperties.district || pseudoProperties.suburb || pseudoProperties.neighbourhood || pseudoProperties.locality || pseudoProperties.city || pseudoProperties.name || '';
  274.                             var city = pseudoProperties.city || pseudoProperties.county || '';
  275.                             var label = poiMode ? buildLabelPoi(pseudoProperties) : buildLabelAdmin(pseudoProperties);
  276.                             if (!label) return null;
  277.                             if (poiMode && !pseudoProperties.name) return null;
  278.                             if (!poiMode && pseudoProperties.name) return null;
  279.                             var lat = parseFloat(item.lat);
  280.                             var lng = parseFloat(item.lon);
  281.                             return {
  282.                                 name: pseudoProperties.name,
  283.                                 place: place,
  284.                                 city: city,
  285.                                 label: label,
  286.                                 score: poiMode ? rankPoi({ name: pseudoProperties.name, label: label }, query) : rankAdmin({ place: place, city: city, label: label }, query),
  287.                                 state: address.state || address.county || '',
  288.                                 country: IVORY_COAST_LABEL,
  289.                                 countrycode: IVORY_COAST_CODE,
  290.                                 lat: Number.isFinite(lat) ? lat : null,
  291.                                 lng: Number.isFinite(lng) ? lng : null
  292.                             };
  293.                         }).filter(Boolean).sort(function (a, b) {
  294.                             if (b.score !== a.score) return b.score - a.score;
  295.                             return normalize(a.label).localeCompare(normalize(b.label), 'fr');
  296.                         });
  297.                     }
  298.                     function renderSuggestions(suggestionsEl, inputEl, results, onSelect) {
  299.                         suggestionsEl.innerHTML = '';
  300.                         if (!results.length) {
  301.                             suggestionsEl.classList.add('d-none');
  302.                             inputEl.setAttribute('aria-expanded', 'false');
  303.                             return;
  304.                         }
  305.                         results.forEach(function (item, index) {
  306.                             var option = document.createElement('button');
  307.                             option.type = 'button';
  308.                             option.className = 'commune-suggestion-item';
  309.                             option.setAttribute('role', 'option');
  310.                             option.setAttribute('data-index', String(index));
  311.                             option.textContent = buildLabel(item);
  312.                             option.addEventListener('click', function () { onSelect(item); });
  313.                             suggestionsEl.appendChild(option);
  314.                         });
  315.                         suggestionsEl.classList.remove('d-none');
  316.                         inputEl.setAttribute('aria-expanded', 'true');
  317.                     }
  318.                     function fetchPhotonSuggestions(query) {
  319.                         var limit = isPoiQuery(query) ? POI_SEARCH_LIMIT : DEFAULT_SEARCH_LIMIT;
  320.                         var url = buildUrl(PHOTON_BASE_URL, { q: query, limit: String(limit), lang: 'fr', countrycode: 'ci' });
  321.                         return fetchWithTimeout(url, {}, REQUEST_TIMEOUT_MS)
  322.                             .then(function (response) {
  323.                                 if (!response.ok) {
  324.                                     var httpErr = new Error('Photon HTTP error');
  325.                                     httpErr.status = response.status;
  326.                                     httpErr.statusText = response.statusText;
  327.                                     httpErr.url = url;
  328.                                     throw httpErr;
  329.                                 }
  330.                                 return response.json();
  331.                             })
  332.                             .then(function (data) {
  333.                                 return dedupe(mapPhotonFeatures(data && data.features ? data.features : [], query));
  334.                             })
  335.                             .catch(function (err) {
  336.                                 console.error('[CommuneAutocomplete] Photon error', {
  337.                                     status: err && err.status ? err.status : null,
  338.                                     statusText: err && err.statusText ? err.statusText : null,
  339.                                     url: err && err.url ? err.url : url,
  340.                                     err: err
  341.                                 });
  342.                                 throw err;
  343.                             });
  344.                     }
  345.                     function fetchNominatimSuggestions(query) {
  346.                         var limit = isPoiQuery(query) ? POI_SEARCH_LIMIT : DEFAULT_SEARCH_LIMIT;
  347.                         var url = buildUrl(NOMINATIM_BASE_URL, { format: 'json', q: query, addressdetails: '1', limit: String(limit), countrycodes: 'ci', 'accept-language': 'fr' });
  348.                         return fetchWithTimeout(url, {}, REQUEST_TIMEOUT_MS)
  349.                             .then(function (response) {
  350.                                 if (!response.ok) {
  351.                                     var httpErr = new Error('Nominatim HTTP error');
  352.                                     httpErr.status = response.status;
  353.                                     httpErr.statusText = response.statusText;
  354.                                     httpErr.url = url;
  355.                                     throw httpErr;
  356.                                 }
  357.                                 return response.json();
  358.                             })
  359.                             .then(function (items) {
  360.                                 return dedupe(mapNominatimItems(items, query));
  361.                             })
  362.                             .catch(function (err) {
  363.                                 console.error('[CommuneAutocomplete] Nominatim error', {
  364.                                     status: err && err.status ? err.status : null,
  365.                                     statusText: err && err.statusText ? err.statusText : null,
  366.                                     url: err && err.url ? err.url : url,
  367.                                     err: err
  368.                                 });
  369.                                 throw err;
  370.                             });
  371.                     }
  372.                     document.addEventListener('DOMContentLoaded', function () {
  373.                         var btn = document.getElementById('btn-commander-invite');
  374.                         var section = document.getElementById('section-checkout-invite');
  375.                         if (!btn || !section) return;
  376.                         var inputEl = document.getElementById('commune');
  377.                         var suggestionsEl = document.getElementById('commune-suggestions');
  378.                         var feedbackEl = document.getElementById('commune-feedback');
  379.                         var alertEl = document.getElementById('places-alert');
  380.                         var latEl = document.getElementById('commune_lat');
  381.                         var lngEl = document.getElementById('commune_lng');
  382.                         var stateEl = document.getElementById('commune_state');
  383.                         var countryEl = document.getElementById('commune_country');
  384.                         var countryCodeEl = document.getElementById('commune_countrycode');
  385.                         var form = document.querySelector('form[data-guest-checkout="1"]');
  386.                         if (!inputEl || !suggestionsEl || !form) return;
  387.                         function closeSuggestions() {
  388.                             suggestionsEl.classList.add('d-none');
  389.                             inputEl.setAttribute('aria-expanded', 'false');
  390.                         }
  391.                         function selectSuggestion(item) {
  392.                             inputEl.value = buildLabel(item);
  393.                             if (latEl) latEl.value = item.lat !== null ? String(item.lat) : '';
  394.                             if (lngEl) lngEl.value = item.lng !== null ? String(item.lng) : '';
  395.                             if (stateEl) stateEl.value = item.state || '';
  396.                             if (countryEl) countryEl.value = IVORY_COAST_LABEL;
  397.                             if (countryCodeEl) countryCodeEl.value = IVORY_COAST_CODE;
  398.                             setFeedback(feedbackEl, 'Commune sélectionnée.', 'text-success');
  399.                             if (alertEl) alertEl.classList.add('d-none');
  400.                             closeSuggestions();
  401.                         }
  402.                         var fetchSuggestions = debounce(function (query) {
  403.                             if (query.length < 2) {
  404.                                 closeSuggestions();
  405.                                 setFeedback(feedbackEl, '', 'text-muted');
  406.                                 return;
  407.                             }
  408.                             var requestId = ++activeRequestId;
  409.                             setFeedback(feedbackEl, 'Recherche...', 'text-muted');
  410.                             if (alertEl) alertEl.classList.add('d-none');
  411.                             fetchPhotonSuggestions(query)
  412.                                 .catch(function () { return fetchNominatimSuggestions(query); })
  413.                                 .then(function (results) {
  414.                                     if (requestId !== activeRequestId) return;
  415.                                     renderSuggestions(suggestionsEl, inputEl, results, selectSuggestion);
  416.                                     if (results.length) {
  417.                                         setFeedback(feedbackEl, '', 'text-muted');
  418.                                     } else {
  419.                                         setFeedback(feedbackEl, "Aucun résultat en Côte d'Ivoire.", 'text-muted');
  420.                                     }
  421.                                 })
  422.                                 .catch(function () {
  423.                                     if (requestId !== activeRequestId) return;
  424.                                     closeSuggestions();
  425.                                     setFeedback(feedbackEl, 'Erreur réseau. Veuillez réessayer.', 'text-danger');
  426.                                     if (alertEl) {
  427.                                         alertEl.textContent = "Le service de suggestions est indisponible. Vous pouvez saisir la commune manuellement.";
  428.                                         alertEl.classList.remove('d-none');
  429.                                     }
  430.                                 });
  431.                         }, DEBOUNCE_DELAY);
  432.                         inputEl.addEventListener('input', function (event) {
  433.                             clearHiddenFields(latEl, lngEl, stateEl, countryEl, countryCodeEl);
  434.                             setFeedback(feedbackEl, '', 'text-muted');
  435.                             fetchSuggestions((event.target.value || '').trim());
  436.                         });
  437.                         document.addEventListener('click', function (event) {
  438.                             if (!event.target.closest('.commune-autocomplete')) {
  439.                                 closeSuggestions();
  440.                             }
  441.                         });
  442.                         btn.addEventListener('click', function () {
  443.                             section.classList.toggle('d-none');
  444.                             if (!section.classList.contains('d-none')) {
  445.                                 inputEl.focus();
  446.                             }
  447.                         });
  448.                         form.addEventListener('submit', function (e) {
  449.                             var value = (inputEl.value || '').trim();
  450.                             if (value.length < 2) {
  451.                                 e.preventDefault();
  452.                                 setFeedback(feedbackEl, 'La commune est obligatoire.', 'text-danger');
  453.                                 inputEl.focus();
  454.                             }
  455.                         });
  456.                     });
  457.                 })();
  458.             </script>
  459.         {% endif %}
  460.         <style>
  461.             .cart-page {
  462.                 background: #f8fafb;
  463.             }
  464.             .cart-card {
  465.                 border-radius: 1rem;
  466.             }
  467.             .cart-table thead tr {
  468.                 background: #f9fafb;
  469.                 border-bottom: 1px solid #e9ecef;
  470.             }
  471.             .cart-table th,
  472.             .cart-table td {
  473.                 vertical-align: middle;
  474.             }
  475.             .cart-table tbody tr:hover {
  476.                 background-color: #f5f7fb;
  477.             }
  478.             .empty-cart-icon i {
  479.                 opacity: 0.6;
  480.             }
  481.             .commune-autocomplete {
  482.                 position: relative;
  483.             }
  484.             .commune-suggestions {
  485.                 position: absolute;
  486.                 top: calc(100% + 4px);
  487.                 left: 0;
  488.                 right: 0;
  489.                 max-height: 240px;
  490.                 overflow-y: auto;
  491.                 background: #fff;
  492.                 border: 1px solid #dee2e6;
  493.                 border-radius: .375rem;
  494.                 box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  495.                 z-index: 20;
  496.             }
  497.             .commune-suggestion-item {
  498.                 display: block;
  499.                 width: 100%;
  500.                 padding: .5rem .75rem;
  501.                 border: 0;
  502.                 background: transparent;
  503.                 text-align: left;
  504.                 font-size: .95rem;
  505.                 cursor: pointer;
  506.             }
  507.             .commune-suggestion-item:hover,
  508.             .commune-suggestion-item:focus {
  509.                 background: #f3f7ff;
  510.             }
  511.         </style>
  512.     </body>
  513. </html>