I have a booking system from a residential and I can disable days specific but not days from my table with the days registered.
I have 2 tables habitaciones
and reservas
table habitaciones (room)
id_habitacion integer..
table `reservas` (bookings)
`id_reserva integer`
id_habitacion integer
`llegada date` (startdate)
`salida date` (enddate)
I have input from llegada
and salida
<input style="height: 31px;" id="datepicker2" class="form-control" name="llegada">
<input style="height: 31px;" id="datepicker3" class="form-control" name="salida">
In the script datepicker I have:
<script>
var disableddates = ["12-12-2016", "13-12-2016", "14-12-2016", "14-12-2016"];
function DisableSpecificDates(date) {
var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
return [disableddates.indexOf(string) == -1];
}
$(function() {
$("#datepicker2").datepicker({
beforeShowDay: DisableSpecificDates
});
});
</script>
This its work: Disable days ["12-12-2016", "13-12-2016", "14-12-2016", "14-12-2016"]
Now I have dates from table reservas
select * from reservas
And I Finally need rescue this dates from table reservas
and disabled days
between llegada
and salida
(where id_habitacion ....)(my english is more or less)