Korean Beef Bulgogi - 9 recipes | Woolworths (2024)

` ) }, 3000) }) } // OTP APIs function executeOtpAPI(preferredChannel) { if (!useTestAPI) { return getOtpAPI(preferredChannel); } else { return testGetOtpAPI(preferredChannel); } } function getOtpAPI(preferredChannel) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/api/v3/ui/authentication/otp?isInitial=true&Channel=${preferredChannel}`, type: 'GET', contentType: 'application/json', }).then(res => { if (res.Successful) { resolve(res); } else { reject(res); } }) }); } // send new code / send SMS/Email instead api function testGetOtpAPI(preferredChannel) { console.log('testGetOtpAPI preferredChannel', preferredChannel) if (preferredChannel == 1) { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "Successful": true, "Channel": 1, "MaskedContact": "p****h@g****.com" }) }, 3000) }) } else { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "Successful": true, "Channel": 0, "MaskedContact": "*******927" }) }, 3000) }) } } function executeVerifyOtp(otpInputValue) { if (!useTestAPI) { return verifyOtp(otpInputValue); } else { return testVerifyOtp(otpInputValue); } } // Verify the OPT provided by the user function verifyOtp(otpInputValue) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/api/v3/ui/authentication/otp`, type: 'POST', contentType: 'application/json', data: JSON.stringify({ OneTimePin: otpInputValue, UpdatePrimaryContact: false }) }).done((res) => { if (res.Successful) { resolve(res); } else { reject(res); } }).fail((res) => { reject(res); }) }); } function testVerifyOtp(otpInputValue) { if (otpInputValue == "123123") { return testOtpSuccess(); } else if (otpInputValue == "000000") { return testApiFailed(); } else { return testWrongOtpCode(); } } function testOtpSuccess() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "Successful": true, "Error": null, "TokenValue": "d5794417cf1d4d5385c8347d8960ca07", "ErrorMessage": null }) }, 3000) }) } // wrong otp code function testWrongOtpCode() { console.log('testWrongOtpCode') return new Promise((resolve, reject) => { setTimeout(() => { reject({ "Successful": false, "Error": "InvalidOneTimePin", "TokenValue": "", "ErrorMessage": "Incorrect code. You have 4 attempt(s) left." }) }, 3000) }) } function fetchOrders(shopperId) { if (!useTestAPI) { return getOrdersAPI(shopperId); } else { return testGetOrdersAPI(); // return testNoOrdersAPI(); } } function getOrdersAPI(shopperId) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://prod.mobile-api.woolworths.com.au/wow/v1/orders/api/orders?shopperId=${shopperId}&pageNumber=1&pageSize=6`, type: 'GET', contentType: 'application/json', headers: { "x-api-key": "s7iXf5Rixn4XxFrsYh4HKkriVp8hlnec" }, xhrFields: { withCredentials: true }, crossDomain: true }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } // orderstatus = // "Placed", "Received", "Preparing", // "Prepared", "OnItsWay", "Delivered", // "Shipped", "PartiallySent", "Cancelled" let testOrderStatus = "PartiallySent"; // DeliveryMethod = "Courier", "Express", "Pickup", "DriveUp" let testDeliveryMethod = "DriveUp"; function testGetOrdersAPI() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "items": [{ "OrderId": 148153401, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false }, { "OrderId": 148153402, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false }, { "OrderId": 148153403, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false } ], "_links": { "self": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6", "next": "/api/Orders?shopperId=4282500&pageNumber=2&pageSize=6", "previous": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6" } }) }, 1500) }) } function testNoOrdersAPI() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "items": [], "_links": { "self": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6", "next": "/api/Orders?shopperId=4282500&pageNumber=2&pageSize=6", "previous": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6" } }) }, 3000) }) } function fetchOrderDetails(orderId) { if (!useTestAPI) { return getOrderDetails(orderId); } else { return testGetOrderDetails(); } } function getOrderDetails(orderId) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://prod.mobile-api.woolworths.com.au/wow/v1/orders/api/orders/${orderId}`, type: 'GET', contentType: 'application/json', headers: { "x-api-key": "s7iXf5Rixn4XxFrsYh4HKkriVp8hlnec" }, xhrFields: { withCredentials: true }, crossDomain: true }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } function testGetOrderDetails() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "DeliveryWindowId": 628988, "DeliveryInstructions": "", "CanLeaveOrderUnattended": false, "ContainsFrozen": true, "ContainsRestrictedBySignature": false, "ContainsRestrictedBySignatureAndPhotoId": false, "DeliveryStreet1": "20 Bridge St", "DeliveryStreet2": "EPPING NSW", "DeliverySuburb": "Epping", "DeliveryPostCode": "2121", "OrderProducts": [{ "Ordered": { "StockCode": 175905, "Brand": "Woolworths", "Name": "Woolworths 12 Extra Large Free Range Eggs", "Quantity": 5, "Total": 26, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 5.2 }, "SalePrice": { "Measure": "Each", "Value": 5.2 }, "ComparativePrice": { "Measure": "100G", "Value": 0.74 }, "AllowSubstitution": true, "LineNumber": 1, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } }, { "Ordered": { "StockCode": 463666, "Brand": "Chobani", "Name": "Chobani Plain Whole Milk Greek Yogurt", "Quantity": 1, "Total": 7, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 7 }, "SalePrice": { "Measure": "Each", "Value": 7 }, "ComparativePrice": { "Measure": "100G", "Value": 0.77 }, "AllowSubstitution": true, "LineNumber": 2, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } }, { "Ordered": { "StockCode": 117381, "Brand": "Macro", "Name": "Macro Organic Carrots", "Quantity": 1, "Total": 4.5, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 4.5 }, "SalePrice": { "Measure": "Each", "Value": 4.5 }, "ComparativePrice": { "Measure": "1KG", "Value": 6 }, "AllowSubstitution": true, "LineNumber": 3, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } }, { "Ordered": { "StockCode": 785977, "Brand": "Nong Shim", "Name": "Nong Shim Shin Ramyun", "Quantity": 4, "Total": 18, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 7 }, "SalePrice": { "Measure": "Each", "Value": 4.5 }, "ComparativePrice": { "Measure": "100G", "Value": 0.75 }, "AllowSubstitution": true, "LineNumber": 4, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } } ], "OrderDiscountDetailsList": [], "PaymentDetails": { "MarketTotalByVendor": {}, "TotalBeforeSavings": 65.5, "Savings": 10, "Subtotal": 55.5, "OrderDiscount": 0, "DeliveryFeeBeforeDiscount": 13, "DeliveryFeeDiscount": 0, "DeliveryFee": 13, "MarketShippingFee": 0, "MarketShippingFeeBeforeDiscount": 0, "MarketShippingFeeDiscount": 0, "MarketSellerShippingFees": [], "Total": 69.5, "AdditionalDeductions": 0, "AmountToPay": 69.5, "PaidBy": [{ "Type": "CreditCard", "Amount": 69.5 }], "WowTotal": 69.5, "CompleteTotal": 69.5, "MarketplaceTotal": 0, "MarketplaceSubtotal": 0, "WowSubtotal": 55.5, "TeamDiscount": 0, "OrderDiscountWithoutTeamDiscount": 0, "PackagingFeeBeforeDiscount": 1, "PackagingFeeDiscount": 0, "PackagingFee": 1, "PackagingFeeLabel": "Reusable bags", "MarketDeliveryFee": 0 }, "RewardsPointsToCollect": 56, "RewardsCreditsToCollect": 0, "RewardsCreditsRedeemed": 0, "IsRewardsEarningsAvailable": true, "FulfilmentStore": { "Id": 8881, "Name": "Lidcombe CFC", "Timezone": "AUS Eastern Standard Time", "Url": "", "PhoneNumber": "", "Street1": "6 Hill Road", "Street2": "", "Area": "8881 Lidcombe CFC LOCAL", "PostCode": "2141", "Suburb": "Lidcombe Place Holder Suburb", "State": "" }, "RewardsCardNumber": "9355130014696", "IsRedelivery": false, "AmendmentCutOffStoreTime": "2023-02-05T00:45:00+11:00", "HasMarketOrderGiftingDetails": false, "DeliveryDelayed": false, "OrderId": 148153401, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "GroceriesOrderId": 148153401, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false } ) }, 1500) }) } function fetchEdrCard() { if (!useTestAPI) { return getEdrCard(); } else { return testGetEdrCard(); // return testNoEdrCard(); } } function getEdrCard() { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/apis/ui/EdrCard`, type: 'GET', contentType: 'application/json' }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } function testGetEdrCard() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "NoValidEdrCardMessage": null, "HasValidAndRegisteredEdrCardMessage": "Your Woolworths Rewards cards has been accepted.", "HasValidAndUnRegisteredEdrCardMessage": null, "IsStaffMemberMessage": null, "CardValidationResult": "NotApplicable", "CardNumber": "9355130014696", "Isprimary": true, "Password": null, "Status": "Registered", "ShopperId": 4282500, "ValidatePassword": true, "Crn": "" }) }, 3000) }) } function testNoEdrCard() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({}) }, 3000) }) } function fetchEdrCardBalance(cardNumber) { if (!useTestAPI) { return getEdrCardBalance(cardNumber); } else { return testEdrCardBalance(); } } function getEdrCardBalance(cardNumber) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/apis/ui/EdrCard/BalanceSummary?cardNumber=${cardNumber}`, type: 'GET', contentType: 'application/json' }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } let testEdrBalance = 1622; function testEdrCardBalance() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "SaveForLaterPreference": { "Preference": "Automatic", "QffPoints": null, "PayOutDate": null, "RoundedCurrentVoucherBalance": 0, "IsLessThanMinimumBalance": false }, "Response": { "IsError": false, "Result": { "ReturnCode": "0", "ErrorMessage": "" }, "ReturnCode": "Success", "LifeTimeEarn": "1", "LifeTimeRedeem": "0", "CurrentPointBalance": `${testEdrBalance}`, "CurrentVoucherBalance": "0", "NextVoucherExpiry": "2023-02-01", "QffVoucherBalance": null, "LifeTimeCreditEarn": "3", "LifeTimeCreditRedeem": "0", "CurrentCreditBalance": "3", "ErrorMessage": null }, "LifeTimeEarn": 1, "LifeTimeRedeem": 0, "CurrentPointBalance": testEdrBalance, "CurrentVoucherBalance": 0, "NextVoucherExpiry": null, "LifeTimeCreditEarn": 3, "LifeTimeCreditRedeem": 0, "CurrentCreditBalance": 3, "IsError": false, "ErrorMessage": null, "DisplayErrorMessage": null }) }, 1000) }) } // show and hide password when clicking on the eye $(".password-with-eye").click(function() { if ($(this).parent(".password-textbox").find("input").attr("type") == "password") { $(this).parent(".password-textbox").find("input").attr("type", "text"); $(this).find("i").removeClass("iconAct-Visibility_Off").addClass("iconAct-Visibility"); } else { $(this).parent(".password-textbox").find("input").attr("type", "password"); $(this).find("i").removeClass("iconAct-Visibility").addClass("iconAct-Visibility_Off"); } });

