"use strict";function handleCallOfferSubmit(e,t){var n=document.querySelector("#".concat(t)),r=n.querySelector("button");if(!r.classList.contains("loading")){r.classList.add("loading");var o=new FormData(n),i=Object.fromEntries(o),s=!1;["name","phone","agree"].forEach((function(e){i[e]||(n.querySelector("[name=".concat(e,"]")).setAttribute("error",""),s=!0)})),s?r.classList.remove("loading"):fetch("".concat(settings.templateDir,"/post/call-offer.php"),{credentials:"same-origin",mode:"same-origin",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then((function(e){return 200===e.status?e.json():(n.querySelector(".result-text").innerText="Kunne ikke udføre anmodningen. Ring venligst direkte til os i stedet.",n.classList.add("text-red-600"),Promise.reject("server"))})).then((function(){n.innerHTML='\n      <div class="text-4xl font-extrabold">Tak for din henvendelse!</div>\n      <div>Vi kontakter dig hurtigst muligt.</div>\n      ',n.classList.add("py-12")})).catch((function(e){"server"!==e&&console.log(e)}))}}function onCallOfferCheckboxChange(e){e.target.removeAttribute("error")}function onCallOfferInputFocus(e){e.target.removeAttribute("error")}
//# sourceMappingURL=callOffer.min.js.map