This project has the following capabilities already
- Saving of selected seats across browser sessions.
- Automatic selected seat count update.
- Automatic selected seat price update.
-
A button on the HTML page is has its 'click' event listener set to the
purchaseSeats()
function. This sets the selected seat to occupied for the current movie selected. -
This is done using the localStorage object provided by JavaScript. The movie title is used to generate a slug that is used to save the occupied seat for the current movie.
-
An event listener, that calls the
setMovieSlug()
andpopulateOccupiedSeats()
methods, when ever the field is changed. This causes the currentMovieSlug to be set to that of the current movie then uses the variable to get the occupied seats for that movie and populate the UI with them. -
This is achieved by using the
removeItem()
method in the localStorage object. Because the localStorage is storing items for each movie seperately this resets for only the current movie selected.