|
|
|
@@ -11,12 +11,18 @@ const inputDPD = $("#shippingMethod8c6d913e29c14c3cb3c6429724efaab8"); |
|
|
|
const inputVorkasse = $("#paymentMethod31bc923a38bc435a80d49d4d40368081"); |
|
|
|
|
|
|
|
$(document).ready(function() { |
|
|
|
// Add Class for Promotion Modal Box |
|
|
|
if ($(".swag-custom-notification-info-modal__content").length) { |
|
|
|
$(".swag-custom-notification-info-modal__content").parents(".modal").addClass("spwn-swag-custom-notification-info"); |
|
|
|
} |
|
|
|
|
|
|
|
let dpInput = $(".confirm-delivery-date #dtgs-datepicker-inputfield"); |
|
|
|
if (dpInput.length) { |
|
|
|
fp = document.querySelector("#dtgs-datepicker-inputfield")._flatpickr; |
|
|
|
dpInput.prop('disabled', true); |
|
|
|
dpInput.wrap('<div class="spwn-date-wrapper"></div>'); |
|
|
|
$("<span id='spwn-remove-date' title='Zurücksetzen'></span>").insertAfter(dpInput); |
|
|
|
$("<input type='text' value='' id='spwn-dp-input' />").insertAfter(dpInput); |
|
|
|
let doNotShow = $(".do-not-show").length ? " class='do-not-show'" : ""; |
|
|
|
$("<div id='spwn-delivery'" + doNotShow + "><p></p><div class='spwn-delivery--time'></div></div>").insertAfter(".confirm-delivery-date"); |
|
|
|
fp.config.onChange.push(function() { |
|
|
|
@@ -38,11 +44,24 @@ $(document).ready(function() { |
|
|
|
}); |
|
|
|
|
|
|
|
/* Set first selectable day selected */ |
|
|
|
|
|
|
|
spawnDateInputValue = $(".confirm-delivery-date #dtgs-datepicker-inputfield").val(); |
|
|
|
// remove hours |
|
|
|
console.log("A"); |
|
|
|
console.log($(".confirm-delivery-date #dtgs-datepicker-inputfield").val()); |
|
|
|
console.log(spawnDateInputValue); |
|
|
|
if ($(".confirm-delivery-date #dtgs-datepicker-inputfield").val().indexOf(":") !== -1) { |
|
|
|
let inputTemp = $(".confirm-delivery-date #dtgs-datepicker-inputfield").val(); |
|
|
|
spawnDateInputValue = inputTemp.substring(0, inputTemp.length - 6); |
|
|
|
console.log("A2"); |
|
|
|
console.log(spawnDateInputValue); |
|
|
|
} else { |
|
|
|
spawnDateInputValue = $(".confirm-delivery-date #dtgs-datepicker-inputfield").val(); |
|
|
|
console.log("3"); |
|
|
|
console.log(spawnDateInputValue); |
|
|
|
} |
|
|
|
if (spawnDateInputValue === '') { |
|
|
|
setDateSelected(); |
|
|
|
} |
|
|
|
$("#spwn-dp-input").val(spawnDateInputValue); |
|
|
|
|
|
|
|
changeDelivery(fp); |
|
|
|
} |
|
|
|
@@ -58,6 +77,7 @@ $(document).ready(function() { |
|
|
|
} |
|
|
|
|
|
|
|
$("body").on("click", "#spwn-remove-date", function() { |
|
|
|
$(".confirm-delivery-date #spwn-dp-input").val(""); |
|
|
|
$(".confirm-delivery-date #dtgs-datepicker-inputfield").val(""); |
|
|
|
spawnDateInputValue = ""; |
|
|
|
}); |
|
|
|
@@ -88,7 +108,20 @@ function easeOutCuaic(t){ |
|
|
|
} |
|
|
|
|
|
|
|
function manipulateDateInputValue() { |
|
|
|
spawnDateInputValue = $(".confirm-delivery-date #dtgs-datepicker-inputfield").val(); |
|
|
|
// remove hours |
|
|
|
console.log("B"); |
|
|
|
console.log($(".confirm-delivery-date #dtgs-datepicker-inputfield").val()); |
|
|
|
console.log(spawnDateInputValue); |
|
|
|
if ($(".confirm-delivery-date #dtgs-datepicker-inputfield").val().indexOf(":") !== -1) { |
|
|
|
let inputTemp = $(".confirm-delivery-date #dtgs-datepicker-inputfield").val(); |
|
|
|
spawnDateInputValue = inputTemp.substring(0, inputTemp.length - 6); |
|
|
|
console.log("B2"); |
|
|
|
console.log(spawnDateInputValue); |
|
|
|
} else { |
|
|
|
spawnDateInputValue = $(".confirm-delivery-date #dtgs-datepicker-inputfield").val(); |
|
|
|
console.log("B3"); |
|
|
|
console.log(spawnDateInputValue); |
|
|
|
} |
|
|
|
if (inputSameDayDelivery.is(':checked')) { |
|
|
|
// If same day delivery is checked, select time |
|
|
|
$("#spwn-delivery .spwn-delivery--time span.active").trigger("click"); |
|
|
|
@@ -116,7 +149,8 @@ function changeDelivery(fp) { |
|
|
|
$("body").on("click", "#spwn-delivery .spwn-delivery--time span", function() { |
|
|
|
$("#spwn-delivery .spwn-delivery--time span").removeClass("active"); |
|
|
|
$(this).addClass("active"); |
|
|
|
$(".confirm-delivery-date #dtgs-datepicker-inputfield").val(spawnDateInputValue + " " + $(this).text()); |
|
|
|
$(".confirm-delivery-date #spwn-dp-input").val(spawnDateInputValue + " " + $(this).text()); |
|
|
|
$(".confirm-delivery-date #dtgs-datepicker-inputfield").val(spawnDateInputValue + " " + $(this).attr('data-time')); |
|
|
|
}); |
|
|
|
|
|
|
|
let daysToAdd = 0; |
|
|
|
@@ -128,12 +162,14 @@ function changeDelivery(fp) { |
|
|
|
if (inputShopPickup.is(':checked')) { |
|
|
|
// Abholung im Ladengeschäft |
|
|
|
console.log("Abholung"); |
|
|
|
$(".confirm-delivery-date #dtgs-datepicker-inputfield").val('Abholung im Ladengeschäft'); |
|
|
|
$(".confirm-delivery-date #spwn-dp-input").val('Abholung im Ladengeschäft'); |
|
|
|
$(".confirm-delivery-date #dtgs-datepicker-inputfield").val('9.9.1999 19:19'); |
|
|
|
$(".confirm-delivery-date").hide(); |
|
|
|
$("#spwn-delivery p").text("Die bestellten Produkte stehen zur Abholung in unserem Ladengeschäft in Hamburg für Sie bereit."); |
|
|
|
} else if (inputSameDayDelivery.is(':checked')) { |
|
|
|
// Abendzustellung |
|
|
|
console.log("Abendzustellung"); |
|
|
|
$(".confirm-delivery-date #spwn-dp-input").val(''); |
|
|
|
$(".confirm-delivery-date #dtgs-datepicker-inputfield").val(''); |
|
|
|
spwnIncludedDays = [1, 2, 3, 4, 5]; |
|
|
|
if (daysToAdd === 0) { |
|
|
|
@@ -141,13 +177,14 @@ function changeDelivery(fp) { |
|
|
|
} |
|
|
|
setIncludedDays("evening", fp, daysToAdd); |
|
|
|
$("#spwn-delivery p").text("Abendzustellung gewählt. Bitte wählen Sie nun eine Wunsch-Zeit:"); |
|
|
|
$("#spwn-delivery .spwn-delivery--time").append("<span class='active'>18 - 20 Uhr</span><span>19 - 21 Uhr</span><span>20 - 22 Uhr</span>"); |
|
|
|
$("#spwn-delivery .spwn-delivery--time").append("<span class='active' data-time='18:00'>18 - 20 Uhr</span><span data-time='19:00'>19 - 21 Uhr</span><span data-time='20:00'>20 - 22 Uhr</span>"); |
|
|
|
// If not date from DPD days |
|
|
|
if (!$(".flatpickr-day").hasClass("selected")) { |
|
|
|
setDateSelected(); |
|
|
|
} |
|
|
|
if ($(".flatpickr-day").hasClass("selected")) { |
|
|
|
if (spawnDateInputValue === "" || spawnDateInputValue.indexOf("Uhr") === -1) { |
|
|
|
// || spawnDateInputValue.indexOf(":00") === -1 |
|
|
|
if (spawnDateInputValue === "") { |
|
|
|
manipulateDateInputValue(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
|