onPlacesPrompt

Click on the General Admission Area to have a browser prompt handle the number of places selection.

by seatsio

HTML

<script src="https://cdn.seatsio.net/chart.js"></script>
<div id="chart"></div>

CSS

body {
	margin: 0;
	padding: 0;
}

#chart {
	width: 100vw;
	height: 100vw;
}

JavaScript

var chart = new seatsio.SeatingChart({
	divId: "chart",
	workspaceKey: "publicDemoKey",
	event: "smallTheatreEvent",
	pricing: [
		{ category: 1, price: 30 },
		{ category: 2, price: 40 },
		{ category: 3, price: 50 }
	],
	onPlacesPrompt: showPlacesDialog
}).render();


function showPlacesDialog(params, confirmSelection) {
	console.log('showPlacesDialog', params)

	const selectedPlaces = params.selectedPlaces

	// Using prompt would be bad practice. This is done to keep this example short.
	var amount = parseInt(prompt('Edit the number of selected places', selectedPlaces))
	if (isNaN(amount)) {
		return
	}

	const object = params.objectToSelect
	console.log(`Selecting ${amount} places in ${object.label}`)

	confirmSelection(amount)
}