sterntours/web/js/_fewoBooking-script-min.js
2023-01-25 12:43:22 +01:00

103 lines
2.8 KiB
JavaScript

$(document).ready(function () {
var i = $(".st-booking-form"),
a = $(".st-booking-summary"),
t = $("#fewo_booking_request_toDate_day"),
e = $("#fewo_booking_request_toDate_month"),
s = $("#fewo_booking_request_toDate_year");
function h() {
var t = location.href.split("?"),
e = t[0].split("/");
e.pop();
var s = e.join("/") + "/berechne-gesamtpreis";
t[1] && (s += "?" + t[1]),
$.ajax({ url: s, type: "post", data: i.serialize() }).then(
function (t) {
a.html(t);
},
function () {
a.html(
"Aufgrund eines Fehlers konnte kein Angebot ermittelt werden."
);
}
);
}
i.find("input, select").change(function () {
h();
});
var n = $("#fewo_booking_request_fromDate").val(),
r = $("#fewo_booking_request_toDate").val(),
o = $("#hidden_toDate").val(),
l = JSON.parse($("#hidden_reservationDays").val()),
d = JSON.parse($("#hidden_customDays").val()),
c = function (t) {
var e = t.format("DD.MM.YYYY");
return (
-1 < l.indexOf(e) ||
(void 0 !== d[e] &&
-1 == d[e].indexOf("bookable") &&
-1 == d[e].indexOf("bookable-end"))
);
},
u = function (t) {
if (!1 !== t) {
var e = t.format("DD.MM.YYYY");
if (void 0 !== d[e]) return d[e];
}
};
$(
"#fewo_booking_request_fromDate, #fewo_booking_request_toDate"
).daterangepicker(
{
isInvalidDate: c,
isCustomDate: u,
minDate: moment(),
maxDate: o,
timePickerSeconds: !0,
locale: {
format: "DD.MM.YYYY",
separator: " - ",
applyLabel: "OK",
cancelLabel: "X",
fromLabel: "Von",
toLabel: "Bis",
customRangeLabel: "Custom",
weekLabel: "W",
daysOfWeek: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
monthNames: [
"Januar",
"Februar",
"März",
"April",
"Mai",
"Juni",
"Juli",
"August",
"September",
"Oktober",
"November",
"Dezember",
],
firstDay: 1,
},
autoApply: !0,
autoUpdateInput: !1,
startDate: n,
endDate: r,
},
function (t, e, s) {
var i = t.format("DD.MM.YYYY"),
a = e.format("DD.MM.YYYY"),
n = $("#fewo_booking_request_fromDate"),
r = $("#fewo_booking_request_toDate");
n.val(i), r.val(a);
var o = r.data("daterangepicker");
o.setStartDate(i), o.setEndDate(a);
var l = n.data("daterangepicker");
l.setStartDate(i), l.setEndDate(a), h();
}
),
$("#fewo_booking_request_fromDate, #fewo_booking_request_toDate").on(
"show.daterangepicker",
function (t, e) {}
);
});