1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| function unavailable(date) {
ymd = date.getFullYear() + "-" + ("0"+(date.getMonth()+1)).slice(-2) + "-" + ("0"+date.getDate()).slice(-2);
day = new Date(ymd).getDay();
if ($.inArray(ymd, unavailableDates) < 0 ) {
return [true, "enabled", ""];
} else {
return [false,"disabled","we are closed"];
}
}
$("#txtFromDate").datepicker({
minDate: "+<?php echo $bsiCore->config['conf_booking_start'];?>D",
maxDate: "+365D",
beforeShowDay: unavailable,
numberOfMonths: 2,
onSelect: function(selected) {
var date = $(this).datepicker('getDate');
if(date){
date.setDate(date.getDate());
}
$("#txtToDate").datepicker("option","minDate", date)
}
});
$("#txtToDate").datepicker({
minDate: 0,
beforeShowDay: unavailable,
maxDate:"+365D",
numberOfMonths: 2,
onSelect: function(selected) {
$("#txtFromDate").datepicker("option","maxDate", selected)
}
});
$("#datepickerImage").click(function() {
$("#txtFromDate").datepicker("show");
});
$("#datepickerImage1").click(function() {
$("#txtToDate").datepicker("show");
});
$('#btn_room_search').click(function() {
if($('#pickuploc').val()==0){
alert('<?php echo mysql_real_escape_string(PICKUP_LOCATION_ALERT);?>');
return false;
}else if($('#dropoffloc').val()==0){
alert('<?php echo mysql_real_escape_string(DROPOFF_LOCATION_ALERT);?>');
return false;
}else if($('#txtFromDate').val()==""){
alert('<?php echo mysql_real_escape_string(PLEASE_ENTER_CHECK_IN_DATE_ALERT);?>');
return false;
}else if($('#txtToDate').val()==""){
alert('<?php echo mysql_real_escape_string(PLEASE_ENTER_CHECK_OUT_DATE_ALERT);?>');
return false;
} else {
return true;
}
});
}); |
Partager