Skip to content

Commit 30ca2b7

Browse files
committed
[update] integration with scheduler updated
1 parent a2c5159 commit 30ca2b7

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

docs/guides/integration-with-widgets.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The integration primarily focuses on converting the Scheduler data into Booking
1616
- Scheduler handles events (e.g., single or recurring).
1717
- Booking generates available time slots from those events.
1818

19-
So what you actually need is to generate booking slots from the schedule (the [snippet below](#example) shows how to generate booking slots from the doctor's schedule using JSON data).
19+
So what you actually need is to generate booking slots from the schedule (the [snippet below](#example) shows how to generate booking slots from the doctor's schedule by converting JSON data on server-side).
2020

2121
- **Recurring events limitation:**
2222
- Booking supports only weekly recurring events (defined as INTERVAL=1;FREQ=WEEKLY in Scheduler).
@@ -42,14 +42,12 @@ The snippet below demonstrates how to integrate Booking with the Scheduler widge
4242

4343
Converting Scheduler events to Booking slots is the major part of integration and the rules for handling the events and converting them to slots are described in the [section below](#rules-for-converting-scheduler-events-to-booking-slots).
4444

45-
We also ensure that the timestamps are converted correctly. When global (UTC) timestamps are used, they need to be converted to local time before loading them into the system (**l2g** function in the example). Similarly, before saving the data back, the timestamps should be converted from local time to global (UTC) time (**g2l** function in the example).
4645

4746
<iframe src="https://snippet.dhtmlx.com/d5zbq3g3?mode=result" frameborder="0" class="snippet_iframe" width="100%" height="800"></iframe>
4847

49-
5048
## Rules for converting Scheduler events to Booking slots
5149

52-
We will show how to generate booking slots from the doctor's schedule using JSON data.
50+
We will show how to generate booking slots from the doctor's schedule using JSON data. Data is converted on the server-side. The schedule for the next period is considered: from 2025-03-13 to 2027-03-13
5351

5452
**Rule 1. Single event slot creation.**
5553

@@ -86,21 +84,21 @@ Booking slot:
8684

8785
**Rule 2. Recurring events.**
8886

89-
For recurring events, we use a weekly pattern. The start and end dates must be the same for each occurrence, as Booking only supports weekly recurring slots.
87+
For recurring events, we use a weekly pattern. The start date and end date of each recurring event in Scheduler should be equal to Booking [start](/api/config/booking-start) and [end](/api/config/booking-end) dates, otherwise create placeholders for dates before and after the recurring event (see Rule 7).
9088

9189
Scheduler event (weekly on weekdays): the recurrence rule (rrule) specifies that the event repeats weekly on Monday, Tuesday, Wednesday, Thursday, and Friday.
9290

9391
~~~json
9492
{
9593
"doctor_id": 1,
9694
"start_date": "2025-03-13 09:00:00",
97-
"end_date": "9999-02-01 00:00:00",
95+
"end_date": "2027-03-13 00:00:00",
9896
"rrule": "INTERVAL=1;FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",
9997
"duration": 28800
10098
}
10199
~~~
102100

103-
Booking Slots: In Booking, the weekly schedule is represented as a single rule, with the same start and end times for all repeated events:
101+
Booking slots: In Booking, the weekly schedule is represented as a single rule, with the same start and end times for all recurring events:
104102

105103
~~~json
106104
{
@@ -129,7 +127,7 @@ Scheduler event:
129127
{
130128
"doctor_id": 2,
131129
"start_date": "2025-03-13 20:00:00",
132-
"end_date": "9999-02-01 00:00:00",
130+
"end_date": "2027-03-13 00:00:00",
133131
"rrule": "INTERVAL=1;FREQ=WEEKLY;BYDAY=SA",
134132
"duration": 28800
135133
}
@@ -163,16 +161,16 @@ In this case, a single event is added to a recurring schedule. The Booking slots
163161

164162
Scheduler events:
165163

166-
- Repeating event: Doctor’s availability from 9:00 AM to 5:00 PM on weekdays.
167-
- Single event: Doctor is also available from 2:00 AM to 6:00 AM on March 18th and 19th.
164+
- Recurring event: a doctor’s availability from 9:00 AM to 5:00 PM on weekdays.
165+
- Single event: a doctor is also available from 2:00 AM to 6:00 AM on March 18th and 19th.
168166

169167
~~~json
170168
[
171169
// recurring event
172170
{
173171
"doctor_id": 1,
174172
"start_date": "2025-03-13 09:00:00",
175-
"end_date": "9999-02-01 00:00:00",
173+
"end_date": "2027-03-13 00:00:00",
176174
"rrule": "INTERVAL=1;FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",
177175
"duration": 28800
178176
},
@@ -193,9 +191,8 @@ Scheduler events:
193191

194192
Booking slots:
195193

196-
- Merging events: The repeating event and single events are combined into one Booking rule.
197-
- If the single event has priority, its specific dates (March 18th and 19th) are added to the repeating event's rule.
198-
- If the single event needs to override the repeating one, it must not be added to the repeating event’s dates.
194+
- Merging events: the recurring event and single events are combined into one Booking rule.
195+
- If a single event has priority, its specific dates (March 18th and 19th) are added to the recurring event's rule. Please, refer to [Defining the slot rules](/guides/configuration/#defining-slot-rules)
199196

200197
~~~json
201198
{
@@ -235,7 +232,7 @@ Scheduler event:
235232
{
236233
"doctor_id": 1,
237234
"start_date": "2025-03-13 09:00:00",
238-
"end_date": "9999-02-01 00:00:00",
235+
"end_date": "2027-03-13 00:00:00",
239236
"rrule": "INTERVAL=1;FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",
240237
"duration": 28800
241238
},
@@ -284,7 +281,7 @@ Scheduler event:
284281
{
285282
"doctor_id": 5,
286283
"start_date": "2025-03-14 09:00:00",
287-
"end_date": "9999-02-01 00:00:00",
284+
"end_date": "2027-03-13 00:00:00",
288285
"rrule": "INTERVAL=1;FREQ=WEEKLY;BYDAY=TH,FR,SA,SU",
289286
"duration": 28800
290287
},
@@ -318,15 +315,15 @@ Booking slot:
318315

319316
**Rule 7. Events starting later than Booking start date.**
320317

321-
If a recurring event starts after the Booking start date (default is today), create rules with empty time intervals for the dates prior to the event's start date. This simulates the dates being "removed" from the recurrence.
318+
If a recurring event starts after the Booking start date (default is today and in the example it's 2025-03-14), create rules with empty time intervals for the dates prior to the event's start date. This simulates the dates being "removed" from the recurrence.
322319

323320
Scheduler event:
324321

325322
~~~json
326323
{
327324
"id": "ffbe7628-25f4-4cbe-9127-3bc779d6bafa",
328325
"start_date": "2025-03-17 09:00:00",
329-
"end_date": "9999-02-01 00:00:00",
326+
"end_date": "2027-03-13 00:00:00",
330327
"rrule": "INTERVAL=1;FREQ=WEEKLY;BYDAY=SU,MO,TU,WE,TH,FR,SA",
331328
"duration": 28800
332329
}
@@ -335,6 +332,7 @@ Scheduler event:
335332
Booking slots:
336333

337334
~~~json
335+
// the start date is March 14, 2025
338336
{
339337
"slots": [
340338
{ "from": "09:00", "to": "17:00", "days": [0, 1, 2, 3, 4, 5, 6] },

docs/news/whats_new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Released on March 12, 2025
1414

1515
- Lazy rendering of cards via the [`renderType`](/api/config/booking-rendertype) property
1616
- Ability to embed templates via the [`cardTemplate`](/api/config/booking-cardtemplate) and [`infoTemplate`](/api/config/booking-infotemplate) properties
17-
- [Integration with frameworks](/category/backend-and-frameworks-integration/) and [DHTMLX Event Calendar](/guides/integration-with-widgets/#integration-with-dhtmlx-event-calendar)
17+
- [Integration with frameworks](/category/backend-and-frameworks-integration/) and [DHTMLX Event Calendar](https://snippet.dhtmlx.com/c5eu8pdk)
1818

1919
## Version 1.0.1
2020

0 commit comments

Comments
 (0)