Seatchart

new Seatchart(options)

Creates a seatchart.

Param Type Default Description
options Object Seatmap options.
options.map Object Map options.
options.map.id number Container id.
options.map.rows number Number of rows.
options.map.columns number Number of columns.
[options.map.seatName] seatNameCallback Seat name generator.
[options.map.reserved] Array.<number> Array of reserved seats.
[options.map.reserved.seats] Array.<number> Array of the reserved seats.
[options.map.disabled] Object Disabled seats options.
[options.map.disabled.seats] Array.<number> Array of the disabled seats.
[options.map.disabled.rows] Array.<number> Array of the disabled rows of seats.
[options.map.disabled.columns] Array.<number> Array of the disabled columns of seats.
[options.map.indexes] Object Indexes options.
[options.map.indexes.rows] Object Rows index options.
[options.map.indexes.rows.visible] boolean true Row index visibility.
[options.map.indexes.rows.position] string "left" Row index position.
[options.map.indexes.rows.name] rowNameCallback Row name generator.
[options.map.indexes.columns] Object Columns index options.
[options.map.indexes.columns.visible] boolean true Column index visibility.
[options.map.indexes.columns.position] string "top" Column index position.
[options.map.indexes.columns.name] columnNameCallback Column name generator.
[options.map.front] Object Front header options.
[options.map.front.visible] boolean true Front header visibility.
options.types Array.<Object> Seat types options.
options.types.type string Name of seat type.
options.types.backgroundColor string Background color of the defined seat type.
options.types.price number Price of the defined seat type.
[options.types.textColor] string "white" Text color of the defined seat type.
[options.types.selected] Array.<number> Selected seats of the defined seat type.
[options.cart] Array.<Object> Cart options.
[options.cart.id] string Container id.
[options.cart.height] string Cart height.
[options.cart.width] string Cart width.
[options.cart.currency] string Current currency.
[options.legend] string Legend options.
[options.legend.id] string Container id.
[options.assets] Array.<Object> Assets options.
[options.assets.path] string Path to assets.

seatchart.getCart() ⇒ Object.<string, Array.<number>>

Gets a reference to the shopping cart object.

Returns: Object.<string, Array.<number>> - An object containing all seats added to the shopping cart, mapped by seat type.

seatchart.getPrice(type) ⇒ number

Gets the price for a specific type of seat.

Returns: number - Price.

Param Type Description
type string The type of the seat.

seatchart.getTotal() ⇒ number

Gets the total price of the selected seats.

Returns: number - - The total price.

seatchart.isGap(seatIndex) ⇒ boolean

Checks whether a seat is a gap or not.

Returns: boolean - True if it is, false otherwise.

Param Type Description
seatIndex number Seat index.

seatchart.makesGap(seatIndex) ⇒ boolean

Checks whether a seat creates a gap or not.

Returns: boolean - True if it does, false otherwise.

Param Type Description
seatIndex number Seat index.

seatchart.getGaps() ⇒ Array.<number>

Gets all seats which represent a gap of the seat map.

Returns: Array.<number> - Array of indexes.

seatchart.get(index) ⇒ Seat

Gets seat info.

Returns: Seat - Seat info.

Param Type Description
index number Seat index.

seatchart.set(index, type, [emit])

Set seat type.

Param Type Default Description
index number Index of the seat to update.
type string New seat type ('disabled', 'reserved' and 'available' are supported too).
[emit] boolean false True to trigger onChange event.

seatchart.onChange(e)

Triggered when a seat is selected or unselected.

Param Type Description
e ChangeEvent A change event.

seatchart.onClear(e)

Triggered when all seats are removed with the 'delete all' button in the shopping cart.

Param Type Description
e ClearEvent A clear event.

seatNameCallback(row, column) ⇒ string

Callback to generate a seat name.

Returns: string - Seat name. Return null or undefined if empty.

Param Type Description
row object
row.index number Row index (starts from 0).
row.disabled boolean True if current row is disabled.
row.disabledCount number Number of disabled rows till that one (including current one if disabled).
column object
column.index number Column index (starts from 0).
column.disabled boolean True if current column is disabled.
column.disabledCount number Number of disabled columns till that one (including current one if disabled).

rowNameCallback(index, disabled, disabledCount) ⇒ string

Callback to generate a row name.

Returns: string - Row name. Return null or undefined if empty.

Param Type Description
index number Row index (starts from 0).
disabled boolean True if current row is disabled.
disabledCount number Number of disabled rows till that one (including current one if disabled).

columnNameCallback(index, disabled, disabledCount) ⇒ string

Callback to generate a column name.

Returns: string - Column name. Return null or undefined if empty.

Param Type Description
index number Column index (starts from 0).
disabled boolean True if current column is disabled.
disabledCount number Number of disabled columns till that one (including current one if disabled).

Seat : Object

Properties

Name Type Description
type string Seat type.
id number Seat id.
index number Seat index.
name string Seat name.
price number Seat price.

ChangeEvent : Object

Properties

Name Type Description
action string Action on seat ('add', 'remove' or 'update').
current Seat Current seat info.
previous Seat Seat info previous to the event.

ClearEvent : Array.<Object>

Properties

Name Type Description
current Seat Current seat info.
previous Seat Seat info previous to the event.

results matching ""

    No results matching ""