rebelcode / rcmod-wp-bookings-ui
A RebelCode module that provides the WordPress admin interface for bookings.
Installs: 1 017
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Type:rc-module
Requires
- php: ^5.4 | ^7.0
- dhii/memoize-memory: ^0.2-alpha1
- dhii/normalization-helper-base: ^0.1-alpha2
- dhii/placeholder-template: ^0.1-alpha2
- rebelcode/modular: ^0.1-alpha1
- rebelcode/transformers: ^0.1-alpha1
Requires (Dev)
- codeclimate/php-test-reporter: <=0.3.2
- dhii/container-helper-base: ^0.1-alpha7
- dhii/expression-interface: ^0.2
- dhii/php-cs-fixer-config: ^0.1
- dhii/psr-14: ^0.1
- dhii/stringable-interface: ^0.1
- phpunit/phpunit: ^4.8
- psr/container: ^1.0
- ptrofimov/xpmock: ^1.1
- rebelcode/entity-manager-interface: ^0.1-alpha2
- rebelcode/rcmod-eddbk-rest-api: 0.1-alpha10
- dev-develop / 0.1.x-dev
- v0.1-alpha25
- v0.1-alpha24
- v0.1-alpha23
- v0.1-alpha22
- v0.1-alpha21
- v0.1-alpha20
- v0.1-alpha19
- v0.1-alpha18
- v0.1-alpha17
- v0.1-alpha16
- v0.1-alpha15
- v0.1-alpha14
- v0.1-alpha13
- v0.1-alpha12
- v0.1-alpha11
- v0.1-alpha10
- v0.1-alpha9
- v0.1-alpha8
- v0.1-alpha7
- v0.1-alpha6
- v0.1-alpha5
- v0.1-alpha4
- v0.1-alpha3
- v0.1-alpha2
- v0.1-alpha1
- dev-task/refactoring-for-testing
- dev-master
This package is auto-updated.
Last update: 2021-05-10 10:24:02 UTC
README
WP Bookings plugin's UI Module
Run Front Assembling
To run front assembling just run:
$ npm install # it will install JS dependencies and build `booking-js` $ npm run build:css # build UI css
Run Application
This module's front-end logic expects to retrieve initial application state to initialize application. By default it is window.EDDBK_APP_STATE
which should be generated on server using wp_localize_script(...)
.
We have two separate pages that require different states to work. Bookings page and one service page. So for this 2 pages we need two different application states.
Service Page
State
Expected structure of state on service page (when user open some service for editing):
{
// List of all availabilities for this service.
"availabilities": [
{
"id": 1,
"fromDate": "2017-01-03",
"repeats": "week",
"repeatsEvery": 2,
"repeatsOn": ["mon", "tue", "thu"],
"repeatsEnds": "afterPeriod",
"repeatsEndsPeriod": 12,
"fromTime": "09:30:00",
"toTime": "12:30:00"
}
// ... other availabilities
],
// List of all available session lengths.
"sessions": [
{
"id": 1,
"length": 120, // session length in seconds
"price": 10.00
}
// ... other sessions
],
// Current service's bookings display options.
"displayOptions": {
"allowCustomerChangeTimezone": true
// ... other options
}
}
Bookings Page
State
Expected structure of state on bookings page:
{
// Statuses that should be displayed on screen options
"screenStatuses": [
"draft", "approved", "scheduled", "pending", "completed"
],
// List of all services. It will be used to filter bookings and for bookings editing.
"services": [
{
"id": 1,
"title": "Service Name",
"color": "#ff7f50" // Service color needed to render it in the calendar
}
]
}
Endpoints
Here is endpoints required for bookings page. Paths are not real, this is just demonstration of concept which functionality is required from backend to make everything works.
Bookings
GET /booking
- Retrieve list of bookings, screen statuses list with items count for each status, filtered items count. It should accept next parameters to filter result:
Both views:
search
- Search string to filter bookings by it. Allows to filter bookings via client name or client email address. If empty - no searching happens. For example:client@rebelcode.com
,service
- Service to filter by it. If empty - no service filtering happens. For example:1
,statuses
- Enabled screen statues to filter bookings by them. For example:draft,scheduled
,status
- Current status to filter. For example:all
ordraft
.
Calendar filtering:
start
- Start date to get bookings. For example:"2017-07-11"
,end
- End date to get bookings. For example:"2017-07-18"
.
List view filtering:
page
- Page number for pagination. For exmple:1
,month
- Month number to filter bookings by it. If empty - no month filtering happens. For example:1
.
POST /booking
- Create one booking.
UPDATE /booking/{id}
- Update booking by it's ID.
DELETE /booking/{id}
- Delete booking by it's ID.
Clients
This API endpoint is required for booking editing functionality. When user creates/edits booking he can search across all clients or create new one.
GET /client?search={queryString}
- Search for client.
POST /client
- Create new client. Should accept this two fields:
name
- Client's name,email
- Clien's email.