We could not find any yachts to fit your criteria. Please try broadening your search options.
<!--
-->
$(document).ready(function () {
if (window.history.replaceState) window.history.replaceState(null, null, window.location.href);
$("#dt1").datepicker({
dateFormat: "yy-mm-dd",
minDate: 0,
onSelect: function () {
var dt2 = $('#dt2');
var startDate = $(this).datepicker('getDate');
var minDate = $(this).datepicker('getDate');
var dt2Date = dt2.datepicker('getDate');
//difference in days. 86400 seconds in day, 1000 ms in second
var dateDiff = (dt2Date - minDate) / (86400 * 1000);
startDate.setDate(startDate.getDate() + 30);
if (dt2Date == null || dateDiff 30) {
dt2.datepicker('setDate', startDate);
}
//sets dt2 maxDate to the last day of 30 days window
dt2.datepicker('option', 'maxDate', startDate);
dt2.datepicker('option', 'minDate', minDate);
}
});
$('#dt2').datepicker({
dateFormat: "yy-mm-dd",
minDate: 0
});
});
$(document).ready(function () {
var selectedDestination = "";
$("#destination_id").change(function () {
selectedDestination = $(this).children("option:selected").val();
$("#yacht_id").empty();
var x = document.getElementById("yacht_id");
var option = document.createElement("option");
option.text = "Loading...";
x.add(option);
// var isDisabled = $('#yacht_id').prop('disabled');
// if(isDisabled){
// var ser = document.getElementById("yacht_id");
// ser.attributes.removeNamedItem("disabled");
// }
//ajax
var action = "form_data1";
$.ajax({
type: 'post',
url: "https://myprivateyachtcharter.com/wp-admin/admin-ajax.php",
data: {
action: action,
DestinationID: selectedDestination,
},
success: function (response) {
var res = JSON.parse(response);
var ObjToArr = Object.entries(res);
$("#yacht_id").empty();
var x = document.getElementById("yacht_id");
var option = document.createElement("option");
option.text = "Select Yacht Type";
x.add(option);
var isDisabled = $('#yacht_id').prop('disabled');
if (isDisabled) {
var ser = document.getElementById("yacht_id");
ser.attributes.removeNamedItem("disabled");
}
ObjToArr.forEach(function (yacht, index) {
var option = document.createElement("option");
option.setAttribute("value", yacht[1].substring(0, 1));
if (yacht[1] == 'Cat') {
option.text = 'Catamaran';
} else {
option.text = yacht[1];
}
x.options[0].disabled = true;
x.options[0].setAttribute("value", "");
x.add(option);
});
}
});
//ajax
});
});
$(document).ready(function () {
var selectedYacht = "";
$("#yacht_id").change(function () {
selectedYacht = $(this).children("option:selected").val();
$("#guest_id").empty();
var y = document.getElementById("guest_id");
var e = document.getElementById("destination_id");
var destid = e.value;
var option = document.createElement("option");
option.text = "Loading...";
y.add(option);
//ajax
var action = "form_data2";
$.ajax({
type: 'post',
url: "https://myprivateyachtcharter.com/wp-admin/admin-ajax.php",
data: {
action: action,
ID: {yachtid: selectedYacht, destid: destid}
},
success: function (response) {
var res = JSON.parse(response);
var ObjToArr = Object.entries(res);
$("#guest_id").empty();
var y = document.getElementById("guest_id");
var option = document.createElement("option");
option.text = "Select Guests";
y.add(option);
var isDisabled = $('#guest_id').prop('disabled');
if (isDisabled) {
var ser = document.getElementById("guest_id");
ser.attributes.removeNamedItem("disabled");
}
ObjToArr.forEach(function (yacht, index) {
var option = document.createElement("option");
option.text = yacht[1];
y.options[0].disabled = true;
y.options[0].setAttribute("value", "");
y.add(option);
});
}
});
//ajax
});
});
$(document).ready(function () {
// var limit_num = 6;
// var offset_count = 1;
// var offset_num = 0;
$("#myform").submit(function (event) {
event.preventDefault();
//getids
var budgetid = document.getElementById("budget_id").value;
var budgetrange = budgetid.split(" - ");
var yachtid = document.getElementById("yacht_id").value;
var guestid = document.getElementById("guest_id").value;
var locationid = document.getElementById("destination_id").value;
var pricefrom = budgetrange[0];
var priceto = budgetrange[1] == undefined ? '' : budgetrange[1];
var startdate = document.getElementById("dt1").value;
var enddate = document.getElementById("dt2").value;
console.log(yachtid, guestid, locationid, pricefrom, priceto, startdate, enddate);
// limit_num = 6;
// offset_num = limit_num * offset_count;
// offset_count++;
//ajax
var action = "form_data3";
$.ajax({
type: 'post',
url: "https://myprivateyachtcharter.com/wp-admin/admin-ajax.php",
data: {
action: action,
IDS: {
yid: yachtid,
lid: locationid,
gid: guestid,
prcfrom: pricefrom,
prcto: priceto,
strtdt: startdate,
enddt: enddate
},
},
success: function (response) {
var res = JSON.parse(response);
//console.log(res);
var pricesort = document.getElementById("pricesort").value;
$("#mainwrapper").empty();
//$("#parent").removeClass(//);
if (res.yacht.yachtId == 'No Results') {
$("#mainwrapper").append('
We could not find any yachts to fit your criteria. Please try broadening your search options.
');
} else {
if (pricesort == 'low') {
var arr = res.yacht.sort((a, b) = > parseFloat(a.yachtHighNumericPrice) - parseFloat(b.yachtHighNumericPrice)
)
;
console.log(arr, 'low');
arr.forEach(function (yacht) {
var yname = yacht.yachtName;
$("#mainwrapper").append('
' + yacht.yachtName + '
FROM '.$obj - > yachtLowPrice.
' / WK in WINTER, '.$obj - > yachtHighPrice.
' / WK in SUMMER
- Length:
' + yacht.sizeFeet + ' / ' + yacht.sizeMeter + '
- Guests:
' + yacht.yachtPax + '
- Staterooms:
' + yacht.yachtCabins + '
'
)
;
});
} else {
var arr2 = res.yacht.sort((a, b) = > parseFloat(b.yachtHighNumericPrice) - parseFloat(a.yachtHighNumericPrice)
)
;
console.log(arr2, 'high');
arr2.forEach(function (yacht) {
$("#mainwrapper").append('
' + yacht.yachtName + '
FROM '.$obj - > yachtLowPrice.
' / WK in WINTER, '.$obj - > yachtHighPrice.
' / WK in SUMMER
- Length:
' + yacht.sizeFeet + ' / ' + yacht.sizeMeter + '
- Guests:
' + yacht.yachtPax + '
- Staterooms:
' + yacht.yachtCabins + '
'
)
;
});
}
$('#loadMore').click();
setTimeout(function () {
$('#loadMore').click();
}, 1000);
}
}
});
//ajax
});
});