1function formDropdownClose(e){formDropdownToggle(e.parentNode.getElementsByClassName("form-dropdown-btn")[0])}function formDropdownChooseItem(e,t){e.preventDefault();e=t.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("form-dropdown-btn")[0];return e.innerHTML=t.text+"<span class='fa fa-angle-up'></span>",formDropdownToggle(e),gotToLinkWithSearchPrams(t.href),!1}function gotToLinkWithSearchPrams(t){if(t){var i=document.getElementById("search-bar");let e="";i.value&&(e="?q="+i.value),window.location.href=t+e}}function formDropdownToggle(e){var t=e.children,i=t[0].className,e=e.parentNode,s=e.getElementsByClassName("form-dropdown-menu")[0],e=e.getElementsByClassName("form-dropdown-btn-close")[0];"fa fa-angle-up"===i?(t[0].className="fa fa-angle-down",s.style.display="none",e.style.display="none"):(t[0].className="fa fa-angle-up",s.style.display="block",e.style.display="block")}function removeSelectItems(e){for(;e.options.length;)e.remove(0)}let cacheUserNameHelper={el:{login:document.getElementById("js-login-btn")},state:{isLogin:!1,dashboard:null},init:function(){this.el.login&&this.setUserName()},isLogin(){return this.state.isLogin},getPathToDashboard(){return this.state.dashboard},setUserName:function(){var e=window.localStorage.getItem("account.json");e&&this.renderUserName(JSON.parse(e)),fetch("/api/status/username").then(async e=>{var t;204===e.status?(window.localStorage.removeItem("account.json"),this.renderUserName(null)):200!==e.status?console.error("status: "+e.status):(e=await e.text(),t=JSON.parse(e),e?(window.localStorage.setItem("account.json",e),this.renderUserName(t)):this.renderUserName(null))})},renderUserName:function(e){e&&e.name?(this.state.isLogin=!0,this.state.dashboard=e.path,this.el.login.innerText=e.name,this.el.login.href=e.path):(this.state.isLogin=!1,this.el.login.innerText="Inloggen",this.el.login.href="/login",this.state.dashboard="/login")}},clientCards=(cacheUserNameHelper.init(),{init(){let i=document.getElementById("clientTrack");var t=document.querySelector(".client-nav-prev"),s=document.querySelector(".client-nav-next");if(i&&t&&s){let e=()=>{var e,t=i.querySelector(".client-card");return t?(e=parseInt(getComputedStyle(i).columnGap||30,10),t.offsetWidth+e):360};t.addEventListener("click",()=>i.scrollBy({left:-e(),behavior:"smooth"})),s.addEventListener("click",()=>i.scrollBy({left:e(),behavior:"smooth"}))}}}),cspMove={openCalendly(){document.querySelectorAll(".js-calendly-open").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),Calendly.initPopupWidget({url:"https://calendly.com/1stalling?hide_gdpr_banner=1"})})})}};class DemoBarPlanner{constructor(){let e=document.querySelector(".demo-bar-wrapper");var t=document.querySelector(".demo-close");e&&(window.addEventListener("scroll",()=>{e.classList.toggle("hidden",window.scrollY<=400)}),t?.addEventListener("click",()=>e.remove()))}}let enumList={country:{nl:"NL",be:"BE",de:"DE",fr:"FR",en:"EN",es:"ES"},price:{priceType:{fixed:"fixed",variable:"variable"}},group:{for:{vehicle:"vehicle",storage:"storage",marina:"marina",workspace:"workspace",passerby:"passerby",garagebox:"garagebox",parking:"parking",house:"house",boot_motor:"boot-motor",service:"service"}},type:{book_place_prefer:{yes:"yes",yes_map:"yes_map"}},typeInfo:{id:{caravan:1,camper:2,folding_trailer:3,car:4,boats:5,trailer:6,oldtimer:7,storage:8,motorbike:9,workspaces:10,marina:11,garagebox:12,office:17,watercraft:18,bootmotor:19},isVehicleOrMarina(e){return[1,2,3,4,5,6,7,9,11,18].includes(e)},isBootOrMarina(e){return[5,11].includes(e)},idToName(e){return{1:"Caravan",2:"Camper",3:"Vouwwagen",4:"Auto",5:"Boot",6:"Aanhanger",7:"Oldtimer",9:"Motor",11:"Jachthaven",18:"Waterscooter"}[e]}},user:{accountType:{private:"private",receiver:"receiver"}},package:{stopOption:{ticket:"ticket",instruction:"instruction"}},ticket:{reason:{other:0,not_needed:1,switch:2,sold:3,wrong_size:4,elsewhere:5,unsatisfied:6,bad_price:7}},appointment:{type:{bring_loc:"bring-loc",pickup_loc:"pickup-loc",workshop:"workshop"}},exportOption:{source:{invoice:"invoice",place:"place",article:"article",vehicle:"vehicle",invoice_open_post:"invoice_open_post",invoice_deposits:"invoice_deposits",user_note:"user_note",reservation_from:"reservation_from",chats:"chats",passerby:"passerby",appointment:"appointment",lead:"lead",reservation:"reservation",product:"product",relay_log:"relay_log",task:"task",vehicle_log:"vehicle_log",meter_log:"meter_log",reservation_feedback:"reservation_feedback"}},article:{type:{normal:"normal",service:"service",member:"member",rent:"rent",insurance:"insurance"},boxState:{no:"no",yes:"yes",yes_required:"yes_required"}},passerbyInfo:{priceType:{fixed:"fixed",variable:"variable"}},product:{frequency:{one_time:"eenmalig",month:"per maand",half_year:"per half jaar",quarter:"per kwartaal",year:"per jaar"}},reservation:{closeSettlement:{no:"no",restore:"restore",partial_credit:"partial_credit",final_settlement:"final_settlement",delete:"delete"}},invoice:{bundle:{normal:"normal",broken:"broken"}}};function faqStructToggle(e){var e=e.parentElement,t=e.classList.contains("active"),i=document.querySelectorAll(".faq-struct > div");return view.removeClass(i,"active"),t||e.classList.add("active"),!1}function faqToggle(e){var t=e.parentNode.getElementsByTagName("div")[0],s=document.getElementsByClassName("faq-answer"),a=document.getElementsByClassName("faq-question"),n="none"!==t.style.display;for(i=0;i<s.length;i++)s[i].style.display="none";for(i=0;i<a.length;i++)a[i].classList.remove("faq-line-icon-down");return n?t.style.display="none":(e.classList.add("faq-line-icon-down"),t.style.display="block"),!1}var formatHelper={volumeToNl:function(e){return e&&e.replace(".",",")}};let inputDateForState={transform(e,t){return"date"!==e.type&&t&&4===t.indexOf("-")?this.dateToNl(t):t},inputToDate(e){return 4===e.indexOf("-")?new Date(e):this.nlToDate(e)},dateToInput(e,t){return"date"===e.type?this.dateToEn(t):this.dateToNl(t)},dateToNl(e){var e=new Date(e),t=e.getDate(),i=e.getMonth()+1;return(t<10?"0"+t:t)+"-"+(i<10?"0"+i:i)+"-"+e.getFullYear()},dateToNlLocal(e){return new Date(e).toLocaleDateString("nl-NL",{day:"numeric",month:"short",year:"numeric"})},dateToEn(e){let t=""+(e.getMonth()+1),i=""+e.getDate(),s=e.getFullYear();return t.length<2&&(t="0"+t),i.length<2&&(i="0"+i),[s,t,i].join("-")},nlToDate(e){var e=e.split("-"),t=parseInt(e[0]),i=parseInt(e[1]),e=parseInt(e[2]);return new Date(e,i-1,t)},daysInYear(e){return e%400==0||e%100!=0&&e%4==0?366:365},diffInDay(e,t){return e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),t=new Date(t.getFullYear(),t.getMonth(),t.getDate()),Math.floor((t-e)/864e5)}},inputDateElements=document.getElementsByClassName("form-date");for(let e=0;e<inputDateElements.length;e++){let t=inputDateElements[e];if("date"!==t.type&&"datetime-local"!==t.type){if(""!==t.value){let e=t.value;e&&4===e.indexOf("-")&&(t.value=inputDateForState.dateToNl(e))}t.pattern||(t.pattern="(0[1-9]|1[0-9]|2[0-9]|3[01])-(0[1-9]|1[012])-[0-9]{4}")}else if(!t.classList.contains("form-date-no-reset")){let e=document.createElement("a");e.classList.add("form-date-reset"),e.addEventListener("click",function(e){t.value="",t.setAttribute("value",""),t.dispatchEvent(new Event("input")),t.dispatchEvent(new Event("change"))}),t.parentElement.appendChild(e)}}for(var inputTimeElements=document.getElementsByClassName("form-time"),i=0;i<inputTimeElements.length;i++){var inputTimeElement=inputTimeElements[i];"time"===inputTimeElement.type||inputTimeElement.pattern||(inputTimeElement.pattern="([01][0-9]|2[0-3]):[0-5][0-9]")}var menuBar={menuElements:document.getElementsByClassName("menu-item"),menuState:!1,toggle:function(){this.menuState=!this.menuState,this.render()},open:function(){this.menuState=!0,this.render()},close:function(){this.menuState=!1,this.render()},OnlyClose:function(){this.menuState&&this.close()},render:function(){this.renderMenu()},renderMenu:function(){for(var e in this.menuElements)this.menuElements.hasOwnProperty(e)&&(this.menuElements[e].style.display=this.menuState?"block":"none")}};let offerFilter={state:{typeInfoId:null},init(e){this.state.typeInfoId=e},resetFilter(e){gtag("event","click-offer-reset-filter-"+e),"price-from"===e&&(document.getElementById("filter-price-from").value=""),"price-to"===e&&(document.getElementById("filter-price-to").value=""),"distance"===e&&(document.getElementById("filter-distance").selectedIndex=0),"washing"===e&&(document.getElementById("filter-has-wash").checked=!1),"repair"===e&&(document.getElementById("filter-has-repair").checked=!1),"power"===e&&(document.getElementById("filter-has-power").checked=!1),"self-service"===e&&(document.getElementById("filter-has-self-service").checked=!1),"delivery-service"===e&&(document.getElementById("filter-has-delivery-service").checked=!1),"frost-free"===e&&(document.getElementById("filter-has-frost-free").checked=!1),"area-type"===e&&(document.getElementById("filter-area-type").selectedIndex=0),"ground-type"===e&&(document.getElementById("filter-ground-type").selectedIndex=0),"company-type"===e&&(document.getElementById("filter-company-type").selectedIndex=0),"volume-min"===e&&(document.getElementById("filter-volume-min").value=0),"volume-max"===e&&(document.getElementById("filter-volume-max").value=0),"square-min"===e&&(document.getElementById("filter-square-min").value=0),"square-max"===e&&(document.getElementById("filter-square-max").value=0),"volume-selection"===e&&(document.getElementById("filter-volume-selection").selectedIndex=0),"winter"==e&&(document.getElementById("filter-winter").checked=!1),"year-price"===e&&(document.getElementById("filter-year-price").checked=!1),this.updateFilter()},orderFilter(e){gtag("event","click-offer-order-filter-"+e.innerHTML);var t=document.getElementById("offer-order-holder");t.getAttribute("data-order-by")===e.innerHTML?this.orderFilterToggle():"afstand"===e.innerHTML?t.setAttribute("data-order-by","afstand"):"prijs"===e.innerHTML?t.setAttribute("data-order-by","prijs"):(t.setAttribute("data-order",""),t.setAttribute("data-order-by","")),this.updateFilter()},orderFilterToggle(){var e=document.getElementById("offer-order-holder");"desc"===e.getAttribute("data-order")?e.setAttribute("data-order","asc"):e.setAttribute("data-order","desc")},updateFilter(t){if("object"==typeof t){let e=null;t.id&&(e=t.id),(e=t.getAttribute("data-a-name")?t.getAttribute("data-a-name"):e)&>ag("event","click-offer-filter-"+e)}var t=document.getElementById("offer-order-holder").getAttribute("data-order-by"),e=document.getElementById("offer-order-holder").getAttribute("data-order"),i=parseInt(document.getElementById("filter-price-from").value),s=parseInt(document.getElementById("filter-price-to").value),a=document.getElementById("filter-volume-min"),n=document.getElementById("filter-volume-max"),r=document.getElementById("filter-volume-selection"),l=document.getElementById("filter-square-min"),o=document.getElementById("filter-square-max"),c=document.getElementById("filter-square-selection"),h=document.getElementById("filter-l"),d=document.getElementById("filter-w"),u=document.getElementById("filter-distance"),p=document.getElementById("filter-area-type"),m=document.getElementById("filter-ground-type"),g=document.getElementById("filter-company-type"),f=document.getElementById("filter-has-wash"),y=document.getElementById("filter-has-repair"),b=document.getElementById("filter-has-power"),v=document.getElementById("filter-has-self-service"),k=document.getElementById("filter-has-delivery-service"),_=document.getElementById("filter-has-frost-free"),S=document.getElementById("filter-winter"),L=document.getElementById("filter-year-price");let I=location.protocol+"//"+location.host+location.pathname;var w=[];i&&0<i&&w.push("prijs-van="+i),s&&0<s&&(i&&i<s||!i)&&w.push("prijs-tot="+s),r&&r.value?(i=r.value.split("-"),w.push("volume-van="+i[0]),w.push("volume-tot="+i[1])):(a&&a.value&&w.push("volume-van="+parseInt(a.value)),n&&n.value&&w.push("volume-tot="+parseInt(n.value))),c&&c.value?(s=c.value.split("-"),w.push("oppervlakte-van="+s[0]),w.push("oppervlakte-tot="+s[1])):(l&&l.value&&w.push("oppervlakte-van="+parseInt(l.value)),o&&o.value&&w.push("oppervlakte-tot="+parseInt(o.value))),h&&h.value&&h.getAttribute("data-default-value")!==h.value&&w.push("l="+h.value),d&&d.value&&d.getAttribute("data-default-value")!==d.value&&w.push("b="+d.value),u&&u.value&&w.push("afstand="+u.value),f&&f.checked&&w.push("wassen=ja"),y&&y.checked&&w.push("onderhoud=ja"),b&&b.checked&&w.push("stroom=ja"),b&&v.checked&&w.push("self-service=ja"),k&&k.checked&&w.push("haal-breng-service=ja"),_&&_.checked&&w.push("vorstvrij=ja"),S&&S.checked&&w.push("winter=ja"),L&&w.push("jaar-prijs="+(L.checked?"ja":"nee")),p&&p.value&&w.push("gebied="+p.value),m&&m.value&&w.push("ondergrond="+m.value),g&&g.value&&w.push("bedrijfstype="+g.value),t&&"prijs"===t&&w.push("order-op="+t),e&&"asc"!==e&&w.push("order="+e),w.length&&(I=I+"?"+w.join("&")),h&&localStorage.setItem("visitor-object-l-"+this.state.typeInfoId,h.value),d&&localStorage.setItem("visitor-object-w-"+this.state.typeInfoId,d.value),window.location.href=I}},onAction={init(){this.activeForPage()&&this.setListener()},activeForPage(){var e=document.location.pathname;return"/"===e||e.startsWith("/aanbod")},setListener(){document.body.addEventListener("keydown",this.keyDown.bind(this))},keyDown(e){e.target===document.body&&"?"===e.key&&e.shiftKey&&cacheUserNameHelper.isLogin()&&(document.location.href=cacheUserNameHelper.getPathToDashboard())}},panel=(onAction.init(),(oneSubmit={element:{forms:document.querySelectorAll("form")},state:{setLock:!1,lockSubmit:!0},init:function(){this.onSubmit()},onSubmit:function(){for(var e=this.element.forms,t=0;t<e.length;t++)e[t].addEventListener("submit",function(e){for(var t=this.querySelectorAll("input[type='submit']:not(.skip-one-submit)"),i=oneSubmit,s=0;s<t.length;s++)i.state.setLock||(t[s].setAttribute("data-restore-value",t[s].value),t[s].addEventListener("click",function(e){if(oneSubmit.state.lockSubmit)return console.log("skip click"),e.preventDefault(),!1})),t[s].classList.add("btn-disabled"),t[s].value="Verwerken...";i.state.setLock=!0,i.state.lockSubmit=!0})},restore:function(){this.state.lockSubmit=!1;for(var e=this.element.forms,t=0;t<e.length;t++)for(var i=document.querySelectorAll("input[type='submit']"),t=0;t<i.length;t++)i[t].classList.remove("btn-disabled"),i[t].value=i[t].getAttribute("data-restore-value")}}).init(),{idToOb(e){return document.getElementById(e)},show(e){e&&(e.style.display="")},hide(e,t){e?e.style.display="none":t||console.debug("panel missing",e)},set(e,t){return t?this.show(e):this.hide(e)},requiredChange(e,t){e&&(e.required=t)}}),panelClass={show(e){e.classList.contains("show")||e.classList.add("show")},hide(e,t){e.classList.contains("show")&&e.classList.remove("show")},toggle(e){e.classList.toggle("show")}},priceHelper={priceTypeFixed:"fixed",priceTypeVariable:"variable",priceTypeVariableM2:"variable-m2",fromCentToNl(e,t){return this.toNl(e/100,t)},toNl(e,t){return e&&0!=e?"number"==typeof(e="string"==typeof e?parseFloat(e.replace(",",".")):e)?e.toFixed(2).replace(".",","):null:t?null:0},centToEuroLongNl(e){return e?new Intl.NumberFormat("nl-NL",{style:"currency",currency:"EUR",minimumFractionDigits:0}).format(e/100):"-"},centToLongNl(e){return e?new Intl.NumberFormat("nl-NL",{style:"currency",currency:"EUR"}).format(e/100):"-"}
1,toFloat(e){if("string"==typeof e&&(e=e.replace(".",""),e=parseFloat(e.replace(",","."))),"number"==typeof e)return e.toFixed(2)}},pricingSlider={init(){var n=document.querySelectorAll(".pricing-slider");if(0<n.length)for(let a=0;a<n.length;a++){var r=n[a];let e={el:r.querySelector("input")},t=(e.data=JSON.parse(e.el.getAttribute("data-price-input")),e.currentValEl=r.querySelector(".pricing-slider-value"),r.closest(".pricing-v2, .pricing-slider-section, section")),i=t?t.querySelector("#billing-toggle"):null;var l=t.querySelectorAll(".pricing-item-price");let s=[];for(let e=0;e<l.length;e++){var o=l[e],c={};c.el=o,c.currency=o.querySelector(".pricing-item-price-currency"),c.amount=o.querySelector(".pricing-item-price-amount"),c.after=o.querySelector(".pricing-item-price-after"),s.push(c)}e.el.setAttribute("min",0),e.el.setAttribute("max",Object.keys(e.data).length-1),e.el.getAttribute("value")||e.el.setAttribute("value",0),h(e,s,i,t),e.el.addEventListener("input",function(){h(e,s,i,t)}),i&&i.addEventListener("change",function(){h(e,s,i,t)})}function h(t,i,e,s){let a=!!e&&e.checked,n=a?"yearly":"monthly";t.currentValEl.innerHTML=t.data[t.el.value];for(let e=0;e<i.length;e++){var r=i[e],l=a?r.el.getAttribute("data-price-output-yearly")||r.el.getAttribute("data-price-output-monthly")||r.el.getAttribute("data-price-output"):r.el.getAttribute("data-price-output-monthly")||r.el.getAttribute("data-price-output");r.data=JSON.parse(l),r.currency&&(r.currency.innerHTML=r.data[t.el.value][0]),r.amount&&(r.amount.innerHTML=r.data[t.el.value][1]),r.after&&(r.after.innerHTML=r.data[t.el.value][2])}s&&(s.querySelectorAll("[data-billing-label]").forEach(e=>{e.classList.toggle("active",e.getAttribute("data-billing-label")===n)}),s.querySelectorAll(".table-price-monthly").forEach(e=>{e.style.display=a?"none":""}),s.querySelectorAll(".table-price-yearly").forEach(e=>{e.style.display=a?"":"none"}))}}};for(let e of document.querySelectorAll('input[type="range"].slider-progress'))e.style.setProperty("--value",e.value),e.style.setProperty("--min",""==e.min?"0":e.min),e.style.setProperty("--max",""==e.max?"9":e.max),e.addEventListener("input",()=>e.style.setProperty("--value",e.value));let reqHelper={debug:!1,getJson(e,t,i,s){return this.get(e,async function(e){t(await e.json())},i,s)},get(e,t,i,s){var a=new AbortController,e=new Request(e,{method:"get",signal:a.signal});return this.call(e,t,i,s,a)},call(e,t,i,s,a){s&&s.abortController&&(this.debug&&console.log("REQ: abort",s),s.abortController.abort("new request"));var n=()=>{fetch(e).then(e=>{t&&t(e)}).catch(e=>{console.log("REQ err:",e)})};let r=null;return i?(s&&s.delayTimer&&(this.debug&&console.log("REQ: delay stop prerivius"),clearTimeout(s.delayTimer)),r=setTimeout(n.bind(this),i)):n(),{delayTimer:r,abortController:a,request:e}}},requestHelper={getJson:function(t,e){t=this.get(t,e);if(t)try{return JSON.parse(t.responseText)}catch(e){console.error("request or json failed",t.responseURL,e)}},get:function(e,t){t=this.do(e,t,!1);return console.debug("request: ",e,t.status),200!=t.status?null:t},do:function(e,t,i){var s;if(e)return(s=new XMLHttpRequest).onreadystatechange=t,s.open("GET",e,i),void 0!==window._language&&s.setRequestHeader("X-Accept-Language",language().getLanguageCode()),s.send(),s},post:function(e,t,i,s,a){var n;if(e)return(n=new XMLHttpRequest).onreadystatechange=i,n.open("POST",e,s),n.setRequestHeader("Content-Type","application/json"),void 0!==window._language&&n.setRequestHeader("X-Accept-Language",language().getLanguageCode()),a&&n.setRequestHeader("X-CSRF-TOKEN",a),n.send(t),console.debug("request post: ",e,n.status),n},getOb:function(e){return{url:e,data:this.getJson(e)}},async getFetchJson(e){var t={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}};return void 0!==window._language&&(t.headers["X-Accept-Language"]=language().getLanguageCode()),(await fetch(e,t)).json()},async getFetchJsonOb(e){e=await fetch(e);return{response:e,json:await e.json()}},async postFetch(e,t,i){e={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-CSRF-TOKEN":e},body:JSON.stringify(i)};return void 0!==window._language&&(e.headers["X-Accept-Language"]=language().getLanguageCode()),fetch(t,e)}};var scrollAction={set:function(i,s){window.addEventListener("scroll",function(e){var t=document.getElementById(i);window.scrollY>s?t.classList.add("show"):t.classList.remove("show")})}};let selectHelper={removeAll(e){for(;e.options.length;)e.remove(0)},add(e,t,i,s,a,n){var r=document.createElement("option");r.value=t,n?r.dataset.trans=i:r.text=i,a&&(r.disabled=!0),s&&(r.selected="selected"),e.add(r)},selectedByValue(e,t){for(var i,s=e.options,a=0;i=s[a];a++)if(i.value==t){e.selectedIndex=a;break}},onchangeGEvent:function(e,t){e=e.value;gtag("event","onchange-"+t+"-"+e)}},showSlide={el:{closeBtn:document.getElementById("btn-close"),container360:document.getElementById("container360"),fotoShow:document.getElementById("foto-show"),inSlide:{photo:document.getElementById("slide-in-open-photo"),b360:document.getElementById("slide-in-open-360"),video:document.getElementById("slide-in-open-video")},photo:{previous:document.getElementById("sheet-photo-previous"),next:document.getElementById("sheet-photo-next")},b360:{container:document.getElementById("container360")}
1,btnBar:{photo:document.getElementById("slide-open-photo"),b360:document.getElementById("slide-open-360"),video:document.getElementById("slide-open-video")}},config:{swipeOffset:100},state:{show:!1,photoIndex:0,type:null,b360ImageList:[],b360ImageUrl:""},init(){this.setListener()},setListener(){this.el.closeBtn.addEventListener("click",this.actionClose.bind(this)),document.addEventListener("keydown",this.actionKeyDown.bind(this)),this.el.photo.previous&&this.el.photo.next&&(this.el.photo.previous.addEventListener("click",this.actionPushSlide.bind(this,-1)),this.el.photo.next.addEventListener("click",this.actionPushSlide.bind(this,1))),this.el.btnBar.photo&&this.el.btnBar.photo.addEventListener("click",this.actionOpen.bind(this,"photo",0)),this.el.btnBar.b360&&this.el.btnBar.b360.addEventListener("click",this.actionOpen.bind(this,"360",1)),this.el.btnBar.video&&this.el.btnBar.video.addEventListener("click",this.actionOpen.bind(this,"video",0)),this.el.inSlide.photo&&this.el.inSlide.photo.addEventListener("click",this.actionOpen.bind(this,"photo",0)),this.el.inSlide.b360&&this.el.inSlide.b360.addEventListener("click",this.actionOpen.bind(this,"360",0)),this.el.inSlide.video&&this.el.inSlide.video.addEventListener("click",this.actionOpen.bind(this,"video",0));var t=document.querySelectorAll(".offer-show-limit img");for(let e=0;e<t.length;e++)t[e].addEventListener("click",this.actionOpen.bind(this,"photo",e));var i=document.querySelectorAll("#sheet-photo .slide-show-box-btn .btn-nav-choose");for(let e=0;e<i.length;e++)i[e].addEventListener("click",this.actionOpen.bind(this,"photo",e));var s=document.querySelectorAll("#sheet-360 .slide-show-box-btn .btn-nav-choose");for(let e=0;e<s.length;e++)s[e].addEventListener("click",this.actionOpen.bind(this,"360",e));var e=document.getElementById("slide-show-swipe");let a=0;e.addEventListener("touchstart",e=>{a=e.changedTouches[0].screenX}),e.addEventListener("touchend",function(e){e=e.changedTouches[0].screenX,e=a-e;Math.abs(e)>this.config.swipeOffset&&this.actionPushSlide(0<e?1:-1)}.bind(this))},actionKeyDown(e){this.state.type&&("ArrowLeft"===e.key&&this.actionPushSlide(-1),"ArrowRight"===e.key&&this.actionPushSlide(1),"Escape"===e.key)&&this.actionClose()},actionOpen(e,t){this.stopYoutube(),panel.show(this.el.fotoShow),this.el.fotoShow.style.display="block",this.renderSlideBox(e,t),document.body.style.position="fixed",this.state.type=e},actionClose(){this.el.container360.innerHTML="",this.el.fotoShow.style.display="none",this.stopYoutube(),document.body.style.position="relative",this.state.type=null},actionPushSlide(e){this.state.photoIndex+=e,this.renderPhotoSlide()},stopYoutube(){if("video"===this.state.type){var t=document.querySelectorAll(".youtube-movie-item");for(let e=0;e<t.length;e++)t[e].src=t[e].src}},renderSlideBox(t,e){this.state.photoIndex=e;var i=document.getElementsByClassName("slide-show-sheet");for(let e=0;e<i.length;e++)i[e].style.display="none";var s=document.getElementsByClassName("btn-nav-option");for(let e=0;e<s.length;e++)s[e].dataset.select===t?s[e].classList.add("active"):s[e].classList.remove("active");"photo"===t&&(document.getElementById("sheet-photo").style.display="block",this.renderPhotoSlide()),"360"===t&&(document.getElementById("sheet-360").style.display="block",this.render360(e)),"video"===t&&(document.getElementById("sheet-film").style.display="block")},renderPhotoSlide(){var t=document.querySelectorAll("#sheet-photo .slide-item"),e=document.querySelectorAll("#sheet-photo .btn-nav-choose");this.state.photoIndex>=t.length&&(this.state.photoIndex=0),this.state.photoIndex<0&&(this.state.photoIndex=t.length-1);for(let e=0;e<t.length;e++)t[e].style.display="none";e.forEach(e=>{e.classList.remove("active")}),e[this.state.photoIndex].classList.add("active"),t[this.state.photoIndex].style.display="block"},render360(e){e++;document.querySelectorAll("#sheet-360 .slide-item");var t=document.querySelectorAll("#sheet-360 .btn-nav-choose");let i=this.el.b360.container.clientHeight,s=this.el.b360.container.clientWidth;this.el.b360.container.innerHTML="";var e=this.state.b360ImageList[e],a=e.start_point||0;let n=new Kaleidoscope.Image({source:this.state.b360ImageUrl+e.number+".jpg",containerId:"#container360",height:i,width:s,initialYaw:a});n.render(),window.onresize=function(){i=this.el.b360.container.clientHeight,s=this.el.b360.container.clientWidth,n.setSize({height:i,width:s})}
1.bind(this),t.forEach(e=>{e.classList.remove("active")}),t[this.state.photoIndex].classList.add("active")}},stringHelper={UppercaseFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)},nl2Br(e){return e?e.replace(/(?:\r\n|\r|\n)/g,"<br>"):""}};(tabOpeningHours={currentSheetName:null,render:function(){for(sheet=document.getElementById("tab-opening-sheet-"+this.currentSheetName),sheets=document.getElementsByClassName("tab-sheet"),i=0;i<sheets.length;i++)sheets[i].style.display="none";if(sheet&&(sheet.style.display="block"),menu=document.getElementById("tab-menu"),sheet&&menu)for(buttons=menu.children,i=0;i<buttons.length;i++)buttons[i].className=buttons[i].className.replace(" active",""),buttons[i].getAttribute("data-name")==this.currentSheetName&&(buttons[i].className=buttons[i].className+=" active")},open:function(e){this.currentSheetName="object"==typeof e?e.getAttribute("data-name"):e,gtag("event","click-type-tab-open-"+this.currentSheetName),this.render()},firstTime:function(e,t){this.currentSheetName=e,document.getElementById("tab-opening-sheet-a")||(this.currentSheetName=t),this.render()}}).firstTime("a","b");var textCollapse={actionClick:function(e){var t=e.parentElement;if(t)return(t=(t=t.getElementsByClassName("text-collapse-content"))&&t[0]?t[0]:t).classList.contains("expanded")?(t.classList.remove("expanded"),e.classList.remove("back")):(t.classList.add("expanded"),e.classList.add("back")),!1;console.log("textCollapse: parent object is missing",e)}};let tip={init(){var t=document.querySelectorAll("[data-tip].tip");for(let e=0;e<t.length;e++){var i=t[e],s=document.createElement("button"),a=document.createElement("button"),n=document.createElement("div");s.type="button",s.classList.add("btn-no","btn-white-dark","btn-xs","fa","fa-info"),s.addEventListener("click",panelClass.toggle.bind(this,n)),a.type="button",a.addEventListener("click",panelClass.hide.bind(this,n)),a.innerHTML="Sluit",n.classList.add("tip-cont","below"),n.innerHTML=i.getAttribute("data-tip"),n.append(a),i.append(s),i.append(n)}}},toast=(tip.init(),{el:{toast:document.createElement("div")},state:{running:!1,list:[]},init(){this._stuck()},info(e,t){this.show("info",e,t)},success(e,t){this.show("success",e,t)},warning(e,t){this.show("warning",e,t)},error(e,t){this.show("error",e,t)},show(e,t,i){this.state.list.push({type:e,time:i,text:t}),this._run()},_stuck(){this.el.toast.id="toast-msg",document.body.append(this.el.toast)},_run(){if(!this.state.running){this.state.running=!0;let e=this.state.list.shift();var t;e?(this.el.toast.classList.add("show"),this.el.toast.classList.add(e.type),this.el.toast.innerHTML=e.text,t=1e3*(e.time||4),setTimeout(function(){this.el.toast.classList.remove("show"),this.el.toast.classList.remove(e.type),0!==this.state.list.length?setTimeout(function(){this.el.toast.style.display="",this.state.running=!1,this._run()}.bind(this),500):this.state.running=!1}.bind(this),t)):this.state.running=!1}}}),jsCl=(toast.init(),{toggle(e,t){document.getElementById(e).classList.toggle(t)}});class Uploader{uploadHandler=null;progressBarEl=null;constructor(e,t,i,s,a,n){if(!s)throw new Error("No upload handler set.");this.uploadHandler=s,this.progressBarEl=i,this.afterUploadHandler=a,e.addEventListener("click",()=>{t.click()}),t.addEventListener("change",e=>{e=Array.from(e.target.files);t.value="",this.uploadFiles(e).then(e=>{setTimeout(()=>{n&&n(!1,e)},200)}).catch(e=>{n&&n(e.message,null)}).finally(()=>{setTimeout(()=>{this.progressBarEl.classList.remove("show")},1e3)})})}async uploadFiles(t){var e=this.progressBarEl,s=e.querySelector(".progress"),a=e.querySelector(".status");let n="";s.style.width="0%",e.classList.add("show");var r=t.length;if(a.innerText="0/"+r,r){let e=0;for(let i of t)try{let t=await ImageTools.resizeAndConvert(i,2e3,2e3).catch(e=>{console.warn("Could not resize file. Falling back to original. Error: "+e.message),t=i});var l=await this.uploadHandler(t),o=(l.ok?this.afterUploadHandler&&this.afterUploadHandler(l):(console.error("Failed to upload "+i.name,l),n+="Fout "+l.status+": "+i.name+" kon niet geupload worden."),e++,Math.round(e/r*100));s.style.width=o+"%",a.innerText=e+"/"+r}catch(e){console.error("Failed to upload "+i.name,e),n+="Fout: "+i.name+" kon niet geupload worden. "}if(n)throw new Error(n)}}}class ImageTools{static async resizeAndConvert(e,t,i,s={}){var{type:s="image/jpeg",quality:a=1}=s,n=await createImageBitmap(e),r=n.width,l=n.height,t=Math.min(t/r,i/l,1),r=Math.round(r*t),l=Math.round(l*t),i=new OffscreenCanvas(r,l),t=(i.getContext("2d").drawImage(n,
10,0,r,l),await i.convertToBlob({type:s,quality:a}));return n.close?.(),new File([t],e.name,{type:s})}}var view={show:function(e){e.style.display=""},hide:function(e){e.style.display="none"},removeClass:function(e,t){for(var i=0;i<e.length;i++)e[i].classList.remove(t)}};let bookView={el:{conform:{title:document.getElementById("conform-title"),line_1:document.getElementById("conform-line_1"),line_2:document.getElementById("conform-line_2"),cost:document.getElementById("conform-cost"),deposit:document.getElementById("conform-deposit"),startup:document.getElementById("conform-startup"),service:document.getElementById("conform-service"),allowance:document.getElementById("conform-allowance"),discount:document.getElementById("conform-discount"),startDate:document.getElementById("conform-start_date"),conformExtra:document.getElementById("conform-extra")},error:{welcome:document.querySelector(".error-box-welcome"),account:document.querySelector(".error-box-account"),storage:document.querySelector(".error-box-storage"),vehicle:document.querySelector(".error-box-vehicle"),extra:document.querySelector(".error-box-extra"),conform:document.querySelector(".error-box-conform")},img:document.querySelector(".box-info"),btn:{nextList:document.querySelectorAll(".js-btn-next"),mapOpen:document.getElementById("show-map"),mapOpenNoOption:document.getElementById("show-map-no-option"),mapClose:document.getElementById("map-close-btn")},btnBar:{mapTap:document.getElementById("map-tab-holder")},message:{rentPackage:document.getElementById("message-rent-package"),storageNoOptions:document.getElementById("message-storage-no-option"),storageStartDate:document.getElementById("message-storage-start_date"),workspaceNoOptions:document.getElementById("message-workspace-no-option"),accountMailNotValid:document.getElementById("message-account-email-no-valid")},panel:{newCustomer:document.getElementById("panel-new-customer"),showDiscount:document.getElementById("panel-show-discount"),inputDiscount:document.getElementById("panel-input-discount"),welcomeType:document.getElementById("panel-welcome-type"),welcomeFull:document.getElementById("panel-welcome-full"),storagePackage:document.getElementById("panel-storage-package"),storagePlace:document.getElementById("panel-storage-place"),workspacePackage:document.getElementById("panel-workspace-package"),vehicleBoat:document.getElementById("panel-vehicle-boat"),vehicleSize:document.getElementById("panel-vehicle-size"),license:document.getElementById("panel-license_plate"),conformDeposit:document.getElementById("conform-deposit-panel"),conformStartup:document.getElementById("conform-startup-panel"),conformService:document.getElementById("conform-service-panel"),conformAllowance:document.getElementById("conform-allowance-panel"),conformExtra:document.getElementById("conform-extra-panel"),map:document.getElementById("map"),boxForm:document.getElementById("panel-box-form"),extraList:document.getElementById("panel-extra-list")},title:{rent:document.getElementById("sheet-title-rent"),vehicle:document.getElementById("sheet-title-vehicle")},usp:document.querySelectorAll(".box-usp"),resultKvk:document.getElementById("result-kvk"),resultKvkBg:document.getElementById("result-kvk-bg"),messagePrice:document.getElementById("message-price"),messagePlace:document.getElementById("message-place")},field:{type:document.querySelector("select[name=type]"),location:document.querySelector("select[name=location]"),startDate:document.querySelector("input[name=start_date]"),package:document.querySelector("select[name=package]"),priceId:document.querySelector("select[name=price_id]"),place:document.querySelector("select[name=place]"),email:document.querySelector("input[name=email]"),accountType:document.querySelector("select[name=account_type]"),companyName:document.querySelector("input[name=company_name]"),kvk:document.querySelector("input[name=kvk]"),firstName:document.querySelector("input[name=first_name]"),lastName:document.querySelector("input[name=last_name]"),mobile:document.querySelector("input[name=mobile]"),mobileCounty:document.querySelector("select[name=mobile_country]"),zipcode:document.querySelector("input[name=zipcode]"),number:document.querySelector("input[name=number]"),street:document.querySelector("input[name=street]"),city:document.querySelector("input[name=city]"),vehicleTypeDisabled:document.querySelector("input[name=vehicle_type_disabled]"),license_plate:document.querySelector("input[name=license_plate]"),license_plate_country:document.querySelector("select[name=license_plate_country]"),length_cm:document.querySelector("input[name=length_cm]"),width_cm:document.querySelector("input[name=width_cm]"),height_cm:document.querySelector("input[name=height_cm]"),brand:document.querySelector("input[name=brand]"),model:document.querySelector("input[name=model]"),boot_name:document.querySelector("input[name=boot_name]"),registration_no:document.querySelector("input[name=registration_no]"),mast_length_cm:document.querySelector("input[name=mast_length_cm]"),draft_cm:document.querySelector("input[name=draft_cm]"),description:document.querySelector("textarea[name=description]"),discountCode:document.querySelector("input[name=discount_code]"),verificationCode:document.querySelector("input[name=verification_code]")},col:{company:document.getElementById("company-col")},sheet:{all:document.querySelectorAll(".sheet")},state:{sheet:null,location:null,type:null,startDate:null,package:null,priceId:null,placeId:null,extraLoadType:null,extraLoadFrequency:null,email:null,isNewCustomer:null,isNotValidEmail:null,isPrivate:null,accountType:null,companyName:null,kvk:null,firstName:null,lastName:null,mobile:null,mobileCountry:null,zipcode:null,number:null,street:null,city:null,length_cm:null,width_cm:null,height_cm:null,brand:null,model:null,boot_name:null,registration_no:null,mast_length_cm:null,draft_cm:null,license_plate:null,license_plate_country:null,description:null,discountCode:null,discountCodeAuto:!1,currentPrice:null,currentLocationOb:{id:null,for:[]},currentLocationTypeOb:{online:null,map:[]},articleIdList:[],emailPreviousCheck:null,verificationCode:null,errors:null,showNextButton:!0,mapInit:!1,currentMapId:null,currentMapTypeId:null},json:{locationTypeList:null},request:{place:{url:null,data:null},created:{status:null,is_login:null,link:null},discount:{code:null,title:null},address:{url:null,data:{postcode:null,number:null,street:null,city:null},timeout:null},company:{url:null,data:[{business_name:null,kvk:null,city:null,street:null}],timeout:null}},enum:{sheet:{welcome:"welcome",rent:"rent",vehicle:"vehicle",account:"account",extra:"extra",conform:"conform",send:"send"}},prefer:{type:null,date:null,square:null,volume:null,locationId:null,priceId:null,packageId:null,email:null,csrf:null},init(){this.setDefault(),this.setListener(),this.updateState(),this.render(),this.renderUsp(),this.mapClose()},updateState(){this.setState(),this.requestData()},setDefault(){this.state.sheet=this.enum.sheet.welcome,this.json.locationTypeList&&1===this.json.locationTypeList.length&&1===this.json.locationTypeList[0].for.length&&(e=this.json.locationTypeList[0].for[0],this.prefer.type=e.type_info_
1id,this.state.sheet=enumList.typeInfo.isVehicleOrMarina(this.prefer.type)?this.enum.sheet.vehicle:this.enum.sheet.rent);var e=new URLSearchParams(window.location.search);if(e.has("type_info_id")){let t=parseInt(e.get("type_info_id"));var i=this.json.locationTypeList.find(e=>e.id===this.prefer.locationId);(i?i.for.find(e=>e.type_info_id===t):null)?(this.prefer.type=t,this.state.sheet=enumList.typeInfo.isVehicleOrMarina(this.prefer.type)?this.enum.sheet.vehicle:this.enum.sheet.rent):console.debug("Unknown type",i)}e.has("volume")&&(this.prefer.type=enumList.typeInfo.id.storage,this.prefer.volume=parseFloat(e.get("volume")),this.state.sheet=this.enum.sheet.rent),e.has("square")&&(this.prefer.type=enumList.typeInfo.id.workspace,this.prefer.square=parseFloat(e.get("square"))),e.has("date")&&(i=inputDateForState.dateToEn(new Date(e.get("date"))),this.prefer.date=i,this.field.startDate.value=i),e.has("typeId")&&(this.prefer.type=parseInt(e.get("typeId"))),e.has("type_id")&&(this.prefer.type=parseInt(e.get("type_id"))),e.has("package_id")&&(this.prefer.packageId=parseFloat(e.get("package_id"))),e.has("price_id")&&(this.prefer.priceId=parseFloat(e.get("price_id"))),panel.hide(this.el.panel.showDiscount),panel.hide(this.el.resultKvk),panel.hide(this.el.resultKvkBg),this.el.resultKvkBg.onclick=this.onCompanyAutoComplete.bind(this,null)},setListener(){this.field.package.addEventListener("change",this.onFieldChange.bind(this)),this.field.priceId.addEventListener("change",this.onFieldChange.bind(this)),this.field.location.addEventListener("change",this.onFieldChange.bind(this)),this.field.type.addEventListener("change",this.onFieldChange.bind(this)),this.field.accountType.addEventListener("change",this.onFieldChange.bind(this)),this.field.email.addEventListener("keyup",this.onMailChange.bind(this)),this.field.startDate.addEventListener("change",this.onFieldChange.bind(this)),this.field.zipcode.addEventListener("keyup",this.onFieldZipcode.bind(this)),this.field.number.addEventListener("keyup",this.onFieldZipcode.bind(this)),this.field.companyName.addEventListener("keyup",this.onFieldCompanyName.bind(this)),this.el.btn.mapOpen.addEventListener("click",this.onMapOpen.bind(this)),this.el.btn.mapOpenNoOption.addEventListener("click",this.onMapOpen.bind(this)),this.el.btn.mapClose.addEventListener("click",this.mapClose.bind(this))},setState(){this.state.description=this.field.description.value||null,this.state.discountCode=this.field.discountCode.value?this.field.discountCode.value.toUpperCase():null,this.state.startDate=this.field.startDate?this.field.startDate.value:this.prefer.date,this.state.packageId=this.field.package.value?parseFloat(this.field.package.value):null,this.state.priceId=this.field.priceId.value?parseInt(this.field.priceId.value):null,this.state.placeId=this.field.place.value?parseInt(this.field.place.value):null,this.state.location=this.field.location.value?parseInt(this.field.location.value):this.prefer.locationId,this.state.type=this.field.type&&this.field.type.value?parseInt(this.field.type.value):this.prefer.type,this.state.verificationCode=this.field.verificationCode?this.field.verificationCode.value:null,this.state.sheet===this.enum.sheet.account&&(this.state.email=this.field.email?this.field.email.value:this.prefer.email,this.state.isPrivate=this.field.accountType?[enumList.user.accountType.private,enumList.user.accountType.receiver].includes(this.field.accountType.value):null,this.state.accountType=this.field.accountType?this.field.accountType.value:null,this.state.companyName=this.field.companyName?this.field.companyName.value:null,this.state.kvk=this.field.kvk?this.field.kvk.value:null,this.state.firstName=this.field.firstName?this.field.firstName.value:null,this.state.lastName=this.field.lastName?this.field.lastName.value:null,this.state.mobile=this.field.mobile?this.field.mobile.value:null,this.state.mobileCountry=this.field.mobileCounty?this.field.mobileCounty.value:null,this.state.zipcode=this.field.zipcode?this.field.zipcode.value:null,this.state.number=this.field.number?this.field.number.value:null,this.state.street=this.field.street?this.field.street.value:null,this.state.city=this.field.city?this.field.city.value:null,null===this.state.isNewCustomer)&&this.onMailChange(),enumList.typeInfo.isVehicleOrMarina(this.state.type)?(this.state.length_cm=this.field.length_cm?this.field.length_cm.value:null,this.state.width_cm=this.field.width_cm?this.field.width_cm.value:null,this.state.height_cm=this.field.height_cm?this.field.height_cm.value:null,this.state.brand=this.field.brand?this.field.brand.value:null,this.state.model=this.field.model?this.field.model.value:null,this.state.boot_name=this.field.boot_name?this.field.boot_name.value:null,this.state.registration_no=this.field.registration_no?this.field.registration_no.value:null,this.state.mast_length_cm=this.field.mast_length_cm?this.field.mast_length_cm.value:null,this.state.draft_cm=this.field.draft_cm?this.field.draft_cm.value:null,this.state.license_plate=this.field.license_plate?this.field.license_plate.value:null,this.state.license_plate_country=this.field.license_plate_country?this.field.license_plate_country.value:null):(this.state.length_cm=null,this.state.width_cm=null,this.state.height_cm=null,this.state.brand=null,this.state.model=null,this.state.boot_name=null,this.state.registration_no=null,this.state.mast_length_cm=null,this.state.draft_cm=null,this.state.license_plate=null,this.state.license_plate_country=null)},requestData(){var t;if(this.state.sheet===this.enum.sheet.rent)if(this.state.location){let e="";enumList.typeInfo.isVehicleOrMarina(this.state.type)&&(e="?l="+(this.state.length_cm||402)+(this.state.width_cm?"&w="+this.state.width_cm:"")+(this.state.height_cm?"&h="+this.state.height_cm:"")),t="/api/book/place/"+this.state.location+"/"+this.state.type+"/"+this.state.startDate+e,this.request.place.url!==t&&(this.request.place=requestHelper.getOb(t))}else console.error("missing location id",this.state)},onMailChange(){var e;this.state.email=this.field.email?this.field.email.value:null,this.state.email!=this.state.emailPreviousCheck&&(this.state.isNewCustomer=!1,this.state.showNextButton=!1,e=this.state.email&&/^.{2,}\@.{2,}\.\w{2,}
1$/.test(this.state.email),this.state.isNotValidEmail=!e,this.render(),e?requestHelper.getFetchJson("/api/book/u/"+this.state.location+"/"+this.state.email).then(e=>{this.state.emailPreviousCheck=this.state.email,this.state.isNotValidEmail=!1,this.state.showNextButton=!0,this.state.isNewCustomer=!e.o,this.render()}).catch(e=>console.error(e)):this.state.emailPreviousCheck=null)},onFieldChange(e){this.prefer.volume&&e&&e.target===this.field.priceId&&(this.prefer.volume=null),this.updateState(),this.render()},onFieldCompanyName(){if(this.setState(),panel.hide(this.el.resultKvk),panel.hide(this.el.resultKvkBg),this.state.companyName){let e="/api/book/company/"+this.state.companyName;this.request.company.url!==e&&(this.request.company.url=e,this.request.company.timeout&&clearTimeout(this.request.company.timeout),this.request.company.timeout=setTimeout(()=>{requestHelper.getFetchJsonOb(e).then(e=>{panel.hide(this.el.resultKvk),panel.hide(this.el.resultKvkBg),200===e.response.status&&e.json.data&&(this.request.company.data=e.json.data,panel.show(this.el.resultKvk),panel.show(this.el.resultKvkBg),this.el.resultKvk.innerHTML=null,this.request.company.data.forEach(function(e){var t=document.createElement("div");t.innerHTML=e.business_name+" in "+e.city,t.onclick=this.onCompanyAutoComplete.bind(this,e.kvk),this.el.resultKvk.append(t)}.bind(this)))}).catch(e=>console.error(e))},400))}else this.request.company.timeout&&clearTimeout(this.request.company.timeout)},onCompanyAutoComplete(t){var e=this.request.company.data.find(function(e){return e.kvk===t});e&&(this.field.companyName.value=e.business_name,this.field.kvk.value=e.kvk,this.field.city.value=e.city,this.field.street.value=e.street),panel.hide(this.el.resultKvk),panel.hide(this.el.resultKvkBg)},onFieldZipcode(){if(this.setState(),!this.state.zipcode||this.state.zipcode.length<6||!this.state.number)this.request.address.timeout&&clearTimeout(this.request.address.timeout);else{let e="/api/book/address/"+this.state.zipcode+"/"+this.state.number;this.request.address.url!==e&&(this.request.address.url=e,this.request.address.timeout&&clearTimeout(this.request.address.timeout),this.request.address.timeout=setTimeout(()=>{requestHelper.getFetchJsonOb(e).then(e=>{200!==e.response.status?(this.field.street.value="",this.field.city.value=""):e.json.data&&(this.request.address.data=e.json.data,this.field.zipcode.value=this.request.address.data.postcode,this.field.number.value=this.request.address.data.number,this.field.street.value=this.request.address.data.street,this.field.city.value=this.request.address.data.city)}).catch(e=>console.error(e))},400))}},onMapOpen(e,t){var i;this.setSheetMapStatus(!0),e&&t?window.bookViewStub.que.push(()=>{panel.show(bookView.el.panel.map),bookMap.init(e,t),this.state.mapInit=!0}):(panel.show(bookView.el.panel.map),(i=this.getTypeInfo()).type_id!==this.state.currentMapTypeId&&(this.state.mapInit=!1,this.state.currentMapTypeId=i.type_id),!this.state.mapInit&&this.state.currentMapId&&this.state.currentMapTypeId&&(bookMap.init(this.state.currentMapId,this.state.currentMapTypeId),this.state.mapInit=!0)),setTimeout(()=>{window.bookViewStub.que.push(()=>{bookMap.resizeCanvas(),bookMap.render()})},220)},mapClose(){this.setSheetMapStatus(!1),panel.hide(this.el.panel.map)},setSheetMapStatus(e){var t=document.querySelector(".box-form");t&&(e?t.classList.add("map-open"):t.classList.remove("map-open"))},onUsePlace(t,e){var i=this.state.packageId;let s=null,a=null,n=(e&&(this.state.startDate=new Date(e),this.field.startDate.value=inputDateForState.dateToEn(this.state.startDate),this.onFieldChange()),!1);for(let e=0;e<this.request.place.data.list.length;e++){var r=this.request.place.data.list[e];for(let e=0;e<r.prices.length;e++){var l=r.prices[e];for(let e=0;e<l.places.length;e++){var o=l.places[e];if(o.place_id===t&&(s||(s=r.package_id,a=l.price_id),i===r.package_id)){s=r.package_id,a=l.price_id,n=!0;break}if(n)break}if(n)break}if(n)break}this.state.packageId=s,this.state.priceId=a,this.state.placeId=t,this.renderSheetRent(),this.state.showNextButton=!0,this.renderNextButton(),this.isMobielWith()&&this.mapClose()},actionResendVerification(){requestHelper.postFetch(this.prefer.csrf,"/api/book/code-resend",{mail:this.state.email,location_id:this.state.location}).then(e=>{alert(__("booking.sent"))}).catch(e=>console.error(e))},actionCheckVerification(){requestHelper.postFetch(this.prefer.csrf,"/api/book/code-check",{mail:this.state.email,code:this.field.verificationCode.value,location_id:this.state.location}).then(e=>{200===e.status?this.openLink(this.request.created.link):alert(__("booking.invali
1d_code"))}).catch(e=>console.error(e))},send(){this.updateState();var e={location_id:this.state.location,type_info_id:this.state.type,start_date:this.state.startDate,price_id:this.state.priceId,place_id:this.state.placeId,email:this.state.email,account_type:this.state.accountType,business_name:this.state.companyName,business_kvk:this.state.kvk,first_name:this.state.firstName,last_name:this.state.lastName,mobile:this.state.mobile,mobile_country:this.state.mobileCountry,zipcode:this.state.zipcode,house_number:this.state.number,street:this.state.street,city:this.state.city,length_cm:this.state.length_cm,width_cm:this.state.width_cm,height_cm:this.state.height_cm,brand:this.state.brand,model:this.state.model,boot_name:this.state.boot_name,registration_no:this.state.registration_no,mast_length_cm:this.state.mast_length_cm,draft_cm:this.state.draft_cm,license_plate:this.state.license_plate,license_plate_country:this.state.license_plate_country,article_list:this.getArticleIdList(),description:this.state.description,discount_code:this.state.discountCode},e=JSON.stringify(e);requestHelper.post("/api/book/store",e,function(e){var t,e=e.currentTarget;4===e.readyState&&(this.state.errors=null,200===e.status?(this.request.created=JSON.parse(e.response),this.request.created.is_login?this.openLink(this.request.created.link):this.setSheet(this.enum.sheet.send)):(e=JSON.parse(e.response),this.state.errors=e&&e.screen?e.screen:null,(t=this.state.errors)?t.account?this.setSheet(this.enum.sheet.account):t.storage?this.setSheet(this.enum.sheet.rent):t.vehicle?this.setSheet(this.enum.sheet.vehicle):t.extra?this.setSheet(this.enum.sheet.extra):t.conform?this.setSheet(this.enum.sheet.conform):(console.error("unknown error action",t),this.setSheet(this.enum.sheet.account)):console.error(e)))}.bind(this),!0,this.prefer.csrf)},setSheet(e){this.setState();let t="";this.mapClose();var i=this.getTypeInfo(),s=i.article&&0<i.article.length;if("next"===e)if(this.state.sheet===this.enum.sheet.welcome){if(!this.state.type)return panel.show(this.el.error.welcome),void tEl(this.el.error.welcome,"booking.choose_a_type");t=enumList.typeInfo.isVehicleOrMarina(this.state.type)?this.enum.sheet.vehicle:this.enum.sheet.rent,this.state.currentMapId=null}else if(this.state.sheet===this.enum.sheet.vehicle){var a=this.validateVehicle();if(!(!a||i&&i.book_skip_size))return panel.show(this.el.error.vehicle),void tEl(this.el.error.vehicle,"booking.fill_in_all_fields[error:"+a+"]");t=this.enum.sheet.rent}else if(this.state.sheet===this.enum.sheet.rent){if(inputDateForState.diffInDay(new Date,new Date(this.state.startDate))<0)return panel.show(this.el.error.storage),void tEl(this.el.error.storage,"booking.incorrect_start_date");t=s?this.enum.sheet.extra:this.enum.sheet.account}else if(this.state.sheet===this.enum.sheet.extra)t=this.enum.sheet.account;else{if(this.state.sheet!==this.enum.sheet.account)return console.error("unknown sheet",this.state.sheet);t=this.enum.sheet.conform}else if("back"===e)if(this.state.showNextButton=!0,this.state.sheet===this.enum.sheet.vehicle)t=this.enum.sheet.welcome;else if(this.state.sheet===this.enum.sheet.rent)t=enumList.typeInfo.isVehicleOrMarina(this.state.type)?this.enum.sheet.vehicle:this.enum.sheet.welcome;else if(this.state.sheet===this.enum.sheet.account)t=s?this.enum.sheet.extra:this.enum.sheet.welcome;else if(this.state.sheet===this.enum.sheet.extra)t=this.enum.sheet.rent;else{if(this.state.sheet!==this.enum.sheet.conform)return console.error("unknown action");t=this.enum.sheet.account}else t=e;this.state.sheet=t,this.updateState(),this.render()},openLink(e){top.window.location.href=e},checkDiscountCode(){this.setState(),panel.hide(this.el.panel.showDiscount);var e={code:this.state.discountCode,price_id:this.state.priceId};e.price_id=this.state.priceId,requestHelper.postFetch(this.prefer.csrf,"/api/book/discount-check",e).then(e=>200!==e.status?(alert(__("booking.invalid_code")),null):e.json()).then(e=>{(this.request.discount=e)&&this.setDiscount(this.request.discount.code,this.request.discount.title)}).catch(e=>console.error(e))},setDiscount(e,t){this.state.discountCode=e,this.field.discountCode.value=e,panel.set(this.el.panel.showDiscount,e),this.el.conform.discount.innerHTML=e?"<span class='flag success'>"+t+"</span>":""},validateVehicle(){return this.state.length_cm<10?__("booking.lacks_length"):this.state.width_cm<10?__("booking.lacks_width"):this.state.brand?this.state.model?null:__("booking.lacks_model"):__("booking.lacks_brand")},render(){this.renderSheet()},renderSheet(){this.el.panel.boxForm.classList.remove("box-wide-60"),[this.enum.sheet.extra].includes(this.state.sheet)&&this.el.panel.boxForm.classList.add("box-wide-60"),this.sheet.all.forEach(e
1=>{panel.set(e,this.state.sheet===e.getAttribute("data-sheet"))}),this.state.sheet===this.enum.sheet.welcome&&this.renderSheetWelcome(),this.state.sheet===this.enum.sheet.vehicle&&this.renderSheetVehicle(),this.state.sheet===this.enum.sheet.rent&&this.renderSheetRent(),this.state.sheet===this.enum.sheet.extra&&this.renderSheetExtra(),this.state.sheet===this.enum.sheet.account&&this.renderSheetAccount(),this.state.sheet===this.enum.sheet.conform&&this.renderSheetConform(),this.renderNextButton();var e=this.state.type||0;this.el.img.style.backgroundImage='url("/image/location/'+this.state.location+"/book/"+e+'.jpg"),url("/image/book/backup/'+e+'.jpg")'},renderNextButton(){this.el.btn.nextList.forEach(e=>{panel.set(e,this.state.showNextButton)})},renderSheetWelcome(){if(panel.hide(this.el.error.welcome),selectHelper.removeAll(this.field.type),selectHelper.removeAll(this.field.location),this.json.locationTypeList){let i=!1,s=!0;for(let e=0;e<this.json.locationTypeList.length;e++){var a=this.json.locationTypeList[e],n=this.state.location?this.state.location===a.id:0===e;selectHelper.add(this.field.location,a.id,a.name,n);let t=!1;if(n&&a.for.length){i=1<a.for.length,selectHelper.add(this.field.type,"","booking.choose_a_type",!1,!1,!0);for(let e=0;e<a.for.length;e++){var r=a.for[e],l=(!1===r.is_full&&(s=!1),r.disable?null:this.state.type?this.state.type===r.type_info_id:this.prefer.type===r.type_info_id);l&&(t=l),selectHelper.add(this.field.type,r.type_info_id,r.title,l,r.disable,!0)}if(!t)for(let e=0;e<a.for.length;e++){var o=a.for[e];if(!o.disable){this.state.type=o.type_info_id,this.field.type.value=o.type_info_id;break}}}}tEl(this.el.panel.welcomeFull,"booking.location_is_full"),panel.set(this.el.panel.welcomeFull,s),s&&(this.state.showNextButton=!1),this.state.type=this.field.type.value,panel.set(this.el.panel.welcomeType,i&&!s)}},renderSheetVehicle(){panel.hide(this.el.error.vehicle),panel.hide(this.el.panel.license),panel.hide(this.el.panel.vehicleBoat),this.state.showNextButton=!0;var e=this.getTypeInfo();if(this.state.errors&&this.state.errors.vehicle){panel.show(this.el.error.vehicle),this.el.error.vehicle.innerHTML="";for(var[t,i]of Object.entries(this.state.errors.vehicle))this.el.error.vehicle.innerHTML+=i.join(", ")+"<br>"}var s=(this.state.type===enumList.typeInfo.id.marina||this.state.type===enumList.typeInfo.id.boats?__("booking.vessel"):__("booking.vehicle")).toLowerCase();tEl(this.el.title.vehicle,"booking.information_about_object[object:"+s+"]"),this.field.vehicleTypeDisabled.value=enumList.typeInfo.idToName(this.state.type),this.state.type===enumList.typeInfo.id.boats||this.state.type===enumList.typeInfo.id.marina?panel.show(this.el.panel.vehicleBoat):panel.show(this.el.panel.license),panel.set(this.el.panel.vehicleSize,e&&!e.book_skip_size)},renderSheetRent(){if(panel.hide(this.el.error.storage),this.state.errors&&this.state.errors.storage){panel.show(this.el.error.storage),this.el.error.storage.innerHTML="";for(var[e,t]of Object.entries(this.state.errors.storage))this.el.error.storage.innerHTML+=t.join(", ")+"<br>"}let i="booking.package_and_moment",s=(this.state.type===enumList.typeInfo.id.storage?i="booking.the_storage_box":this.state.type===enumList.typeInfo.id.workspaces?i="booking.the_business_premises":this.state.type===enumList.typeInfo.id.office?i="booking.the_office_space":this.state.type===enumList.typeInfo.id.garagebox?i="booking.the_garage_box":enumList.typeInfo.isVehicleOrMarina(this.state.type)&&(i="booking.package_and_moment"),tEl(this.el.title.rent,i),""),a=this.getTypeInfo();var n,r,l=a.book_min&&new Date(a.book_min).setHours(0,0,0,0)!==(new Date).setHours(0,0,0,0);if(a.book_min&&l&&(n=new Date(a.book_min),(r=new Date).setHours(0,0,0,0),r=n.getTime()===r.getTime(),s=a.book_max?language().span("booking.choose_date_between")+" "+inputDateForState.dateToNl(n):r?"":language().span("booking.can_be_reserved_from")+" "+inputDateForState.dateToNl(n),this.field.startDate.min=inputDateForState.dateToEn(n),new Date(this.field.startDate.value)<n)&&(this.field.startDate.value=inputDateForState.dateToEn(n)),a.book_max&&(r=new Date(a.book_max),s+=(l?" "+language().span("booking.and")+" ":language().span("booking.choose_date_earlier_than")+" ")+inputDateForState.dateToNl(r),this.field.startDate.max=inputDateForState.dateToEn(r)),panel.set(this.el.message.storageStartDate,
1s),s&&(this.el.message.storageStartDate.innerHTML=s),selectHelper.removeAll(this.field.package),selectHelper.removeAll(this.field.priceId),this.request.place.data){let i=!1,s=!1;if(this.state.packageId||this.prefer.packageId)for(let e=0;e<this.request.place.data.list.length;e++){var o=this.request.place.data.list[e];if(this.state.packageId===o.package_id||this.prefer.packageId===o.package_id){i=!0;break}}panel.set(this.el.panel.storagePackage,1<this.request.place.data.list.length),panel.hide(this.el.message.rentPackage);for(let t=0;t<this.request.place.data.list.length;t++){var c=this.request.place.data.list[t],h=c.prices.length;let e=this.state.packageId?this.state.packageId===c.package_id:this.prefer.packageId===c.package_id;if(i||0!==t||(e=!0),selectHelper.add(this.field.package,c.package_id,c.name+(h?"":" vol"),e,!h),e){let t=this.state.currentPrice=null;for(let e=0;e<c.prices.length;e++){var d=c.prices[e],u=d.places&&0<d.places.length,p=u&&(this.state.priceId?this.state.priceId===d.price_id:this.prefer.volume===d.volume||this.prefer.priceId===d.price_id);u&&(t=t||d,p&&(this.state.currentPrice=d),s=!0),selectHelper.add(this.field.priceId,d.price_id,d.name,p,!u)}this.state.currentPrice=this.state.currentPrice||t,panel.hide(this.el.messagePrice),this.el.messagePrice.innerHTML="",this.prefer.volume&&this.state.currentPrice&&this.prefer.volume!=this.state.currentPrice.volume&&(panel.show(this.el.messagePrice),this.el.messagePrice.innerHTML='<span class="fa fa-warning"></span>'+language().span("booking.alternative_format_chosen")+" "+this.prefer.volume+" "+language().span("booking.space_not_available")),this.prefer.priceId&&this.state.currentPrice&&this.prefer.priceId!=this.state.currentPrice.price_id&&(panel.show(this.el.messagePrice),this.el.messagePrice.innerHTML='<span class="fa fa-warning"></span>'+language().span("booking.alternative_price_selected")),c.info&&(panel.set(this.el.message.rentPackage,!0),this.el.message.rentPackage.innerHTML=c.info)}}if(panel.hide(this.el.panel.storagePlace),panel.hide(this.el.messagePlace),panel.hide(this.el.btn.mapOpen),panel.hide(this.el.btn.mapOpenNoOption),selectHelper.removeAll(this.field.place),a.book_place_prefer===enumList.type.book_place_prefer.yes&&this.state.currentPrice&&1<this.state.currentPrice.places.length||a.book_place_prefer===enumList.type.book_place_prefer.yes_map&&this.state.currentPrice&&0<this.state.currentPrice.places.length?(panel.show(this.el.panel.storagePlace),a.book_place_prefer===enumList.type.book_place_prefer.yes_map&&panel.show(this.el.btn.mapOpen),a.book_place_url&&(panel.show(this.el.messagePlace),this.el.messagePlace.innerHTML='<a href="'+a.book_place_url+'" target="_blank" data-trans="booking.view"></a> <span data-trans="booking.the_floor_plan"></span>.'),selectHelper.add(this.field.place,null,__("booking.no_preference_best_spot"),!0,!1),this.state.currentPrice.places.forEach(e=>{selectHelper.add(this.field.place,e.place_id,e.name,this.state.placeId===e.place_id,!1)})):0<a.map.length&&panel.show(this.el.btn.mapOpenNoOption),panel.hide(this.el.messagePrice),s&&a.book_note&&(panel.show(this.el.messagePrice),this.el.messagePrice.innerHTML+=(this.el.messagePrice.innerHTML?"<br>":"")+a.book_note),0<a.map.length){if(!this.state.currentMapId){this.el.btnBar.mapTap.innerHTML="",this.state.currentMapId=a.map[0].id,this.state.currentMapTypeId=a.type_id;for(let e=0;e<a.map.length;e++){var m=document.createElement("button");m.addEventListener("click",function(){bookView.el.btnBar.mapTap.querySelectorAll("button").forEach(e=>e.classList.remove("active")),bookMap.openMap(a.map[e].id,a.type_id),this.classList.add("active")}),m.innerHTML=a.map[e].name,0===e&&m.classList.add("active"),this.el.btnBar.mapTap.append(m)}}this.isMobielWith()||this.onMapOpen(a.map[0].id,a.type_id)}else this.el.btnBar.mapTap.innerHTML="",this.state.currentMapId=null;if(this.state.showNextButton=s,panel.set(this.field.priceId,s),panel.set(this.el.message.storageNoOptions,!s),this.state.discountCodeAuto&&(this.state.discountCodeAuto=!1,this.setDiscount(null,null)),this.state.currentPrice&&this.state.currentPrice.package_id&&!this.state.discountCode&&0<this.request.place.data.discount_fill.length)for(let e=0;e<this.request.place.data.discount_fill.length;e++){var g=this.request.place.data.discount_fill[e];if(g.type_id===a.type_id&&(g.package_id===this.state.currentPrice.package_id||null===g.package_id)){this.state.discountCodeAuto=!0,this.setDiscount(g.code,g.title);break}}}},renderSheetExtra(){if(panel.hide(this.el.error.extra),this.state.errors&&this.state.errors.extra){panel.show(this.el.error.extra),this.el.error.extra.innerHTML="";for(var[e,t]of Object.entries(this.state.errors.extra))this.el.error.extra.innerHTML+=t.join(", ")+"<br>"}var a=this.state.currentPrice.frequency;if(this.state.currentPrice){if(this.state.extraLoadType!==this.state.type||this.state.extraLoadFrequency!==a){this.state.extraLoadType=this.state.type,this.state.extraLoadFrequency=a;var n=this.getTypeInfo(),r=(this.el.panel.extraList.innerHTML="",document.createElement("select")),l=(r.classList.add("form"),r.name="insure-option",document.createElement("option"));tEl(l,"booking.no_insurance"),r.appendChild(l);let t=!1,i=!1,s=!1;for(let e=0;e<n.article.length;e++){var o,c=n.article[e];c.frequency!==enumList.product.frequency.one_time&&c.frequency!==a||(s=!0,c.insured?(c.box_state===enumList.article.boxState.yes_required&&(i=!0),(o=document.createElement("option")).value=c.id,o.innerHTML=c.name+" "+__("booking.until").toLowerCase()+" "+priceHelper.centToEuroLongNl(c.insured_value)+" · "+c.price_info,c.box_state===enumList.article.boxState.yes&&(o.selected=!0),c.info&&o.setAttribute("info",c.info),c.insured_link&&o.setAttribute("insured_link",c.insured_link),r.appendChild(o),t=!0):(o=this.newEl.extraArticle(c.name,c.info,c.price,c.id,!1,c.box_state,c.frequency),this.el.panel.extraList.appendChild(o)))}t&&(i&&r.options[0].remove(),l=this.newEl.extraInsure(__("booking.insurance")+" "+(i?" ("+__("booking.required").toLowerCase()+")":""),"",r),this.el.panel.extraList.appendChild(l)),s||(this.el.panel.extraList.innerHTML=__("booking.no_extras_available")+".")}}else console.warn("missing price")},renderSheetAccount(){if(panel.set(this.col.company,!this.state.isPrivate),panel.hide(this.el.error.account),panel.set(this.el.panel.newCustomer,this.state.isNewCustomer),panel.set(this.el.message.accountMailNotValid,this.state.isNot
1ValidEmail),this.state.errors&&this.state.errors.account){panel.show(this.el.error.account),this.el.error.account.innerHTML="";for(var[e,t]of Object.entries(this.state.errors.account))this.el.error.account.innerHTML+=t.join(", ")+"<br>"}},renderSheetConform(){if(panel.hide(this.el.error.conform),panel.hide(this.el.panel.inputDiscount),panel.set(this.el.panel.conformDeposit,this.state.currentPrice.deposit),panel.set(this.el.panel.conformStartup,this.state.currentPrice.startup),panel.set(this.el.panel.conformService,this.state.currentPrice.service),panel.set(this.el.panel.conformAllowance,this.state.currentPrice.allowance),this.state.errors&&this.state.errors.conform){panel.show(this.el.error.conform),this.el.error.conform.innerHTML="";for(var[e,t]of Object.entries(this.state.errors.conform))this.el.error.conform.innerHTML+=t.join(", ")+"<br>"}if(this.state.currentPrice.dis&&panel.show(this.el.panel.inputDiscount),this.state.currentPrice){let t=null;for(let e=0;e<this.json.locationTypeList.length;e++){var i=this.json.locationTypeList[e];if(i.id===this.state.location){t=i;break}}t&&(this.el.conform.line_1.innerHTML=t.line_1,this.el.conform.line_2.innerHTML=t.line_2),this.el.conform.cost.innerHTML=this.state.currentPrice.name,this.el.conform.deposit.innerHTML=this.state.currentPrice.deposit,this.el.conform.startup.innerHTML=this.state.currentPrice.startup+(this.state.currentPrice.startup_reason?" "+this.state.currentPrice.startup_reason:""),this.el.conform.service.innerHTML=this.state.currentPrice.service,this.el.conform.allowance.innerHTML=this.state.currentPrice.allowance+(this.state.currentPrice.allowance_reason?" "+this.state.currentPrice.allowance_reason:""),this.el.conform.startDate.innerHTML=this.state.startDate?new Date(this.state.startDate).toLocaleDateString():"",this.state.currentLocationOb=this.json.locationTypeList.find(e=>e.id===this.state.location),this.state.currentLocationOb&&this.state.type&&(this.state.currentLocationTypeOb=this.state.currentLocationOb.for.find(e=>e.type_info_id===this.state.type)),this.state.currentLocationTypeOb&&this.state.currentLocationTypeOb.online?this.el.conform.title.innerHTML='<h4 data-trans="booking.finalize_your_reservation"></h4><p data-trans="booking.finalize_your_reservation_info"></p>':this.el.conform.title.innerHTML='<h4 data-trans="booking.finalize_your_application"></h4><p data-trans="booking.finalize_your_application_info"></p>';var s=[],a=this.getArticleIdList();if(0<a.length){var n=this.getTypeInfo();for(let e=0;e<a.length;e++){let t=a[e];var r=n.article.find(e=>e.id===t);r?s.push(r.name):console.warn("missing article:",t)}}panel.set(this.el.panel.conformExtra,0<s.length),0<s.length&&(this.el.conform.conformExtra.innerHTML=s.join(", "))}},renderUsp(){this.el.usp.forEach(e=>{e=e.querySelectorAll("li");e[0].classList.add("active"),e.length<2||setInterval(function(e){var t=e.length;let i=0;e.forEach((e,t)=>{e.classList.contains("active")&&(i=t+1)}),i>=t&&(i=0),e.forEach((e,t)=>{t===i?e.classList.add("active"):e.classList.remove("active")})}.bind(this,e),7e3)}),this.el.usp.onclick=function(){slideSource.classList.toggle("fade")}},isMobielWith(){return Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)<700},getLocationInfo(){return this.state.location?this.json.locationTypeList.find(e=>e.id===this.state.location):null},getTypeInfo(){var e=this.getLocationInfo();let t=null;return t=e&&this.state.type?e.for.find(e=>e.type_info_id===this.state.type):t},getArticleIdList(){let t=[];var e=document.querySelectorAll("input[name=extra-id]"),e=(e&&0<e.length&&e.forEach(e=>{e.checked&&t.push(parseInt(e.value))}),document.querySelector("select[name=insure-option]"));return e&&1<e.value&&t.push(parseInt(e.value)),t},newEl:{extraArticle(e,t,i,s,a,n,r){var l=document.createElement("div"),o=(l.classList.add("order-article"),document.createElement("h4")),e=(o.innerHTML=e,document.createElement("p")),t=(e.innerHTML=t,i&&(e.innerHTML+="<br>"+i+" "+language().span("booking.price_frequency."+r.toLowerCase(),!0)),document.createElement("label")),i=(t.classList.add("checkbox-switch"),document.createElement("input"));return i.type="checkbox",i.name="extra-id",i.value=s,n!==enumList.article.boxState.yes&&n!==enumList.article.boxState.yes_required||i.setAttribute("checked","checked"),n===enumList.article.boxState.yes_required&&(i.disabled=!0,o.innerHTML+=" (verplicht)"),t.appendChild(i),t.innerHTML+='<span class="tgl-btn"></span><span class="label"></span>',l.appendChild(o),l.appendChild(e),l.appendChild(t),l},extraInsure(e,t,i){var s=document.createElement("div"),a=(s.id="order-insure",s.classList.add("order-article"),document.createElement("h4")),e=(a.innerHTML=e,document.createElement("p"));return e.innerHTML=t,this._setInsureText(i,e),i.addEventListener("change",this._setInsureText.bind(this,i,e)),s.appendChild(a),s.appendChild(e),s.appendChild(i),s},_setInsureText(e,t){var i,e=e.options[e.selectedIndex];t.innerHTML="",e&&e.getAttribute("info")&&(t.innerHTML=e.getAttribute("info")),e&&e.getAttribute("insured_link")&&((i=document.createElement("a")).href=e.getAttribute("insured_link"),i.target="_blank",i.innerHTML="Bekijk voorwaarden",i.classList.add("insured_link"),t.appendChild(i))}}};var customerWizard={field:{email:document.getElementById("email-field")},tr:{password:document.getElementById("password-tr")},panel:{message:document.getElementById("message-panel")},button:{go:document.getElementById("go-button")},oldState:{},state:{email:null},json:{accountCheck:null},config:{locationId:null},init:function(){this.setState(),this.checkAccount(),this.render()},setState:function(){this.oldState=JSON.parse(JSON.stringify(this.state)),this.state.email=this.field.email.value||null},requestEmailAccount:function(e,t){this.json.accountCheck=requestHelper.getJson("/visitor/api/customer-wizard/form/email/"+e+"/"+t)},checkAccount:function(){this.state.email&&this.validateEmail(this.state.email)&&this.oldState.email!=this.state.email&&this.requestEmailAccount(this.config.locationId,this.state.email)},validateEmail:function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())},change:function(){this.setState(),this.checkAccount(),this.render()},render:function(){this.renderEmailFeedback()},renderEmailFeedback:function(){view.hide(this.tr.password),view.hide(this.panel.message),this.json.accountCheck&&(this.json.accountCheck.exists?(view.show(this.tr.password),view.show(this.button.go)):(view.show(this.panel.message),view.hide(this.button.go)))}};let homeView={el:{img:document.getElementById("search-action-img"),btnListType:document.getElementById("btn-list-type"),btnListTypes:document.querySelectorAll("#btn-list-type button"),btnListFor:document.getElementById("btn-list-for"),btnListForBtn:document.querySelectorAll("#btn-list-for button"),btnListMarine:document.getElementById("btn-list-marine"),btnListStorage:document.getElementById("btn-list-storage"),btnListObject:document.getElementById("btn-list-object"),btnListWorksp
1ace:document.getElementById("btn-list-workspace"),btnListGaragebox:document.getElementById("btn-list-garagebox"),btnListLocation:document.getElementById("btn-list-location"),btnListLocationBtn:document.querySelectorAll("#btn-list-location button")},btn:{search:document.getElementById("search-go-btn")},field:{search:document.getElementById("place-search-field")},state:{firstRender:!0,typeVal:null,marineVal:null,storageVal:null,objectVal:null,locationVal:null,workspaceVal:null,garageboxVal:null},enum:{typeMarine:"marine",typeStalling:"stalling",typeStorage:"storage",typeWorkspace:"workspace",typeGaragebox:"garagebox",storageSelfStorage:"self-storage",storageContainer:"container",storageHomeService:"home-service",marinaPasserby:"passerby",marineDry:"dry",marineHarbor:"harbor",objectCar:"car",objectOldtimer:"oldtimer",objectCaravan:"caravan",objectMotorHome:"motorhome",objectBoat:"boat",objectMotorbike:"motorbike",objectFoldingTrailer:"folding-trailer",objectTrailer:"trailer",workspaceSpace:"workspace-space",garageboxSpace:"garagebox-space",locationAll:"all"},init(){this.setListener(),this.setDefault(),this.setState(),this.render()},setDefault(){this.state.typeVal=this.enum.typeStalling,this.state.marineVal=this.enum.marineHarbor,this.state.storageVal=this.enum.storageSelfStorage,this.state.objectVal=this.enum.objectCaravan,this.state.workspaceVal=this.enum.workspaceSpace,this.state.garageboxVal=this.enum.garageboxSpace,this.state.locationVal=this.enum.locationAll},setListener(){this.el.btnListTypes.forEach(e=>{e.addEventListener("click",this.btnClickAction.bind(this))}
1),this.el.btnListForBtn.forEach(e=>{e.addEventListener("click",this.btnClickAction.bind(this))}),this.el.btnListLocationBtn.forEach(e=>{e.addEventListener("click",this.btnClickAction.bind(this))}),this.btn.search.addEventListener("click",this.searchAction.bind(this))},btnClickAction(e){var t=e.target.parentElement,e=e.target.getAttribute("data-value");t===this.el.btnListType&&(this.state.typeVal=e),t===this.el.btnListMarine&&(this.state.marineVal=e),t===this.el.btnListStorage&&(this.state.storageVal=e),t===this.el.btnListObject&&(this.state.objectVal=e),t===this.el.btnListLocation&&(this.state.locationVal=e,this.searchAction()),this.render()},searchAction(){let e="",t=[],i=(this.state.typeVal===this.enum.typeMarine&&(this.state.marineVal===this.enum.marinaPasserby&&(e="/jachthaven"),this.state.marineVal===this.enum.marineHarbor&&(e="/jachthaven"),this.state.marineVal===this.enum.marineDry)&&(e="/bootstalling"),this.state.typeVal===this.enum.typeStalling&&(this.state.objectVal===this.enum.objectCaravan&&(e="/caravanstalling"),this.state.objectVal===this.enum.objectMotorHome&&(e="/camperstalling"),this.state.objectVal===this.enum.objectCar&&(e="/autostalling"),this.state.objectVal===this.enum.objectBoat&&(e="/bootstalling"),this.state.objectVal===this.enum.objectTrailer&&(e="/aanhangerstalling"),this.state.objectVal===this.enum.objectFoldingTrailer&&(e="/vouwwagenstalling"),this.state.objectVal===this.enum.objectOldtimer&&(e="/oldtimerstalling"),this.state.objectVal===this.enum.objectMotorbike)&&(e="/motorstalling"),this.state.typeVal===this.enum.typeStorage&&(e="/opslagruimte",this.state.storageVal===this.enum.storageSelfStorage&&t.push("self-service=ja"),this.state.storageVal===this.enum.storageHomeService&&t.push("haal-breng-service=ja"),this.state.storageVal===this.enum.storageContainer)&&t.push("gebied=buiten"),this.state.typeVal===this.enum.typeGaragebox&&(e="/garageboxen"),this.state.typeVal===this.enum.typeWorkspace&&(e="/bedrijfsruimte"),"/aanbod");this.state.locationVal&&this.state.locationVal!==this.enum.locationAll&&(i="/nabij/"+this.state.locationVal),e?(t=t.length?"?"+t.join("&"):"",document.location=e+i+t):console.error(e,i,"Unknown")},setState(){},render(){this.renderBtn(),this.renderFor(),this.renderImg(),this.state.firstRen
1der&&(this.state.firstRender=!1)},renderImg(){let t=null;if(this.state.typeVal===this.enum.typeMarine&&(t=this.state.marineVal),this.state.typeVal===this.enum.typeStorage&&(t=this.state.storageVal),this.state.typeVal===this.enum.typeStalling&&(t=this.state.objectVal),this.state.typeVal===this.enum.typeWorkspace&&(t=this.state.workspaceVal),t=this.state.typeVal===this.enum.typeGaragebox?this.state.workspaceVal:t){let e="/image/home/top/"+t+".jpg";var i;this.state.firstRender?this.el.img.style.backgroundImage="url('"+e+"')":((i=new Image).src=e,this.el.img.style.opacity=".9",i.onload=function(){this.el.img.style.backgroundImage="url('"+e+"')",this.el.img.style.opacity="1"}.bind(this))}else console.error("unknown img")},renderBtn(){var e;this.el.btnListType.querySelectorAll(".active").forEach(e=>e.classList.remove("active")),this.el.btnListFor.querySelectorAll(".active").forEach(e=>e.classList.remove("active")),this.el.btnListLocation.querySelectorAll(".active").forEach(e=>e.classList.remove("active")),this.state.typeVal&&(e=this.el.btnListType.querySelector("button[data-value="+this.state.typeVal+"]"))&&e.classList.add("active"),this.state.marineVal&&(e=this.el.btnListMarine.querySelector("button[data-value="+this.state.marineVal+"]"))&&e.classList.add("active"),this.state.storageVal&&(e=this.el.btnListStorage.querySelector("button[data-value="+this.state.storageVal+"]"))&&e.classList.add("active"),this.state.objectVal&&(e=this.el.btnListObject.querySelector("button[data-value="+this.state.objectVal+"]"))&&e.classList.add("active"),this.state.workspaceVal&&(e=this.el.btnListWorkspace.querySelector("button[data-value="+this.state.workspaceVal+"]"))&&e.classList.add("active"),this.state.garageboxVal&&(e=this.el.btnListGaragebox.querySelector("button[data-value="+this.state.garageboxVal+"]"))&&e.classList.add("active"),this.state.locationVal&&(e=this.el.btnListLocation.querySelector("button[data-value="+this.state.locationVal+"]"))&&e.classList.add("active")},renderFor(){panel.set(this.el.btnListMarine,this.state.typeVal===this.enum.typeMarine),panel.set(this.el.btnListStorage,this.state.typeVal===this.enum.typeStorage),panel.set(this.el.btnListObject,this.state.typeVal===this.enum.typeStalling),panel.set(this.el.btnListWorkspace,this.state.typeVal===this.enum.typeWorkspace),panel.set(this.el.btnListGaragebox,this.state.typeVal===this.enum.typeGaragebox)}},invoicePayView={field:{payOption:document.querySelectorAll('input[name="pay_option"]')},state:{payOption:null},init(){this.setListener(),this.setState(),this.render()}
1,setListener(){document.querySelectorAll(".js-pay-option").forEach(e=>{e.addEventListener("click",this.onFieldChange.bind(this))})},setState(){this.state.payOption=this.findCheckValue(this.field.payOption)},findCheckValue(e){for(var t=0;t<e.length;t++)if(e[t].checked)return e[t].value},onFieldChange(){this.setState(),this.render()},render(){this.renderPanel()},renderPanel(){document.querySelectorAll("[data-compare]").forEach(e=>{panel.set(e,this.state.payOption===e.dataset.compare)})}},leadView={field:{postcode:document.getElementById("js-postcode-field"),houseNumber:document.getElementById("js-house_number-field"),street:document.getElementById("js-street-field"),city:document.getElementById("js-city-field")},state:{postcode:null,houseNumber:null,street:null,city:null},enum:{},json:{postcodeInfo:null},request:{address:{url:null,data:{postcode:null,number:null,street:null,city:null},timeout:null}},init(){this.setListener(),this.setDefault(),this.updateState(),this.render()},setDefault(){this.state.typeVal=this.enum.typeStalling,this.state.marineVal=this.enum.marineHarbor,this.state.storageVal=this.enum.storageSelfStorage,this.state.objectVal=this.enum.objectCaravan,this.state.workspaceVal=this.enum.workspaceSpace,this.state.garageboxVal=this.enum.garageboxSpace,this.state.locationVal=this.enum.locationAll},setListener(){this.field.postcode&&this.field.postcode.addEventListener("keyup",function(){this.update()}.bind(this)),this.field.houseNumber&&this.field.houseNumber.addEventListener("keyup",function(){this.update()}.bind(this))},update(){this.updateState(),this.checkPostcode()},checkPostcode(){if(!this.state.postcode||this.state.postcode.length<6||!this.state.houseNumber)this.request.address.timeout&&clearTimeout(this.request.address.timeout);else{let e="/api/book/address/"+this.state.postcode+"/"+this.state.houseNumber;this.request.address.url!==e&&(this.request.address.url=e,this.request.address.timeout&&clearTimeout(this.request.address.timeout),this.request.address.timeout=setTimeout(()=>{requestHelper.getFetchJsonOb(e).then(e=>{200!==e.response.status?(this.field.street.value="",this.field.city.value=""):e.json.data&&(this.request.address.data=e.json.data,this.field.postcode.value=this.request.address.data.postcode,this.field.houseNumber.value=this.request.address.data.number,this.field.street.value=this.request.address.data.street,this.field.city.value=this.request.address.data.city)}).catch(e=>console.error(e))},400))}},updateState(){this.state.postcode=this.field.postcode?this.field.postcode.value.replace(/\s/g,""):null,this.state.houseNumber=this.field.houseNumber?this.field.houseNumber.value:null},render(){}},offerView={el:{searchForm:document.getElementById("home-search"),searchBar:document.getElementById("search-bar"),searchQ:document.getElementById("q-id"),searchResult:document.getElementById("search-bar-results")},state:{searchTimer:null,previousSearch:"",autocompleteList:[]},init(){this.setListener()},setListener(){this.el.searchBar.addEventListener("keyup",this.actionSearchKeyPress.bind(this))},actionSearchKeyPress(i){var e=i.target;if("ArrowUp"===i.key||"ArrowDown"===i.key){var s=document.getElementById("search-bar-results-view").children;let t=0;for(let e=0;e<s.length;e++)"select-by-key"===s[e].className&&(s[e].className="","ArrowUp"===i.code?t=e-1:"ArrowDown"===i.code&&(t=e+1));(!s[t]||(s[t].className="select-by-key",document.getElementById("search-bar").value=s[t].dataset.content,s[t].dataset.link))&&(document.getElementById("search-bar").value=this.state.previousSearch)}else document.getElementById("q-id").value="",this.state.previousSearch!==e.value&&(this.state.previousSearch=e.value,this.showResult(e.value)),e.value||this.renderSearchBarDisplay(!1)},showResult(e){let n=this,t=new XMLHttpRequest,i=(t.onreadystatechange=function(){if(4===this.readyState&&200===this.status){n.state.autocompleteList=[];var i=JSON.parse(this.responseText),s=document.getElementById("search-bar-results-view");if(s.innerHTML="",!i.results)return n.renderSearchBarDisplay(!1),!1;if(i.results&&0<i.results.length){for(let t=0;t<i.results.length;t++){let e=i.results[t].number;e=e||"",""===i.results[t].link&&(n.state.autocompleteList=i.results);var a=document.createElement("li");a.dataset.content=i.results[t].name,a.dataset.link=i.results[t].link,a.addEventListener("click",n.renderSearchBarText.bind(n,i.results[t].name.replace("'",""),i.results[t].id,i.results[t].link)),a.innerHTML='<div class="regel">'+i.results[t].name+"<span>"+e+'</span></div><div class="search-type">'+i.results[t].type+"</div>",s.appendChild(a)}n.renderSearchBarDisplay(!0)}else n.renderSearchBarDisplay(!1)}},document.getElementById("q-stalling").value);i=(i=(i=i.replace("stalling","")).replace("ruimte",""))||"caravan",t.open("GET","/api/search/home/"+i+"/"+encodeURIComponent(e),!0),this.state.searchTimer&&clearTimeout(this.state.searchTimer),this.state.searchTimer=setTimeout(function(){t.send()},400)},renderSearchBarText(e,t,i){i?window.location.href=i:(this.el.searchQ.value=t,this.el.searchBar.value=e,this.el.searchForm.submit())},renderSearchBarDisplay(e){if(this.el.searchResult.style.display=e?"block":"none",!document.getElementById("box-first-a"))return!0;e?window.innerWidth<600&&(document.getElementsByClassName("box-first")[0].style.opacity="0.1",document.getElementById("box-first-a").style.display="none"):(document.getElementsByClassName("box-first")[0].style.opacity="1",document.getElementById("box-first-a").style.display="block")}},passerbyBookView={el:{conform:{title:document.getElementById("conform-title"),startDate:document.getElementById("conform-start_date")},img:document.querySelector(".box-info"),btn:{backList:document.querySelectorAll(".js-btn-back"),nextList:document.querySelectorAll(".js-btn-next"),send:document.querySelector(".js-btn-send")},message:{startHour:document.getElementById("message-start_hour"),endHour:document.getElementById("message-end_hour"),start:document.getElementById("message-start_date"),end:document.getElementById("message-end_date")}
1,panel:{inputPlace:document.getElementById("panel-input-place"),tourist:document.getElementById("tourist-place")},confirm:{name:document.getElementById("confirm-name"),boot:document.getElementById("confirm-boot"),place:document.getElementById("confirm-place"),period:document.getElementById("confirm-period"),priceReservation:document.getElementById("confirm-price-reservation"),priceTourist:document.getElementById("confirm-price-tourist"),priceTotal:document.getElementById("confirm-price-total")}},field:{bootName:document.querySelector("input[name=boot_name]"),bootLength:document.querySelector("input[name=boot_length]"),bootWidth:document.querySelector("input[name=boot_width]"),startDate:document.querySelector("input[name=start_date]"),endDate:document.querySelector("input[name=end_date]"),place:document.querySelector("select[name=place]"),firstName:document.querySelector("input[name=first_name]"),lastName:document.querySelector("input[name=last_name]"),mobile:document.querySelector("input[name=mobile]"),mobileCounty:document.querySelector("select[name=mobile_country]"),mail:document.querySelector("input[name=mail]"),tourist:document.querySelector("input[name=tourist]")},sheet:{all:document.querySelectorAll(".sheet")},state:{locationId:null,sheet:null,showNextButton:!0,hasError:null,bootName:null,bootLength:null,bootWidth:null,startDate:null,endDate:null,placeId:null,firstName:null,lastName:null,mobile:null,mobileCountry:null,mail:null,tourist:null,note:null,errorFieldList:[],errorLastSheet:null},request:{place:{url:null,data:null}},enum:{sheet:{boot:"boot",reservation:"reservation",user:"user",confirm:"confirm",receipt:"receipt"}},prefer:{csrf:null,locationId:null,startDate:new Date,mail:null},config:{startHour:null,endHour:null,priceType:null,rent:null,rentMin:null,tourist:null},init(){this.setDefault(),this.setListener(),this.updateState(),this.render()},setDefault(){this.state.sheet=this.enum.sheet.boot,this.el.message.startHour.innerHTML="vanaf "+this.config.startHour,this.el.message.endHour.innerHTML="tot "+this.config.endHour},setListener(){this.field.startDate.addEventListener("input",this.onFieldChange.bind(this)),this.field.endDate.addEventListener("input",this.onFieldChange.bind(this)),this.el.btn.backList.forEach(function(e){e.addEventListener("click",this.setSheet.bind(this,"back"))}.bind(this)),this.el.btn.nextList.forEach(function(e){e.addEventListener("click",this.setSheet.bind(this,"next"))}.bind(this)),this.el.btn.send.addEventListener("click",this.send.bind(this))},updateState(){this.setState(),this.updateRequest()},setState(){this.state.bootName=this.field.bootName?this.field.bootName.value:null,this.state.bootLength=this.field.bootLength?parseInt(this.field.bootLength.value):null,this.state.bootWidth=this.field.bootWidth?parseInt(this.field.bootWidth.value):null,this.state.startDate=this.field.startDate?this.field.startDate.valueAsDate:this.prefer.startDate,this.state.endDate=this.field.endDate?this.field.endDate.valueAsDate:null,this.state.placeId=this.field.place?parseInt(this.field.place.value):null,this.state.firstName=this.field.firstName?this.field.firstName.value:null,this.state.lastName=this.field.lastName?this.field.lastName.value:null,this.state.mobile=this.field.mobile?this.field.mobile.value:null,this.state.mobileCountry=this.field.mobileCounty?this.field.mobileCounty.value:null,this.state.mail=this.field.mail?this.field.mail.value:null,this.state.tourist=this.field.tourist?parseInt(this.field.tourist.value):null,this.state.note=this.field.note?this.field.note.value:null},onFieldChange(e){this.updateState(),this.updateRequest(),this.state.sheet===this.enum.sheet.reservation&&this.renderSheetReservation(),this.render()},updateRequest(){var e;this.state.sheet===this.enum.sheet.reservation&&(this.state.locationId&&this.state.startDate&&this.state.endDate&&this.state.bootLength&&this.state.bootWidth?(e="/api/passerby/place/"+this.state.locationId+"/"+inputDateForState.dateToEn(this.state.startDate)+"/"+inputDateForState.dateToEn(this.state.endDate)+"?l="+this.state.bootLength+"&w="+this.state.bootWidth,this.request.place.url!==e&&(this.request.place=requestHelper.getOb(e))):this.request.place.url=null)},setSheet(e){this.setState(),this.state.hasError=null;let t="";if("next"===e){if(this.state.sheet===this.state.errorLastSheet&&(this.state.errorLastSheet=null,this.state.errorFieldList=null),this.state.hasError=this.validate(),this.state.hasError)return void this.render();if(this.state.sheet===this.enum.sheet.boot)t=this.enum.sheet.reservation;else if(this.state.sheet===this.enum.sheet.reservation)t=this.enum.sheet.user;else{if(this.state.sheet!==this.enum.sheet.user)return console.error("unknown sheet",this.state.sheet);t=this.enum.sheet.confirm}}else if("back"===e)if(this.state.sheet===this.enum.sheet.reservation)t=this.enum.sheet.boot;else if(this.state.sheet===this.enum.sheet.user)t=this.enum.sheet.reservation;else{if(this.state.sheet!==this.enum.sheet.confirm)return console.error("unknown action");t=this.enum.sheet.user}else t=e;this.state.sheet=t,this.updateState(),this.render()},openLink(e){top.window.location.href=e},validate(){if(this.state.sheet===this.enum.sheet.boot){if(!this.state.bootName)return"Mist boot naam";if(!this.state.bootLength||this.state.bootLength<10)return"Mist lengte";if(!this.state.bootWidth||this.state.bootWidth<10)return"Mist breedte"}if(this.state.sheet===this.enum.sheet.reservation){if(!this.state.startDate)return"Mist startdatum";if(!this.state.endDate)return"Mist einddatum";if(inputDateForState.diffInDay(this.state.startDate,this.state.endDate)<1)return"Einddatum moet 1 dag na startdatum zijn";if(!this.state.placeId)return"Mist plek"}if(this.state.sheet===this.enum.sheet.user){if(!this.state.firstName)return"Mist voorna
1am";if(!this.state.lastName)return"Mist achternaam";if(!this.state.mobile)return"Mist mobiel";if(0<this.config.tourist&&!this.state.tourist&&0!==this.state.tourist)return"Mist toeristenbelasting info"}return null},showValidationError(){let e="";if(this.state.errorFieldList)for(var[t,i]of Object.entries(this.state.errorFieldList))i&&(e+=i);var s=document.querySelectorAll(".sheet .error-box"),a=document.querySelector("div[data-sheet="+this.state.sheet+"] .error-box");s.forEach(e=>{panel.hide(e)}),this.state.hasError&&(e+=this.state.hasError),e&&(panel.show(a),a.innerHTML=e)},send(){this.updateState();var e={location_id:this.state.locationId,boot_name:this.state.bootName,boot_length:this.state.bootLength,boot_width:this.state.bootWidth,start_date:this.state.startDate,end_date:this.state.endDate,place_id:this.state.placeId,first_name:this.state.firstName,last_name:this.state.lastName,mobile:this.state.mobile,mobile_country:this.state.mobileCountry,mail:this.state.mail,tourist:this.state.tourist,note:this.state.note},e=JSON.stringify(e);requestHelper.post("/api/passerby/store",e,function(e){var t,e=e.currentTarget;4===e.readyState&&(this.state.errors=null,200===e.status?(t=JSON.parse(e.response),this.openLink(t.link)):(e=(t=JSON.parse(e.response)).toast||"Status code: "+e.status,this.state.errorFieldList=t.field,this.state.errorLastSheet=t.sheet,this.setSheet(t.sheet),toast.error(e)))}.bind(this),!0,this.prefer.csrf)},render(){this.renderSheet(),this.showValidationError()},renderSheet(){this.sheet.all.forEach(e=>{panel.set(e,this.state.sheet===e.getAttribute("data-sheet"))}),this.state.sheet===this.enum.sheet.boot&&this.renderSheetBoot(),this.state.sheet===this.enum.sheet.reservation&&this.renderSheetReservation(),this.state.sheet===this.enum.sheet.user&&this.renderSheetUser(),this.state.sheet===this.enum.sheet.confirm&&this.renderSheetConfirm(),this.renderNextButton()},renderNextButton(){this.el.btn.nextList.forEach(e=>{panel.set(e,this.state.showNextButton)})},renderSheetBoot(){},renderSheetUser(){panel.hide(this.el.panel.tourist),0<this.config.tourist&&panel.show(this.el.panel.tourist)},renderSheetReservation(){var e=this.request.place.url,t=(panel.
1set(this.el.panel.inputPlace,e),panel.hide(this.el.message.start),panel.hide(this.el.message.end),this.field.startDate.min=inputDateForState.dateToEn(new Date),new Date(this.state.startDate.getTime()));t.setDate(t.getDate()+1),this.field.endDate.min=inputDateForState.dateToEn(t),selectHelper.removeAll(this.field.place),selectHelper.add(this.field.place,"","Kies een plek",!0,!1),e&&this.request.place.data.list.forEach(e=>{selectHelper.add(this.field.place,e.id,e.dropdown,this.state.placeId===e.id,e.disabled)})},renderSheetConfirm(){this.el.confirm.name.innerHTML=this.state.firstName+" "+this.state.lastName,this.el.confirm.boot.innerHTML=this.state.bootName+", "+this.state.bootLength+" x "+this.state.bootWidth+" cm",this.el.confirm.period.innerHTML=inputDateForState.dateToNlLocal(this.state.startDate)+" "+this.config.startHour+" t/m "+inputDateForState.dateToNlLocal(this.state.endDate)+" "+this.config.endHour;var i=this.request.place.data.list.find(e=>e.id===this.state.placeId),i=(i&&(this.el.confirm.place.innerHTML=i.name),inputDateForState.diffInDay(this.state.startDate,this.state.endDate));if(i<1)this.el.confirm.priceTotal.innerHTML="Datum onjuist";else{let e=!1,t=this.config.rent*i;this.config.priceType===enumList.passerbyInfo.priceType.variable&&(t*=Math.abs(this.state.bootLength/100)),this.config.rentMin&&t<this.config.rentMin&&(e=!0,t=this.config.rentMin);var s=this.config.tourist?this.config.tourist*this.state.tourist*i:0,a=t+s;this.el.confirm.priceReservation.innerHTML="â¬"+priceHelper.fromCentToNl(t)+" "+(e?" (min prijs)":"")+" voor "+(1===i?" 1 dag":i+" dagen"),this.el.confirm.priceTourist.innerHTML=0===this.config.tourist?"-":"â¬"+priceHelper.fromCentToNl(s)+" voor "+(1===this.state.tourist?"1 persoon":this.state.tourist+" personen"),this.el.confirm.priceTotal.innerHTML="â¬"+priceHelper.fromCentToNl(a)}}},priceCalculator={priceTable:null,typeInfoId:null,packageItem:document.getElementById("packageItem"),typeLengthItem:document.getElementById("typeLengthItem"),typeWidthItem:document.getElementById("typeWidthItem"),typeHeightItem:document.getElementById("typeHeightItem"),typeVolumeItem:document.getElementById("typeVolumeItem"),typeSquareItem:document.getElementById("typeSquareItem"),winterItem:document.getElementById("winterItem"),field:{priceId:document.getElementById("priceIdField"),type:document.getElementById("typeField"),package:document.getElementById("packageField"),winter:document.getElementById("winterField"),typeLength:document.getElementById("typeLengthField"),typeWidth:document.getElementById("typeWidthField"),typeHeight:document.getElementById("typeHeightField"),typeVolume:document.getElementById("typeVolumeField"),typeSquare:document.getElementById("typeSquareField"),services:document.getElementsByClassName("serviceCalculation")},packageDescriptionText:document.getElementById("packageDescriptionText"),priceText:document.getElementById("priceText"),priceDescriptionText:document.getElementById("priceDescriptionText"),priceDescriptionServiceText:document.getElementById("priceDescriptionServiceText"),priceDescriptionStartupText:document.getElementById("priceDescriptionStartupText"),priceDescriptionDepositText:document.getElementById("priceDescriptionDepositText"),showLengthState:!1,showWidthState:!1,showHeightState:!1,showVolumeState:!1,showSquareState:!1,showWinterState:!1,lastPriceOb:null,yearPrice:0,servicePrice:0,startupPrice:0,depositPrice:0,packageDescriptionTextState:"",squareSizeForPackageState:null,squareSelectedItem:null,storageSizeForPackageState:null,storageSelectedItem:null,winterPriceState:!1,fieldPricePerMonth:document.getElementById("fieldPricePerMonth"),calculate:function(){var t=this.priceTable.packageList[this.field.package.value];let i=null,e=!1,s=!1;if(this.typeInfoId===enumList.typeInfo.id.storage)if(this.showVolumeState=!0,s=!1,this.storageSizeForPackageState!==this.field.package.value){removeSelectItems(this.field.typeVolume);for(let e=0;e<t.length;e++){var a=t[e],n=(i=i||a,document.createElement("option"));n.text=formatHelper.volumeToNl(a.volume_m)+" m³"+(a.floor?" - etage "+a.floor:""),n.value=a.id,n.value===this.storageSelectedItem&&(n.selected=!0,i=a),this.field.typeVolume.add(n)}this.storageSizeForPackageState=this.field.package.value}else for(let e=0;e<t.length;e++){var r=t[e];if(r.id===parseInt(this.field.typeVolume.value)){i=t[e],console.log("FOUND",this.field.typeVolume.value,r.id,i);break}}
1else if(this.typeInfoId===enumList.typeInfo.id.workspaces||this.typeInfoId===enumList.typeInfo.id.garagebox){if(this.showSquareState=!0,s=!1,this.squareSizeForPackageState!==this.field.package.value){removeSelectItems(this.field.typeSquare);for(let e=0;e<t.length;e++){var l=t[e],o=(i=i||l,document.createElement("option"));o.text=formatHelper.volumeToNl(l.square_m)+" m²"+(l.floor?" - etage "+l.floor:""),o.value=l.id,o.value===this.squareSelectedItem&&(o.selected=!0,i=l),this.field.typeSquare.add(o)}this.squareSizeForPackageState=this.field.package.value}else for(let e=0;e<t.length;e++)if(t[e].id===parseInt(this.field.typeSquare.value)){i=t[e];break}}else{s=!0,e=!0;for(let e=0;e<t.length;e++){var c=t[e];!(null==i||c.base<i.base)||null!=c.max_length_cm&&this.field.typeLength.value>c.max_length_cm||null!=c.max_width_cm&&this.field.typeWidth.value>c.max_width_cm||null!=c.max_height_cm&&this.field.typeHeight.value>c.max_height_cm||(i=c)}1===t.length&&(i.type!==priceHelper.priceTypeVariableM2&&(e=!1),i)&&i.type===priceHelper.priceTypeFixed&&(s=!1)}if(!i||!this.field.typeLength.value)return this.yearPrice=0,this.showLengthState=!0,this.showWidthState=!0,this.showHeightState=!1,this.showWinterState=!1,this.showVolumeState=!1,this.showSquareState=!1,this.render();this.showWinterState=0<i.winter,this.showLengthState=s,this.showWidthState=e;let h=0;if((this.lastPriceOb=i).type===priceHelper.priceTypeFixed)h=1;else if(i.type===priceHelper.priceTypeVariable)h=parseFloat(this.field.typeLength.value/100);else{if(i.type!==priceHelper.priceTypeVariableM2)return void console.error("unknown price type: "+i.type);h=parseFloat(this.field.typeLength.value/100*(this.field.typeWidth.value/100))}1==this.field.winter.value&&this.showWinterState?(this.winterPriceState=!0,this.yearPrice=parseFloat(i.winter)*h):(this.winterPriceState=!1,this.yearPrice=parseFloat(i.base)*h),this.field.priceId&&(this.field.priceId.value=i.id),this.yearPrice<parseFloat(i.min)&&(this.yearPrice=parseFloat(i.min));var d=i.price_request;this.packageDescriptionTextState=(i.description?i.description+"<br>":"")+"<small>Aantal ophaalafspraken: "+(-1===i.request_pickup_max?"onbeperkt":i.request_pickup_max)+(-1!==i.request_pickup_max&&i.price_request?" · Extra afspraak: "+d:"")+"</small>";for(let e=this.servicePrice=0;e<this.field.services.length;e++){var u=this.field.services[e],p=u.value;u.checked&&this.priceTable.serviceList[p]&&this.calculateServicePrice(this.priceTable.serviceList[p])}this.startupPrice=parseFloat(i.price_startup),this.depositPrice=parseFloat(i.price_deposit),this.render()},render:function(){panel.set(this.typeLengthItem,this.showLengthState),panel.requiredChange(this.field.typeLength,this.showLengthState),this.showLengthState||(this.field.typeLength.min=""),this.typeWidthItem.style.display=this.showWidthState?"":"none",this.typeHeightItem.style.display=this.showHeightState?"":"none",this.typeVolumeItem.style.display=this.showVolumeState?"":"none",this.typeSquareItem.style.display=this.showSquareState?"":"none",this.winterItem.style.display=this.showWinterState?"":"none",this.packageDescriptionText&&(this.packageDescriptionText.innerHTML=this.packageDescriptionTextState||""),this.typeInfoId===enumList.typeInfo.id.storage||this.typeInfoId===enumList.typeInfo.id.workspaces?(this.priceText.innerHTML=0<this.yearPrice?this.calculateMonthPriceText():"Geen pakket",this.priceDescriptionText.innerHTML=0<this.yearPrice?this.calculateDescriptionPriceText():"--"):(this.priceText.innerHTML=0<this.yearPrice?this.calculateYearPriceText():"Geen pakket",this.priceDescriptionText.innerHTML=0<this.yearPrice?this.calculateMonthPriceText():"--"),this.priceDescriptionStartupText.innerText=0<this.startupPrice?this.calculateStartupPriceText():"Geen opstartkosten",this.priceDescriptionDepositText.innerText=0<this.depositPrice?this.calculateDepositPriceText():"Geen borgsom",this.drawServiceText()},calculateDescriptionPriceText:function(){var e=this.yearPrice,t=this.winterPriceState?6:12;return t+" x "+priceHelper.toNl(e/t)+" = "+priceHelper.toNl(this.yearPrice)+" per jaar"},calculateMonthPriceText:function(){var e=this.winterPriceState?6:12;return"€"+priceHelper.toNl(this.yearPrice/e)+" per maand"},calculateYearPriceText(){return this.lastPriceOb&&this.lastPriceOb.period?"€"+priceHelper.toNl(this.yearPrice)+" per "+this.lastPriceOb.period+(this.lastPriceOb.period_line?" "+this.lastPriceOb.period_line:""):"€"+priceHelper.toNl(this.yearPrice)+" per jaar"},calculateServicePrice:function(e){let t=0;"fixed"===e.type?t=parseFloat(e.base):(t=parseFloat(e.base)*parseFloat(this.field.typeLength.value/100),parseFloat(e.min)>t&&(t=parseFloat(e.min))),this.servicePrice+=t},calculateServicePriceText:function(){return"+ "+priceHelper.toNl(this.servicePrice)+" extra services"},calculateStartupPriceText:function(){return"+ "+priceHelper.toNl(this.startupPrice)+" opstartkosten"},calculateDepositPriceText:function(){return"+ "+priceHelper.toNl(this.depositPrice)+" borgsom"},drawServiceText:function(){var e=0<this.servicePrice?this.calculateServicePriceText():"";e?(this.priceDescriptionServiceText.innerText=e,this.priceDescriptionServiceText.style.display="block"):this.priceDescriptionServiceText.style.display="none"}}; 2//# sourceMappingURL=global.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.