Skip to content
Marcus edited this page Sep 11, 2018 · 13 revisions

Table of contents


After you've configured the settings you are ready to use this plugin. It's used through the global craft variable in twig. We have made it really easy and logical to use. The table below explains how it works:

Twig methods

The variables below simply return the exact same as the Waitwhile API does. Currently this uses the v1 API for Waitwhile.

Method API Reference Description
craft.waitwhile.getWaitlist Retrieve a waitlist Retrieve the default waitlist
craft.waitwhile.getAllWaitlists List all waitlists Get all available waitlists
craft.waitwhile.getWaitlistStatus Waitlist waitlist status Gets the waitlist status
craft.waitwhile.getWaitingGuests List all waiting guests Fetches all guests in the queue
craft.waitwhile.getResources List resources Fetches all resources
craft.waitwhile.getBookings List bookings Gets all bookings
craft.waitwhile.getBookingsFrom(int64) Same as getBookings but only after specific time Get all booked times after certain unix ms timestamp
craft.waitwhile.getBookingTimesForDay(string $date) - Get a list of available booking times for a certain day
craft.waitwhile.unix_ms_to_human(string) - Same as equivalent twig filter
craft.waitwhile.unix_ms_to_minutes(string) - Same as equivalent twig filter

Twig extension

We've added some twig filters for ease of use with the business hours and estimated wait time. Simply use the filter waitwhile_unix_ms_to_human to convert the unix ms timestamp to a HH:mm format, or waitwhile_unix_ms_to_minutes to convert the unix ms timestamp to minutes.

Actions

everyday-waitwhile/queue

This creates a queue entry for Waitwhile

This option requires a name input, but also accepts phone, email and notes inputs.

Additionally you can define a country_code input field for the default phone number country code if the user fails to supply one.

everyday-waitwhile/booking

This option requires a name input, duration input (unix ms) and time input (unix ms). It also accepts a phone, email and notes input.

Getting the response of an action

In twig after you have just submitted an action, you can use the craft.waitwhile.getSession variable to read the previous response.

Other routes

everyday-waitwhile/booking/times

This option requires a date in whatever format that PHP DateTime can parse of the current day. It then returns a json object in the following format:

{
  "isOpen": boolean,
  "times": [
    "hh:mm": {
      'start': 'hh:mm',
      'start_unix_ms': 'int64',
      'start_real_unix_ms': 'int64',
      'duration': 'int64',
      'available': boolean
    }
    ...
  ]
}

start_real_unix_ms is what you would want to pass to the everyday-waitwhile/booking action as the time and duration would be passed as the duration. start_real_unix_ms is the unix ms time since Unix epoch, start_unix_ms is the unix ms time since the start of the current day.

Pull requests are welcome.

Read the debugging FAQ before submitting an issue.

Clone this wiki locally