mateuszmarkowski / jQuery-Seat-Charts

jQuery Seat Charts Plugin
MIT License
596 stars 209 forks source link

General Admission #25

Closed jejernig closed 8 years ago

jejernig commented 8 years ago

Not a Issue, but a question. What would be the best way to have a general admission type event?

Meaning to zoom out a level, customers aren't picking a specific seat , they are getting the first available ticket to sit anywhere in the theater, and anywhere in the section. Until the section is full.

mateuszmarkowski commented 8 years ago

That's a very interesting problem. The easiest way could be to disable user interactions by overriding at least click handler and possibly focus/blur depending on what your requirements are. Then you know that user won't be able to pick his own seat (at least client-side) so you can freely do it for the user:


$('#seat-map')
    //get the seatCharts object
    .seatCharts()
    //find all available seats in "f" section, you can skip f if you want to search the whole map
    .find('f.available')
    //get the first available seat (be sure to check length in case there're no available seats)
    .seats[0]
    //change the seat status to selected
    .status('selected')

If user can specify how many general admission tickets he wants, you can use .each() to iterate over a few first seats available instead of directly accessing the first one.