I am looking for help in coding. I ve a booking system similar to airbnb. My issue is related to booking date. To be more specific i ll give you one example
One appartment is already booked for those following dates 2 dec 2012 till 5 dec 2012:
if a new customer select the following dates from 4 dec 2012 till the 6 dec 2012, it displayed message saying "those dates are already booked".
But if the customer select dates like those one 1 dec til the 6 dec or 29 nov and 10 dec. The system let the customer proceed like if the dates are availables.
To sum up: i d like to make sure that customer will have the message " those dates are already booked" if the period he selected includes dates that have already been booked.
I am not an expert in coding, not at all. But i am quite sure that the problem comes from the javascript that display available Flats.
I will put the entire Js.
The message " those dates are already booked" corresponds to #book_it_disabled_message.
Thank you in advance for you time and skills.
function check_inputs(b, c, a) {
b = typeof (b) != "undefined" ? b : true;
c = typeof (c) != "undefined" ? c : "checkin";
a = typeof (a) != "undefined" ? a : "checkout";
if (calendar_is_not_set_date(c)) {
if (b) {
calendar_show_cal(c)
}
return false
}
if (calendar_is_not_set_date(a)) {
if (b) {
calendar_show_cal(a)
}
return false
}
return true
}
function copy_checkin_checkout_fields() {
var a = check_inputs(false);
if (a) {
jQuery("#message_checkin").val(jQuery("#checkin").val());
jQuery("#message_checkout").val(jQuery("#checkout").val());
jQuery("#message_number_of_guests").val(jQuery("#number_of_guests").val());
check_availability_of_dates()
}
}
function copy_message_fields_to_book_it() {
jQuery("#checkin").val(jQuery("#message_checkin").val());
jQuery("#checkout").val(jQuery("#message_checkout").val());
jQuery("#number_of_guests").val(jQuery("#message_number_of_guests").val())
}
function refresh_subtotal() {
var a = function (c, e, d) {
var b;
if (c.available) {
jQuery("#book_it_disabled").hide();
jQuery("#book_it_enabled").show();
b = jQuery("#price_amount").html(c.price_per_night).data("nightly-price", c.price_per_night);
jQuery("#service_fee").html(c.service_fee);
CogzidelRooms.staggered = c.staggered;
if (CogzidelRooms.staggered === true) {
if (CogzidelRooms.stayOffered !== 0) {
jQuery("#payment_period").hide();
jQuery("#per_month").show();
CogzidelRooms.$cancellationVal.text(Translations.long_term);
jQuery("#includesFees").show();
jQuery("#book_it_default").addClass("monthly")
}
jQuery("#subtotal_area").hide();
jQuery("#show_more_subtotal_info").hide();
jQuery("#price_amount").text(Cogzidel.Utils.decode(c.staggered_price));
b.data("monthly-price", c.staggered_price);
CogzidelRooms.hideMonthlyPriceDetails()
} else {
if (CogzidelRooms.stayOffered === 2) {
jQuery("#per_month").hide();
CogzidelRooms.$cancellationVal.text(CogzidelRooms.originalCancellationPolicy);
jQuery("#includesFees").hide();
jQuery("#book_it_default").removeClass("monthly");
jQuery("#payment_period").show()
}
jQuery("#subtotal_area ").show();
jQuery("#subtotal_area").find("p").show();
jQuery("#show_more_subtotal_info").show();
jQuery("#subtotal").html(c.total_price);
jQuery("#payment_period").val("per_night");
b.removeAttr("data-monthly-price");
CogzidelRooms.showMonthlyPriceDetails()
}
if (c.can_instant_book) {
Page3.showInstantBookButton()
} else {
Page3.showBookItButton()
}
} else {
if (CogzidelRooms.stayOffered === 1) {
jQuery("#payment_period").hide();
jQuery("#per_month").show();
CogzidelRooms.$cancellationVal.text(Translations.long_term);
jQuery("#includesFees").show();
CogzidelRooms.hideMonthlyPriceDetails()
} else {
jQuery("#book_it_default").removeClass("monthly");
jQuery("#payment_period").show();
jQuery("#per_month").hide();
CogzidelRooms.$cancellationVal.text(CogzidelRooms.originalCancellationPolicy);
jQuery("#includesFees").hide();
jQuery("#price_amount").html(jQuery("#price_amount").data("nightly-price"));
CogzidelRooms.showMonthlyPriceDetails()
}
jQuery("#book_it_disabled_message").html(c.reason_message);
jQuery("#book_it_enabled").hide();
jQuery("#book_it_disabled").show();
jQuery("#show_more_subtotal_info").hide()
}
jQuery("#book_it_status").pulsate(1, 600)
};
jQuery("#book_it_button").removeAttr("disabled");
jQuery("#subtotal_area").find("p").hide();
jQuery("#subtotal_area").show();
if (calendar_is_not_set_date("checkin") || calendar_is_not_set_date("checkout")) {
a = function () {};
jQuery("#book_it_disabled").hide();
jQuery("#book_it_enabled").show();
jQuery("#subtotal_area").hide();
jQuery("#show_more_subtotal_info").hide()
} else {
jQuery("#subtotal, #book_it_disabled_message").html('<img src="'+base_url+'images/spinner.gif" alt="" height="16" width="16" />')
}
jQuery.getJSON(base_url+"rooms/ajax_refresh_subtotal", jQuery("#book_it_form").serialize(), a)
}