Adding checkin and checkout time


#1

Is there any provision to add check in and check out time to the “Hotel Room Reservation Calendar”, such that if a person checks out from “Room 1” at 10:00 then that room can be booked again from 10:01.
Also the color filled for “Room 1” must be proportionate to check in and check out time ie if a person checksout at 12 noon ,then the cell must be half colored and half empty.


#2

Hi,

There is no ready solution to achieve it, but you can try to achieve this in the next way:
to disable the possibility to create an event at 10:00-10:01, you can block this minute. Please use blockTime() method for it.

scheduler.blockTime({ days: "fullweek", zones: [10*60, 10*60+1], sections: { timeline: [1] } });
Also you need to set the value of time_step config to 1.
Example: docs.dhtmlx.com/scheduler/snippet/fb42e0cd

To block time dinamically, you need to check if events exist in the required period of time, for example at 9.00-10.00 by getEvent() method when onViewChange event fires.

If so - block required sections. And then call updateView() method to apply changes.


#3

I also have a question similar to same. how automatically block the dates prior to today and avoid new bookings for a later date?


#4

Hi Kelum Jayasoma,
to block and mark areas before and after today, use the addMarkedTimespan method. Using this method, you can determine which time periods to block and to mark with your custom styles.
Every time when the onBeforeViewChange event fires you need to remove the custom styling with deleteMarkedTimespan method and add them when the event onViewChange event fires. Thus, the dates before and after today will be blocked.
You can read more detailed about blocking and marking dates in the article:
https://docs.dhtmlx.com/scheduler/limits.html
Here is a demo:
http://snippet.dhtmlx.com/5/1c50bb2f6