window.hdLoaded?console.log("layout.js already loaded"):(window.hdLoaded=!0,(()=>{if(!document.querySelector(".orderpads-wrapper"))return;const e=document.querySelector(".myaccount.quicklistsedit");if(e){e.insertAdjacentHTML("afterbegin",'\n
\n ');const t=document.querySelector(".listtools-top .sortby");document.querySelector(".quicklists-header-right").insertAdjacentElement("afterbegin",t),document.querySelector(".quicklists-header-right").insertAdjacentElement("afterbegin",document.querySelector(".gridtopleft .itemsfound")),document.querySelector(".quicklists-header-left").insertAdjacentElement("afterbegin",document.querySelector(".breadcrumb")),document.querySelector(".listtools-top").insertAdjacentElement("afterbegin",document.querySelector(".quicklist-title"))}document.querySelectorAll(".orderpads-wrapper .productgridwidget .tileparent").forEach((t=>{if(e){const e=t.querySelector(".btn-update-default-qty");t.querySelector(".buttons.group").insertAdjacentElement("beforeend",e);const n=t.querySelector(".actioncontent");t.querySelector(".shopping-actions").insertAdjacentElement("beforeend",n);t.querySelector(".delete").insertAdjacentHTML("beforeend","Remove From Quicklist")}const n=document.createElement("div"),r=t.querySelector(".inputquantity");n.classList.add("quantity-wrapper"),r.insertAdjacentElement("beforebegin",n),n.appendChild(r);const c=document.createElement("button");c.classList.add("plus-btn"),c.innerHTML='',n.insertAdjacentElement("beforeend",c);const i=document.createElement("button");i.classList.add("minus-btn"),i.innerHTML='',n.insertAdjacentElement("afterbegin",i),c.addEventListener("click",(function(){const e=parseInt(r.value,10)||0;r.value=e+1,r.dispatchEvent(new Event("change",{bubbles:!0}))})),i.addEventListener("click",(function(){const e=parseInt(r.value,10)||0;e>0&&(r.value=e-1,r.dispatchEvent(new Event("change",{bubbles:!0})))}));const o=document.createElement("div");o.classList.add("product-stock-and-actions"),t.querySelector(".shopping-actions").appendChild(o);const s=t.querySelector(".quicklist-groups-btn-wrapper");s&&o.insertAdjacentElement("beforeend",s);const a=t.querySelector(".live-inventory-v2-wrapper");a&&o.insertAdjacentElement("beforeend",a);const d=t.querySelector(".product-compare-action");d&&o.insertAdjacentElement("beforeend",d)})),document.addEventListener("live-inventory-done",(()=>{console.log("live inventory has just finished running"),document.querySelectorAll(".orderpads-wrapper .productgridwidget .tileparent").forEach((e=>{const t=e.querySelector(".inputquantity"),n=e.querySelector(".has-price");if(n){let r=e.querySelector(".total-price");r||(r=document.createElement("span"),r.classList.add("total-price"),n.insertAdjacentElement("afterend",r));const c=()=>{const e=n.textContent.trim(),c=(parseFloat(e.replace(/[^0-9.-]+/g,""))||0)*(parseInt(t.value,10)||0);r.textContent=c>0?`€${c.toFixed(2)}`:"€0.00"};t.addEventListener("change",c),t.addEventListener("input",c),c()}}))}),!1)})());