ClickCease

Contact Information
Powered by Party Rental Software
Days

Start
End



Some items are not available for the selected delivery method.
You may not be on the correct site. Click here to change location.
Subtotal (estimate):
Delivery Fee (Change Address):
"); let sel = jQuery(""); sel.append("") jQuery("[id^=io_acc_shortname_"+main_rental_id+"]").each(function(){ sel.append("") if(this.id.split("_").length > 4){ let split_id = this.id.split("_"); let option_rental_id = split_id[split_id.length - 1]; let sel2 = jQuery(""); sel2.append("") jQuery("[id^=io_acc_shortname_"+option_rental_id+"_]").each(function(){ sel2.append("") }); sel_div.append(sel2); } }); sel_div.prepend(sel); jQuery(".io_product_acc_pkg").replaceWith(sel_div); } } if(io_cart_party_planner_email === "on" && io_cart_party_planner_destination){ jQuery("#cartPartyBuilderEmailContainer").show() if(getCookie("io_email")){ jQuery("#cartPartyBuilderEmailInput").val(getCookie("io_email")); } } if(io_brand == "PW"){ jQuery(".io_product_price_box").attr("style", "display: none !important;"); jQuery(".io_product_price_sqfoot").attr("style", "display: grid !important;"); } setTimeout(simpleCart.init, 100); if(io_hide_zero == 1){ jQuery(".io_product_price_top_left").each(function (){ if(Number(this.innerText.replace(/[^0-9.-]+/g,"")) == 0){ jQuery(this).parent().attr('style','display:none !important'); } }); jQuery(".io_product_price_left").each(function (){ if(Number(this.innerText.replace(/[^0-9.-]+/g,"")) == 0){ jQuery(this).parent().attr('style','display:none !important'); } }); } if (io_categoryVariantImages == 'on'){ jQuery(".io_category_thumbox").show(); jQuery('.view-product-button').addClass('view-product-button2') } let giftcard_value = jQuery(".item_giftcardvalue"); if(giftcard_value && giftcard_value.text()){ jQuery(".delivery_charge_check_container").hide(); } if (io_customer_geolocation == 'on') initializeGeolocation(); }); /*end of on-ready*/ /**/ /**/ function phraseUpdateCount(inputElement) { //read the text and strip out spaces const fullText = inputElement.value; const lettersOnly = fullText.replace(/\s+/g, ""); const count = lettersOnly.length; const cookieKey = inputElement.classList[0]; document.querySelector(".item_quantity").textContent = count; setCookie(cookieKey, fullText, 45); } function io_party_planner_email_submit(){ let valid_regex = /^(([^<>()[\]\\.,;:\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,}))$/; let email = jQuery("#cartPartyBuilderEmailInput").val(); if(email){ if(email.match(valid_regex)){ setCookie("io_email", email, 14); window.open(io_cart_party_planner_destination, '_blank').focus(); }else{ jQuery("#cartPartyBuilderEmailWarning").show(); } }else{ jQuery("#cartPartyBuilderEmailWarning").show(); } } function rid_in_batch(rid, batch_ids){ let result = batch_ids.filter(function(batch){ if(batch.includes(this)) return true; }, rid); return result } function set_cart_time_instructions(){ /* Making it clearer that customers need to set the time in order to see pricing and availability. */ let instructions_container = jQuery("

