修复日期选择 JS 错误

hotfix/paypal-note
Jimmy Liow 2 years ago
parent 67daf81ae9
commit 80c1668097

@ -171,11 +171,13 @@
<div class="trip_date_length" id="tripDateBlock" style="display: none"> <div class="trip_date_length" id="tripDateBlock" style="display: none">
<p style="text-align: left; font-weight: 400; font-size: 19px;">Select your travel date and trip length (days).</p> <p style="text-align: left; font-weight: 400; font-size: 19px;">Select your travel date and trip length (days).</p>
<div id='dateSelectionBlock'> <div id='dateSelectionBlock'>
<div id='flatpickrBlock'>
<input type="text" class="arrivalDate datepicker" id="starting_date" name="date_start" value="" placeholder="mm/dd/yyyy" autocomplete="off" style="width: auto; <input type="text" class="arrivalDate datepicker" id="starting_date" name="date_start" value="" placeholder="mm/dd/yyyy" autocomplete="off" style="width: auto;
float: left; float: left;
margin-right: 15px; margin-right: 15px;
border-radius: 6px; border-radius: 6px;
padding: 0 15px;"> padding: 0 15px;">
</div>
<input type="month" id="expectedMonth" name="expected_month" placeholder="Select your expected travel date." style="width: auto; <input type="month" id="expectedMonth" name="expected_month" placeholder="Select your expected travel date." style="width: auto;
float: left; float: left;
margin-right: 15px; margin-right: 15px;
@ -640,10 +642,9 @@
}); });
var $tripDateBlock = $('#tripDateBlock'); var $tripDateBlock = $('#tripDateBlock');
var $expectedDate = $('#starting_date');
var $expectedMonth = $('#expectedMonth'); var $expectedMonth = $('#expectedMonth');
var $dateSelectionBlock = $('#dateSelectionBlock'); var $dateSelectionBlock = $('#dateSelectionBlock');
var $expectedTravelDateBlock = $('#expectedTravelDateBlock'); var $flatpickrBlock = $('#flatpickrBlock');
$('input[name="trip_date"]').each((i, tripDateEle) => { $('input[name="trip_date"]').each((i, tripDateEle) => {
$(tripDateEle).click(function (e) { $(tripDateEle).click(function (e) {
$expectedDate.val(''); $expectedDate.val('');
@ -653,17 +654,15 @@
selectedExpectedDate = selectedTripDate.id; selectedExpectedDate = selectedTripDate.id;
if (selectedTripDate.id === 'exact') { if (selectedTripDate.id === 'exact') {
$dateSelectionBlock.show(); $dateSelectionBlock.show();
$expectedTravelDateBlock.hide();
$expectedMonth.hide(); $expectedMonth.hide();
$expectedDate.show(); $flatpickrBlock.show();
} else if (selectedTripDate.id === 'approximate') { } else if (selectedTripDate.id === 'approximate') {
$dateSelectionBlock.show(); $dateSelectionBlock.show();
$expectedTravelDateBlock.hide(); $flatpickrBlock.hide();
$expectedDate.hide();
$expectedMonth.show(); $expectedMonth.show();
} else if (selectedTripDate.id === 'yet') { } else if (selectedTripDate.id === 'yet') {
$dateSelectionBlock.hide(); $dateSelectionBlock.hide();
$expectedTravelDateBlock.show(); $flatpickrBlock.hide();
} }
}) })
}); });
@ -754,37 +753,6 @@
} }
} }
}); });
document.querySelector('.expandAll').onclick = function (e) {
let obj = document.querySelector('.expandAll');
let all_status = obj.getAttribute("collapse-status");
if (all_status == "hide") {
obj.setAttribute("collapse-status", "show");
obj.querySelector(".expandAllText").innerHTML = "Collapse All";
obj.parentNode.querySelectorAll("div[collapse] span[id$='Icon']").forEach(function(icon, i){
icon.classList.remove('OpenIcon');
icon.classList.add('CloseIcon');
});
obj.parentNode.querySelectorAll("div[collapse-content]").forEach(function(itinerary, i){
slideDown(itinerary);
});
obj.parentNode.querySelectorAll("div[collapse]").forEach(function(title, i){
title.setAttribute("collapse-status", "show");
});
} else {
obj.setAttribute("collapse-status", "hide");
obj.querySelector(".expandAllText").innerHTML = "Expand All";
obj.parentNode.querySelectorAll("div[collapse] span[id$='Icon']").forEach(function(icon, i){
icon.classList.remove('CloseIcon');
icon.classList.add('OpenIcon');
});
obj.parentNode.querySelectorAll("div[collapse-content]").forEach(function(itinerary, i){
slideUp(itinerary);
});
obj.parentNode.querySelectorAll("div[collapse]").forEach(function(title, i){
title.setAttribute("collapse-status", "hide");
});
}
}
function slideUp(target, duration) { function slideUp(target, duration) {
duration = duration ? duration : 500; duration = duration ? duration : 500;
target.style.transitionProperty = 'height, margin, padding'; target.style.transitionProperty = 'height, margin, padding';

Loading…
Cancel
Save