Korean Beef Bulgogi - 9 recipes | Woolworths (1)

# ${orderId}.

Order Status

${orderStatus}.

Fulfilment method

${fulfilmentMethod} .

Order date

${orderDate} .

Action 1 is

Track Order

Action 2 is

` ); if(orderStatus !== "Cancelled") { fetchOrderDetails(orderId).then(res => { let amendmentCutOffStoreTime = res.AmendmentCutOffStoreTime ? res.AmendmentCutOffStoreTime : ""; if(amendmentCutOffStoreTime) { amendOrderByDateTime = moment(amendmentCutOffStoreTime).format( 'LT [on] dddd, D MMM'); // logic if order pickup has expired let ammendHtml = ""; // check if the cutoff date is before current date if(moment(amendmentCutOffStoreTime).isBefore(moment())) { let projectedDeliveryStartTime = order.ProjectedDeliveryTime.StartTime ? moment(order.ProjectedDeliveryTime.StartTime).format('LT') : ""; let projectedDeliveryEndTime = order.ProjectedDeliveryTime.EndTime ? moment(order.ProjectedDeliveryTime.EndTime).format('LT') : ""; amendHtml = `

Estimated between ${projectedDeliveryStartTime} - ${projectedDeliveryEndTime} .
`; }else { amendHtml = `

You may

Make changes up until ${amendOrderByDateTime} .
`; // append the change my order widget if before the cutoff time $('.item__action-panel').append(` Change my order `) } $(`.lux-order-item[data-order-id="${orderId}"] .lux-order-middle-section`) .append(amendHtml); } }); } else if (order.ProjectedDeliveryTime && order.ProjectedDeliveryTime.StartTime && order.ProjectedDeliveryTime.EndTime) { let projectedDeliveryStartTime = order.ProjectedDeliveryTime.StartTime ? moment(order.ProjectedDeliveryTime.StartTime).format('LT') : ""; let projectedDeliveryEndTime = order.ProjectedDeliveryTime.EndTime ? moment(order.ProjectedDeliveryTime.EndTime).format('LT') : ""; let amendHtml = `

Delivery Window

Estimated between ${projectedDeliveryStartTime} - ${projectedDeliveryEndTime} .
`; $(`.lux-order-item[data-order-id="${orderId}"] .lux-order-middle-section`) .append(amendHtml); } if(isMultiOrder) { // update orders section title to display no. of orders $('.lux-my-orders-title').html(`My orders (${orderList.length})`); // set left pos value for order card posValue = posValue + posShiftValue + 20; //20px gap between order cards // set the dots for order card carousel $('.my-orders-indicator').append(`

