
No Item available
' : html.join("")) }); } $(document).ready(function(){ // Observer to auto-trigger addon loading when addon section becomes visible const addonObserver = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { const target = $(mutation.target) if(target.hasClass('purchaseAddon') && mutation.type === 'attributes' && mutation.attributeName === 'class') { if(!target.hasClass('hide')) { // Addon section just became visible, ensure items are loaded setTimeout(function() { if($("#itemAddons .row").children().length === 0 || $("#itemAddons .row").text().includes("No Item available")) { console.log("Auto-triggering addon load...") $("[data-addon=upsell-all]").trigger("click") } }, 150) } } }) }) // Start observing addon section const addonSection = document.querySelector('.purchaseAddon') if(addonSection) { addonObserver.observe(addonSection, { attributes: true, attributeFilter: ['class'] }) } $(".purchasePopup").delegate("#addtocart-card", "click", async function(){ $(this).find("span").addClass("loading") let isValid = true $(".formAddressPurchase [required]").each(function(){ const t = $(this) const input = t.val() const p = t.parent() if(input === '') { p.addClass("error") isValid = false } }) if(!isValid) { $(this).find("span").removeClass("loading") return } let items = [] const mainProps = { "Delivery Date": $("#propDeliveryDate").val(), "Delivery Time": $("#propDeliveryTime").val() !== '' ? $("#propDeliveryTime").val() : '-' , "Kota Pengiriman": $("#cities").val(), "Nama Penerima": $("[data-properties=nama-penerima]").val() !== '' ? $("[data-properties=nama-penerima]").val() : '-' , "Alamat Penerima": $("[data-properties=alamat-penerima]").val() !== '' ? $("[data-properties=alamat-penerima]").val() : '-' , "Kodepos": $("#zip").val() !== '' ? $("#zip").val() : '-' , "Telepon Penerima": $("[data-properties=telepon-penerima").val() !== '' ? $("[data-properties=telepon-penerima").val() : '-' , "Papan Nama Penerima": $("[data-properties=penerima]").val() !== '' ? $("[data-properties=penerima]").val() : '-' , "Papan Ucapan": $("[data-properties=ucapan]").val() !== '' ? $("[data-properties=ucapan]").val() : '-' , "Papan Nama Pengirim": $("[data-properties=pengirim]").val() !== '' ? $("[data-properties=pengirim]").val() : '-' , "Papan Logo": $("[data-properties=papan-logo]").val() !== '' ? $("[data-properties=papan-logo]").val() : '-' , "Foto Alamat": $("[data-properties=foto-alamat]").val() !== '' ? $("[data-properties=foto-alamat]").val() : '-' , "Province": $("#province").val() !== '' ? $("#province").val() : '-' , "Country": $("#properties-kota-pengiriman-country").val() !== '' ? $("#properties-kota-pengiriman-country").val() : '-' , "Shipping": $("#properties-shipping").val() !== '' ? $("#properties-shipping").val() : '-' , "Company": $("[data-properties=company]").val() !== '' ? $("[data-properties=company]").val() : '-' , "id": $("#properties-time").val() !== '' ? $("#properties-time").val() : '-', "type": 'product' } const props = await propItems() properties = {...mainProps, ...props }; const id = $("#productSelect").find('option:selected').val() console.log(id, 'main ID') const mainItem = { id: Number(id), quantity: 1, properties } items.push(mainItem) const cardId = $("#itemCards").find(".selected input").val() const cardItem = { id: Number(cardId), quantity: 1, properties: { "id": $("#properties-time").val() !== '' ? $("#properties-time").val() : '-', type: 'card' } } console.log(cardId, 'cardId') if(cardId) { items.push(cardItem) } const addon = await addons() if(addon) { for(let i = 0; i 0) { target.attr("name", "id[]") $("#properties-card").val(id) $(".greetingCard").removeClass("disabled") $("#skip-card").attr("disabled", false) } else { $("#properties-card").val("") } }) $("#itemCards").delegate(".item-without-card label", "click", function(){ const parent = $(this).parents(".sectionPurchase") const next = parent.next(".sectionPurchase") $(".greetingCard").addClass("disabled") parent.addClass("hide") next.removeClass("hide") $("[data-addon=upsell-all]").click() $("#zip").select2() }) $("[data-properties=ucapan]").keyup(function(){ const v = $(this).val() const p = $(this).parents(".sectionPurchase") $(".purchaseAddress").find(".greetingCard textarea").val(v) if(v.length > 3) { p.find(".next-purchase-button").attr("disabled", false) } else { p.find(".next-purchase-button").attr("disabled", true) } }) $("[data-properties=penerima]").keyup(function(){ const v = $(this).val() $(".purchaseAddress").find("[data-properties=penerima]").val(v) }) $("[data-properties=pengirim]").keyup(function(){ const v = $(this).val() $(".purchaseAddress").find("[data-properties=pengirim]").val(v) }) $(document).click(function(e){ if($(e.target).closest('.wrapperPopupCart').length != 0) return false; // $('#popupCart').fadeOut('slow'); // location.reload() }); $(".toggleAddonCart").click(function(){ const p = $(this).parent(".itemAddonCart") p.toggleClass("open") }) $(".btnViewCart").click(function(){ window.location.href = "https://outerbloom.com/cart"; }) $(".btnViewCheckout").click(async function(){ $(this).find("span").addClass("loading") let zip = $("#zip").val() const first_name = $("#first_name").val() const last_name = $("#last_name").val() const company = $("#company").val() !== '' ? $("#company").val() : '' const address1 = $("#delivery_address").val() const address2 = zip && zip !== '' ? zip?.split(' - ')[1] : '' zip = zip && zip !== '' ? zip?.split(' - ')[0] : '' const phone = $("#recipient_number").val() const city = $("#cities").val() const province = $("#province").val() const country = 'Indonesia' const ver = Date.parse(new Date()) const params = `checkout[email]=&checkout[shipping_address][first_name]=${first_name}&checkout[shipping_address][last_name]=${last_name}&checkout[shipping_address][company]=${company}&checkout[shipping_address][address1]=${address1}&checkout[shipping_address][address2]=${address2}&checkout[shipping_address][city]=${city}&checkout[shipping_address][country]=${country}&checkout[shipping_address][province]=${province}&checkout[shipping_address][zip]=${zip}&checkout[shipping_address][phone]=${phone}&v=${ver}` const clear = await fetch(`/cart/clear.js`, {method: 'POST'}) if(clear.status === 200) { const savedItem = window.localStorage.getItem("items"); const items = JSON.parse(savedItem) const addItems = await additem(items) console.log(addItems, 'new addItems') if(addItems) { window.location.href = `https://outerbloom.com/checkout?${params}`; } } }) $(".btnContinueShopping").click(function(){ window.location.href = "https://outerbloom.com/"; }) if (isIOS) { $(".empty-state-card").click(function(){ $("#input-foto").trigger("click") }) $(".btn-upload-image").click(function(){ $("#input-foto").trigger("click") }) $("[for=input-video]").click(function(){ $("#input-video").trigger("click") }) $(".btn-upload-papan").click(function(){ $("#logoPapan").trigger("click") }) } $("[data-properties]").each(function(){ const select = $(this).parents(".form-group").find("select") $(this).change(function(){ const name = $(this).data("properties") const v = $(this).val() if (name == 'telepon-penerima') { let phone = v.replace(/[^0-9]/g, '') $(this).val(phone); $("#properties-telepon-penerima").val(phone) $('.iti__search-input').val('-') } else { $("#properties-" + name).val(v) } }) select.on("change", function(){ const name = $(this).data("properties") const v = $(this).val() $("#properties-" + name).val(v) }) }) $("#show_note").click(function(){ nameq = $("#properties-nama-penerima").val() dear = $("#properties-kartu-nama-penerima").val() card = $("[data-properties=ucapan]").val() sender = $("#properties-kartu-nama-pengirim").val() photo = $("#properties-photo").val() video = $("#properties-video").val() updateCard(nameq, dear, card, sender, photo, video, status) }) $(".remove-image").click(function(e){ e.preventDefault() $(this).find("img").show() removeImage() }) $(".remove-media").click(function(e){ e.preventDefault() $(this).find("img").show() removeVideo() }) $("[data-delivery_method]").click(function(e){ e.preventDefault() const t = $(this) const data = t.data("delivery_method") $("[data-delivery_method]").removeClass("selected") t.addClass("selected") $("#cities").val("") $("#properties-delivery-date").val("-") $("#deliveryDate button").removeClass("selected") $("#full-date").val("Full Calendar →") $("#propDeliveryDate").val("") const step3 = $("#step-3") if(data.match('PickUp')) { $(".selfpickup-point").show() step3.find("[data-finished=false]").hide() $("#panel-4").hide() step3.find("[data-finished=true]").show() $("#cities").attr("required", false) $("#form-group-city").hide() $("#row-delivery-time").hide() $("#propDeliveryTime, #properties-delivery-time, #properties-nama-penerima, #properties-alamat-penerima, #properties-kodepos, #properties-kodepos, #properties-telepon-penerima").val("-") $("#propDeliveryTime").attr("required", false) // $("#deliveryDate").find("button:first-child").addClass("stop") $(".form-selfpickup").show() $(".form-delivery").hide() $(".form-delivery").find("input, textarea, select").val("") $(".form-delivery").find("input, textarea, select").attr("required", false) $("#properties-shipping").val("0") $("#noteDeliveryDate").hide() $(".form-delivery .form-control").attr("required", false) $("#stepNav4").hide() $("#deliveryDate").find("button:nth-child(1)").addClass("stop") if(timeOfDay >= 16.01){ $("#deliveryDate").find("button:nth-child(2)").addClass("stop") } } else { $("#deliveryDate").find("button:nth-child(1)").removeClass("stop") step3.find("[data-finished=false]").show() $("#panel-4").show() step3.find("[data-finished=true]").hide() $("#cities").attr("required", true) $(".selfpickup-point").hide() $("#form-group-city").show() $("#cities").val('').trigger('change'); $("#properties-kota-pengiriman").val("-") $("#row-delivery-date, #row-delivery-time").show() $("#propDeliveryDate, #propDeliveryTime").attr("required", true) $("#deliveryDate").find("button").removeClass("stop") $(".form-selfpickup").hide() $(".form-delivery").show() $(".form-delivery").find("input, textarea, select").attr("required", true) $(".form-delivery [data-properties]").attr("readonly", false) $("#properties-kodepos").val("-") $("#properties-alamat-penerima").val("-") $(".form-delivery .form-control").attr("required", true) $(this).parents(".setup-content").attr("id", "step-1") $("#stepNav4").show() } }) $("[name=selfpickup]").click(function(){ const p = $(this).parents(".row-pickup") const pickupCity = $("input[name='selfpickup']:checked").val(); const pickupAddress = $("input[name='selfpickup']:checked").data("address"); const pickupZip = $("input[name='selfpickup']:checked").data("zip"); $(".row-pickup").removeClass("selected") p.addClass("selected") $("#properties-kota-pengiriman").val(pickupCity) $("#province").val("Jakarta") $("#properties-alamat-penerima").val(pickupAddress) $("#properties-kodepos").val(pickupZip) }) $("#cities").change(function(e){ e.preventDefault() $(this).parent(".row").find("p.error").remove() $("#full-date").val("Full Calendar") $("#deliveryDate, #deliveryDateFull label ").show() $("#deliveryDateFull").removeClass("filled") $(".btnChangeDeliveryDate").addClass("hide") $("#full-date").prop('disabled', false); $("#stepNav2, #stepNav3, #stepNav4").removeClass("btn-success") $("#stepNav2, #stepNav3, #stepNav4").find("a").attr("disabled", true) const step3 = $("#step-3") $("#cityNote").remove() $("#noteDeliveryDate").hide() $("#noteDeliveryDate").empty() let v = $(this).val() let v2 = $('option:selected', this).attr('data-city'); let v3 = $('option:selected', this).attr('data-province'); let price = $('option:selected', this).attr('data-price'); $("#country").val(v) $("#properties-kota-pengiriman").val(v) $("#properties-shipping").val(price) $("#deliveryDate button, #deliveryTime button, .calendarseasonal .button").removeClass("selected") $("#properties-delivery-date, #properties-delivery-time").val("-") $("#propDeliveryDate, #propDeliveryTime").val("") let note = $('option:selected', this).attr('data-note'); if(v === 'Kota Lainnya') { $("#noteDeliveryDate").show() $("#noteDeliveryDate").text("Order akan segera dikirim. Estimasi tanggal diterima akan disesuaikan dengan waktu pengiriman oleh pihak ekspedisi ke lokasi Anda.") $("#zip").attr("required", false) $("#zip").hide() $("#propDeliveryDate, #propDeliveryTime").attr("required", false) $("#propDeliveryDate, #properties-delivery-date, #propDeliveryTime, #properties-delivery-time").val("-") $("#row-delivery-date, #row-delivery-time").hide() $("#properties-shipping").val("") // $(this).parents(".setup-content").attr("id", "step-2") } else { $("#noteDeliveryDate").hide() $("#zip").attr("required", true) $("#zip").show() $("#row-delivery-date, #row-delivery-time").show() $("#propDeliveryDate, #propDeliveryTime").attr("required", true) $("#deliveryDate").find("button").removeClass("stop") // $(this).parents(".setup-content").attr("id", "step-1") } // if(v !== 'Jakarta') { // $("[data-type=upsell]").hide() // } else { // $("[data-type=upsell]").show() // } // $('.collection-addons')[0].swiper.update(); getProvince(v) $("#zip").html(``) renderZip(v, v2, v3) disabledSameDay() if(v !== 'Jakarta' && v !== 'Depok' && v !== 'Bekasi' && v !== 'Tangerang') { $("#cardOccasion, #navAddon, .collection-addons").hide() $("[data-addon=giftcard]").show() $("[data-addon=giftcard]").click() $("#itemAddons").show() $("#flower-step").addClass("nonjadetabek") } else { $("#cardOccasion, #navAddon, .collection-addons").show() $("[data-addon=all]").click() $("#flower-step").removeClass("nonjadetabek") } if(v !== '') { $("#personalizeBtn .btn").attr("disabled", false) } else { $("#personalizeBtn .btn").attr("disabled", true) } }) $("#zip").change(function(e){ let v = $(this).val() var city = $("#cities").find('option:selected'); $("#properties-kodepos").val(v) if(city === 'Kota Lainnya') { $(this).attr("required", true) $("#recipient-address").val("") } }) var minDate = +7 $("#full-date").datepicker({ minDate, dateFormat: 'Mdd_yy', //Nop22_2021, beforeShowDay: disabledays, onSelect: function (date) { $("#deliveryDate, #deliveryDateFull label ").hide() $("#deliveryDateFull").addClass("filled") $(".btnChangeDeliveryDate").removeClass("hide") $("#full-date").prop('disabled', true); $('#propDeliveryDate, #properties-delivery-date').val('Kirim_'+date); $(".date-full").addClass("selected") $(".date-single, .calendar-group").removeClass("selected") $("#propDeliveryTime").val('') $("#properties-delivery-time").val('-') $(".time-single").removeClass("selected") } }); $(".btnChangeDeliveryDate").click(function(){ $("#deliveryDate, #deliveryDateFull label ").show() $("#deliveryDateFull").removeClass("filled") $(".btnChangeDeliveryDate").addClass("hide") $("#full-date").prop('disabled', false); }) $("#deliveryDate").delegate(".calendarbutton:not(.date-full)", "click", function(e){ e.preventDefault() $(this).parents("#row-delivery-date").find("p.error").remove() const fulldate = $(this).data("fulldate") const day = $(this).data("day") const date = $(this).data("date") const month = $(this).data("month") const year = $(this).data("year") const off_pagi = $(this).data("offpagi") const off_siang = $(this).data("offsiang") const off_Malam = $(this).data("offMalam") $(".calendarbutton").removeClass("selected") $(this).addClass("selected") $("#propDeliveryDate, #properties-delivery-date").val(`Kirim_${month}${date}_${year}`) $("#propDeliveryTime").val('') $("#properties-delivery-time").val('-') $(".calendarbutton2").removeClass("selected") $("#full-date").val("Full Calendar") if(off_pagi && timeOfDay > off_pagi) { $("[data-time=Morning]").attr("disabled", true) } else { $("[data-time=Morning]").attr("disabled", false) } if(off_siang && timeOfDay > off_siang) { $("[data-time=Afternoon]").attr("disabled", true) } else { $("[data-time=Afternoon]").attr("disabled", false) } }) if(today === 14 && timeOfDay > 17.00) { $("#deliveryDate button:first-child").attr("disabled", true) } $("#deliveryTime").delegate(".calendarbutton2", "click", function(e){ e.preventDefault() const time = $(this).data("time") const date = $("#propDeliveryDate").val() if(date == '') { return alert('Silakan pilih tanggal terlebih dahulu') } $(".calendarbutton2").removeClass("selected") $(this).addClass("selected") $("#propDeliveryTime, #properties-delivery-time").val(`KirimJam_${date.replace('Kirim_','')}_${time}`) }) $('textarea.has-limit, input.has-limit').keyup(function () { max = this.getAttribute("maxlength"); let len = $(this).val().length; let limit = $(this).siblings(".limit"); if (len > max) { alert('you have reached the limit'); } else { limit.text(`${len}/${max}`); } }); $("#button-action-step .btn").click(function(){ $(this).find("span").text("Processing..."); }); $(".finishBtn").on('click', function() { $(this).addClass("is-adding"); // $(this).click(); }); $('.setup-panel .nav-item a.btn-success').trigger('click'); $("#button-action .btn").click(function(){ $("#flower-step").addClass("block"); $("#button-action").hide(); }); $(".close-how-order").click(function(){ $("#flower-step").removeClass("block"); $("#button-action").show(); }); $("#input-foto, #input-video").change(function(e){ readURL(this); }); $("#logoPapan").change(function(){ readURLPapan(this); }); $("#address-upload").change(async function(){ const upload_address = await readURLAddress(this) if(upload_address) { const url = upload_address.url $(".props-address-upload").val(url) $(".form-address").addClass("address-uploaded") $(".form-address-upload").addClass("uploaded") $(this).parents(".form-group").siblings(".form-group").find("[required]").attr("required", false) } }) $(".address-manualy").click(function(){ $(".form-address-upload").removeClass("uploaded"); $(".photo-address").hide(); $(".form-address").removeClass("address-uploaded") $("#formAddressPurchase").find(".form-control").attr("required", true) }); $(".case-video-preview").delegate(".replace-video", "click", function(){ $("#input-video").trigger("click") }) $('.date-single').click(function(e) { e.preventDefault(); $('.date-single').removeClass('selected'); $('#full-date').removeClass('selected'); $(this).addClass('selected'); $('#full-date').html('Full' + '' + 'Calendar'); }); $('#full-date').click(function(e){ e.preventDefault(); $('.date-single').removeClass('selected'); $(this).addClass('selected'); }); // $("tr").each(function(){ // if($(this).text().match('SKU')) { // $(".sku-product").html($(this).parents("table").html()) // } // }) $("#product-image").scroll(function(){ $(".desc-add").each(function(){ const img = $(this).find("img") const src = img.data("src") img.attr("src", src) }) }) $(".product-fixed").hide() let target = $("#personalizeBtn") $(".product-meta").scroll(function() { if ($(window).scrollTop() >= target.offset().top ) { $(".product-fixed").addClass("show") } else { $(".product-fixed").removeClass("show") } }); $(window).scroll(function() { if ($(window).scrollTop() >= target.offset().top ) { $(".product-fixed").addClass("show") } else { $(".product-fixed").removeClass("show") } }); });













// 