I am currently working on an application which manages rooms, their availability, pricing, etc. on different days.
I have already made the application with general management, like having on price for the whole year and the room will be available for the whole year.
What I want to achieve is that the user should be able to set price for each day, if he doesn’t sets the price for a particular day, then the general price will be for that day, he should also be able to set whether the room is available on a particular day or not.
For adding this feature I am using FullCalendar.
Here is how I have done it
There is a model called as Calendar which belongs to rooms and rooms has many calendar.
The calendar table consist of the following columns:
Price : float
availability : boolean
Date : Date
Room_id : integer
FullCalendar requires me to send the data as Json, so i query for all the dates within the current month and show the title as price and description as available or not.
But implementing it this way requires me to add details to calendar for each day even if the user is setting a general price for each and every day for the room. That is, 365 records for each room in the calendar table. Which I have to set at the time of creation of the room model.
Can anyone suggest me a better way to achieve this feature in much better way.