`); } if(orderList.length == index) { isOrderCardSetupDone = true; } }); if(isMultiOrder && isOrderCardSetupDone) { // update orders section title to display no. of orders $('.lux-my-orders-title').html(`My orders (${orderList.length})`); } } else { // replace loading orders container with no orders container $('.my-orders.loading').replaceWith( `

You currently have no orders to display.
` ); } }) .catch(err => { console.log('error loading orders', err); }); } } function getOrderStatusClass(orderStatus) { switch(orderStatus) { case "Placed": return "placed"; case "Received": return "received"; case "Preparing": return "preparing"; case "OnItsWay": return "in-transit"; case "Delivered": case "Shipped": return "completed"; case "Cancelled": return "cancelled"; case "PartiallySent": return "partiallySent"; default: return "other"; } } function getOrderStatusText(orderStatus, fulfilmentMethod) { switch(orderStatus) { case "Received": return "Order received"; case "Preparing": return "Preparing order"; case "Prepared": switch (fulfilmentMethod) { case "Pick up": return "Ready for Pick up"; case "Direct to boot": return "Ready"; default: return "Preparing order"; } case "OnItsWay": return "On its way"; case "Delivered": return "Delivered"; case "PickedUp": return "Picked up"; case "Shipped": return "Shipped"; case "Cancelled": return "Cancelled"; case "PartiallySent": return "Partially shipped"; default: return ""; } } function getFulfilmentMethodText(fulfilmentMethod) { switch(fulfilmentMethod) { case "Pickup": return "Pick up"; case "DriveUp": return "Direct to boot"; default: // "Courier" || "Express" return "Delivery"; } } $('body').on('click', '.lux-orders-paginate-left-btn', function() { shiftOrders('right'); updateActiveCarouselDot('right'); enableDisableOrderCarouselButton(); }) $('body').on('click', '.lux-orders-paginate-right-btn', function() { shiftOrders('left'); updateActiveCarouselDot('left'); enableDisableOrderCarouselButton(); }) function shiftOrders(direction /* left, right */) { $('.lux-order-item').each((index, item) => { let currentPosValue = $(item).css('left'); let newPosValue = direction == 'left' ? parseInt(currentPosValue, 10) - posShiftValue : parseInt(currentPosValue, 10) + posShiftValue; $(item).css("left", `${newPosValue}px`); }) } let currentActiveDotIndex = 0; function updateActiveCarouselDot(direction /* left, right */) { $('.my-orders-indicator .dot').removeClass('active'); currentActiveDotIndex = direction == 'left' ? currentActiveDotIndex + 1 : currentActiveDotIndex - 1; $(`.my-orders-indicator .dot:nth-child(${currentActiveDotIndex + 1})`).addClass('active'); } function enableDisableOrderCarouselButton () { if(currentActiveDotIndex == 0) { $('.lux-orders-paginate-left-btn').prop('disabled', true); } else { $('.lux-orders-paginate-left-btn').prop('disabled', false); } if (currentActiveDotIndex == $('.lux-order-item').length - 1) { $('.lux-orders-paginate-right-btn').prop('disabled', true); } else { $('.lux-orders-paginate-right-btn').prop('disabled', false); } } // END: LOGGED IN USER PANEL FUNCTIONS

${errorMessage}

` $(errorHTML).insertAfter("#page2 .find-delivery h4.tab-heading"); } }) } function deliveryAddressUpdateFulfilment(selectedAddressId) { $.ajax({ url: `${url}/ui/Fulfilment`, type: 'POST', data: { "addressId": selectedAddressId, "fulfilmentMethod": "Courier" } }).then(() => { getCustomerInfoAsync().then((res) => { totalData = res updateDeliveryTimeDisplay() updateDeliveryMethod() openDeliveryPickupSidePanel() }) }) } // open pick time for delivery side panel function openDeliveryPickupSidePanel() { $('.open-side.time-to').first().click() } // manual delivery address entry $('body').on('click', '.addressSelector-enterManually', function(e) { e.preventDefault() $('.delivery-warning').addClass('hide') showManualDeliveryAdressInput() }) function showManualDeliveryAdressInput() { $('.find-delivery').hide() $('#auto-delivery-buttons-container').hide() $('#manual-delivery-search').show() $('#manual-delivery-buttons-container').show() $('.previous-add').hide() $('#page2').addClass('manual') $('#page2').removeClass('auto') } function hideManualDeliveryAdressInput() { $('.find-delivery').show() $('#auto-delivery-buttons-container').show() $('#manual-delivery-search').hide() $('#manual-delivery-buttons-container').hide() $('#page2').removeClass('manual') $('#page2').addClass('auto') if (previousAddresses) { $('.find-delivery').hide() $('.previous-delivery, .add-address-button').show() $('.previous-add').hide() } } // button to return to auto delivery search from manual delivery search $('#manual-delivery-buttons-container .linkButton.fulfilment-button').click(function(e) { e.preventDefault() hideManualDeliveryAdressInput() }) // add class to input boxes on input so labels stay small if they hhave text $('#shared-text-input-11, #shared-text-input-12, input[name="Postcode"]').on('input', function() { let text = $(this).val() if (text.length) { $(this).addClass('input-with-value') } if (!text.length) { $(this).removeClass('input-with-value') } }) // retrieve the suburbs for the select when you input a postcode for manual delivery search $('input[name="Postcode"]').on('input', function() { let postcode = $(this).val() $('shared-dropdown[name="Suburb"] select').empty() if (postcode.length >= 4) { retrieveSuburbsFromPostCode(postcode).then((res) => { res.Response.forEach(option => { $('shared-dropdown[name="Suburb"] select').append( `` ) }) }) } else { $('shared-dropdown[name="Suburb"] select').append( `` ) } }) function retrieveSuburbsFromPostCode(postcode) { return $.ajax({ url: `${url}/ui/address/suburb/${postcode}`, type: 'GET' }) } // remove validation messages on input to input fields for manual delivery $('shared-textbox[name="Street1"]').on('input', function() { $(this).find('shared-validation-messages').hide() // if this has text then add class let text = $(this).find('input').val() if (text.length) { $(this).addClass('input-with-value') } else { $(this).removeClass('input-with-value') } }) $('shared-dropdown[name="Suburb"], shared-textbox[name="Postcode"]').on('input', function() { $('shared-dropdown[name="Suburb"]').find('shared-validation-messages').hide() $('shared-textbox[name="Postcode"]').find('shared-validation-messages').hide() }) // submit manual delivery search form function manual_delivery() { let form = $('#page2.manual') $(form).find('shared-validation-messages').hide() $(form).find('shared-dropdown[name="Suburb"]').removeClass('ng-invalid') $(form).find('shared-textbox[name="Postcode"]').removeClass('ng-invalid') $(form).find('shared-textbox[name="Street1"]').removeClass('ng-invalid') let street_address1 = $(form).find('input[name="Street1"]').val(); let street_address2 = $(form).find('input[name="Street2"]').val(); let postcode = $(form).find('input[name="Postcode"]').val(); let suburb = $(form).find('select#shared-dropdown-input-4').val(); let suburbObject = { Text: $('#shared-dropdown-input-4').find(':selected').text(), Id: $('#shared-dropdown-input-4').find(':selected').attr('data-id'), IsNonServiced: $('#shared-dropdown-input-4').find(':selected').attr('data-serviced') } let suburbId = $('#shared-dropdown-input-4').find(':selected').attr('data-id') let dataObject = { Postcode: postcode, Street1: street_address1, Street2: street_address2, Suburb: suburbObject, SuburbId: suburbId } if (!street_address1 || !postcode || !suburb) { if (!street_address1) { $(form).find('input[name="Street1"]').siblings('shared-validation-messages').show() $(form).find('shared-textbox[name="Street1"]').addClass('ng-invalid') } if (!postcode) { $(form).find('input[name="Postcode"]').siblings('shared-validation-messages').show() $(form).find('shared-textbox[name="Postcode"]').addClass('ng-invalid') } if (!suburb) { $(form).find('select#shared-dropdown-input-4').siblings('shared-validation-messages').show() $(form).find('shared-dropdown[name="Suburb"]').addClass('ng-invalid') } else { $('.addressSelectorManual-postcodeSuburbInput').removeClass('empty-drop') } } else { if (isUserLoggedIn) { manualDeliveryAddressCall(dataObject) } else { window.location.href = '/shop/securelogin' } } } $('body').on('click', '#page2.manual button[type="submit"].shopper-action', function(e) { e.preventDefault() manual_delivery() }) $('.fms-form shared-address-selector-manual input').on('keypress', function(e) { if (e.which == 13) { e.preventDefault() manual_delivery() } }) function manualDeliveryAddressCall(data) { $.ajax({ url: `${url}/ui/address/manual`, type: 'POST', contentType: 'application/json;', data: JSON.stringify(data) }).then(res => { let addressId = res.Address.AddressId deliveryAddressUpdateFulfilment(addressId) }) } // pickup and to boot // on-input pick-up address populate with list-items $('body').on('input', '#pickupAddressSelector, #pickupAddressSelectorBoot', function() { const pickup_or_boot = $(this).closest('.page-hide').attr('id') === 'page3' ? 'pickup' : 'boot' var searchVal = $(this).val() if (searchVal.length) { $(this).addClass('input-with-value') } if (!searchVal.length) { $(this).removeClass('input-with-value') } $.ajax({ url: `${url}/ui/StoreLocator/Suburbs`, type: 'GET', data: { "SearchTerm": searchVal } }).then((res) => { $('ul.list.ng-star-inserted').remove() if (pickup_or_boot === 'pickup') $('

    ').insertAfter( '#pickup-results') if (pickup_or_boot === 'boot') $('

      ').insertAfter( '#boot-results') if (!res.Suburbs.length) { $('ul.list.ng-star-inserted').append( `

    • No suburb found. Reset search
    • ` ) } if (res.Suburbs.length > 0) { if (pickup_or_boot === 'pickup') { res.Suburbs.forEach((suburb, index) => { $('ul.list.ng-star-inserted').append(`

    • ${suburb.SuburbStateString}

    • `) }) } if (pickup_or_boot === 'boot') { res.Suburbs.forEach((suburb, index) => { $('ul.list.ng-star-inserted').append(`

    • ${suburb.SuburbStateString}

    • `) }) } } }) }) // reset search when no results found $('body').on('click', '.drawer .reset-search', function(e) { $('#pickupAddressSelector').focus() e.preventDefault() $('#pickupAddressSelector').val('') $('#pickupAddressSelectorBoot').val('') inputIcons($(e.target)) $('ul.list.ng-star-inserted').remove() }) // selecting a suburb from list of suburbs for pickup and boot $('body').on('click', '.suburb-list-item', function() { const pickup_or_boot2 = $(this).closest('.page-hide').attr('id') === 'page3' ? 'pickup' : 'boot' const pickup_or_boot_api_value = $(this).closest('.page-hide').attr('id') === 'page3' ? 'Pickup' : 'DriveUp' const postCode = $(this).data('postcode') if (pickup_or_boot2 === 'pickup') { $('input#pickupAddressSelector').val(postCode) $('.pick-up-warning').addClass('hide') } if (pickup_or_boot2 === 'boot') { $('.direct-boot-warning').addClass('hide') $('input#pickupAddressSelectorBoot').val(postCode) } getListPickupStores({ postCode }) }) // get all stores that match a location and append them to the page function getListPickupStores(location) { return $.ajax({ url: `${url2}/v3/ui/fulfilment/stores`, type: 'GET', data: { ...location } }).then((res) => { //set first address as selected address id if (res && Array.isArray(res) && res.length > 0 && res[0].AddressId) { addressIdItem = res[0].AddressId } $('.stores.ng-star-inserted').remove() $('#page3 fieldset').append( '

      ') const pickUpContent = (pickupOrDriveUp) => { if (pickupOrDriveUp === 'Pickup') { return ` In-store pick up` } if (pickupOrDriveUp === 'DriveUp') { return ` Korean Beef Bulgogi - 9 recipes | Woolworths (2)Direct to boot` } } res.forEach((suburb, index) => { $('.stores.ng-star-inserted').append(`

      ${suburb.Description}

      ${suburb.AddressText}

      ${pickUpContent(suburb.FulfilmentMethod)}

      ${suburb.Distance} km

      `) }) $('.list.ng-star-inserted').html('') }).then(() => { // hide all options after first 4 $('.suburb-list-item2:gt(4)').hide() // select the first option by default $('.suburb-list-item2:first input').prop("checked", true); // append the "view more button" when required let button = `` if ($('.suburb-list-item2').length > 5) { $(document).find('#page3 div.tab-content.ng-star-inserted .stores.ng-star-inserted').append( button) } // hide order options info $('#page3 .tab-content div.cvp.ng-star-inserted').hide() }) } // view more button for suburbs $(document).on('click', '.view-more-button', function() { const pickup_or_boot = $(this).closest('.page-hide').attr('id') === 'page3' ? 'pickup' : 'boot' if (pickup_or_boot === 'pickup') { $('.suburb-list-item2:hidden:lt(5)').show() if ($('.suburb-list-item2:hidden').length == 0) { $('.view-more-button').hide() $('.stores:last-child').css('border', 'none') } } if (pickup_or_boot === 'boot') { $('.suburb-list-item3:hidden:lt(5)').show() if ($('.suburb-list-item3:hidden').length == 0) { $('.view-more-button').hide() } } }) let addressIdItem; let fulfilmentMethod; // select a pickup or driveup location from the menu $('body').on('click', '.suburb-list-item2', function() { addressIdItem = $(this).data('id') fulfilmentMethod = $(this).data('fulfilmentMethod') // update input icons $('.suburb-list-item2 input').prop("checked", false); $(this).find('input').prop("checked", true); }) // pickup save button $('body').on('click', '.pickup-save', function(e) { e.preventDefault(e) if ($('#pickupAddressSelector').val() != '' || $('.suburb-list-item2').length) { $('.pick-up-warning').addClass('hide') $(this).find('.spinner-button').removeClass('hide') $(this).find('.button-text').addClass('hide') pickupMethodFulfilmentCall(fulfilmentMethod) let _this = $(this) setTimeout(function() { $(_this).find('.spinner-button').addClass('hide') $(_this).find('.button-text').removeClass('hide') }, 5000) } else { $('.pick-up-warning').removeClass('hide') } }) function pickupMethodFulfilmentCall(pickupMethod) { if (addressIdItem) { if (isUserLoggedIn) { $.ajax({ url: `${url}/ui/Fulfilment`, type: 'POST', data: { addressId: addressIdItem, fulfilmentMethod: pickupMethod } }).then(() => { getCustomerInfoAsync().then((res) => { totalData = res updateDeliveryTimeDisplay() updateDeliveryMethod() // open time select modal openDeliveryPickupSidePanel() }) }).then(() => { }) } else { window.location.href = '/shop/securelogin' } } } // update delivery / pickup method display function updateDeliveryMethod() { if (totalData.GetDeliveryInfoRequest && totalData.GetDeliveryInfoRequest.DeliveryMethod) { $('.linkButton.fulfilment-button.ng-star-inserted.back-button').hide() } if (totalData.GetDeliveryInfoRequest && (totalData.GetDeliveryInfoRequest.DeliveryMethod == 'Courier' || totalData.GetDeliveryInfoRequest.DeliveryMethod == 'Null')) { $('.delivery-fee').show() } if (isUserLoggedIn) { if (totalData && totalData.GetDeliveryInfoRequest && totalData.GetDeliveryInfoRequest.DeliveryMethod) { let deliveryDisplayText = totalData.GetDeliveryInfoRequest?.Address?.Description ? totalData .GetDeliveryInfoRequest?.Address?.Description : totalData.GetDeliveryInfoRequest?.Address ?.AddressText ? totalData.GetDeliveryInfoRequest?.Address?.AddressText : "" $('#page1').remove() if (totalData.GetDeliveryInfoRequest.DeliveryMethod == 'Pickup') { $('.delivery-fee').hide() $('#deliveryContent, #delivery_display_mobile').html(`

      Pick up: ${ deliveryDisplayText} Pick up ${deliveryDisplayText}

      `) } else if (totalData.GetDeliveryInfoRequest.DeliveryMethod == 'DriveUp') { $('.delivery-fee').hide() $('#deliveryContent, #delivery_display_mobile').html(`

      Korean Beef Bulgogi - 9 recipes | Woolworths (3)

      Direct to boot: ${deliveryDisplayText} Pick up Direct to boot ${deliveryDisplayText}

      `) } else { $('.delivery-fee').show() $('#deliveryContent, #delivery_display_mobile').html(`

      Delivery to: ${deliveryDisplayText} Delivery to ${deliveryDisplayText}

      `) } $(".header-fulfilment__section-arrow.open-side.deliver-to .md-min-hide").html(' Change ') } } } // update delivery / pickup chosen time display function updateDeliveryTimeDisplay() { let delivery_pickup_text = 'When suits? ' const data = totalData.GetDeliveryInfoRequest let dateString; if (data.ReservedDate.Date) { let time_format_day = moment(data.ReservedDate.Date).format('ddd'); delivery_pickup_text = 'Chosen time: ' dateString = `

      ` } else { dateString = `

      `; } $('#select_a_time, #select_a_time_mobile').html('') $('#select_a_time, #select_a_time_mobile').append(dateString) if (data.ReservedDate.Date) { $(".header-fulfilment__section-arrow.open-side.time-to .md-min-hide").html(' Change ') } } // general // prevent forms submitting on enter $('.fms-form').submit(function(e) { e.preventDefault() }) // function to only allow number input function validate(evt) { var theEvent = evt || window.event; // Handle paste if (theEvent.type === 'paste') { key = event.clipboardData.getData('text/plain'); } else { // Handle key press var key = theEvent.keyCode || theEvent.which; key = String.fromCharCode(key); } var regex = /[0-9]|\./; if (!regex.test(key)) { theEvent.returnValue = false; if (theEvent.preventDefault) theEvent.preventDefault(); } } // close search options dropdown when cicking away from it $('body').on('blur', '#deliveryAddressSelector, #pickupAddressSelector, #pickupAddressSelectorBoot', function() { setTimeout( function() { $('ul.list.ng-star-inserted').hide() }, 500) }); // reopen search options when focus back $('body').on('focus', '#deliveryAddressSelector, #pickupAddressSelector, #pickupAddressSelectorBoot', function() { $('ul.list.ng-star-inserted').show() }); // search input $('#pickupAddressSelectorBoot, #pickupAddressSelector, #deliveryAddressSelector').on('input', function(e) { inputIcons($(this)) }) $('#pickupAddressSelectorBoot, #pickupAddressSelector, #deliveryAddressSelector').on('focus', function(e) { inputIcons($(this)) }) $('#pickupAddressSelectorBoot, #pickupAddressSelector, #deliveryAddressSelector').on('blur', function(e) { inputIcons($(this)) }) // switch between geolocation icon and the clear text icon function inputIcons(_this) { let _thisParent = _this.closest('shared-pickup-address-selector') let searchTerm = $(_thisParent).find('input').val() if (typeof searchTerm != 'undefined' && searchTerm.length > 0) { if (!$(_thisParent).find('.clear-text').is(':visible')) { $(_thisParent).find('shared-textbox').append( `

      ` ) } $('.geolocate-icon').hide() } if (typeof searchTerm != 'undefined' && !searchTerm.length) { $(_thisParent).find('.clear-text').remove() $('.geolocate-icon').show() } } $('body').on('click', 'shared-pickup-address-selector .clear-text', function() { $(this).siblings('input').val('') inputIcons($(this).siblings('input')) }) // geolocation let pickupType; // get user location if possible function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(getMatchingLocations); // getMatchingLocations() } else { alert("Geolocation is not supported by this browser."); } } function getMatchingLocations(position) { getListPickupStores(pickupType, { latitude: position.coords.latitude, longitude: position.coords.longitude }) } let pickup_text = 'Search for Pick up location'; let direct_boot_text = 'Search for a Direct to boot location'; let user_location_text = 'Using your location'; $(document).on('keypress ', 'input[name="pickupAddressSelector"]', function() { if ($('#pickupAddressSelector', this)) { $(this).siblings('label.ng-star-inserted').text(pickup_text) } else if ('#pickupAddressSelectorBoot') { $(this).siblings('label.ng-star-inserted').text(direct_boot_text) } }) $(document).on('click', function(e) { if (!$(e.target).is('#geolocationiconDriveUp') && !$(e.target).is('#geolocationiconPickup')) return pickupType = $(e.target).is('#geolocationiconDriveUp') ? 'DriveUp' : 'Pickup' if (pickupType == 'DriveUp') { $('#geolocationiconDriveUp').siblings('shared-typeahead').find('label.ng-star-inserted').text( user_location_text) } else { $('#geolocationiconPickup').siblings('shared-typeahead').find('label.ng-star-inserted').text( user_location_text) } e.preventDefault(e) getLocation() }) $(document).on("click", ".add-address-button", function(e) { e.preventDefault(); $('.previous-delivery, .add-address-button').hide() $('.find-delivery, .previous-add').show() $('#manual-delivery-search').hide() $('#manual-delivery-buttons-container').hide() $('#page2').removeClass('manual') }); $(document).on("click", ".previous-add", function(e) { e.preventDefault(); $('.previous-delivery, .add-address-button').show() $('.find-delivery, .previous-add').hide() $('#manual-delivery-search').hide() $('#manual-delivery-buttons-container').hide() $('#page2').removeClass('manual') });

      ' ) } number = $('#afternoonTime .appendTimeHere .time-slot-container').length - 3 $('#afternoonTime .appendTimeHere .time-slot-container').length > 3 ? $( '#afternoonTime .appendTimeHere').append( `` ) : null $('#afternoonTime .appendTimeHere .time-slot-container').slice(3).hide() if (number == -3) { $('#afternoonTime .appendTimeHere').append( '

      All afternoon times are closed

      ' ) } number = $('#eveningTime .appendTimeHere .time-slot-container').length - 3 $('#eveningTime .appendTimeHere .time-slot-container').length > 3 ? $('#eveningTime .appendTimeHere') .append( `` ) : null $('#eveningTime .appendTimeHere .time-slot-container').slice(3).hide() if (number == -3) { $('#eveningTime .appendTimeHere').append( '

      All evening times are closed

      ' ) } if (pre_selected) { if (totalData.GetDeliveryInfoRequest.ReservedTime.Id) { const time = totalData.GetDeliveryInfoRequest.ReservedTime.Id; $(`.times-column .time-slot-list input[id="` + time + `"]`).prop('checked', true); } } }) $(document).on('click', '.view-more-button-time ', function(e) { e.preventDefault(e) $(this).closest('.appendTimeHere').find('.time-slot-container').show() $(this).hide() }) // update time slot choice let timeslotId; $(document).on('input', '.time-slot-container input.wowRadio ', function() { timeslotId = $(this).attr('id') $('.hide-select-time').hide() $('.show-select-time').show() const data = totalData.GetDeliveryInfoRequest const addressId = data.Address.AddressId const fulfilmentMethod = data.DeliveryMethod const windowDate = time_id_match $.ajax({ url: `${url}/ui/Fulfilment`, type: 'POST', contentType: 'application/json', dataType: "json", data: JSON.stringify({ addressId, fulfilmentMethod, windowDate, timeslotId }) }).then(() => { getCustomerInfo() }) }) $(document).on('click', '.time-save', function() { $('.drawer').removeClass('is-open') $('.mask').removeClass('is-masked') $('body').removeClass('overflow-none') })

      ` ) $(this).find('.product-tile-v2--image img').addClass('is-unavailable'); } else { $(this).find('.cartControls-addButton').show() $(this).find(`.cartControls-inTrolleyWrapper`).remove() $(this).find(`.cart-item-unavailable`).remove() } }); } // update cart with additional populate cart data function updateCart() { const data = cartData $('.item-count-amount').html(data.TotalTrolleyItemQuantity) // add items to cart const items = data.AvailableItems const unavailableItems = data.UnavailableItems populateRHSCart(items, unavailableItems) // update total const total = data.Totals.SubTotal; const totalSavings = data.Totals.TotalSavings.toFixed(2); const numberItems = data.TotalTrolleyItemQuantity; const everydayMarketTotal = data.Totals.MarketTotal; const woolworthstTotal = data.Totals.WoolworthsTotal; updateCartTotal(total, totalSavings, numberItems, everydayMarketTotal, woolworthstTotal) } // populate the RHS cart with the product items // show differently if items are unavailable or available function populateRHSCart(availableItems, unavailableItems) { $('wow-cart-products .auto_products-in-cart').html('') $('#unavailable-items-container').remove() if (unavailableItems.length > 0) { $('wow-cart-products').prepend( `

      These items are currently unavailable

      ` ) } unavailableItems.forEach((item) => { $('wow-cart-products #unavailable-items-container .cart-items-container').append( `

      Unavailable

      ${item.Name} ${item.PackageSize}

      ` ) }) availableItems.forEach((item) => { let price = item.SalePrice.toFixed(2) let priceSml = price.split('.')[1] let priceLrg = price.split('.')[0] $('wow-cart-products .auto_products-in-cart').append(`

      ${item.Discount ? '

      SAVE $' + item.Discount.toFixed(2) + '

      ' : ''}

      ${item.Name} ${item.PackageSize}

      $${priceLrg}

      .${priceSml}

      ${item.SalePrice.toFixed(2) != (item.ListPrice * item.Quantity).toFixed(2) ? ' Was $' + (item.ListPrice * item.Quantity).toFixed(2) + ' ' : ''}

      `) }) if ((availableItems.length + unavailableItems.length) == 0) { let insert_empty = `Korean Beef Bulgogi - 9 recipes | Woolworths (6)

      Your cart is empty

      Continue shopping to browse and search for items.

      ` $('.checkout-buttons').addClass('is-disabled') $('.scroll-wrapper .cart-content').hide() $('.scroll-wrapper .empty-cart-container').show() $('.scroll-wrapper .empty-cart-container').html(insert_empty) } else { $('.checkout-buttons').removeClass('is-disabled') $('.scroll-wrapper .cart-content').show() $('.scroll-wrapper .empty-cart-container').html('') $('.scroll-wrapper .empty-cart-container').hide() } } // click continue shopping button in cart $('body').on('click', '.empty-cart-container button', function() { if (shopping_pages || campaign_page) { tracking_click_continue_shopping_button() } }) // update the cart total in header and at bottom of rhs cart function updateCartTotal(total, TotalSavings, numberItems, everydayMarketTotal, woolworthstTotal) { if (total.toFixed(2) == 0.00) { $('.order-total-number.current').text(`$0.00`); $('.wx-header-checkout-amount-sr').text(`$0.00`); $('.wx-header-checkout-plural-sr').text('item'); $('.cart-checkout-total__currency').text(`$0`); $('.headerCheckout-cartButtonTotal').text(`$0.00`); $('.lux-everyday-market-price').text(`$0`); $('.lux-woolworths-price').text(`$0`); updateCartAmountIcon(numberItems); } else { $('.order-total-number.current').text(`$${total.toFixed(2)}`); $('.wx-header-checkout-amount-sr').text(`$${total.toFixed(2)}`); $('.cart-checkout-total__currency').text(`$${total.toFixed(2)}`); $('.headerCheckout-cartButtonTotal').text(`$${total.toFixed(2)}`); $('.lux-everyday-market-price').text(`$${everydayMarketTotal > 0 ? everydayMarketTotal.toFixed(2) : 0}`); $('.lux-woolworths-price').text(`$${woolworthstTotal > 0 ? woolworthstTotal.toFixed(2) : 0}`); if (numberItems > 1) { $('.wx-header-checkout-plural-sr').text('items'); } else { $('.wx-header-checkout-plural-sr').text('item'); } updateCartAmountIcon(numberItems); } $('.cart-totalSavings').remove() if (!!+TotalSavings) { $('.saving-count-container .total-savings').remove() const savingsHTML = ` Total saved: $${TotalSavings}` $('.saving-count-container').prepend(savingsHTML) } function updateCartAmountIcon(numberItems) { if (numberItems > 0) { // desktop $('.wx-fs-header__checkout-quantityPill .quantity-pill-number.current').text(numberItems); $('.wx-header-checkout-quantity-sr').text(numberItems); // mobile $('.headerCheckout-cartButtonIcon').html(`

      ${numberItems}

      `); $('.wx-fs-header__checkout-quantityPill').removeClass('wx-fs-header__checkout-quantityPillHidden'); } else { $('.wx-fs-header__checkout-quantityPill').addClass('wx-fs-header__checkout-quantityPillHidden'); } } } // if the user has WOW no rewards function insertNoReward() { $('.cartLoyalty-container').html('') const noRewardHTML = `

      Earn points on this shop Korean Beef Bulgogi - 9 recipes | Woolworths (7)

      Collect points on this shop

      Link Everyday Rewards Card

      ` $('.cartLoyalty-container').html(noRewardHTML) } // if the user has WOW rewards function insertReward(rewardData, cartTotal) { $('.cartLoyalty-container').html('') if (rewardData) { const currentBalance = cartTotal let rewardHTML if (rewardData.WowRewardsToSpend > 0) { rewardHTML = `

      Korean Beef Bulgogi - 9 recipes | Woolworths (8)

      Everyday Rewards, off next shop

      Korean Beef Bulgogi - 9 recipes | Woolworths (9) $${rewardData.WowRewardsToSpend}

      off next shop

      Everyday Rewards, You'll Earn

      Korean Beef Bulgogi - 9 recipes | Woolworths (10) ${currentBalance} pts

      You'll collect

      ` } else { rewardHTML = `

      Everyday Rewards, You'll Earn Korean Beef Bulgogi - 9 recipes | Woolworths (11)

      Korean Beef Bulgogi - 9 recipes | Woolworths (12) ${currentBalance} pts

      You'll collect

      ` } $('.cartLoyalty-container').html(rewardHTML) } } // check if rewards are applicable to user data function checkRewardStatus() { if (isUserLoggedIn) { const rewardData = cartData.WowRewardsSummary const cartTotal = Math.ceil(cartData.Totals.SubTotal) // if user doesnt have rewards card if (rewardData && !rewardData.IsWowRewardsCardRegistered) { insertNoReward() } // if user does have rewards card if (rewardData && rewardData.IsWowRewardsCardRegistered) { insertReward(rewardData, cartTotal) } } } // save to cart list function savedButton() { const savedButtonHTML = '

      Saved

      ' $('button.cartSaveList-saveButton').show() $('button.cartSaveList-saveButton span').hide() $('.cartSaveList-saveButton', document).prop('disabled', true) $('button.cartSaveList-saveButton').append(savedButtonHTML) setTimeout(function revertToSaveButton() { $('button.cartSaveList-saveButton').children('.cartSaveList-SavedContainer').remove( '.cartSaveList-SavedContainer') $('button.cartSaveList-saveButton span').show() }, 2000) } const clearProductsFromCartCall = function() { $.ajax({ url: `${url}/ui/Trolley/Clear`, type: 'POST' }).then(res => { cartData = res; updateCartProductsRewards() }) } // populate save cart const populateSaveCartButton = function() { $('#save-remove-container').remove() const data = cartData.AvailableItems if (data.length) { const html = `
      ` $('.cart-content').append(html) } else { $('#save-remove-container').remove() } } // ********************************** events ****************************** // update item ajax call var updateItemTimeout; const updateItemAjax = function(stockcode, newQuantity, checkMainProd, checkSimilarProd) { $.ajax({ url: `${url}/ui/Trolley/UpdateItem`, type: "POST", data: { stockcode, quantity: newQuantity } }).then((res) => { cartData = res updateCart() if (checkMainProd) checkIfMainProdInCart() if (checkSimilarProd) checkIfSimilarProdInCart() checkRewardStatus() // shopping only tracking if (shopping_pages || campaign_page) { if (newQuantity > 0) tracking_update_item_in_cart(stockcode, newQuantity) if (newQuantity == 0) tracking_remove_item_from_cart(stockcode, newQuantity) } }) } // add item to cart on button click $(document).on('click', '.cartControls-addButton', function() { const id = $(this).data('sku') addToCartRequest(id) }) // remove item from cart $('body').on('click', '.cart-item .iconAct-Close_Cancel', function() { const stockCode = $(this).closest('.cart-item').data('stockcode') $.ajax({ url: `${url}/ui/Trolley/Remove`, type: 'POST', data: { Stockcode: stockCode } }).then(res => { if (shopping_pages || campaign_page) { tracking_remove_item_from_cart(stockCode, 0) } cartData = res updateCartProductsRewards() }) }) let cart_quantity_debounce_time = 500; // update number of items in cart $('body').on('click', '.cart-item .cartControls-quantityButton', function() { const stockCode = $(this).closest('.cart-item').data('stockcode') const supplyLimit = $(this).closest('.cart-item').data('supply-limit') const input = $(this).siblings('input') const step = parseFloat($(this).siblings('input').attr('step')) const value = parseFloat($(this).siblings('input').val()) if ($(this).closest('.cartControls-incrementButton').length) { // prevent adding products past supply limit if ((value + step) > supplyLimit) { $(this).attr('disabled', 'disabled'); return } $(input).val(value + step) if ((value + step) === supplyLimit) { $(this).attr('disabled', 'disabled'); } //debounce clearTimeout(updateItemTimeout); updateItemTimeout = setTimeout(updateItemAjax, cart_quantity_debounce_time, stockCode, value + step, true, true); } if ($(this).closest('.cartControls-decrementButton').length) { if (value - step > -1) { $(input).val(value - step) //debounce clearTimeout(updateItemTimeout); updateItemTimeout = setTimeout(updateItemAjax, cart_quantity_debounce_time, stockCode, value - step, true, true); } } }) // update number of items for main product $('body').on('click', '.main-product .cartControls-quantityButton', function() { const supplyLimit = $(this).closest('.main-product').data('supply-limit') const stockCode = $('.main-product .cartControls-addButton').data('sku') const input = $(this).siblings('input') const step = parseFloat($(this).siblings('input').attr('step')) const value = parseFloat($(this).siblings('input').val()) let newVal = 0; if ($(this).closest('.cartControls-incrementButton').length) { newVal = value + step } if ($(this).closest('.cartControls-decrementButton').length) { newVal = value - step } if (newVal >= 0 && newVal <= 36) { // prevent adding products past supply limit if (newVal > supplyLimit) { $(this).attr('disabled', 'disabled'); return } if (newVal === supplyLimit) { $(this).attr('disabled', 'disabled'); } $(input).val(newVal) clearTimeout(updateItemTimeout); updateItemTimeout = setTimeout(updateItemAjax, cart_quantity_debounce_time, stockCode, newVal, true, true); // update any similar prods $(`.product[data-sku="${stockCode}"]`).find('.cartControls-quantityInput').val(newVal) } }) // update number of items for similar product $('body').on('click', '.product .cartControls-quantityButton', function() { const supplyLimit = $(this).closest('.product').data('supply-limit') const stockCode = $(this).closest('.product').data('sku') const input = $(this).siblings('input') const step = parseFloat($(this).siblings('input').attr('step')) const value = parseFloat($(this).siblings('input').val()) if ($(this).closest('.cartControls-incrementButton').length) { // prevent adding products past supply limit if ((value + step) > supplyLimit) { $(this).attr('disabled', 'disabled'); return } $(input).val(value + step) if ((value + step) === supplyLimit) { $(this).attr('disabled', 'disabled'); } //debounce clearTimeout(updateItemTimeout); updateItemTimeout = setTimeout(updateItemAjax, cart_quantity_debounce_time, stockCode, value + step, true, true); } if ($(this).closest('.cartControls-decrementButton').length) { if (value - step > -1) { $(input).val(value - step) //debounce clearTimeout(updateItemTimeout); updateItemTimeout = setTimeout(updateItemAjax, cart_quantity_debounce_time, stockCode, value - step, true, true); } } }) $(document).on('click', '#order-review-button', function() { const unavailableItems = cartData.UnavailableItems if (unavailableItems.length) { const unavailableStockCodes = unavailableItems.map(item => item.Stockcode) $.ajax({ url: `${url}/ui/Trolley/RemoveItems`, type: 'POST', contentType: 'application/json;', data: JSON.stringify({ Stockcodes: [...unavailableStockCodes] }) }).then(res => { cartData = res updateCartProductsRewards() }) } }) // save cart as list button $('body').on('click', '.cartSaveList-button', function() { $(this).hide() $('.product-actionsClearCart').hide() const listInputHTML = `

      Save cart as a list

      ` $(listInputHTML).insertAfter($(this)) if (shopping_pages || campaign_page) { tracking_click_save_to_list_checkout_panel() } }) $(document).on('input', '#shared-text-input-8', function() { $('shared-validation-messages').hide() // if no value if ($(this).val() != '') { $('#cartSaveList-input .clear-text').addClass('typing-change') $(this).addClass('input-with-value') $('.cartSaveList-saveButton', document).prop('disabled', false) } else { $('#cartSaveList-input .clear-text').removeClass('typing-change') $(this).removeClass('input-with-value') $('.cartSaveList-saveButton', document).prop('disabled', true) } }) $(document).on('click', '.cartSaveList-input .clear-text', function() { $('.cartSaveList-editing').remove() $('.cartSaveList-button._saveCartListInitial').click() }) // save cart as list input $('body').on('click', '.cartSaveList-saveButton', function(e) { e.preventDefault() $('.loading-button').show() $('button.cartSaveList-saveButton').hide() if (shopping_pages || campaign_page) { tracking_click_save_after_user_enter_list_name_cart() } if (isUserLoggedIn) { const Name = $('#shared-text-input-8').val() $.ajax({ url: `${url}/ui/Trolley/SaveAsList`, type: 'POST', contentType: 'application/json;', data: JSON.stringify({ Name }) }).then((res) => { if (!res.Success) { $('shared-validation-messages').hide() let msg = res.Message $('shared-validation-messages .validationMessages-text').text(`${msg}`) $('shared-validation-messages').show() $('.loading-button').hide() $('button.cartSaveList-saveButton').show() $('.cartSaveList-saveButton', document).prop('disabled', false) } if (res.Success) { $('.loading-button').hide() savedButton() updateListItems() } }) } else { window.location.href = 'https://www.woolworths.com.au/shop/securelogin' } }) // close button --- after succesful list add $('body').on('click', '.cartSaveList-closeSavedButton', function() { $('shared-cart-save-list').html( `` ) }) // cancel cart button $('body').on('click', '.cartSaveList-cancelButton', function(e) { e.preventDefault() $('.cartSaveList-button').show() $('.cartSaveList-editing').remove() $('.product-actionsClearCart').show() }) // remove all prods button $('body').on('click', '.linkButton.product-actionsClearCart', function() { const html = `

      Are you sure you would like to remove all products from the cart?

      ` $('.remove-all-items-container').append(html) $('.remove-all-items-container').show() $('.cart-contents').hide() // tracking if (shopping_pages || campaign_page) { tracking_click_remove_all_button() } }) // remove all prods cancel $('body').on('click', '.clear-cart-container .linkButton', function() { $('.remove-all-items-container').html('') $('.remove-all-items-container').hide() $('.cart-contents').show() }) // remove all prods yes $('body').on('click', '.clear-cart-container .primary.m', function() { clearProductsFromCartCall() if (shopping_pages || campaign_page) { tracking_click_remove_all_confirmation_button() } setTimeout(function() { $('.remove-all-items-container').hide() $('.cart-contents').show() }, 500); }) // order summary toggle $('.cart-checkout-summary__heading').click(function() { $('.cart-checkout-summary__content').toggleClass('is-open') $(this).find('i').toggleClass('iconAct-Chevron_Up iconAct-Chevron_Down') }) // click on checkout button if (shopping_pages || campaign_page) { $('.checkout-top').click(function() { tracking_click_checkout_top_button() }) $('.checkout-bottom').click(function() { tracking_click_checkout_bottom_button() }) }

      Korean Beef Bulgogi - 9  recipes  | Woolworths (2024)
      Top Articles
      Latest Posts
      Article information

      Author: Mr. See Jast

      Last Updated:

      Views: 6786

      Rating: 4.4 / 5 (75 voted)

      Reviews: 82% of readers found this page helpful

      Author information

      Name: Mr. See Jast

      Birthday: 1999-07-30

      Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

      Phone: +5023589614038

      Job: Chief Executive

      Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

      Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.