Untitled
unknown
plain_text
a year ago
6.1 kB
2
Indexable
Never
$("#AdultPlusProduct").click(function () { var totalSelected = selectedAdultsCount + selectedChildrenCount; if (totalSelected == maxOccupancy) return; var maxAdultsAllowed = (maxAdults > 0 ? maxAdults : maxOccupancy); if (selectedChildrenCount > 1) { if (selectedChildrenCount <= zBedsCount && selectedAdultsCount < maxAdultsAllowed) { var paxCountBox = $("#AdultCountProduct"); var pax = parseInt($(paxCountBox).val()) + 1; $("#AdultCountProduct").val(pax); selectedAdultsCount++; } else if (((selectedAdultsCount + selectedChildrenCount - zBedsCount) < maxOccupancy) && (selectedAdultsCount < maxAdultsAllowed)) { var paxCountBox = $("#AdultCountProduct"); var pax = parseInt($(paxCountBox).val()) + 1; $("#AdultCountProduct").val(pax); selectedAdultsCount++; } } else if (selectedAdultsCount < maxAdultsAllowed) { var paxCountBox = $("#AdultCountProduct"); var pax = parseInt($(paxCountBox).val()) + 1; $("#AdultCountProduct").val(pax); selectedAdultsCount++; } var paxCountBox = $("#InfantCountProduct"); var currentPaxValue = parseInt($(paxCountBox).val()); if (MaxInfantsDefined == false) { maxInfantOccupancy = selectedAdultsCount; } if (currentPaxValue < maxInfantOccupancy) { $("#InfantPlusProduct").removeClass("disabled"); } SetPassengerPlusMinusProduct(); ShowHideInfantErrorMessage(); SetPassengerSelection(); }); $("#AdultMinusProduct").click(function () { var paxCountBox = $("#AdultCountProduct"); var currentPaxValue = parseInt($(paxCountBox).val()); var pax = currentPaxValue <= 0 ? 0 : currentPaxValue - 1; if (selectedChildrenCount > 1) { if (selectedChildrenCount <= zBedsCount && (selectedAdultsCount > minOccupancy && selectedAdultsCount > 1)) { $("#AdultCountProduct").val(pax); selectedAdultsCount--; } else if ((selectedAdultsCount + selectedChildrenCount - zBedsCount) > minOccupancy && selectedAdultsCount > 1) { $("#AdultCountProduct").val(pax); selectedAdultsCount--; } } else if ((selectedAdultsCount + selectedChildrenCount) > minOccupancy && selectedAdultsCount > 1) { $("#AdultCountProduct").val(pax); selectedAdultsCount--; } var paxCountBox = $("#InfantCountProduct"); var currentPaxValue = parseInt($(paxCountBox).val()); if (MaxInfantsDefined == false) { maxInfantOccupancy = selectedAdultsCount; } if (currentPaxValue >= maxInfantOccupancy) { $("#InfantPlusProduct").addClass("disabled"); } SetPassengerPlusMinusProduct(); SetPassengerSelection(); }); $("#ChildPlusProduct").click(function () { if ((selectedChildrenCount + selectedAdultsCount) < (maxOccupancy + zBedsCount)) { var paxCountBox = parseInt($("#ChildCountProduct").val()); var pax = paxCountBox + 1; if (pax >= 1 && $(".pax-note-container").hasClass("d-none")) { $(".pax-note-container").removeClass("d-none"); $(".pax-note-asterisk").removeClass("d-none"); } $("#ChildCountProduct").val(pax); selectedChildrenCount++; } hideErrors(); SetPassengerPlusMinusProduct(); SetPassengerSelection(); }); $("#ChildMinusProduct").click(function () { var paxCountBox = parseInt($("#ChildCountProduct").val()); var pax = paxCountBox - 1; if (pax == 0 && !$(".pax-note-container").hasClass("d-none") && parseInt($("#InfantCountProduct").val()) < 1) { $(".pax-note-container").addClass("d-none"); $(".pax-note-asterisk").addClass("d-none"); } if (paxCountBox > 0 && (selectedChildrenCount + selectedAdultsCount) > minOccupancy) { $("#ChildCountProduct").val(pax); selectedChildrenCount--; } else { $("#child-age-container").css("display", "none"); $(this).addClass("disabled"); } hideErrors(); SetPassengerPlusMinusProduct(); SetPassengerSelection(); }); $("#InfantMinusProduct").click(function () { var paxCountBox = $("#InfantCountProduct"); var currentPaxValue = parseInt($(paxCountBox).val()); var pax = currentPaxValue <= 0 ? 0 : currentPaxValue - 1; if (pax == 0 && !$(".pax-note-container").hasClass("d-none") && parseInt($("#ChildCountProduct").val()) < 1) { $(".pax-note-container").addClass("d-none"); $(".pax-note-asterisk").addClass("d-none"); } if (MaxInfantsDefined == false) { maxInfantOccupancy = selectedAdultsCount; } if (pax >= 0) { $("#InfantCountProduct").val(pax); } if (pax <= 0) { $("#InfantMinusProduct").addClass("disabled"); $("#InfantPlusProduct").removeClass("disabled"); } else { $("#InfantMinusProduct").removeClass("disabled"); } if (pax < maxInfantOccupancy) { $("#InfantPlusProduct").removeClass("disabled"); } ShowHideInfantErrorMessage(); SetPassengerSelection(); }); $("#InfantPlusProduct").click(function () { var paxCountBox = $("#InfantCountProduct"); var pax = parseInt($(paxCountBox).val()) + 1; if (pax >= 1 && $(".pax-note-container").hasClass("d-none")) { $(".pax-note-container").removeClass("d-none"); $(".pax-note-asterisk").removeClass("d-none"); } if (MaxInfantsDefined == false) { maxInfantOccupancy = selectedAdultsCount; } if (pax <= maxInfantOccupancy) { $("#InfantCountProduct").val(pax); } if (pax >= maxInfantOccupancy) { $("#InfantPlusProduct").addClass("disabled"); } else { $("#InfantPlusProduct").removeClass("disabled"); } $("#InfantMinusProduct").removeClass("disabled"); SetPassengerSelection(); });