Skip to content

Commit 9d1b3ad

Browse files
[add] events description
1 parent 3e958ed commit 9d1b3ad

5 files changed

Lines changed: 162 additions & 4 deletions

File tree

docs/api/api_overview.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ new booking.Booking("#root", {
5151

5252
## Booking events
5353

54-
| Name | Description |
55-
| ----------------------------------------------------- | ----------------------------------------------------------- |
56-
| [](api/events/booking_eventname_event.md) | @getshort(api/events/booking_eventname_event.md) |
54+
| Name | Description |
55+
| ----------------------------------------- | ------------------------------------------------ |
56+
| [](api/events/js_booking_confirmslot.md) | @getshort(api/events/js_booking_confirmslot.md) |
57+
| [](api/events/js_booking_selectslot.md) | @getshort(api/events/js_booking_selectslot.md) |
58+
| [](api/events/js_booking_setfilter.md) | @getshort(api/events/js_booking_setfilter.md) |
5759

5860
## Booking properties
5961

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
sidebar_label: confirm-slot
3+
title: confirm-slot Event
4+
description: You can learn about the confirm-slot event in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
5+
---
6+
7+
# confirm-slot
8+
9+
### Description
10+
11+
@short: Fires when confirming the booking of a slot
12+
13+
### Usage
14+
15+
~~~jsx {}
16+
"confirm-slot": ({
17+
cardId: string | number,
18+
data: {
19+
[key: string]: string,
20+
},
21+
startTime: number,
22+
confirmation: promise,
23+
}) => void;
24+
~~~
25+
26+
### Parameters
27+
28+
The callback of the **confirm-slot** event can take an object with the following parameters:
29+
30+
- `cardId` - (required) the ID of a card for which the booking of a slot is confirmed
31+
- `data` - (required) an abject with the booking screen form fields with the following parameters for each field:
32+
- `key` - (required) the form field ID. By default, three fields are added: *name*, *email*, *description*
33+
- `startTime` - (required) the start time of a slot in milliseconds
34+
- `confirmation` - (required) a promise with the confirmation status
35+
36+
### Example
37+
38+
~~~jsx {7-10}
39+
// create Booking
40+
const booking = new booking.Booking("#root", {
41+
cards,
42+
cardShape
43+
});
44+
45+
// ...
46+
booking.api.on("confirm-slot", (obj) => {
47+
console.log(obj.cardId);
48+
});
49+
~~~
50+
51+
**Related articles:** TODO
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
sidebar_label: select-slot
3+
title: select-slot Event
4+
description: You can learn about the select-slot event in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
5+
---
6+
7+
# select-slot
8+
9+
### Description
10+
11+
@short: Fires when selecting a slot
12+
13+
### Usage
14+
15+
~~~jsx {}
16+
"select-slot": ({
17+
cardId: string | number,
18+
slotTime: {
19+
from?: Date,
20+
to?: Date,
21+
}
22+
}) => void;
23+
~~~
24+
25+
### Parameters
26+
27+
The callback of the **select-slot** event can take an object with the following parameters:
28+
29+
- `cardId` - (required) the ID of a card a selected slot belongs to
30+
- `slotTime` - (required) an object with the slot time parameters. In this object you can specify the following parameters:
31+
- `from` - (optional) the slot start date
32+
- `to` - (optional) the slot end date
33+
34+
### Example
35+
36+
~~~jsx {7-10}
37+
// create Booking
38+
const booking = new booking.Booking("#root", {
39+
cards,
40+
cardShape
41+
});
42+
43+
// ...
44+
booking.api.on("select-slot", (obj) => {
45+
console.log(obj.cardId);
46+
});
47+
~~~
48+
49+
**Related articles:** TODO
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
sidebar_label: set-filter
3+
title: set-filter Event
4+
description: You can learn about the set-filter event in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
5+
---
6+
7+
# set-filter
8+
9+
### Description
10+
11+
@short: Fires when filtering cards
12+
13+
### Usage
14+
15+
~~~jsx {}
16+
"set-filter": ({
17+
global?: string,
18+
date?: string,
19+
time?: [
20+
{
21+
from?: number,
22+
to?: number,
23+
}, {...}
24+
],
25+
}) => void;
26+
~~~
27+
28+
### Parameters
29+
30+
The callback of the **set-filter** event can take an object with the following parameters:
31+
32+
- `global` - (optional) the text in the search field
33+
- `date` - (optional) the slot date
34+
- `time` - (optional) an array of objects containing time options for a slot. For each object, you can specify the following parameters:
35+
- `from` - (optional) the start time
36+
- `to` - (optional) the end time
37+
38+
### Example
39+
40+
~~~jsx {7-10}
41+
// create Booking
42+
const booking = new booking.Booking("#root", {
43+
cards,
44+
cardShape
45+
});
46+
47+
// ...
48+
booking.api.on("set-filter", (obj) => {
49+
console.log(obj.time);
50+
});
51+
~~~
52+
53+
**Related articles:** TODO

sidebars.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ module.exports = {
7878
collapsed: true,
7979
items: [
8080
// Booking events
81-
"api/events/booking_eventname_event",
81+
//"api/events/booking_eventname_event",
82+
"api/events/js_booking_confirmslot",
83+
"api/events/js_booking_selectslot",
84+
"api/events/js_booking_setfilter",
8285
]
8386
},
8487
{

0 commit comments

Comments
 (0)