"); let instructions = ""; if(multi_day){ instructions += "Select the event date or date range using the calendar"; }else{ instructions += "Select the event date using the calendar"; } instructions += "."; instructions_container.text(instructions); jQuery("#cartCalendar").append(instructions_container); } function live_pricing_is_on(){ /* Checks to see if live pricing is on. Assumes it is on unless one of the following conditions: The setting Hide Live Price is off. The setting Show Weekend/Weekday Pricing is off. Delivery method pricing is enabled by default. We are on an item page that uses delivery method pricing. */ if(io_hide_live_prices != 1 || io_weekEndPrice != "on" || io_delivery_prices["default"].length != 0 || jQuery(".io_product_infobox .item_rentalid").innerText in io_delivery_prices["override"] || io_custom_prices["default"].length != 0 || jQuery(".io_product_infobox .item_rentalid").innerText in io_delivery_prices["override"]){ return false; } return true; } function allow_same_day_select_on_checkout(){ jQuery(".jquery-datepicker").datepicker("option", "minDate", 0); } function show_or_hide_required_info_message(){ if(io_info_required == "on"){ if(!all_info_provided()){ jQuery("#io_all_prices").hide(); jQuery("#item_additonal_info_open_message").show(); }else{ jQuery("#io_all_prices").show(); jQuery("#item_additonal_info_open_message").hide(); } } } function all_info_provided(){ /* This is used for when the "Hide all pricing on page until information is provided" setting is on price settings. */ let all_data_provided = true; let io_required_data = io_info_required_data; for (const [data, value] of Object.entries(io_required_data)) { if(value == 1){ if(!getCookie(data)){ all_data_provided = false } } } if(live_pricing_is_on() && !event_time_set()) { all_data_provided = false; } return all_data_provided; } function event_time_set(){ if(getCookie("io_timeStart") && getCookie("io_timeEnd") && getCookie("io_dateStart") && getCookie("io_dateEnd")){ return true; } else{ return false } } function show_cart_message(){ message_container = jQuery("#cartCustomMessage"); message_container.html(io_cart_message); message_container.show(); } function deliveryMethodSelected(){ setCookie("io_delivery_method", jQuery(".ioDeliveryMethods option:selected").text(), 14); checkRestrictedDeliveries(); } function adjustPicBoxForHeader(){ /* For some reason its hard to get css with querySelector so we use jQuery to get the picbox. */ pic_box = jQuery(".io_product_picbox"); io_header = document.querySelector(".io_header"); if(pic_box != null && pic_box.css("position") == "sticky"){ if(io_header != null){ header_height = io_header.offsetHeight; pic_box.css("top", (10+header_height).toString()+"px"); } else{ possible_headers = document.querySelectorAll("header,section") possible_headers.forEach((ele) =>{ if(ele.style.top == "0px" && (ele.style.position == "fixed" || ele.style.position == "sticky")){ header = ele; header_height = header.offsetHeight; pic_box.css("top", (10+header_height).toString()+"px"); } }); } } } function cart_times_all_set(){ if(jQuery("#ioCartTimeSelectContainer [name=dateStart]").val() == ""){ return false; } if(io_hidetimes === "off" || io_hidetimes === ""){ if(jQuery("#ioCartTimeSelectContainer [name=timeStart]").val() == ""){ return false; } if(jQuery("#ioCartTimeSelectContainer [name=timeEnd]").val() == ""){ return false; } } return true; } function checkRestrictedDeliveries(){ let items = simpleCart.items() let restrictions_found = false; for(i in items){ let rid = items[i].get("rentalid"); if(typeof jQuery(".ioDeliveryMethods").val() != "undefined"){ if(io_delivery_methods[jQuery(".ioDeliveryMethods").val()]["restricted"].includes(rid)){ jQuery("#deliveryMethodWarning").show(); restrictions_found = true; } } } if(!restrictions_found){ jQuery("#deliveryMethodWarning").hide(); } } function display_cart_warning(item){ let cart_warning_container = jQuery("#cartWarning"); // Check if an event date if not we should tell them to set it. event_times = getAvailTimes(); if(!event_times[0] || !event_times[1]){ cart_warning_container.text("Please set the date and time for your event above."); cart_warning_container.show(); return false; } let item_name = item.get("name"); let item_timeslots = item.get("timeslots"); let timeslot_name = getTimeslotName(item_timeslots); let stop_loop = false; if(item_timeslots){ if(jQuery(item_timeslots).nodeName == "SELECT"){ /* NOTE: It should not be possible for timeslots to be empty. But in the event they somehow are, we should have this here. */ /* timeslots */ var timeslot_sel_range = jQuery(".item-timeslots [name=\""+timeslot_name+"\"] option:selected").val(); if(typeof timeslot_sel_range != "undefined"){ var [start_time, end_time] = break_timeslot_sel_range(timeslot_sel_range); } }else{ /* timepickers */ let [start_timepicker, end_timepicker] = get_cart_timepickers(timeslot_name); var start_time = start_timepicker.value; var end_time = end_timepicker.value; } if(!start_time || !end_time){ cart_warning_container.text("Please select a time range for the following item: " + item_name); cart_warning_container.show() stop_loop = true; } } else{ cart_warning_container.text("Some items are not available on this date."); cart_warning_container.show() } return stop_loop } const io_personal_cookie_keys = ["io_email", "io_phone", "io_address", "io_city", "io_state", "io_zip"]; function ioHasMarketingConsent(){ if(typeof cmplz_has_consent !== 'function'){ return true; } return cmplz_has_consent('marketing'); } function ioUnwrapStoredValue(raw) { // Fully peel any {v,e} wrapper layers that may have accumulated when an // older plugin version re-saved an already-wrapped value (IO-36799). Cart // values (dates, times, addresses) are never JSON objects, so any layer // that parses to a {v,...} object is a wrapper to unwrap. Returns // { value, expired, malformed } describing the innermost stored string. var value = (raw == null) ? "" : String(raw); for (var depth = 0; depth < 25; depth++) { var trimmed = value.trim(); if (trimmed.charAt(0) !== '{') break; // plain value -> done var obj; try { obj = JSON.parse(trimmed); } catch (e) { break; // not parseable -> stop, keep value } if (!obj || typeof obj !== 'object' || !('v' in obj)) break; // not our wrapper if (obj.e && Date.now() > obj.e) { return { value: "", expired: true, malformed: false }; } value = (obj.v != null) ? String(obj.v) : ""; } // Only flag as malformed if what remains still looks like our own broken // {"v":...} wrapper (e.g. truncated) -- never an ordinary value that just // happens to start with "{", which must be preserved untouched. var malformed = /^\s*\{\s*"v"\s*:/.test(value); return { value: value, expired: false, malformed: malformed }; } function setCookie(cname, cvalue, exdays) { if(io_personal_cookie_keys.indexOf(cname) !== -1 && !ioHasMarketingConsent()){ return; } // Store values in localStorage with an io_ prefix for uniqueness and emulate expiration try { // Unwrap first so an already-wrapped value can never be re-wrapped and // compound into nested {v,e} layers (IO-36799). var clean = ioUnwrapStoredValue(cvalue).value; var expiresAt = (typeof exdays === 'number' && exdays > 0) ? Date.now() + (exdays * 24 * 60 * 60 * 1000) : null; var payload = JSON.stringify({ v: clean, e: expiresAt }); window.localStorage.setItem(cname, payload); } catch (e) { // Swallow errors to keep behavior similar to cookie writes silently failing console.log(e); } } function getCookie(cname) { // Read values from localStorage honoring expiration; return empty string if missing/expired try { var raw = window.localStorage.getItem(cname); if (!raw) return ""; var result = ioUnwrapStoredValue(raw); if (result.expired || result.malformed) { // Drop expired or corrupted entries so they self-heal instead of being // rendered as raw JSON in the date/time fields (IO-36799). try { window.localStorage.removeItem(cname); } catch (e) {} return ""; } return result.value; } catch (e) { return ""; } } async function fetchAndSetCookie(name) { var requestInit = { credentials: "include" }; fetch("https://rental.software/include/get_cookie.php?name=" + name, requestInit).then(function (response) { return response.json(); }).then(function (response) { return handleResponse(name, response); }); } function handleResponse(name, response) { var currentCookieValue = getCookie(name); if (!!response.value && currentCookieValue !== response.value) { setCookie(name, response.value, 14); } return response.value; } function clearIoPersonalDataForNoConsent(){ io_personal_cookie_keys.forEach(function(key){ try { window.localStorage.removeItem(key); } catch (e) { console.log(e); } }); var trackingUrl = (window.location.href.indexOf("localhost") > -1) ? "http://localhost/io/bugs/include/iotracking.php" : "https://rental.software/include/iotracking.php"; var clearImg = new Image(); clearImg.src = trackingUrl + "?action=remove&nocache=" + Math.random(); } document.addEventListener("cmplz_status_change", function (e) { if (e.detail.category === 'marketing' && e.detail.value === 'deny') { clearIoPersonalDataForNoConsent(); } }); function break_timeslot_sel_range(timeslot_sel_range){ /* Takes a time range given by selected timeslot and gets the start and end time removing meridiem.*/ timeslot_sel_arr = timeslot_sel_range.split(" - "); var start_time = timeslot_sel_arr[0].replace("am"," am").replace("pm"," pm").replace(" "," "); var end_time = timeslot_sel_arr[1].replace("am"," am").replace("pm"," pm").replace(" "," "); return Array(start_time, end_time); } function getAvailTimes(){ /* Commonly used helper function. Accomplishes two things: Returns an array containing start_date, start_time, and event duration. Sets cookies for start and end date, and start and end time. Uses the inputs available in the cart if they are filled out, so dateStart, dateEnd, timeStart, and timeEnd. If timeslots are being used in cart it chooses the selected timeslot and breaks it on - and gets the start ane end time from that. */ let start_date = jQuery("input[name=dateStart]").val(); let end_date = jQuery("input[name=dateEnd]").val(); if(io_company_timeslots.length != 0 && io_cartdayselect == "single_day"){ let cart_company_timeslot_selected = jQuery(".ioCartCompanyTimeslots option:selected").first().val(); if(cart_company_timeslot_selected){ setCookie("io_company_timeslot_selected", cart_company_timeslot_selected, 14); cart_company_timeslot_selected = cart_company_timeslot_selected.split("-"); var start_time = cart_company_timeslot_selected[0].trim(); var end_time = cart_company_timeslot_selected[1].trim(); } } else { var start_time = jQuery("input[name=timeStart]").val(); var end_time = jQuery("input[name=timeEnd]").val(); } if (start_date.length == 0) { start_date = getCookie("io_dateStart"); end_date = getCookie("io_dateEnd"); start_time = getCookie("io_timeStart"); end_time = getCookie("io_timeEnd"); } const has_selected_company_timeslot = io_company_timeslots.length != 0 && io_cartdayselect == "single_day" && jQuery(".ioCartCompanyTimeslots option:selected").first().val(); if(io_hidetimes === "on" && io_force_blank_timepickers != "on" && !has_selected_company_timeslot) { start_time = start_default; end_time = end_default; jQuery("input[name=timeStart]").val(start_time); jQuery("input[name=timeEnd]").val(end_time); } if(io_force_blank_timepickers != "on") { if(start_time.length == 0) { start_time = start_default; } if(end_time.length == 0) { end_time = end_default; } } /* no past dates */ if(start_date.length != 0 && convertDateStringtoDateObject(start_date, start_time) < new Date()){ start_date=""; end_date=""; } /* setCookie("checkDate", start_date, 14); */ setCookie("io_dateStart", start_date, 14); setCookie("io_dateEnd", end_date, 14); setCookie("io_timeStart", start_time, 14); setCookie("io_timeEnd", end_time, 14); /* If we are using the information gathering tool, we do not want to show this message.*/ if( live_pricing_is_on() && io_info_required == "off" ){ if(!event_time_set() && io_always_display_live_price != "on"){ jQuery("#item_live_price_time_set_message").show(); }else{ jQuery("#item_live_price_time_set_message").hide(); } } var newDate1 = convertDateStringtoDateObject(start_date, start_time); var newDate2 = convertDateStringtoDateObject(end_date, end_time); let time_duration = ((newDate2 - newDate1) / 3600) / 1000; return [start_date,start_time,time_duration]; } function getAllRentalIDsFromCart(){ let rental_ids = ""; jQuery("[id^='cartItem_']").each(function(){ children = this.children for(let i = 0; i < children.length; ++i){ if(children[i].className == "item-rentalid") { rental_ids += children[i].innerText + "|"; break; } } }); return rental_ids } /*
*/ /**/ function init_date_timepicker_for_info_header(){ jQuery(".ioInfoDatepicker").datepicker({ changeMonth: true, changeYear: true, dateFormat: dateFormat, rangeSelect: true, numberOfMonths: 1, stepMonths: 1, speed: "fast", showOn: "both", onChangeMonthYear: cal_onChangeMonthYear, buttonText: "Calendar", minDate: 1, firstDay: 0 }); jQuery("#ioHeaderDateStart").datepicker("option", { onSelect: function() { set_info_header_end_date(); saveInfoHeader(); // Add more functions if needed } }); if(restrictTimes){ jQuery(".ioInfoTimepicker").timepicker({ startTime: new Date(0, 0, 10, 0, 0, 0), endTime: new Date(0, 0, 0, 20, 0, 0, 0), minTime:restrictTimeStart, maxTime:restrictTimeEnd, /*show24Hours: $show24Hours,*/ timeFormat: timeFormat, separator: ":", className: "elementor-widget-text-editor", step: 15, disableTouchKeyboard: true }); } else{ jQuery(".ioInfoTimepicker").timepicker({ startTime: new Date(0, 0, 10, 0, 0, 0), endTime: new Date(0, 0, 0, 20, 0, 0, 0), /*show24Hours: $show24Hours,*/ timeFormat: timeFormat, separator: ":", className: "elementor-widget-text-editor", step: 15, disableTouchKeyboard: true }); } setTimeout(setUpTimeRestrictions_infoHeaderTimepickers, 500); } function saveInfoHeader(){ let info_header_start_date = jQuery("[id$=ioHeaderDateStart]"); let info_header_end_date = jQuery("[id$=ioHeaderDateEnd]"); let info_header_start_time = jQuery("[id$=ioHeaderTimeStart]"); let info_header_end_time = jQuery("[id$=ioHeaderTimeEnd]"); let info_header_address = jQuery("[id$=ioHeaderAddress]"); let info_header_city = jQuery("[id$=ioHeaderCity]"); let info_header_state = jQuery("[id$=ioHeaderState]"); let info_header_zip = jQuery("[id$=ioHeaderZipCode]"); let info_header_phone = jQuery("[id$=ioHeaderPhone]"); let info_header_email = jQuery("[id$=ioHeaderEmail]"); if(info_header_start_time.val()) setCookie("io_timeStart", info_header_start_time.val(), 14); if(info_header_end_time.val()) setCookie("io_timeEnd", info_header_end_time.val(), 14); if(info_header_start_date.val()) setCookie("io_dateStart", info_header_start_date.val(), 14); if(info_header_end_date.val()) setCookie("io_dateEnd", info_header_end_date.val(), 14); if(info_header_address.val()) setCookie("io_address", info_header_address.val(), 14); if(info_header_city.val()) setCookie("io_city", info_header_city.val(), 14); if(info_header_state.val()) setCookie("io_state", info_header_state.val(), 14); if(info_header_zip.val()) setCookie("io_zip", info_header_zip.val(), 14); if(info_header_phone.val()) setCookie("io_phone", info_header_phone.val(), 14); if(info_header_email.val()) setCookie("io_email", info_header_email.val(), 14); /* Set information in the cart. */ calCancel(); header_increment_step(); /* Stop form from doing anything else for elementor */ // jpa - still allow, turn off actions in form if wanted. to turn off io lead submission use the plugin settings //event.preventDefault(); //event.stopPropagation(); return true; } function set_info_header_values(){ let info_header_start_date = jQuery("[id$=ioHeaderDateStart]"); let info_header_end_date = jQuery("[id$=ioHeaderDateEnd]"); let info_header_start_time = jQuery("[id$=ioHeaderTimeStart]"); let info_header_end_time = jQuery("[id$=ioHeaderTimeEnd]"); let info_header_street = jQuery("[id$=ioHeaderAddress]"); let info_header_city = jQuery("[id$=ioHeaderCity]"); let info_header_state = jQuery("[id$=ioHeaderState]"); let info_header_zip = jQuery("[id$=ioHeaderZipCode]"); let info_header_phone = jQuery("[id$=ioHeaderPhone]"); let info_header_email = jQuery("[id$=ioHeaderEmail]"); if(getCookie("io_timeStart")) info_header_start_time.val(getCookie("io_timeStart")); if(getCookie("io_timeEnd")) info_header_end_time.val(getCookie("io_timeEnd")); if(getCookie("io_dateStart")) info_header_start_date.val(getCookie("io_dateStart")); if(getCookie("io_dateEnd")) info_header_end_date.val(getCookie("io_dateEnd")); if(getCookie("io_address")) info_header_street.val(getCookie("io_address")); if(getCookie("io_city")) info_header_city.val(getCookie("io_city")); if(getCookie("io_state")) info_header_state.val(getCookie("io_state")); if(getCookie("io_zip")) info_header_zip.val(getCookie("io_zip")); if(getCookie("io_phone")) info_header_phone.val(getCookie("io_phone")); if(getCookie("io_email")) info_header_email.val(getCookie("io_email")); } function add_classes_and_onClicks(){ /* First set up for dates */ let info_header_start_date = jQuery("#ioHeaderDateStart"); let info_header_end_date = jQuery("#ioHeaderDateEnd"); info_header_start_date.addClass("ioInfoDatepicker"); info_header_end_date.addClass("ioInfoDatepicker"); /* Now Timepickers */ let info_header_start_time = jQuery("#ioHeaderTimeStart"); let info_header_end_time = jQuery("#ioHeaderTimeEnd"); info_header_start_time.addClass("ioInfoTimepicker"); info_header_end_time.addClass("ioInfoTimepicker"); /* Add the onClick to the button */ let button = jQuery("#ioInfoHeaderSubmit"); button.click(saveInfoHeader); button.css("cursor", "pointer"); /* Init datepicker and timepickers */ init_date_timepicker_for_info_header(); /* Lastly set the values if they are set already */ set_info_header_values(); } function remove_set_event_buttton(){ let set_event_button = jQuery(".pageDateRangeWrapper"); if(set_event_button.length > 0) set_event_button.hide(); } function set_info_header_end_date(){ if(!jQuery("#ioHeaderDateEnd").val()){ jQuery("#ioHeaderDateEnd").val(jQuery("#ioHeaderDateStart").val()) } jQuery("#ioHeaderDateEnd").datepicker("option", { minDate: new Date(jQuery("#ioHeaderDateStart").val()) }); } function header_increment_step(){ let active = jQuery(".io-step-active"); switch(active.attr("id")){ case "io-step-1": if (/Mobi|Android/i.test(navigator.userAgent)) { jQuery("#io-step-2,#io-step-3,#io-step-4").hide(); } if(check_header_step_one(active)){ active.removeClass("io-step-active"); active.addClass("io-step-done") jQuery("#io-step-2").addClass("io-step-active") header_increment_step(); } break; case "io-step-2": if (/Mobi|Android/i.test(navigator.userAgent)) { jQuery("#io-step-2,#io-step-3,#io-step-4").show(); } if(simpleCart.items().length > 0){ active.removeClass("io-step-active"); active.addClass("io-step-done") jQuery("#io-step-3").addClass("io-step-active") header_increment_step(); } break; case "io-step-3": if (/Mobi|Android/i.test(navigator.userAgent)) { jQuery("#io-step-2,#io-step-3,#io-step-4").show(); } if(document.location.href.indexOf("io_quoteconfirm") >= 0){ active.removeClass("io-step-active"); active.addClass("io-step-done") jQuery("#io-step-4").addClass("io-step-active") header_increment_step(); } break; case "io-step-4": if (/Mobi|Android/i.test(navigator.userAgent)) { jQuery("#io-step-2,#io-step-3,#io-step-4").show(); } break; } } function check_header_step_one(active) { var allInputs = active.find('input'); for (var i = 0; i < allInputs.length; i++) { if (jQuery(allInputs[i]).val() === "") { return false; // Return false if any input is empty } } return true; // Return true if all inputs have a value } /**/ /**/ function accDDClicked(event){ this_element = jQuery(this) if(!this_element.prop("selected")){ pid = event.data.pid accLmt = event.data.accLmt all_elements = jQuery("[id^=io_acc_"+pid+"_]") let count = 0; /* Tried using .filter and .length to get the count of selected items but could not make it work. */ for(i = 0; i < all_elements.length; ++i){ if(all_elements[i].selected){ ++count; } } if(accLmt == 0){ this_element.css("border", "5px solid #bbb"); this_element.prop("selected", true); } else if(count >= accLmt){ let selected_value = jQuery("[id^=io_acc_"+pid+"_]").filter(function() { return this["selected"]; }); /* be sure to unselect other slected values if our acc limit has been reached. */ selected_value.prop("selected", false); selected_value.css("border", "1px solid #bbb"); } this_element.css("border", "5px solid #bbb"); this_element.prop("selected", true); } else{ this_element.prop("selected", false); this_element.css("border", "1px solid #bbb"); } } /* when accessory choice is clicked */ function accOnClick(acc_select=null){ /* set name/img back to original main in case they are just clicking on a 1st level size option */ jQuery("#bookNowBtn").removeClass("item_add").addClass("item_add_off").trigger("classChange"); jQuery(".io_product_title.item_name").html(main_name_orig); jQuery(".io_product_container .item_image").first().attr("src",main_img_src); jQuery(".io_product_container .item_image").first().attr("data-src",main_img_src); jQuery(".io_product_container .item_encoded").first().html(main_encoded); jQuery(".io_product_container .io_image_big").first().attr("src",main_img_src); jQuery(".io_product_container .io_image_big").first().attr("data-src",main_img_src); let main_id = jQuery(".io_product_container .item_rentalid").first().text(); let main_id_arr = main_id.split(":") jQuery(".io_product_container .item_rentalid").html(main_id_arr[0]); let clk_id; if(jQuery(acc_select).find(":selected").val()){ clk_id = jQuery(acc_select).find(":selected").val().replace("io_acc_shortname_",""); }else{ clk_id = this.id.replace("io_acc_shortname_",""); } clk_id = clk_id.replace("iothumb_",""); let click_id_arr = clk_id.split("_"); /* let pid = main_id; */ /* if(main_id.split("_").length>1) pid = parseInt(click_id_arr[0]); */ let acc_obj_relate_is_map = acc_obj_relate instanceof Map; let acc_obj_relate_entries = acc_obj_relate_is_map ? acc_obj_relate.entries() : Object.entries(acc_obj_relate); for (let [key, value] of acc_obj_relate_entries) { let id = key; let children = acc_obj_relate_is_map ? acc_obj_relate.get(key) : value; if(Object.keys(children).length>0){ for (key2 in children) { if(Object.keys(children[key2]).length > 0){ /* 3rd level */ for (key3 in children[key2]) { displayPackageChoices(clk_id,key2,key3,children[key2]); } }else{ displayPackageChoices(clk_id,key,key2,children); } } }else{ displayPackageChoices(clk_id,0,id,acc_obj_relate); } } } /* show/hide accessory levels as needed */ /* clk_id: one they clicked on, pid: parentid, id: iterator, arr: relationship array */ function displayPackageChoices(clk_id,pid,id,arr){ let main_id = jQuery(".io_product_container .item_rentalid").first().text(); let main_arr = main_id.split("_"); if(main_arr.length>1) main_id = parseInt(main_arr[0]); let click_id_arr = clk_id.split("_"); elem = getAccElem(id,pid); if(click_id_arr[0]==pid || click_id_arr[1]==pid || pid==0){ elem.style.display="inline-block"; }else{ elem.style.display="none"; } if(click_id_arr[1]==id && (click_id_arr[0]==pid || (pid==0 && click_id_arr[0]==main_id) ) || (click_id_arr.length==1 && click_id_arr[0]==id)){ jQuery("#bookNowBtn").removeClass("item_add_off").addClass("item_add").trigger("classChange"); updateMainItem(id,pid); } } /* update it with accessory data for choices */ var main_img_src = jQuery("#single_image").first().attr("href"); var main_name_orig = jQuery(".io_product_title.item_name").html(); var main_encoded = jQuery(".io_product_container .item_encoded").html(); var main_desc = jQuery(".io_product_detailbox .io_product_desc").html(); function updateMainItem(id,pid){ /* update add to cart btn, name, img, desc */ let name = ""; let name_enc = ""; let main_id = jQuery(".io_product_container .item_rentalid").first().text(); let main_arr = main_id.split(":"); if(main_arr.length>1) main_id = main_arr[0]; if(pid!=0){ name += jQuery("#io_acc_itemname_"+pid).html()+":"; name_enc += jQuery("#io_acc_itemname_"+pid).html()+":"; name += jQuery("#io_acc_shortname_"+id).html(); name_enc += jQuery("#io_acc_itemname_"+id).html(); }else{ pid = main_id; name += jQuery("#io_acc_itemname_"+id).html(); name_enc += jQuery("#io_acc_itemname_"+id).html(); } jQuery(".io_product_container .item_encoded").html(encodeURIComponent(name_enc.replace(/[\u2032\u2019]+/ig,"'"))); jQuery(".io_product_container .item_rentalid").html(main_id+":"+pid+"_"+id); jQuery(".io_product_title.item_name").html(name); // Make sure the description actually displays text. let acc_desc = jQuery("#io_acc_desc_"+pid+"_"+id).first(); if(acc_desc.length>0 && acc_desc.text()){ jQuery(".io_product_container .io_product_desc").first().html(jQuery("#io_acc_desc_"+pid+"_"+id).first()[0].innerHTML); } /* swap accessory image with main image pic for drop-down type items (linens) */ let img = jQuery("#io_acc_imgbig_"+pid+"_"+id).first().attr("href"); if(img==null) img = jQuery("#iothumb_"+pid+"_"+id).first().attr("src") if(img==null){ }else{ if(img.length==0 && pid==main_id){ /* for 1 level dd items that have no img, use the main img */ img = main_img_src; } jQuery(".io_product_container .io_image_big").first().attr("src",img); jQuery(".io_product_container .io_image_big").first().attr("data-src",img); jQuery(".io_product_container .item_image").first().attr("src",jQuery("#iothumb_"+pid+"_"+id).first().attr("src")); jQuery(".io_product_container .item_image").first().attr("data-src",jQuery("#iothumb_"+pid+"_"+id).first().attr("src")); jQuery("#single_image").first().attr("href",img).show(); } checkAvailFilter(); } /* get either img or text for accessory choices */ function getAccElem(id,pid){ let path =pid+"_"+id; if(pid==0){ path=id; } let elem = null; try{ elem = document.querySelector("#ioAccButtonWrapper_"+path); }catch(e){} if(elem == null){ try{ elem = document.querySelector("#iothumb_"+path); }catch(e){} } if(elem==null){ try{ elem = document.querySelector("#io_product_acc_pkg_sel_"+pid); }catch(e){} if(elem!=null) return elem; }else{ return elem; } if(elem == null){ try{ elem = document.querySelector("#io_acc_shortname_"+path); }catch(e){} }else if(elem.src=="" | elem.getAttribute("data-src")==""){ try{ elem = document.querySelector("#io_acc_shortname_"+path); }catch(e){} }else if(elem.src.substr(-1)=="/"){ try{ elem = document.querySelector("#io_acc_shortname_"+path); }catch(e){} } if(elem==null){ try{ elem = document.querySelector("#io_acc_shortname_"+id); }catch(e){} } return elem; } /* create the accessory choice btn (img/text) */ function makeAccBtn(button_add,pid){ let newButton; if(button_add.nodeName=="IMG"){ newButton = button_add; let id = newButton.id.replace("iothumb_"+pid,""); var wrapper = document.createElement("div"); wrapper.setAttribute("id", "ioAccButtonWrapper_"+pid+id); wrapper.style.display = "inline-block"; wrapper.appendChild(newButton); let acc_name = document.createElement("span"); acc_name.style.overflow = "hidden"; acc_name.style.textOverflow = "ellipsis"; acc_name.style.maxWidth = "80px"; acc_name.style.display = "block"; acc_name.style.whiteSpace = "nowrap"; acc_name.textContent = jQuery("#io_acc_shortname"+id).text(); acc_name.classList.add("accTextName"); acc_name.setAttribute("id", "io_acc_shortname_"+pid+id); wrapper.appendChild(document.createElement("br")); wrapper.appendChild(acc_name); }else{ newButton = button_add.cloneNode(true); let id = newButton.id.replace("io_acc_shortname_",""); newButton.id = "io_acc_shortname_" + pid + "_" + id; } newButton.classList.add("elementor-animation-grow"); newButton.classList.remove("item_image"); newButton.style="cursor:pointer;border: solid 1px grey"; newButton.classList.add("io_access_button"); newButton.style.display = "inline-block"; newButton.style.verticalAlign = "top"; newButton.onclick=accOnClick; if(newButton.nodeName=="IMG"){ newButton.style.minWidth = "80px"; newButton.style.width = "80px"; newButton.style.margin = "2px"; newButton.style.height = "80px"; }else{ newButton.style.margin = "0px 2px 0px 2px"; } if(button_add.nodeName=="IMG"){ return wrapper } return newButton; } /* when clicking the thumb swatches under main image (2nd image for an item) */ function updateMainPic(img) { let container = img.parentElement; while (container && !container.querySelector(".io_image_big")) { container = container.parentElement; } const main_img = container ? container.querySelector(".io_image_big") : null; if (!main_img) return; const dataBigSrc = img.getAttribute("data-big-src"); if (dataBigSrc) { main_img.src = dataBigSrc; return; } let thumb_id = img.id; let big_id = thumb_id.replace("thumb", "big"); const img_big = document.getElementById(big_id); if (img_big && img_big.href) { main_img.src = img_big.href; } } /**/ /**/ function calApply() { /* reset timeslots if filtering is on */ filterTimeslotsByDay_itemTimeslots(); simpleCart.update(); /* Prevent zero-duration selection: disallow identical start and end date/time */ try { var ds = jQuery("input[name=dateStart]").val(); var de = jQuery("input[name=dateEnd]").val(); var ts = jQuery("input[name=timeStart]").val(); var te = jQuery("input[name=timeEnd]").val(); if(ts && te && ds && de) { var s24 = convert12HourTo24Hour(ts); var e24 = convert12HourTo24Hour(te); var sObj = buildDateObj(ds.split("/"), s24); var eObj = buildDateObj(de.split("/"), e24); if(sObj && eObj && typeof sObj.getTime === 'function' && typeof eObj.getTime === 'function') { if(eObj.getTime() === sObj.getTime()) { alert("Please choose an end time that's after the start time."); jQuery("input[name=timeEnd]").val(""); return false; } } } }catch(e){} if(cart_times_all_set()){ ioCartLoaderActivate(); setCookie("io_dateApplied", "true", 1) checkAvailAll(); // If no availability calls were made, hide loader shortly after setTimeout(function() { if(io_cart_loading_active && io_cart_loading_count === 0) { io_cart_loading_active = false; ioCartShowOverlay(false); } }, 300); calCancel(); } let io_required_data = io_info_required_data; for (const [data, value] of Object.entries(io_required_data)) { if(value == 1){ setCookie(data, jQuery("#io_im_"+data).val(), 14); } } /* Check if information gathering header exists. If it does, update the times on there. */ if(jQuery("#ioInfoHeader").length){ jQuery("#ioHeaderTimeStart").val(jQuery("[name=timeStart]").val()); jQuery("#ioHeaderTimeEnd").val(jQuery("[name=timeEnd]").val()); jQuery("#ioHeaderDateStart").val(jQuery("[name=dateStart]").val()); jQuery("#ioHeaderDateEnd").val(jQuery("[name=dateEnd]").val()); header_increment_step(); } show_or_hide_required_info_message() /* if(!cartStayOpen) cartHide(); */ } function calCancel() { click_count = 0; start_date = getCookie("io_dateStart"); end_date = getCookie("io_dateEnd"); start_time = getCookie("io_timeStart"); end_time = getCookie("io_timeEnd"); jQuery("input[name=dateStart]").val(start_date); jQuery("input[name=dateEnd]").val(end_date); if(io_company_timeslots.length != 0 && io_cartdayselect == "single_day" && getCookie("io_company_timeslot_selected")){ jQuery(".ioCartCompanyTimeslots").val(getCookie("io_company_timeslot_selected")); } else{ jQuery("input[name=timeStart]").val(start_time); jQuery("input[name=timeEnd]").val(end_time); } setCalBackground(); jQuery(".ioDateRange").html(smartFormatDateRange()) jQuery("#cartCalendar, #cartTimePicker").hide(); jQuery(".ioDateRange").show(); jQuery(".changeDateLinkWrapper").show(); } /* var cartStayOpen = false; */ function calSetDateRange(stayOpen) { /* if(stayOpen==1){ cartStayOpen = true; }else{ cartStayOpen = false; } */ jQuery(".changeDateLinkWrapper").hide(); jQuery("#cartCalendar, #cartTimePicker").show(); jQuery("#cartDateRange").hide(); } function smartFormatDateRange() { let start_date = jQuery("input[name=dateStart]").val(); let end_date = jQuery("input[name=dateEnd]").val(); if(io_company_timeslots.length != 0 && io_cartdayselect == "single_day"){ let cart_company_timeslot_selected = jQuery(".ioCartCompanyTimeslots option:selected").first().val(); if(cart_company_timeslot_selected){ setCookie("io_company_timeslot_selected", cart_company_timeslot_selected, 14); cart_company_timeslot_selected = cart_company_timeslot_selected.split("-"); var start_time = cart_company_timeslot_selected[0].trim(); var end_time = cart_company_timeslot_selected[1].trim(); } } else { var start_time = jQuery("input[name=timeStart]").val(); var end_time = jQuery("input[name=timeEnd]").val(); } let text = ""; text = start_date; if(io_hidetimes!="on") text += " " + start_time; if (start_date == end_date) { if(io_hidetimes!="on"){ text += " "; text += end_time; } } else { text += " "; text += end_date; if(io_hidetimes!="on") text += " " + end_time; } /* text += " "; */ return text; } function resetCalButtons() { jQuery("#cartCalendar .ui-datepicker-prev").addClass("fas fa-arrow-left").css("color", pallet_color1); jQuery("#cartCalendar .ui-datepicker-next").addClass("fas fa-arrow-right").css("color", pallet_color1); } function cal_onChangeMonthYear(year, month, obj) { setTimeout(resetCalButtons, 10); setTimeout(setCalBackground, 10); } function cal_onSelect(dateText, obj) { setTimeout(resetCalButtons, 10); let whatday_choice = ""; if(io_cartdayselect === "dropdown_options" && io_multidayquote === "on"){ let choice_obj = jQuery("#whatday"); if(choice_obj){ whatday_choice = choice_obj.val(); } } click_count++; end_timepicker = jQuery("input[name=timeEnd]"); let timeStart = jQuery("input[name=timeStart]").val(); if(io_force_blank_timepickers != "on") { if (timeStart == "") { jQuery("input[name=timeStart]").val(start_default); jQuery("input[name=timeEnd]").val(end_default); } } if (click_count == 1 || !multi_day || whatday_choice==="Same Day" || whatday_choice==="Overnight") { jQuery("input[name=dateStart]").val(dateText); jQuery("input[name=dateEnd]").val(dateText) end_timepicker.timepicker("option",{"minTime": jQuery("input[name=timeStart]").val()}); if(EndTimeLessThanStartTime( jQuery("input[name=timeStart]").val(), end_timepicker.val(), jQuery("[name='dateStart']").val(), jQuery("[name='dateEnd']").val() ) ) { end_timepicker.val(""); } if(io_cartAllowSameDay == "on"){ restrictStartTimepickerOnSameDaySelect(dateText, jQuery("input[name=timeStart]"), end_timepicker); } } else if (click_count == 2) { jQuery("input[name=dateEnd]").val(dateText); let start_date_str = jQuery("input[name=dateStart]").val(); let start_date_obj = convertDateStringtoDateObject(start_date_str); let end_date_obj = convertDateStringtoDateObject(dateText); if(end_date_obj < start_date_obj){ jQuery("input[name=dateStart]").val(dateText); if(io_cartAllowSameDay == "on"){ restrictStartTimepickerOnSameDaySelect(dateText, jQuery("input[name=timeStart]"), end_timepicker); } } else{ end_timepicker.timepicker("option",{"minTime": io_restrict_time_start}); } click_count = 0; } else { click_count = 0; } //custom code for suncoast_event if(io_cartdayselect === "dropdown_options" && io_multidayquote === "on"){ endDisplay(); //daysSelect(); } filterTimeslotsByDay_companyTimeslots(); setTimeout(setCalBackground, 10); } function endDisplay(){ //todo: need to figure out if these work and set triggers // trigger enddisplay after date is selected or possibly when dateEnd changes? let choice = jQuery("#whatday").val(); setCookie("io_whatday", choice, 14); let dateStart = jQuery("[name=dateStart]"); let timeStart = jQuery("[name=timeStart]"); let dateEnd = jQuery("[name=dateEnd]"); let timeEnd = jQuery("[name=timeEnd]"); if(choice==='Overnight'){ let startdate = dateStart.val(); let starttime = io_overnightPickupTime; let endcalc_date_obj = new Date(buildDateobjectstring(startdate,dateFormat,starttime)); let duration_hrs = 24; let end_date_obj = new Date(endcalc_date_obj.getTime()+duration_hrs*60*60*1000); if(!isNaN(end_date_obj)){ dateEnd.val(getFormatteddate(end_date_obj)); timeEnd.val(getFormattedtime(end_date_obj)); timeEnd.attr('readonly','readonly'); } }else if(choice==='Multi-Day'){ let startdate = dateStart.val(); let starttime = timeStart.val() || start_default; let start_date_obj = new Date(buildDateobjectstring(startdate, dateFormat, starttime)); if(!isNaN(start_date_obj)){ //dateEnd.val(getFormatteddate(start_date_obj)); let cal = jQuery("#cartCalendar"); let origOnSelect = cal.datepicker("option", "onSelect"); cal.datepicker("option", "onSelect", null); cal.datepicker("setDate", start_date_obj); cal.datepicker("option", "onSelect", origOnSelect); } timeEnd.removeAttr('readonly'); if(io_force_blank_timepickers == "on" && !timeEnd.val()){ timeEnd.val(""); } else if(!timeEnd.val()){ timeEnd.val(end_default); } }else{ let startdate = dateStart.val(); let starttime = timeStart.val() || start_default; let start_date_obj = new Date(buildDateobjectstring(startdate, dateFormat, starttime)); if(!isNaN(start_date_obj)){ dateEnd.val(getFormatteddate(start_date_obj)); let cal = jQuery("#cartCalendar"); let origOnSelect = cal.datepicker("option", "onSelect"); cal.datepicker("option", "onSelect", null); cal.datepicker("setDate", start_date_obj); cal.datepicker("option", "onSelect", origOnSelect); } timeEnd.removeAttr('readonly'); if(io_force_blank_timepickers == "on" && !timeEnd.val()){ timeEnd.val(""); } else if(!timeEnd.val()){ timeEnd.val(end_default); } click_count = 0; } setTimeout(setCalBackground, 10); } function setCalBackground() { let dateStart_string = jQuery("input[name=dateStart]").val(); let dateEnd_string = jQuery("input[name=dateEnd]").val(); if (dateFormat == "d/m/yy") { let dateStartArray = dateStart_string.split("/"); let dateEndArray = dateEnd_string.split("/"); var dateStart = new Date(dateStartArray[2], Number(dateStartArray[1])-1, dateStartArray[0]); var dateEnd = new Date(dateEndArray[2], Number(dateEndArray[1])-1, dateEndArray[0]); } else { var dateStart = new Date(dateStart_string); var dateEnd = new Date(dateEnd_string); } let sday = dateStart.getDate(); let smonth = dateStart.getMonth(); let syear = dateStart.getFullYear(); let eday = dateEnd.getDate(); let emonth = dateEnd.getMonth(); let eyear = dateEnd.getFullYear(); /* clear any (in case of cancel) */ jQuery(".ui-datepicker-calendar [data-handler=selectDay]").css("background-color","initial"); /* set the selected ones */ jQuery("#cartCalendar [data-month=" + smonth + "][data-year=" + syear + "], #cartCalendar [data-month=" + emonth + "][data-year=" + eyear + "]").each(function (i) { let cday = jQuery(this).find("a").first().text(); let cmonth = jQuery(this).attr("data-month"); let cyear = jQuery(this).attr("data-year"); /* let dateCurrent = new Date(Date.UTC(cyear,cmonth,cday,12)); */ let dateCurrent = new Date(cyear, cmonth, cday); if (click_count == 1 && dateEnd_string.length == 0) dateEnd = dateStart; if (dateCurrent.getTime() == dateStart.getTime() && dateCurrent.getTime() == dateEnd.getTime()) { jQuery(this).css("border-radius", "6px 6px 6px 6px"); } else if (dateCurrent.getTime() == dateStart.getTime()) { jQuery(this).css("border-radius", "6px 0 0 6px"); } else if (dateCurrent.getTime() == dateEnd.getTime()) { jQuery(this).css("border-radius", "0 6px 6px 0"); } if (dateCurrent >= dateStart && dateCurrent <= dateEnd) { jQuery(this).css("background-color", pallet_color1); } }); } /**/ /**/ /* called from simplecart */ function timeslotChange(){ checkAvailCartTimeslots(); } function filterTimeslotsByDay_companyTimeslots(){ var weekday = new Array(); weekday[0] = "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; weekday[6] = "Saturday"; let times = getAvailTimes(); let start_date = times[0]; var newDate1 = convertDateStringtoDateObject(start_date); let day = weekday[new Date(newDate1).getDay()]; let selected_option_label = jQuery(".ioCartCompanyTimeslots option:selected").first().text().toLowerCase(); if(optionHasDay(weekday, selected_option_label)){ if(selected_option_label.indexOf(day.toLowerCase()) === -1){ jQuery(".ioCartCompanyTimeslots").val(""); } } if(io_company_timeslots.length != 0 && io_cartdayselect == "single_day"){ jQuery(".ioCartCompanyTimeslots > option").each(function() { if(optionHasDay(weekday, this.text.toLowerCase())){ for(i=0; i 0){ var timeslot_name = getTimeslotName(timeslots_html); if(typeof item.get("timeslots-orig") == "undefined"){ var timeslots_obj = jQuery.parseHTML(timeslots_html); } else{ var timeslots_obj = jQuery.parseHTML(item.get('timeslots-orig')); } jQuery(timeslots_obj).find("option").each(function(){ if(optionHasDay(weekday, this.text.toLowerCase())){ for(i=0; i'+jQuery(timeslots_obj).html()+''); } } }); } function optionHasDay(weekdays, option_label){ for(i=0; i0){ item.set("timeslots",jQuery(".item-timeslots [name=\""+timeslot_name+"\"]")[0].outerHTML); } /* set on quote page */ jQuery(".controls [name=\""+timeslot_name+"\"] option").not(":selected").removeAttr("selected"); jQuery(".controls [name=\""+timeslot_name+"\"] option[value='"+jQuery(".item-timeslots [name=\""+timeslot_name+"\"] option:selected").val()+"']").attr("selected","selected"); } function setTimePicker(item, timepicker_name){ let [start_timepicker, end_timepicker] = get_cart_timepickers(timepicker_name); let start_time = start_timepicker.value; let end_time = end_timepicker.value; if(!start_time){ start_timepicker.style.borderColor = "red"; } else{ start_timepicker.style.borderColor = ""; } if(!end_time){ end_timepicker.style.borderColor = "red"; } else{ end_timepicker.style.borderColor = ""; } let start_timepicker_html = start_timepicker.outerHTML; let end_timepicker_html = end_timepicker.outerHTML; if(document.querySelectorAll(".item-timeslots [name=\""+timepicker_name+"\"]").length>0){ start_timepicker_html = addOrReplaceValueInTimepicker(start_timepicker_html, start_time); end_timepicker_html = addOrReplaceValueInTimepicker(end_timepicker_html, end_time); item.set("timeslots", '
Start: '+start_timepicker_html+' End: '+end_timepicker_html+'
'); } /* set on quote page */ /* For linen type items with timepickers */ let rental_id = item.get("rentalid"); let split_on_colon = rental_id.split(":"); if(split_on_colon.length > 1){ fix_time_name_for_linen_rid(timepicker_name, split_on_colon, start_time, end_time, rental_id) }else{ let quote_page_start_timepicker = document.querySelectorAll(".controls [name=\""+timepicker_name.replace("io_timepicker_", "starttime_")+"\"]")[0]; let quote_page_end_timepicker = document.querySelectorAll(".controls [name=\""+timepicker_name.replace("io_timepicker_", "endtime_")+"\"]")[0]; if(quote_page_start_timepicker != null && quote_page_end_timepicker != null){ quote_page_start_timepicker.value = start_time; quote_page_end_timepicker.value = end_time; } } } function fix_time_name_for_linen_rid(time_name, split_rid, start_time, end_time, rental_id){ for(let x = 0; x < split_rid.length; x++){ temp_timepicker_name = time_name.replace(rental_id, split_rid[x]); let quote_page_start_timepicker = document.querySelectorAll(".controls [name=\""+temp_timepicker_name.replace("io_timepicker_", "starttime_")+"\"]")[0]; let quote_page_end_timepicker = document.querySelectorAll(".controls [name=\""+temp_timepicker_name.replace("io_timepicker_", "endtime_")+"\"]")[0]; if(quote_page_start_timepicker != null && quote_page_end_timepicker != null){ quote_page_start_timepicker.value = start_time; quote_page_end_timepicker.value = end_time; } } } function addOrReplaceValueInTimepicker(timepicker_html, time_value){ if(timepicker_html.includes("value=")){ timepicker_html = [timepicker_html.slice(0, timepicker_html.indexOf("value=")), 'value="'+time_value+'"', timepicker_html.slice(timepicker_html.length-1)].join(""); }else{ /* No value defined. Add it at the end of the outer html. */ let position = timepicker_html.lastIndexOf(">"); timepicker_html = [timepicker_html.slice(0, position), ' value="'+time_value+'"', timepicker_html.slice(position)].join(""); } return timepicker_html } function restrictEndTimepickers(){ setUpTimeRestrictions_cartTimepickers() setUpTimeRestrictions_timeBasedItems() } function setUpTimeRestrictions_timeBasedItems(){ jQuery("input[name^=start_timeslot_]").change(function() { end_timepicker = jQuery("input[name='"+this.name.replace("start", "end")+"']"); end_timepicker = jQuery(end_timepicker[end_timepicker.length - 1]); end_timepicker.timepicker("option",{"minTime": jQuery(this).val()}); if( EndTimeLessThanStartTime( jQuery(this).val(), end_timepicker.val(), "0/0/0", "0/0/0" ) ){ end_timepicker.val(""); } }); } function setUpTimeRestrictions_cartTimepickers(){ jQuery("input[name=timeStart]").change(function() { end_timepicker = jQuery("[name='"+this.name.replace("Start", "End")+"']"); if(jQuery("[name='dateStart']").val() === jQuery("input[name='dateEnd']").val()){ end_timepicker.timepicker("option",{"minTime": jQuery(this).val()}); if(EndTimeLessThanStartTime( jQuery(this).val(), end_timepicker.val(), jQuery("[name='dateStart']").val(), jQuery("[name='dateEnd']").val() ) ) { end_timepicker.val(""); } } }); } function setUpTimeRestrictions_infoHeaderTimepickers(){ jQuery("#ioHeaderTimeStart").change(function() { end_timepicker = jQuery("#ioHeaderTimeEnd"); if(jQuery("#ioHeaderDateStart").val() === jQuery("#ioHeaderDateEnd").val()){ end_timepicker.timepicker("option",{"minTime": jQuery(this).val()}); if(EndTimeLessThanStartTime( jQuery(this).val(), end_timepicker.val(), jQuery("#ioHeaderDateStart").val(), jQuery("#ioHeaderDateEnd").val() ) ) { end_timepicker.val(""); } } }); } /* helper function to see if the value from a start timepicker is less than the string value of an end timepicker. param start_time: string representation of the start time picker. 12hr or 24hr. param end_time: string representation of the end time picker. 12hr or 24hr. param start_date: string representation of the start date, seperated by "/". Can be wither d/m/y or m/d/y. Pass "0/0/0" if dates do not matter. param end_date: string representation of the end date, seperated by "/". Can be wither d/m/y or m/d/y. Pass "0/0/0" if dates do not matter. */ function EndTimeLessThanStartTime(start_time, end_time, start_date, end_date){ if(!start_time || !end_time) return false; start_time = convert12HourTo24Hour(start_time); end_time = convert12HourTo24Hour(end_time); var split_start_date = start_date.split("/"); var split_end_date = end_date.split("/"); var startDate = buildDateObj(split_start_date, start_time); var endDate = buildDateObj(split_end_date, end_time); if(endDate < startDate){ return true; } else { return false; } } function get_cart_timepickers(timepicker_name){ let start_timepicker = document.getElementsByName(timepicker_name.replace("io_timepicker_", "start_timeslot_")); let end_timepicker = document.getElementsByName(timepicker_name.replace("io_timepicker_", "end_timeslot_")); start_timepicker = start_timepicker[start_timepicker.length-1]; end_timepicker = end_timepicker[end_timepicker.length-1]; return Array(start_timepicker, end_timepicker); } function restrictStartTimepickerOnSameDaySelect(start_date_str, start_timepicker, end_timepicker){ let selected_date_obj = convertDateStringtoDateObject(start_date_str); let current_date_obj = new Date(); if(current_date_obj.getDate() == selected_date_obj.getDate() && current_date_obj.getMonth() == selected_date_obj.getMonth() && current_date_obj.getYear() == selected_date_obj.getYear()){ let next_hour_time_stamp = current_date_obj.setMinutes(60); let next_hour_str = getFormattedtime(new Date(next_hour_time_stamp)) start_timepicker.timepicker("option",{"minTime": next_hour_str}); /* If the time in the input box is less than the time we just restricted too, then clear time inputs */ restricted_time_obj = convertDateStringtoDateObject(start_date_str, next_hour_str); currently_selected_time_obj = convertDateStringtoDateObject(start_date_str, start_timepicker.val()); if(currently_selected_time_obj < restricted_time_obj){ start_timepicker.val(next_hour_str); end_timepicker.val(""); end_timepicker.timepicker("option",{"minTime": next_hour_str}); } }else{ start_timepicker.timepicker("option",{"minTime": restrictTimeStart}); } } /*
*/ /**/ function cart_onUpdate() { /* need slight delay so simplecart updates before this runs */ setTimeout(cart_onUpdate2, 500); try{ for(var i=0;i Number(avail) || avail == "not") { /* item.set("availability",""+item.get("availability")+""); */ setTimeout(function () { jQuery("#cartItem_" + item_id + " .item-availability").css("color", "red") }, 10); //jQuery("#cartWarning").show(); stop_loop = display_cart_warning(item); hasUnavail = true; } else { jQuery("#cartItem_" + item_id + " .item-availability").css("color", "inherit"); } }else{ event_times = getAvailTimes(); if(!event_times[0] || !event_times[1]){ jQuery("#cartWarning").text("Please set the date and time for your event above."); jQuery("#cartWarning").show() } } var timeslots_html = item.get("timeslots"); if(typeof timeslots_html != "undefined"){ if(timeslots_html.length > 0){ var timeslot_name = getTimeslotName(timeslots_html); if(timeslots_html.indexOf(" 0 && dropdown == 1) }); var required_selected = true; required_dropdown_values.each(function() { required_value_id = jQuery(this).find(".item_rentalid")[0].outerText; required_value_id = required_value_id.split("_"); required_value_id = required_value_id[required_value_id.length-1]; let selected = jQuery("[id^='io_acc_"+required_value_id+"']").filter(function() { return this["selected"]; }); //IO-22431 - This wasnt catching if [0] was undefined if(jQuery(this).find(".io_acc_li_name")[0] != undefined){ required_value_name = jQuery(this).find(".io_acc_li_name")[0].outerText ? jQuery(this).find(".io_acc_li_name")[0].outerText : ""; } if(selected.length < jQuery(this).find(".item_required")[0].outerText){ if(item_id == main_id){ alert(required_value_name+" is a required field."); } required_selected = false; } if(!required_selected){ return false; } return true; }); if(!required_selected){ return false; } /* IO-14857 */ if(jQuery(".io_product_measurement_price").length > 0){ let units; if(jQuery(".io_product_infobox .item_qtytype").text() == "Area"){ units = "sq meters" if(country === "US") units = "sq feet" }else if(jQuery(".io_product_infobox .item_qtytype").text() == "Perimeter"){ units = "meters" if(country === "US") units = "feet" } item.set("units", units); item.set("quantity", jQuery(".io_measure_price_raw_measurement").text()); } } function cart_afterAdd(item) { /*loading animation*/ ioCartLoaderActivate(); setTimeout(function(){ if(io_cart_loading_active && io_cart_loading_count === 0){ io_cart_loading_active=false; ioCartShowOverlay(false);} }, 300); /* Add required Accessories */ let required_accs = jQuery("[id^=io_acc_required_]").filter(function() { return parseInt(this["outerText"]) > 0 && this.parentElement.style['display'] != 'none'; }); required_accs.each(function(index) { simpleCart.parse_html_and_add(this, true); }); let selected_values = jQuery("[id^=io_acc_]").filter(function() { return this["selected"]; }); selected_values.each(function() { let info = {}; let rid = jQuery(this).find(".item_rentalid")[0].outerText; let split_rid = rid.split("_"); if(split_rid.length == 3){ let parent_rid = split_rid[1]; let main_item_rid = split_rid[0]; info["acc_dd_parent_limit"] = jQuery("#io_acc_accessorylimit_"+main_item_rid+"_"+parent_rid)[0].outerText; }else{ info["acc_dd_parent_limit"] = "0"; } info["name"] = jQuery(this).find(".io_acc_li_name")[0].outerText info["qtyincrement"] = jQuery(this).find(".item_qtyincrement")[0].outerText info["quantity"] = jQuery(this).find(".item_required")[0].outerText > 0 ? jQuery(this).find(".item_required")[0].outerText : 1; info["rentalid"] = jQuery(this).find(".item_rentalid")[0].outerText info["linkqty"] = jQuery(this).find(".item_linkqty")[0].outerText info["pagename"] = io_pagename; if(jQuery(this).find(".io_acc_li_img_thumb")[0]){ info["image"] = jQuery(this).find(".io_acc_li_img_thumb")[0].src } let already_added = simpleCart.items().filter((item) => item.get("rentalid").startsWith(split_rid[0]+"_"+split_rid[1])); if(jQuery(this).find(".item_accessorydd")[0].outerText != 1 && (info["acc_dd_parent_limit"] == "0" || already_added.length < info["acc_dd_parent_limit"]) ){ simpleCart.add(info, true); } }); checkAvailCartOnly(true); let last_upsell_call_time = Date.now() - last_upsell_call; if(in_cart_upsell && last_upsell_call_time > 2000){ let rental_ids = ""; /* Get the last element in the cart. This is the last item added. */ last_added = jQuery("[id^='cartItem_']").last(); if(last_added.length){ last_added_children = last_added.children(); for(let i = 0; i < last_added_children.length; ++i){ if(last_added_children[i].className == "item-rentalid") { rental_ids += last_added_children[i].innerText + "|"; } } } if(rental_ids.length>0 && jQuery("#cartPopover").attr("class") == "cartIn"){ var times = getAvailTimes(); last_upsell_call = Date.now(); getUpsellsCall(times[0],times[1],times[2],rental_ids,updateCartUpsell); } else{ jQuery("#cart-carousel-container").hide(); } } if(io_company_timeslots.length != 0 && io_cartdayselect == "single_day"){ filterTimeslotsByDay_itemTimeslots(); simpleCart.update(); } if (jQuery(".cartInfo.open,.ioCart.open, .ioCart_link.open").length == 0) { setTimeout(function () { cartShow(); }, 100); } if(simpleCart.items().length==0){ jQuery(".simpleCart_checkout").hide() }else{ jQuery(".simpleCart_checkout").show(); } if(simpleCart.items().length > 0){ let headerBookButton = jQuery("a[href$='io_quoteform/']"); headerBookButton.addClass("ioCart_link"); headerBookButton.attr("href", "javascript:;"); } checkRestrictedDeliveries() if(jQuery("#ioInfoHeader").length){ header_increment_step(); } } function cart_afterQtyChange(){ let last_checkAvail_call_time = Date.now() - last_checkAvail_call; if(last_checkAvail_call_time > 2000){ /*loading animation*/ ioCartLoaderActivate(); setTimeout(function(){ if(io_cart_loading_active && io_cart_loading_count === 0){ io_cart_loading_active=false; ioCartShowOverlay(false);} }, 300); last_checkAvail_call = Date.now(); checkAvailCart(); checkAvailCartTimeslots(); } } function cart_hideTimepickerWrapper(){ jQuery(".ui-timepicker-wrapper").hide(); } function cart_beforeRemove() { last_remove = Date.now(); } function cart_afterRemove(removed_item){ checkAvailCart(); last_upsell_call_time = Date.now() - last_upsell_call; if(in_cart_upsell && last_upsell_call_time > 2000){ rental_ids = getAllRentalIDsFromCart(); if(rental_ids.length>0 && jQuery("#cartPopover").attr("class") == "cartIn"){ var times = getAvailTimes(); last_upsell_call = Date.now(); getUpsellsCall(times[0],times[1],times[2],rental_ids,updateCartUpsell); } else{ jQuery("#cart-carousel-container").hide(); } } /* IO-24060 */ simpleCart.items().forEach(function (item, index) { let expression = '^' + removed_item.get('rentalid') + '(?:[_:]\\d+)*'; if(item.get("rentalid").match(expression)){ item.remove(); } }); checkAvailCartTimeslots(); checkRestrictedDeliveries(); if(simpleCart.items().length==0){ jQuery(".simpleCart_checkout").hide() }else{ jQuery(".simpleCart_checkout").show(); } if(jQuery("#ioInfoHeader").length && simpleCart.items().length == 0){ jQuery("#io-step-3").removeClass("io-step-active"); jQuery("#io-step-2").addClass("io-step-active"); jQuery("#io-step-2").removeClass("io-step-done") } } function cart_afterLoad(){ var items_removed = false; simpleCart.items().forEach(function(item){ if(item.get("pagename") != io_pagename){ item.remove() items_removed = true; } }) if(items_removed){ alert("Some items in the cart are from a different location and have been removed."); } } /**/ /**/ function getFormatteddate(date_obj){ if(dateFormat.substring(0,1)=='d'){ let month = date_obj.getMonth() + 1; formatteddate = date_obj.getDate()+'/'+month+'/'+date_obj.getFullYear(); }else{ let month = date_obj.getMonth() + 1; formatteddate = month+'/'+date_obj.getDate()+'/'+date_obj.getFullYear(); } return formatteddate; } function getFormattedtime(date_obj){ var hour24 = false; var ampm = 'am'; var starttime = jQuery('[name=timeStart]').val(); if(starttime.length>0 && starttime.indexOf('m')==-1) hour24 = true; if(hour24){ //24 hour return return date_obj.getHours()+':'+pad(date_obj.getMinutes(),2); }else{ //12 hour return var hour = date_obj.getHours(); if(hour==12) ampm='pm'; if(hour==0) hour=12; if(hour>12){ hour-=12; ampm='pm'; } return hour+':'+pad(date_obj.getMinutes(),2)+' '+ampm; } } function buildDateobjectstring(date,dateformat,time){ var ampm = 'am'; var hour24 = false; if(typeof date == "undefined") return; if(typeof dateformat == "undefined") return; var start_arr = date.split('/'); if(dateformat.substring(0,1)=='d'){ date = start_arr[2]+'/'+pad(start_arr[1],2)+'/'+pad(start_arr[0],2); }else{ date = start_arr[2]+'/'+pad(start_arr[0],2)+'/'+pad(start_arr[1],2); } if(time.length>0 && time.indexOf('m')==-1) hour24 = true; if(hour24){ try{ var time_arr = time.split(':'); var hour = parseInt(time_arr[0]); var min = pad(time_arr[1], 2); time = hour + ':' + min + ':00'; }catch(err){ time = ""; } }else { try { time = time.replace('am', "").replace(' ', ""); if (time.indexOf('pm') != -1) ampm = 'pm'; time = time.replace('pm', "").replace(' ', ""); var time_arr = time.split(':'); var hour = parseInt(time_arr[0]); var min = pad(time_arr[1], 2); if (ampm == 'pm') { if (hour < 12) hour += 12; } else if (ampm == 'am' && hour == 12) { hour -= 12; } hour = pad(hour, 2); time = hour + ':' + min + ':00'; } catch (err) { time = ""; } } return date+' '+time; } function pad(num, size) { var s = num+""; while (s.length < size) s = "0" + s; return s; } function convertDateStringtoDateObject(date_str, time_str=null){ if(date_str){ split_date_str = date_str.split("/"); /* Parse start and end time. */ if(time_str){ /* Check and see if we are in 12 hour format, if so convert it to 24 hour format. */ split_time_str = convert12HourTo24Hour(time_str); }else{ /* If we do not have a time, then default to zeros */ split_time_str = [0, 0]; } /* Create date object based off our set date format. */ date_obj = buildDateObj(split_date_str, split_time_str); return date_obj; }else{ return new Date(); } } function buildDateObj(split_date_str, split_time_str){ if (dateFormat == "d/m/yy"){ return new Date(split_date_str[2], (+split_date_str[1] - 1).toString(), split_date_str[0], split_time_str[0], split_time_str[1]); }else{ return new Date(split_date_str[2], (+split_date_str[0] - 1).toString(), split_date_str[1], split_time_str[0], split_time_str[1]); } } function convert12HourTo24Hour(time_str){ /* This function returns an array containing hours and minutes of provided string in 24 hour format. */ /* This is primarily used for creating JS Date objects */ split_time = time_str.split(":"); /* We are in 12 hour format if there is an "m" attached to minutes portion. */ if(split_time[1].toLowerCase().search("m") != -1) { let separated_minutes = split_time[1].split(" "); if(separated_minutes.length==1){ split_time[1] = split_time[1].replace("am"," am"); split_time[1] = split_time[1].replace("pm"," pm"); separated_minutes = split_time[1].split(" "); } let minutes = separated_minutes[0]; let modifier = separated_minutes[1]; split_time[1] = minutes; /* First assume that if the hours are 12, then its midnight. */ if(split_time[0] == "12"){ split_time[0] = "00"; } /* Second if there is a "p" in the modifier, then add twelve to the hours. */ if(typeof modifier != "undefined"){ if(modifier.toLowerCase().search("p") != -1){ split_time[0] = (parseInt(split_time[0], 10) + 12); } } } return split_time; } /**/ /**/ function cartShow() { jQuery("#cartPopover").show(); jQuery("#cartPopover").removeClass("cartOut"); jQuery("#cartPopover").addClass("cartIn"); jQuery(".cartInfo,.ioCart,.ioCart_link").addClass("open"); if (/Mobi|Android/i.test(navigator.userAgent)) { document.body.style.overflow = "hidden"; } /* jQuery(this).one("click", cartHide); */ jQuery(".cartInfo").unbind("click").one("click", function(event){ event.stopPropagation(); event.stopImmediatePropagation(); cartHide(); }); jQuery(".ioCart, .ioCart_link").unbind("click").one("click", function(event){ event.stopPropagation(); event.stopImmediatePropagation(); cartHide(); }); jQuery(".cartIcon").removeClass("fa-shopping-cart").addClass("fa-close"); if(simpleCart.items().length==0){ jQuery(".simpleCart_checkout").hide() }else{ jQuery(".simpleCart_checkout").show(); } checkAvailCartOnly(); last_upsell_call_time = Date.now() - last_upsell_call; if(in_cart_upsell && last_upsell_call_time > 2000){ rental_ids = getAllRentalIDsFromCart(); if(rental_ids.length>0 && jQuery("#cartPopover").attr("class") == "cartIn"){ var times = getAvailTimes(); last_upsell_call = Date.now(); getUpsellsCall(times[0],times[1],times[2],rental_ids,updateCartUpsell); } else{ jQuery("#cart-carousel-container").hide(); } } } function cartHide() { jQuery("#cartPopover").removeClass("cartIn"); jQuery("#cartPopover").addClass("cartOut"); if (/Mobi|Android/i.test(navigator.userAgent)) { document.body.style.overflow = "auto"; } /* jQuery("#cartPopover").hide(); */ jQuery(".cartInfo,.ioCart, .ioCart_link").removeClass("open"); /* jQuery(this).one("click", cartShow); */ jQuery(".cartInfo").unbind("click").one("click", function(event){ event.stopPropagation(); event.stopImmediatePropagation(); cartShow(); }); jQuery(".ioCart, .ioCart_link").unbind("click").one("click", function(event){ event.stopPropagation(); event.stopImmediatePropagation(); cartShow(); }); jQuery(".cartIcon").removeClass("fa-close").addClass("fa-shopping-cart"); } /* function set_date_cookie(){ if(this.id.indexOf("start_") !== -1){ setCookie("dateStart", this.value, 14); } else if(this.id.indexOf("end_") !== -1){ setCookie("dateEnd", this.value, 14); } } */ jQuery(document).ready(function () {setTimeout(simpleCart.init, 3);}); /**/ /**/ function checkAvailAll(){ checkAvailCart(); checkAvailCartTimeslots(); checkAvailFilter(); } /**/ /**/ /* for items on page not in cart */ function checkAvailFilter() { let rental_names = ""; let rental_ids = ""; let batch_ids = []; let cart_rental_names = ""; let cart_rental_ids = ""; let item_id = ""; let main_id = ""; jQuery(".item_encoded").each(function(){ rental_names += this.innerText + "|"; }); jQuery(".io_product_infobox .item_rentalid").each(function(){ rental_ids += this.innerText + "|"; item_id = this.innerText; main_id = this.innerText; }); let batch_count = 0; let batch_index = 0; // If we have rental id string set, then we don't want to include availability checking for fpw items in header // IO-31498 if(!rental_ids) { jQuery(".io_item2_list_inner .item_rentalid, .io_item2_listrent .item_rentalid").each(function () { /* if(rental_ids.indexOf(this.innerText+"|") == -1){ rental_ids += this.innerText + "|"; } */ if (batch_count < 9) { if (!batch_ids.length) batch_ids.push("") if (!rid_in_batch(this.innerText + "|", batch_ids).length) { batch_ids[batch_index] += this.innerText + "|"; batch_count++; } } else { if (!rid_in_batch(this.innerText + "|", batch_ids).length) { batch_ids[batch_index] += this.innerText + "|"; batch_index++; batch_count = 0; batch_ids.push(""); } } }); } simpleCart.each(function (item, x) { var cart_name = item.get("encoded"); if(cart_name==null){ cart_name = encodeURIComponent(item.get("name")); cart_name = encodeURIComponent(decodeURIComponent(cart_name).replace(/[\u2032\u2019]+/ig,"'")); } let quantity = item.get("quantity"); if(item.get("inputtype") == "Map"){ quantity = 1 } cart_rental_names += cart_name + "-" + quantity + "|"; var cart_id = item.get("rentalid"); cart_rental_ids += cart_id + "-" + quantity + "|"; }); /* #14494 IO-13779 */ let delivery_methods_arr = []; var delivery_prices = []; if(io_delivery_prices){ if(Object.keys(io_delivery_prices["override"]).includes(item_id)){ delivery_prices = io_delivery_prices["override"][item_id] }else{ if(!item_is_in_overrride_group(main_id)){ delivery_prices = io_delivery_prices["default"] } } for(item in io_delivery_methods){ if(delivery_prices.includes(io_delivery_methods[item]["id"])){ delivery_methods_arr.push(item); } } } let custom_prices_arr = []; if(io_custom_prices){ if(Object.keys(io_custom_prices["override"]).includes(item_id.replace(":", '_'))){ custom_prices_arr = io_custom_prices["override"][item_id.replace(":", '_')] }else{ if(!item_is_in_overrride_group(main_id)){ custom_prices_arr = io_custom_prices["default"] } } } /* IO-13548 */ if(io_accessory_price == "on"){ let times = getAvailTimes(); let acc_rental_id_str = getAccIDforPrice(); let return_id = 0; if(acc_rental_id_str != ""){ checkAvailCall(times[0],times[1],times[2],rental_names,acc_rental_id_str,displayAccessoryPrices,0,[],[],return_id,0,null,1,"",1); } } let times = getAvailTimes(); if(rental_names.length>0){ if(use_weekday_weekend && rental_ids && !item_is_in_overrride_group(main_id)){ let return_id = 0; let week_weekend = ""; if(rental_ids != ""){ return_id = 1; week_weekend = get_week_weekend_times(times, main_id); checkAvailCall(week_weekend["weekday"][0],week_weekend["weekday"][1],week_weekend["weekday"][2],rental_names,rental_ids,updatePageAvail_weekday,0,cart_rental_ids,cart_rental_names,return_id,1); checkAvailCall(week_weekend["weekend"][0],week_weekend["weekend"][1],week_weekend["weekend"][2],rental_names,rental_ids,updatePageAvail_weekend,0,cart_rental_ids,cart_rental_names,return_id,1); } } let return_id = 0; if(rental_ids != "" || batch_ids.length){ return_id = 1; } if(delivery_methods_arr && rental_ids){ delivery_methods_arr.forEach(function(delivery_method){ checkAvailCall(times[0],times[1],times[2],rental_names,rental_ids,updatePageAvail_delivery_method,0,cart_rental_ids,cart_rental_names,return_id,1,delivery_method); }); } if(custom_prices_arr && rental_ids){ custom_prices_arr.forEach(function(custom_price){ let start_date = times[0]; let start_time = times[1]; if(!start_date){ start_date = getFormatteddate(new Date()); } if(!start_time){ start_time = io_default_start_time; } checkAvailCall(start_date,start_time,custom_price['duration'],rental_names,rental_ids,updatePageAvail_custom_price,0,cart_rental_ids,cart_rental_names,return_id,1,"",1,custom_price['name']); }); } if(batch_ids.length){ batch_ids.forEach(function(rids){ return checkAvailCall(times[0],times[1],times[2],"",rids,updatePageAvail,0,cart_rental_ids,cart_rental_names,return_id,1,null,1,"",1); }); }else{ return checkAvailCall(times[0],times[1],times[2],rental_names,rental_ids,updatePageAvail,0,cart_rental_ids,cart_rental_names,return_id,1,null,1); } } } function item_is_in_overrride_group(item_id){ for(const group_id in io_prices['override_groups']){ for(const search_id in io_prices['override_groups'][group_id]){ if(search_id == item_id){ return true; } } } return false } function get_week_weekend_times(times, rid){ /* Create a copy instead of reference.*/ let temp_times = JSON.parse(JSON.stringify(times)); let start_date = temp_times[0]; if(!start_date){ start_date = getFormatteddate(new Date()); temp_times[0] = start_date; } temp_times[1] = io_default_start_time var newDate1 = convertDateStringtoDateObject(start_date, io_default_start_time); var newDate2 = convertDateStringtoDateObject(start_date, io_default_end_time); let time_duration = ((newDate2 - newDate1) / 3600) / 1000; temp_times[2] = time_duration; let day = new Date(newDate1).getDay(); //IO-28150 - Other countries put the date dd/mm/yy so using the formatted newDate1 instead of start_date accounts for this let weekday_weekend = {}; weekday_weekend["rid"] = rid; if(io_weekendDefine == "friday-sunday"){ if(day == 5 || day == 6 || day == 0){ weekday_weekend["weekend"] = JSON.parse(JSON.stringify(temp_times)); temp_times[0] = getNextMonday(temp_times[0]); weekday_weekend["weekday"] = JSON.parse(JSON.stringify(temp_times)); }else if(day == 1 || day == 2 || day == 3 || day == 4){ weekday_weekend["weekday"] = JSON.parse(JSON.stringify(temp_times)); temp_times[0] = getNextSaturday(temp_times[0]); weekday_weekend["weekend"] = JSON.parse(JSON.stringify(temp_times)); } }else if(io_weekendDefine == "saturday-sunday") { if (day == 6 || day == 0) { weekday_weekend["weekend"] = JSON.parse(JSON.stringify(temp_times)); temp_times[0] = getNextMonday(temp_times[0]); weekday_weekend["weekday"] = JSON.parse(JSON.stringify(temp_times)); } else if (day == 1 || day == 2 || day == 3 || day == 4 || day == 5) { weekday_weekend["weekday"] = JSON.parse(JSON.stringify(temp_times)); temp_times[0] = getNextSaturday(temp_times[0]); weekday_weekend["weekend"] = JSON.parse(JSON.stringify(temp_times)); } }else if (io_weekendDefine == "friday-monday"){ if(day == 5 || day == 6 || day == 0 || day == 1){ weekday_weekend["weekend"] = JSON.parse(JSON.stringify(temp_times)); temp_times[0] = getNextTuesday(temp_times[0]); weekday_weekend["weekday"] = JSON.parse(JSON.stringify(temp_times)); }else if(day == 2 || day == 3 || day == 4){ weekday_weekend["weekday"] = JSON.parse(JSON.stringify(temp_times)); temp_times[0] = getNextSaturday(temp_times[0]); weekday_weekend["weekend"] = JSON.parse(JSON.stringify(temp_times)); } } return weekday_weekend; } /* helper function found here: https://bobbyhadz.com/blog/javascript-get-date-of-next-monday#:~:text=To%20get%20the%20next%20Monday%2C%20we%3A&text=If%20the%20remainder%20is%20equal,month%20for%20the%20next%20Monday. */ function getNextMonday(date_str) { const date_obj = parseDate(date_str, dateFormat); const nextMonday = new Date( date_obj.setDate( date_obj.getDate() + ((7 - date_obj.getDay() + 1) % 7 || 7), ), ); return getFormatteddate(nextMonday); } function getNextTuesday(date_str) { const date_obj = parseDate(date_str, dateFormat); const nextMonday = new Date( date_obj.setDate( date_obj.getDate() + ((7 - date_obj.getDay() + 2) % 7 || 7), ), ); return getFormatteddate(nextMonday); } function parseDate(date_str, format) { var parts = date_str.split(/[/.-]/); var day, month, year; if (format === "m/d/yy") { month = parseInt(parts[0]) - 1; day = parseInt(parts[1]); year = parseInt(parts[2]) + (parts[2].length === 2 ? 2000 : 0); } else if (format === "d/m/yy") { day = parseInt(parts[0]); month = parseInt(parts[1]) - 1; year = parseInt(parts[2]) + (parts[2].length === 2 ? 2000 : 0); } else if (format === "yy/m/d") { year = parseInt(parts[0]) + (parts[0].length === 2 ? 2000 : 0); month = parseInt(parts[1]) - 1; day = parseInt(parts[2]); } else { throw new Error("Unsupported date format"); } return new Date(year, month, day); } /* modified from function above */ function getNextSaturday(date_str) { const date_obj = parseDate(date_str, dateFormat); const next_friday = new Date( date_obj.setDate( date_obj.getDate() + ((7 - date_obj.getDay() + 6) % 7 || 7), ), ); return getFormatteddate(next_friday); } function updatePageAvail(data){ let use_id = data["return_id"] delete data["return_id"]; if(use_id == 1){ updatePageAvail_itemIDs(data) }else{ updatePageAvail_itemNames(data); } } function updatePageAvail_weekday(data){ jQuery.each(data, function (rental_id, qty){ if (rental_id == "price") { var prices = qty; jQuery.each(prices, function (price_id, amt) { let cust_price = document.querySelector(".io_product_cust_price_weekday"); if(cust_price==undefined){ var first_price = document.querySelector(".io_product_price_box"); if(first_price != null){ cust_price = first_price.cloneNode(true); /* clear all classes */ cust_price.className = ""; cust_price.classList.add("io_product_price_box"); cust_price.classList.add("io_product_cust_price_weekday"); cust_price.style.display = "none"; first_price.before(cust_price); } } main_item_id = jQuery(".io_product_infobox .item_rentalid").first().text(); if(main_item_id == price_id && cust_price!=undefined){ if(typeof amt == "string") amt = Number(amt.replace(",","")); cust_price.querySelector("p:nth-child(1)").innerHTML=simpleCart.toCurrency(amt); let times = getAvailTimes(); cust_price.querySelector("p:nth-child(2)").innerHTML = io_weekDayText; if(amt>0){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } } }); } }); } function updatePageAvail_delivery_method(data){ var delivery_method = data["delivery_method"] jQuery.each(data, function (rental_id, qty){ if (rental_id == "price") { var prices = qty; jQuery.each(prices, function (price_id, amt) { let cust_price = document.querySelector(".io_product_cust_price_delivery_method"+io_delivery_methods[delivery_method]["id"]); let rid = jQuery(".io_product_container .item_rentalid").first().text(); if(cust_price==undefined && !io_delivery_methods[delivery_method]["restricted"].includes(rid)){ var first_price = document.querySelector(".io_product_price_box"); if(first_price != null){ cust_price = first_price.cloneNode(true); /* clear all classes */ cust_price.className = ""; cust_price.classList.add("io_product_price_box"); cust_price.classList.add("io_product_cust_price_delivery_method"+io_delivery_methods[delivery_method]["id"]); cust_price.style.display = "none"; first_price.before(cust_price); } } main_item_id = jQuery(".io_product_infobox .item_rentalid").first().text(); if(main_item_id == price_id && cust_price!=undefined){ if(typeof amt == "string") amt = Number(amt.replace(",","")); cust_price.querySelector("p:nth-child(1)").innerHTML=simpleCart.toCurrency(amt); let times = getAvailTimes(); cust_price.querySelector("p:nth-child(2)").innerHTML = make_live_price_editable_time(times, delivery_method); if(amt>0 && event_time_set()){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } } }); } }); } function updatePageAvail_custom_price(data, custom_price_name){ let custom_price_class_name = custom_price_name.replace(/[\s:./()!]/g, '_'); jQuery.each(data, function (rental_id, qty){ if (rental_id == "price") { var prices = qty; jQuery.each(prices, function (price_id, amt) { let cust_price = document.querySelector(".io_product_cust_price_"+custom_price_class_name); let rid = jQuery(".io_product_container .item_rentalid").first().text(); if(cust_price==undefined){ var first_price = document.querySelector(".io_product_price_box"); if(first_price != null){ cust_price = first_price.cloneNode(true); /* clear all classes */ cust_price.className = ""; cust_price.classList.add("io_product_price_box"); cust_price.classList.add("io_product_cust_price_"+custom_price_class_name); cust_price.style.display = "none"; first_price.before(cust_price); } } main_item_id = jQuery(".io_product_infobox .item_rentalid").first().text(); if(main_item_id == price_id && cust_price!=undefined){ if(typeof amt == "string") amt = Number(amt.replace(",","")); cust_price.querySelector("p:nth-child(1)").innerHTML=simpleCart.toCurrency(amt); cust_price.querySelector("p:nth-child(2)").innerHTML = "for " + custom_price_name; if(amt>0){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } } }); } }); } function updatePageAvail_weekend(data){ jQuery.each(data, function (rental_id, qty){ if (rental_id == "price") { var prices = qty; jQuery.each(prices, function (price_id, amt) { let cust_price = document.querySelector(".io_product_cust_price_weekend"); if(cust_price==undefined){ var first_price = document.querySelector(".io_product_price_box"); if(first_price != null){ cust_price = first_price.cloneNode(true); /* clear all classes */ cust_price.className = ""; cust_price.classList.add("io_product_price_box"); cust_price.classList.add("io_product_cust_price_weekend"); cust_price.style.display = "none"; first_price.before(cust_price); } } main_item_id = jQuery(".io_product_infobox .item_rentalid").first().text(); if(main_item_id == price_id && cust_price!=undefined){ if(typeof amt == "string") amt = Number(amt.replace(",","")); cust_price.querySelector("p:nth-child(1)").innerHTML=simpleCart.toCurrency(amt); let times = getAvailTimes(); cust_price.querySelector("p:nth-child(2)").innerHTML = io_weekEndText; if(amt>0){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } } }); } }); } function updatePageAvail_itemIDs(data){ jQuery.each(data, function (rental_id, qty){ if (rental_id == "price" && jQuery(".io_product_infobox .item_inputtype").text() != "Map") { var prices = qty; jQuery.each(prices, function (price_id, amt) { let cust_price = document.querySelector(".io_product_cust_price"); if(cust_price==undefined){ var first_price = document.querySelector(".io_product_price_box"); if(first_price != null){ cust_price = first_price.cloneNode(true); /* clear all classes */ cust_price.className = ""; cust_price.classList.add("io_product_price_box"); cust_price.classList.add("io_product_cust_price"); cust_price.style.display = "none"; first_price.before(cust_price); } } main_item_id = jQuery(".io_product_infobox .item_rentalid").first().text(); if(main_item_id == price_id && cust_price!=undefined){ if(typeof amt == "string") amt = Number(amt.replace(",","")); cust_price.querySelector("p:nth-child(1)").innerHTML=simpleCart.toCurrency(amt); let times = getAvailTimes(); cust_price.querySelector("p:nth-child(2)").innerHTML = make_live_price_editable_time(times); if(amt>0 && (event_time_set() || io_always_display_live_price == "on")){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } } }); } if(qty<=0 && rental_id != "delivery_method"){ /* cat,all-item,widget */ if(io_checkavail=="warn"){ jQuery(".add_cart_"+rental_id.replace(":", "\\\:")+" .item_add").removeClass("item_add").addClass("item_add_off").trigger("classChange"); jQuery(".unavailable_message_"+rental_id.replace(":", "\\\:")).show(); } if(io_checkavail=="hide") jQuery(".add_cart_"+rental_id).parent().parent().parent().hide(); /* product page */ if(jQuery(".io_product_container").length && io_checkavail!="off" && jQuery(".io_product_container .item_rentalid").first().text() === rental_id){ jQuery(".add_cart_"+rental_id.replace(":", "\\\:")+" .item_add").first().removeClass("item_add").addClass("item_add_off").trigger("classChange"); jQuery(".io_product_container .unavailable_message").show(); } }else if(qty>0){ if(io_checkavail=="warn"){ jQuery(".add_cart_"+rental_id.replace(":", "\\\:")+" .item_add_off").removeClass("item_add_off").addClass("item_add").trigger("classChange"); jQuery(".unavailable_message_"+rental_id.replace(":", "\\\:")).hide(); } if(io_checkavail=="hide") jQuery(".add_cart_"+rental_id).parent().parent().parent().show(); /* product page */ if(jQuery(".io_product_container").length && io_checkavail!="off" && jQuery(".io_product_container .item_rentalid").first().text() === rental_id){ jQuery(".add_cart_"+rental_id.replace(":", "\\\:")+" .item_add_off").removeClass("item_add_off").addClass("item_add").trigger("classChange"); jQuery(".io_product_container .unavailable_message").hide(); } } }); } function updatePageAvail_itemNames(data){ jQuery.each(data, function (rental_name, qty) { rental_name = rental_name.replace(/[\u2032\u2019]+/ig,"'"); var main_name_temp = ""; if(typeof main_name_orig != "undefined"){ main_name_temp = main_name_orig.replace(/[\u2032\u2019]+/ig,"'"); } rental_name_esc = rental_name.replace(/'/g, "\\\\'"); if (rental_name == "price") { var prices = qty; jQuery.each(prices, function (price_name, amt) { /* var prices = document.querySelector(".io_product_price_box:not(.io_product_cust_price)"); */ /* if(prices != null) prices.remove(); */ let cust_price = document.querySelector(".io_product_cust_price"); if(cust_price==undefined){ var first_price = document.querySelector(".io_product_price_box"); if(first_price != null){ cust_price = first_price.cloneNode(true); /* clear all classes */ cust_price.className = ""; cust_price.classList.add("io_product_price_box"); cust_price.classList.add("io_product_cust_price"); cust_price.style.display = "none"; first_price.before(cust_price); } } try{ var main_name = decodeURIComponent(jQuery(".io_product_container .item_encoded").first().html().replace(/[+]/gi, "%20")); }catch(e){main_name=""} var i = main_name.lastIndexOf(":"); let acc_name = ""; let rental_name = ""; var i = main_name.lastIndexOf(":"); if(i>0){ rental_name = main_name.substring(0, i); acc_name = main_name.substring(i+1); } if (acc_name.toUpperCase() == price_name.toUpperCase() && cust_price!=undefined){ var rental_id = document.querySelector(".item_rentalid").innerText; if(rental_id != null){ rid_arr = rental_id.split(":"); /* ignore the main id for this */ rental_id = rid_arr[rid_arr.length-1]; if(jQuery("#io_acc_overrideprice_"+rental_id).first().text()>0){ amt = prices[acc_name]; }else{ let item_price = Number(prices[rental_name].replace(",","")); amt = Number(amt.replace(",","")) + item_price; amt = simpleCart.toCurrency(amt, {symbol:""}) } } cust_price.querySelector("p:nth-child(1)").innerText="$"+amt; if(typeof amt == "string") amt = Number(amt.replace(",","")); let times = getAvailTimes(); cust_price.querySelector("p:nth-child(2)").innerHTML = make_live_price_editable_time(times); if(amt>0 && (event_time_set() || io_always_display_live_price == "on")){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } }else if(!rental_name && !acc_name && cust_price!=undefined){ amt = prices[main_name]; cust_price.querySelector("p:nth-child(1)").innerText="$"+amt; if(typeof amt == "string") amt = Number(amt.replace(",","")); let times = getAvailTimes(); cust_price.querySelector("p:nth-child(2)").innerHTML = make_live_price_editable_time(times); if(amt>0 && (event_time_set() || io_always_display_live_price == "on")){ cust_price.style.display = "grid"; }else{ cust_price.style.display = "none"; } } }); } if(qty<=0){ /* cat,all-item,widget */ if(io_checkavail=="warn"){ jQuery("div[name='maindiv_"+rental_name_esc+"'] .item_add").removeClass("item_add").addClass("item_add_off").trigger("classChange"); jQuery("div[name='maindiv_"+rental_name_esc+"'] .unavailable_message").show(); } if(io_checkavail=="hide") jQuery("div[name='maindiv_"+rental_name_esc+"']").hide(); /* product page */ if(jQuery(".io_product_container").length && io_checkavail!="off"){ if(main_name_temp==rental_name){ jQuery(".io_product_container .item_add").first().removeClass("item_add").addClass("item_add_off").trigger("classChange"); jQuery(".io_product_container .unavailable_message").show(); } } }else if(qty>0){ /* console.log("good"); */ if(io_checkavail=="warn"){ jQuery("div[name='maindiv_"+rental_name_esc+"'] .item_add_off").removeClass("item_add_off").addClass("item_add").trigger("classChange"); jQuery("div[name='maindiv_"+rental_name_esc+"'] .unavailable_message").hide(); } if(io_checkavail=="hide") jQuery("div[name='maindiv_"+rental_name_esc+"']").show(); /* product page */ if(jQuery(".io_product_container").length && io_checkavail!="off"){ if(main_name_temp==rental_name){ jQuery(".io_product_container .item_add_off").removeClass("item_add_off").addClass("item_add").trigger("classChange"); jQuery(".io_product_container .unavailable_message").hide(); } } } }); } function displayAccessoryPrices(data) { if (data.price) { let acc_prices = data.price; for (const [key, value] of Object.entries(acc_prices)) { let new_key = key; if ((key.match(/_/g) || []).length > 1) { let split_key = key.split("_"); let second_to_last = split_key[split_key.length - 2]; let last = split_key[split_key.length - 1]; new_key = second_to_last + "_" + last; } if (io_hide_zero == 1 && value > 0) { let id_string = "#io_acc_desc_" + new_key; let formatted_price = simpleCart.toCurrency(value); if (jQuery("#io_acc_" + new_key + " .io_acc_price").length > 0) { jQuery("#io_acc_" + new_key + " .io_acc_price").html(formatted_price); } else { let price_display = ' ' + formatted_price + ' '; jQuery(id_string).after(price_display); } } else if (io_hide_zero == 0) { let id_string = "#io_acc_desc_" + new_key; let formatted_price = simpleCart.toCurrency(value); if (jQuery("#io_acc_" + new_key + " .io_acc_price").length > 0) { jQuery("#io_acc_" + new_key + " .io_acc_price").html(formatted_price); } else { let price_display = ' ' + formatted_price + ' '; jQuery(id_string).after(price_display); } } } } } function make_live_price_editable_time(times, delivery_method=null) { if(!delivery_method) delivery_method = getCookie("io_delivery_method"); let ele_text = ""; if(times[0]) ele_text = "on " + times[0] + " "; if(times[2] === 0) times[2] = 1; if(io_hidetimes!="on" && !isNaN(times[2])) ele_text += "for "+times[2]+" hours "; if(delivery_method) ele_text += "for " + delivery_method + ". "; ele_text += 'edit'; return ele_text; } function checkAvailDateClick(){ cartShow(); /* expand the date picker */ setTimeout(calSetDateRange,100); } function checkAvailPageOnly(){ checkAvailFilter(); if(addressCookiesSet() && io_distance_charge){ runDeliveryCall(true); } } function getAccIDforPrice(){ let accessory_arr = jQuery(".io_acc_li").toArray(); let acc_rental_id_str = ""; for(let current_accessory = 0; current_accessory < accessory_arr.length; current_accessory++){ let required_tag = jQuery(accessory_arr[current_accessory]).find(".item_required"); if(required_tag.length > 0){ if(required_tag[0].innerText == 0){ acc_rental_id_str += jQuery(accessory_arr[current_accessory]).find(".item_rentalid")[0].innerText +"|"; } } } return acc_rental_id_str; } function getUpsellIDforPrice(){ let upsell_arr = jQuery(".page-carousel-rid").toArray(); let upsell_rental_id_str = ""; for(let current_upsell = 0; current_upsell < upsell_arr.length; current_upsell++){ upsell_rental_id_str +=upsell_arr[current_upsell].innerText+"|"; } return upsell_rental_id_str; } function displayUpsellPrices(data){ if(data.price){ let upsell_prices = data.price; for (const [key, value] of Object.entries(upsell_prices)) { if(io_hide_zero == 1 && value > 0){ let id_string = "#rid"+ key; let formatted_price = simpleCart.toCurrency(value); let price_display =' '+formatted_price+' '; jQuery(id_string).after(price_display); }else if(io_hide_zero == 0){ let id_string = "#rid"+ key; let formatted_price = simpleCart.toCurrency(value); let price_display =' '+formatted_price+' '; jQuery(id_string).after(price_display); } } pageFlickityRefresh(); } } /**/ /**/ function checkAvailCartOnly(skip_timer=false){ checkAvailCart(); checkAvailCartTimeslots(); } function checkAvailCartTimeslots(){ let rental_names = ""; let rental_ids = ""; let cart_rental_names = ""; let cart_rental_ids = ""; let times = getAvailTimes(); let start_date = times[0]; let event_duration = times[2]; let end_date = start_date; var event_start_time = getCookie("io_timeStart"); simpleCart.each(function (item, x) { var timeslots_html = item.get('timeslots'); if(typeof timeslots_html == "undefined") return; if(timeslots_html.length == 0) return; var cart_name = item.get("encoded"); if(cart_name==null) { cart_name = encodeURIComponent(item.get("name")); cart_name = encodeURIComponent(decodeURIComponent(cart_name).replace(/[\u2032\u2019]+/ig,"'")); } rental_id = item.get("rentalid"); var timeslot_name = getTimeslotName(timeslots_html); var timeslot_sel_range = jQuery(".item-timeslots [name=\""+timeslot_name+"\"] option:selected").val(); if(typeof timeslot_sel_range != "undefined"){ /* timeslots */ setTimeslotSelected(item, timeslot_name); }else{ /* timepickers */ setTimePicker(item, timeslot_name); let start_timepicker = document.getElementsByName(timeslot_name.replace("io_timepicker_", "start_timeslot_")); let end_timepicker = document.getElementsByName(timeslot_name.replace("io_timepicker_", "end_timeslot_")); timeslot_sel_range = start_timepicker[start_timepicker.length-1].value; timeslot_sel_range += " - " + end_timepicker[end_timepicker.length-1].value; } var timeslot_sel_arr = ""; if(typeof timeslot_sel_range != "undefined"){ var [start_time, end_time] = break_timeslot_sel_range(timeslot_sel_range); if(start_time && end_time){ let newDate1 = convertDateStringtoDateObject(start_date, start_time); let newDate2 = convertDateStringtoDateObject(end_date, end_time); let time_duration = ((newDate2 - newDate1) / 3600) / 1000; let quantity = item.get("quantity"); if(item.get("inputtype") == "Map"){ quantity = 1 } rental_names += cart_name + "-" + quantity+"|"; rental_ids += rental_id+"-"+quantity+"-"+start_time+"-"+time_duration+"|"; cart_rental_names = rental_names; cart_rental_ids = rental_ids; } } }); if(rental_ids || rental_names){ checkAvailCall(start_date,event_start_time,event_duration,rental_names,rental_ids,updateCartAvail,1,cart_rental_ids,cart_rental_names,1); } return true; } function checkAvailCart(){ let rental_names = ""; let rental_ids = ""; let cart_rental_names = ""; let cart_rental_ids = ""; simpleCart.each(function (item, x) { if(typeof item.get('timeslots') != "undefined"){ if(item.get('timeslots').length > 0){ return; } } var cart_name = item.get("encoded"); if(cart_name==null){ cart_name = encodeURIComponent(item.get("name")); cart_name = encodeURIComponent(decodeURIComponent(cart_name).replace(/[\u2032\u2019]+/ig,"'")); } let quantity = item.get("quantity"); if(item.get("inputtype") == "Map"){ quantity = 1 } rental_names += cart_name + "-" + quantity + "|"; cart_rental_names += cart_name + "-" + quantity + "|"; var cart_id = item.get("rentalid"); rental_ids += cart_id + "-" + quantity + "|"; cart_rental_ids += cart_id + "-" + quantity + "|"; }); var times = getAvailTimes(); let return_id = 0; if(rental_ids != ""){ return_id = 1; } if(rental_ids != "" || rental_names != ""){ return checkAvailCall(times[0],times[1],times[2],rental_names,rental_ids,updateCartAvail,1,cart_rental_ids,cart_rental_names,return_id); } return true; } function updateCartAvail(data){ let use_id = data["return_id"] delete data["return_id"]; if(use_id == 1){ updateCartAvail_itemIDs(data) }else{ updateCartAvail_itemNames(data); } console.log("cart update"); if(addressCookiesSet() && io_distance_charge){ runDeliveryCall(true); } /* simpleCart.trigger("update"); */ simpleCart.update(); /* jQuery("#avail").html(output); */ } function updateCartAvail_itemIDs(data){ jQuery.each(data, function (rental_id, qty){ simpleCart.each(function (item, x) { if(rental_id == item.get("rentalid")){ if(io_hideQuantityAvail == "off"){ if(qty>=9999 || item.get("inputtype") == "Map" || (item.get("giftcardvalue") && item.get("giftcardvalue").trim())){ item.set("availability", "available"); }else{ item.set("availability", qty + " available"); } }else if(io_hideQuantityAvail == "on"){ if(qty<=0 || qty < item.get("quantity")){ item.set("availability", "not available"); }else{ item.set("availability", "available"); } } var vendorid = item.get("vendorid"); if(vendorid && vendorid.trim()){ item.set("availability", "availability must be verified"); } } if (rental_id == "price") { var prices = qty; jQuery.each(prices, function (price_name, amt) { if(price_name == item.get("rentalid")){ if (typeof amt == "string" || amt instanceof String){ if(amt != "TBD"){ if(typeof amt == "string") amt = Number(amt.replace(",","")); } } item.set("price", amt); } }); } }); }); } function updateCartAvail_itemNames(data){ jQuery.each(data, function (rental_name, qty) { rental_name = rental_name.replace(/[\u2032\u2019]+/ig,"'"); simpleCart.each(function (item, x) { try{ var cart_name = decodeURIComponent(item.get("encoded").replace(/[+]/gi, "%20")); }catch(e){cart_name=null} if(cart_name==null) cart_name = item.get("name") cart_name = cart_name.replace(/[\u2032\u2019]+/ig,"'"); var i = cart_name.lastIndexOf(":"); if(i>0 && cart_name.toUpperCase() != rental_name.toUpperCase() && rental_name!="price"){cart_name = cart_name.substring(i+1)} if (cart_name.toUpperCase() == rental_name.toUpperCase()) { if(qty>9999){ item.set("availability", "available"); }else{ item.set("availability", qty + " available"); } } if (rental_name == "price") { var prices = qty; jQuery.each(prices, function (price_name, amt) { price_name = price_name.replace(/[\u2032\u2019]+/ig,"'"); let acc_name = ""; let rental_name = ""; var i = cart_name.lastIndexOf(":"); if(i>0){ rental_name = cart_name.substring(0, i); acc_name = cart_name.substring(i+1); } if (acc_name === price_name) { var rental_id = item.get("rentalid"); if(rental_id != null){ rid_arr = rental_id.split(":"); /* ignore the main id for this */ rental_id = rid_arr[rid_arr.length-1]; if(jQuery("#io_acc_overrideprice_"+rental_id).first().text()>0){ amt = prices[acc_name]; }else{ let item_price = Number(prices[rental_name].replace(",","")); amt = Number(amt.replace(",","")) + item_price; item.set("price", amt); return; } } if(amt==null){ amt = "0"; } /* returned price is per unit */ if(typeof amt == "string") amt = Number(amt.replace(",","")); item.set("price", amt); }else if(!rental_name && !acc_name){ amt = Number(prices[cart_name].replace(",","")); item.set("price", amt); } }); } }); }); } /**/ /**/ function updateCartUpsell(data){ let cart_carousel = jQuery(".cart-carousel"); viewport = jQuery(".cart-carousel .flickity-viewport"); if(viewport.length > 0){ cart_carousel.flickity("destroy"); } cart_carousel.empty(); data.forEach(function(upsell){ cell = createCartCarouselCell(upsell["image"], upsell["name"], upsell["page"]); cart_carousel.append(cell); }); makeCarousel(cart_carousel); jQuery("#cart-carousel-container").show(); setTimeout(cartFlickityRefresh, 500); } function cartFlickityRefresh(){ jQuery(".cart-carousel").flickity("resize"); } //IO-14031 function isMobile() { // Modern detection if (navigator.userAgentData && navigator.userAgentData.mobile !== undefined) { return navigator.userAgentData.mobile; } // Fallback for older browsers return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent) || ('ontouchstart' in window && navigator.maxTouchPoints > 0); } function makeCarousel(cart_carousel) { cart_carousel.flickity({ wrapAround: true, draggable: isMobile(), cellAlign: 'left', //autoPlay: 3000, groupCells: true, resize: true }); cart_carousel_set = true; } function createCartCarouselCell(image, name, page){ cell = ''; return cell; } /**/ /**/ function checkAvailCall(start_date,start_time,time_duration,rental_names,rental_ids,returnFunc,singleCart,cart_rental_ids,cart_rental_names,return_id,temp=0,delivery_method=null,price_only=0,custom_price_name="", skip_hidden_lead = 0) { /* IO-21459 If we have no duration set (event not set in cart), and we are doing the call for the page live price, and we have the setting on where we want to display this price even if the event date is not set: We set the time_duration to 1 hour. This defaults the start date to January 1, 1970 with duration of 1 hour in the lead meaning it will be available and we have the one hour price. */ if((isNaN(time_duration) || time_duration===0) && price_only==1 && io_always_display_live_price == "on"){ time_duration = 1; if(!start_date){ start_date = getFormatteddate(new Date()); } if(!start_time){ start_time = getFormattedtime(new Date()); } }else if((isNaN(time_duration) || time_duration===0) && price_only==0 && io_hidetimes === "on"){ /* IO-22689 if they have times hidden, and happen to have the same default start and end time, we still want to do the call. */ time_duration = 1; }else if(isNaN(time_duration) || time_duration===0){ return; } url = "https://rental.software/quotes/check_availability_v2.php?callback=?"; if(window.location.href.indexOf("localhost") > -1){ //url = "http://localhost/bugs/quotes/check_availability_v2.php?callback=?"; url = "http://localhost/io/bugs/quotes/check_availability_v2.php?callback=?"; //url = "http://localhost/jbug/trunk/quotes/check_availability_v2.php?callback=?"; } if(!delivery_method) delivery_method = getCookie("io_delivery_method"); let address_data = { "address": getCookie("io_address"), "state": getCookie("io_state"), "city": getCookie("io_city"), "zip": getCookie("io_zip") }; if(!ioHasMarketingConsent()){ address_data = {"address":"", "state":"", "city":"", "zip":""}; } url += "&name=" + encodeURIComponent("Jump Around VA") + "&startdate=" + start_date + "&starttime=" + start_time + "&duration=" + time_duration + "&street=" + encodeURIComponent(address_data["address"]) + "&city=" + encodeURIComponent(address_data["city"]) + "&state=" + encodeURIComponent(address_data["state"]) + "&zip=" + encodeURIComponent(address_data["zip"]) + "&single_cart=" + singleCart + "&usecushion=1" + "&include_price=1" + "&showlocations=0" + "&rental_names=" + rental_names + "&rental_ids=" + rental_ids + "&cart_rental_names=" + cart_rental_names + "&cart_rental_ids=" + cart_rental_ids + "&return_id=" + return_id + "&delivery_method=" + delivery_method + "&temp=" + temp + "&skip_hidden_lead="+ skip_hidden_lead; if (custom_price_name) { ioCartLoaderIncrement(); jQuery.getJSON(url, function (data) { try { returnFunc(data, custom_price_name); } finally { ioCartLoaderDecrement(); } }); } else { ioCartLoaderIncrement(); jQuery.getJSON(url, function (data) { try { returnFunc(data); } finally { ioCartLoaderDecrement(); } }); } } function getUpsellsCall(start_date,start_time,time_duration,rental_ids,returnFunc) { if(rental_ids.replace(/[|]/g,"").length==0){return;} url = "https://rental.software/quotes/in_cart_upsell.php?callback=?"; if(window.location.href.indexOf("localhost") > -1){ //url = "http://localhost/bugs/quotes/in_cart_upsell.php?callback=?" url = "http://localhost/io/bugs/quotes/in_cart_upsell.php?callback=?" } url += "&name=" + encodeURIComponent("Jump Around VA") + "&startdate=" + start_date + "&starttime=" + start_time + "&duration=" + time_duration + "&usecushion=1" + "&include_price=1" + "&showlocations=0" + "&rental_ids=" + rental_ids; //IO-25557 if(window.location.href.indexOf("dev.rental.software") > -1)//if it is a dev site, we need to send { let pattern = /(https:\/\/dev\.rental\.software\/[^\/]+\/)/; let matches = window.location.href.match(pattern); matches && matches.length > 0 ? url += "&site=" + matches[0]:0; } else { url += "&site=" + window.location.host; } jQuery.getJSON(url, returnFunc); } /**/ /**/ function setLocationInLocalStorage(city) { try { const location_data = { city: city, timestamp: Date.now() }; localStorage.setItem(storage_key, JSON.stringify(location_data)); return true; } catch (e) { console.warn('Failed to save location to localStorage:', e); return false; } } function getLocationFromLocalStorage() { try { const location_data = localStorage.getItem(storage_key); if (location_data) { return JSON.parse(location_data); } } catch (e) { console.warn('Failed to retrieve location from localStorage:', e); } return null; } function displayLocation(city) { const location_element = jQuery('.io_geo_city'); const container_element = jQuery('#io_customer_geolocation'); if (location_element.length && container_element.length) { location_element.text(`${city}`); container_element.show(); return true; } return false; } function getCityFromIO(returnFunc) { var url = "https://rental.software/include/geolocation_handler.php?callback=?"; if(window.location.href.indexOf("localhost") > -1) { url = "http://localhost//features//include/geolocation_handler.php?callback=?"; } url += "&name=" + encodeURIComponent("Jump Around VA") + "&ip=" + encodeURIComponent(io_customer_ip); jQuery.getJSON(url, returnFunc); } function initializeGeolocation() { try { // Check local storage first const cached_location = getLocationFromLocalStorage(); if (cached_location && cached_location.city) { if (displayLocation(cached_location.city)) { return; } } // If no cached location, call the handler to get location getCityFromIO(function(location_data) { if (location_data && location_data.city && !location_data.error) { // Display and store the location if (displayLocation(location_data.city)) { setLocationInLocalStorage(location_data.city); } } else { console.warn('Failed to get location:', location_data ? location_data.error : 'Unknown error'); } }); } catch (error) { console.error('Geolocation initialization failed:', error); } } /**/ /**/ /** * Toggles the visibility of the cart loading overlay. * * @param {boolean} show - A boolean value to determine whether to show or hide the overlay. * If true, the overlay becomes visible; if false, it is hidden. * @return {void} This function does not return a value. */ function ioCartShowOverlay(show) { try { var overlay = document.getElementById('ioCartLoadingOverlay'); if (!overlay) return; if (show) { overlay.style.display = 'flex'; overlay.setAttribute('aria-hidden', 'false'); } else { overlay.style.display = 'none'; overlay.setAttribute('aria-hidden', 'true'); } } catch (e) {} } /** * Activates the cart loader by setting the loading state to active, initializing the loading count, * and displaying the overlay. Includes a fallback to deactivate the loader if no response is received * within a specified timeout period. * * @return {void} This method does not return a value. */ function ioCartLoaderActivate() { io_cart_loading_active = true; io_cart_loading_count = 0; ioCartShowOverlay(true); //fallback in case the availability call doesn't come back if (io_cart_loading_fallback_timer) clearTimeout(io_cart_loading_fallback_timer); io_cart_loading_fallback_timer = setTimeout(function () { if (io_cart_loading_active) { io_cart_loading_active = false; io_cart_loading_count = 0; ioCartShowOverlay(false); } }, 15000); } /** * Increments the count of active cart loading operations and ensures the cart overlay is displayed. * * This method increases the `io_cart_loading_count` if the `io_cart_loading_active` flag is set to true. * It also calls the `ioCartShowOverlay` function with a true value to show the overlay. * * @return {void} This function does not return any value. */ function ioCartLoaderIncrement() { if (io_cart_loading_active) { io_cart_loading_count++; ioCartShowOverlay(true); } } /** * Decrements the `io_cart_loading_count` if `io_cart_loading_active` is true. * If the count reaches zero, it deactivates the loader, removes the overlay, * and clears the fallback timer */ function ioCartLoaderDecrement() { if (io_cart_loading_active) { io_cart_loading_count = Math.max(0, io_cart_loading_count - 1); if (io_cart_loading_count === 0) { io_cart_loading_active = false; ioCartShowOverlay(false); if (io_cart_loading_fallback_timer) { clearTimeout(io_cart_loading_fallback_timer); io_cart_loading_fallback_timer = null; } } } } /**/
Save Address

Continue Shopping
Enter Address Information (edit)
Locate

If you are taking measurements for a structure such as a building or fence, please provide the height of the structure here. If height does not apply to the wash, for instance for a gutter wash, leave this field empty. Please note if you enter a value here after taking measurements, you will need to take measurements again.