onPlacesWithTicketTypesPrompt
Called when the chart needs to prompt how many places to select for each ticket type.
To understand how to integrate this callback, please read the Prompts API page.
Possible triggers:
- Selecting a General Admission Area, Variable Occupancy Area or Fixed Occupancy Area with multiple ticket types.
- Selecting multiple seats with multiple ticket types, by either using the multi-select tool, or when passing the config numberOfPlacesToSelect.
Defining
onPlacesWithTicketTypesPrompt: (parameters: object, confirmSelection: function) => {}
parameters
An object describing what needs to be prompted to the end user.
- ticketTypes: An array of possible ticket types to pick from, defined in dictionary form.
- selectedPlacesByTicketType: A dictionary with the number of places currently selected per ticket type.
- minPlaces: Minimum number of places the prompt expects to be confirmed.
- maxPlaces: Maximum number of places the prompt expects to be confirmed. This can be affected by the selection size, capacity of the object, or configuration parameters such as numberOfPlacesToSelect and maxSelectedObjects.
- objectsToSelect: An array of Objects to be selected.
Only the total number of places will be verified from maxSelectedObjects
to reject an incorrect selection. When building your own dialog prompts, you must check other limits in categories and ticket types by yourself before confirming selection.
Example:
{
ticketTypes: [
{ price: 12, ticketType: "Adult", formattedPrice: "12€" },
{ price: 8, ticketType: "Child", formattedPrice: "8€" }
],
selectedPlacesByTicketType: {
"Adult": 1
},
minPlaces: 0,
maxPlaces: 10,
objectToSelect: {
// ...
label: "General Admission",
// ...
}
}
confirmSelection
Callback. Must be called to perform the selection once the user has made their choice on your custom dialog.
This function can be called in two different ways:
Passing a dictionary
function(placesPerTicketType: object)
- placesPerTicketType: A dictionary containing ticket types as keys, and places to be assigned to each as values.
Example:
confirmSelection({
"Adult": 2,
"Child": 1
})
Passing an ordered array
function(ticketTypes: array)
- placesPerTicketType: An array of ticket type keys.
Example:
confirmSelection([
"Adult",
"Child",
"Adult"
])
When selecting multiple seats at once, the order of the ticket types will be used to assign a ticket type to each seat in the order defined in parameters.objectsToSelect
. This order is ignored in Areas, as they don't actually contain assignable seats.
Working example
Click on a group of red seats or the area, to have a browser prompt handle the number of places to be selected per ticket type. You must select at exactly 3 places since numberOfPlacesToSelect: 3
is passed as a config setting.