{"id":50,"date":"2026-06-23T22:29:42","date_gmt":"2026-06-23T22:29:42","guid":{"rendered":"http:\/\/francerezy.cluster015.ovh.net\/?page_id=50"},"modified":"2026-07-10T21:26:26","modified_gmt":"2026-07-10T21:26:26","slug":"envois-internationaux","status":"publish","type":"page","link":"https:\/\/www.antsound.net\/index.php\/envois-internationaux\/","title":{"rendered":"Envois internationaux"},"content":{"rendered":"\n<div id=\"expeditions-internationales\" class=\"ml-expeditions\">\n\n  <h2>Exp\u00e9diteur<\/h2>\n  <div class=\"ml-row\">\n    <input id=\"exp_firstname\" placeholder=\"Pr\u00e9nom\">\n    <input id=\"exp_lastname\" placeholder=\"Nom\">\n    <input id=\"exp_email\" placeholder=\"Email\">\n    <input id=\"exp_phone\" placeholder=\"T\u00e9l\u00e9phone\">\n  <\/div>\n\n  <div class=\"ml-row\">\n    <input id=\"exp_address\" placeholder=\"Adresse\">\n    <div id=\"exp_address_suggestions\" class=\"ml-suggestions\"><\/div>\n  <\/div>\n\n  <div class=\"ml-row\">\n    <input id=\"exp_zip\" placeholder=\"Code postal\">\n    <input id=\"exp_city\" placeholder=\"Ville\">\n    <input id=\"exp_country\" value=\"FR\">\n  <\/div>\n\n  <h2>Destinataire<\/h2>\n  <div class=\"ml-row\">\n    <input id=\"dest_firstname\" placeholder=\"Pr\u00e9nom\">\n    <input id=\"dest_lastname\" placeholder=\"Nom\">\n    <input id=\"dest_email\" placeholder=\"Email\">\n    <input id=\"dest_phone\" placeholder=\"T\u00e9l\u00e9phone\">\n  <\/div>\n\n  <div class=\"ml-row\">\n    <input id=\"dest_address\" placeholder=\"Adresse\">\n    <div id=\"dest_address_suggestions\" class=\"ml-suggestions\"><\/div>\n  <\/div>\n\n  <div class=\"ml-row\">\n    <input id=\"dest_zip\" placeholder=\"Code postal\">\n    <input id=\"dest_city\" placeholder=\"Ville\">\n    <input id=\"dest_country\" value=\"FR\">\n  <\/div>\n\n  <h2>Colis<\/h2>\n  <div class=\"ml-row\">\n    <input id=\"parcel_weight\" type=\"number\" step=\"0.1\" placeholder=\"Poids (kg)\">\n    <input id=\"parcelLength\" type=\"number\" placeholder=\"Longueur (cm)\">\n    <input id=\"parcelWidth\" type=\"number\" placeholder=\"Largeur (cm)\">\n    <input id=\"parcelHeight\" type=\"number\" placeholder=\"Hauteur (cm)\">\n  <\/div>\n\n  <button id=\"btn_get_rates\">Voir les transporteurs<\/button>\n\n  <div id=\"transporteurs\" style=\"margin-top:20px;\"><\/div>\n<\/div>\n\n\n<style>\n  .ml-expeditions { max-width: 900px; margin: 0 auto; }\n  .ml-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }\n  .ml-row input { flex: 1 1 200px; padding: 8px; }\n  #btn_get_rates { margin-top: 15px; padding: 10px 20px; cursor: pointer; }\n  #transporteurs button { display: block; margin-top: 8px; padding: 8px 12px; cursor: pointer; }\n  .ml-suggestions { position: relative; z-index: 10; background: #fff; border: 1px solid #ccc; max-height: 180px; overflow-y: auto; }\n  .ml-suggestions div { padding: 6px 8px; cursor: pointer; }\n  .ml-suggestions div:hover { background: #f0f0f0; }\n<\/style>\n\n\n<script>\n\/\/ -------- AUTOCOMPL\u00c9TION --------\nasync function autocompleteAddress(inputId, suggestionsId, zipId, cityId) {\n  const input = document.getElementById(inputId);\n  const container = document.getElementById(suggestionsId);\n\n  input.addEventListener(\"input\", async () => {\n    const q = input.value.trim();\n    container.innerHTML = \"\";\n    if (q.length < 3) return;\n\n    try {\n      const res = await fetch(\"https:\/\/api-adresse.data.gouv.fr\/search\/?q=\" + encodeURIComponent(q) + \"&#038;limit=5\");\n      const data = await res.json();\n\n      data.features.forEach(f => {\n        const s = document.createElement(\"div\");\n        s.textContent = f.properties.label;\n\n        s.onclick = () => {\n          input.value = f.properties.name || f.properties.label;\n          document.getElementById(zipId).value = f.properties.postcode || \"\";\n          document.getElementById(cityId).value = f.properties.city || \"\";\n          container.innerHTML = \"\";\n        };\n\n        container.appendChild(s);\n      });\n\n    } catch (e) {\n      console.error(\"autocomplete error\", e);\n    }\n  });\n\n  document.addEventListener(\"click\", (e) => {\n    if (!container.contains(e.target) && e.target !== input) {\n      container.innerHTML = \"\";\n    }\n  });\n}\n\n\/\/ Exp\u00e9diteur\nautocompleteAddress(\"exp_address\", \"exp_address_suggestions\", \"exp_zip\", \"exp_city\");\n\/\/ Destinataire\nautocompleteAddress(\"dest_address\", \"dest_address_suggestions\", \"dest_zip\", \"dest_city\");\n\n\n\/\/ -------- CONTR\u00d4LE POIDS + DIMENSIONS --------\nfunction checkParcelFields() {\n  const w = parseFloat(document.getElementById(\"parcel_weight\")?.value || \"0\");\n  const L = parseFloat(document.getElementById(\"parcelLength\")?.value || \"0\");\n  const W = parseFloat(document.getElementById(\"parcelWidth\")?.value || \"0\");\n  const H = parseFloat(document.getElementById(\"parcelHeight\")?.value || \"0\");\n\n  const errors = [];\n\n  if (w <= 0) errors.push(\"Poids invalide.\");\n  if (w > 30) errors.push(\"Poids maximum d\u00e9pass\u00e9 (30 kg).\");\n\n  if (L <= 0 || W <= 0 || H <= 0) errors.push(\"Veuillez remplir toutes les dimensions.\");\n\n  if (L > 120) errors.push(\"Longueur maximale d\u00e9pass\u00e9e (120 cm).\");\n  if (W > 60) errors.push(\"Largeur maximale d\u00e9pass\u00e9e (60 cm).\");\n  if (H > 60) errors.push(\"Hauteur maximale d\u00e9pass\u00e9e (60 cm).\");\n\n  if (L + W + H > 300) errors.push(\"Somme des dimensions > 300 cm.\");\n\n  const volumetric = (L * W * H) \/ 5000;\n  if (volumetric > 30) errors.push(\"Poids volum\u00e9trique trop \u00e9lev\u00e9.\");\n\n  if (errors.length) {\n    alert(errors.join(\"\\n\"));\n    return false;\n  }\n\n  return true;\n}\n\n\n\/\/ -------- BOUTON : R\u00c9CUP\u00c9RATION DES OFFRES --------\ndocument.getElementById(\"btn_get_rates\").onclick = async () => {\n\n  if (!checkParcelFields()) return;\n\n  const div = document.getElementById(\"transporteurs\");\n  div.innerHTML = \"Chargement des offres...\";\n\n  \/\/ Ici tu mettras Boxtal API V3 quand ton compte sera valid\u00e9\n  \/\/ Pour l'instant je mets des offres fictives pour tester\n\n  setTimeout(() => {\n    div.innerHTML = \"\";\n\n    const offers = [\n      { carrier: \"UPS International\", product: \"Standard\", price: 22.90 },\n      { carrier: \"DHL Express\", product: \"Express\", price: 29.50 },\n      { carrier: \"FedEx Economy\", product: \"Economy\", price: 18.70 }\n    ];\n\n    offers.forEach(rate => {\n      const btn = document.createElement(\"button\");\n      btn.innerText = `${rate.carrier} \u2013 ${rate.product} \u2013 ${rate.price}\u20ac`;\n      btn.onclick = () => alert(\"Paiement Boxtal bient\u00f4t disponible\");\n      div.appendChild(btn);\n    });\n\n  }, 800);\n};\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Exp\u00e9diteur Destinataire Colis Voir les transporteurs<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-50","page","type-page","status-publish","hentry"],"acf":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/pages\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":10,"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/pages\/50\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/pages\/50\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/www.antsound.net\/index.php\/wp-json\/wp\/v2\/media?parent=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}