Skip to content

Commit

Permalink
[update] how-to-start added, initialization updated, filtershape updated
Browse files Browse the repository at this point in the history
  • Loading branch information
tbshag2 committed Sep 10, 2024
1 parent 6d58a24 commit 4abadc4
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/api/config/booking-filtershape.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ filterShape:{

- `text` - (optional) if **true**, the text input field is displayed (default); if **false**, the text field is hidden
- `id` - (required) the id of a card
- `suggest` - (required) if **true**, the values (from the [`data`](/api/config/booking-data) object) that match a user's input text will be displayed
- `suggest` - (required) if **true**, the auto-complete is enabled and the values (from the [`data`](/api/config/booking-data) object) that match a user's input text will be displayed
- `label` - (optional) the label for the property from the `data` object. See [Default config](#default-config) below.
- `date` - (optional) shows/hides the date field; **true** is set by default (the field is shown)
- `time` - (optional) shows/hides the time field. If set to **true**, it takes an array of objects with default time options for a slot. For each object you can specify the following parameters:
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ new booking.Booking("#root", {

### Configuring filter fields

To show the values that match a user's input text in the **text** field, set the `suggest` parameter of the [`filterShape`](/api/properties/filterShape) property to **true**. The values from the [`data`](/api/config/booking-data) object will be displayed. To add labels to these fields, apply the `label` parameter of the [`filterShape`](/api/properties/filterShape) property.
To enable the auto-complete and show the values that match a user's input text in the **text** field, set the `suggest` parameter of the [`filterShape`](/api/properties/filterShape) property to **true**. The values from the [`data`](/api/config/booking-data) object will be displayed. To add labels to these fields, apply the `label` parameter of the [`filterShape`](/api/properties/filterShape) property.

Example:

Expand Down Expand Up @@ -424,7 +424,7 @@ new booking.Booking("#root", {

### Enabling the autoApply mode for the filter

To hide the **Search** button and make the filter apply right after a user's input, seth the `autoApply` parameter of the [`filterShape`](/api/properties/filterShape) property to **true**.
To hide the **Search** button and make the filter apply right after a user's input, set the `autoApply` parameter of the [`filterShape`](/api/properties/filterShape) property to **true**.

Example:

Expand Down
6 changes: 4 additions & 2 deletions docs/guides/initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ new booking.Booking("#root", {

### Configuration properties

List of properties here
:::info
The full list of properties to configure **Booking** can be found [**here**](api/overview/properties-overview.md).
:::

## Example

In this snippet you can see how to initialize **JavaScript Booking** with the initial settings:

**[TODO]!!! Заменить ссылку на сниппет с инициализацией**
**[TODO]!!!
<iframe src="" frameborder="0" class="snippet_iframe" width="100%" height="500"></iframe>
153 changes: 150 additions & 3 deletions docs/how-to-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,157 @@ description: You can explore how to start working with DHTMLX Booking in the doc

# How to start

## Step 1. Including source files
This clear and comprehensive tutorial will guide your through the steps you need to take in order to get a full-functional Booking application on a page.

## Step 2. Creating Booking
!! add image - booking-main

## Step 3. Configuring Booking
## Step 1. Downloading and installing packages

[Download the package](https://dhtmlx.com/docs/products/dhtmlxbooking/download.shtml) and unpack it into a folder of your project.

You can import JavaScript Booking into your project using `yarn` or `npm` package manager.

#### Installing trial Booking via npm and yarn

:::info
If you want to use the trial version of Booking, download the trial [booking package](https://dhtmlx.com/docs/products/dhtmlxbooking/download.shtml) and follow the steps mentioned in the *README* file. Note that trial booking is available for 30 days only.
:::

#### Installing PRO Booking via npm and yarn

:::info
If you have already purchased Booking under the proprietary license, send your **license number** to the *[email protected]* email in order to receive *login* and *password* for private **npm** as well as detailed guide on how to install Booking. Note that private **npm** is available before the expiration of the proprietary Booking license.
:::

## Step 2. Including source files

Start from creating an HTML file and call it *index.html*. Then proceed to include Booking source files into the created file.

There are two necessary files:

- the JS file of booking
- the CSS file of booking

~~~html {5-6} title="index.html"
<!DOCTYPE html>
<html>
<head>
<title>How to Start with Booking</title>
<script src="./dist/booking.js"></script>
<link href="./dist/booking.css" rel="stylesheet">
</head>
<body>
<script>
// your code will be here
</script>
</body>
</html>
~~~

:::tip
If you want to integrate JavaScript Booking into React, Angular or Vue projects, refer to the corresponding [**Examples on CodeSandbox**](https://codesandbox.io/u/DHTMLX) for more information.
:::

## Step 3. Creating booking

Now you are ready to add booking to the page. First, let's create the DIV container for Booking.

~~~html {} title="index.html"
<!DOCTYPE html>
<html>
<head>
<title>How to Start with Booking</title>
<script src="./dist/booking.js"></script>
<link href="./dist/booking.css" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script>
const table = new booking.booking("#root", {
// configuration properties
});
</script>
</body>
</html>
~~~

## Step 4. Configuring Booking

To start working with Booking, first you need to provide the initial data, and then you can add other configuration properties you want to be applied at the initialization. The example below creates Booking with two cards:
- the [`data`](/api/config/booking-data) property allows adding data to each card, such as title, image, rating data, and booking slots
- the [`cardShape`](/api/config/booking-infoshape) property helps to configure which cards' data fields to display

~~~jsx
const data = [
{
id: "ee828b5d-a034-420c-889b-978840015d6a",
title: "Natalie Tyson",
category: "Allergist",
subtitle: "2 years of experiece",
details: "Lexington Avenue 54\nWheatfields, Hungary",
preview:
"https://files.webix.com/30d/d34de82e0a8e3b561988a46ce1e86743/stock-photo-doc.jpg",
price: "27 $",
review: {
stars: 4,
count: 120,
},
slots: [
{
from: 9,
to: 21,
days: [1, 2, 3, 4, 5],
},
{
from: 10,
to: 18,
days: [6, 0],
},
],
},
{
id: "5c9b64ad-1830-4e5b-a5f9-8acea10706df",
title: "Luz Lancaster",
category: "Allergist",
subtitle: "3 years of experiece",
details: "Ludlam Place 128\nMooresburg, Antigua and Barbuda",
preview:
"https://files.webix.com/30d/d34de82e0a8e3b561988a46ce1e86743/stock-photo-doc.jpg",
price: "27 $",
review: {
stars: 4,
count: 64,
},
slotSize: 45,
slotGap: 10,
slots: [
{
from: 9,
to: 17,
days: [1, 2, 3, 4, 5],
},
],
},
]

const infoShape = {
preview: true,
category: true,
title: true,
price: true,
details: true,
};

new booking.Booking("#root", {
data,
infoShape,
// other parameters
});
~~~

## What's next

That's all you need to create a simple Booking on a page. Now you can dive into the Booking API to configure it to the needs of your application:

- [Guides](/category/guides) pages provide instructions about installation, loading data, styling, and other helpful tips to go smoothly with the Booking configuration
- [API reference](/api/overview/main-overview) gives description of the Booking functionality

0 comments on commit 4abadc4

Please sign in to comment.