Someone has ideas of how this rental application could be builded

Is a very simple scenario:

I need to build a rent a car application.

I fill out a booking form where I select the car I have rented and on which date it will be rented:
Start and end date

Ok, if later fill a new form and select the same dates the application should not let me choose that car because it will not be available.

Or if i select a date, the application must show what are the cars that will be available on that date.

Any idea how to get it?


So, naturally, you require 2 things:
1. a collection (array) of dates for which the car is unavailable,
2. a way to block those dates on the calendar (datepicker).

For the 1st point, you could maintain an array of dates, by creating the array and storing it in a string form in the Car record itself and updating/using it whenever required.

For the 2nd point, the $.datepicker method allows a few options to block selected dates. You can use your earlier-created array of dates with one of the datepicker methods.

I am myself not sure about which methods and what exact code, yet, but i know that this approach can work out for you.

Kicking this one all the way up. Anyone know how to achieve the future availability?



Hi, did you fix this? I'm really interested in this feature.



Thank you very much for your example Luis!

The problem is that i don't know how to control the future availability. 

If I have a rented car from 1 to 10 August and someone wants to rent it for August 5 on the rental form the list of available cars should not appear.

But if on the date field I put on August 15, it should appear as available

Hi Hoipoi Code:

See this link maybe this can be usefull for you.

Luis G.