Organizing seating arrangements for a concert hall performance

My goal is to develop a custom concert seat booking system using HTML, CSS, and JavaScript.

For example, if the concert venue has 10 rows with 20 seats in each row, I could organize them like this:

const rows = [
  { name: 'A', seats: [1, 2, 3, 4] },
  { name: 'B', seats: [1, 2, 3, 4, 5, 6, 7, 8] },
  { name: 'C', seats: [1, 2, 3, 4] },
  { name: 'D', seats: [1, 2, 3, 4] },
];

However, what if the concert hall has multiple sections? Would it still follow a similar structure with objects like ConcertHall, Section, Row, and Seat?

Could the layout of a concert hall be represented like this:

{
  name: "Concert Hall Name",
  sections: [
    {
      name: "Balcony",
      rows: [
        {
          name: "A",
          seats: [1, 2, 3, 4, 5]
        }
      ]
    }
  ]
}

In order for users to book specific seats, perhaps each seat could be its own object. For example:

{
  name: "Concert Hall Name",
  sections: [
    {
      name: "Balcony",
      rows: [
        {
          name: "A",
          seats: [
            { id: 'some seat id', name: '1' },
            { id: 'another seat id', name: '2' },
          ]
        }
      ]
    }
  ]
}

And then tickets can be created like this:

{
  date: 'some date',
  seatId: 'some seat id'
}

Is this approach feasible and scalable to handle large concert halls like the one found at ?

Answer №1

This is a sample code structure I would recommend:

const movieTheater = {
    "name": "Starlight Cinemas",
    "screens": [
        {
            "id": 1,
            "room": "Screen 1",
            "seats": 100
        },
        {
            "id": 2,
            "room": "Screen 2",
            "seats": 120
        },
        {
            "id": 3,
            "room": "IMAX Theater",
            "seats": 80
        }
    ]
}

It's organized and provides specific details for each screening room.

When issuing a movie ticket, you could follow this format:

{
    "bookingDate": "2020-07-15T10:45:23.990Z",
    "screenId": 1,
    "viewer": {
        "firstName": "Sarah",
        "lastName": "Jones",
        "email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="395157515b415472455e524f435e574e535056593460444240">[email protected]</a>"
    },
    "movieId": 22,
    "price": 8.99,
    "currency": "USD"
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Module not found: The system encountered an error and was unable to locate the file 'os' in the specified directory

I'm currently working on a Laravel/Vue3 project and ran into an issue. When I try to execute "npm run dev", I encounter 37 error messages. I suspect it has something to do with the mix or webpack configuration, but being unfamiliar with this area, I&a ...

Is there a way to disable automatic spacing in VS code for a React file?

I am currently working on my code in VS Code within my JSX file, but I keep encountering an error. The issue seems to be that the closing tag < /h1> is not being recognized. I have attempted multiple methods to prevent this automatic spacing, but so ...

Using Python Webdriver to Execute JavaScript File and Passing Arguments to Functions

How can I execute a JavaScript function and pass arguments to it? value = driver.execute_script(open("path/file.js").read()) I have successfully executed the file, but I am unsure of how to pass arguments to the function within it. Any suggestions would ...

I encountered an error while using the router: TypeError: Cannot read property 'use' of undefined

Hello everyone, I am new to node.js and seeking help from experts. I am currently working on a code for user synchronization using node.js + AWS Cognito + Facebook Login. I followed an example from this link. Everything was going smoothly until I reached ...

What is the process of matching a server response with the appropriate pending AJAX query?

Imagine a scenario where my web app utilizes AJAX to send out query #1, and then quickly follows up with query #2 before receiving a response from the server. At this point, there are two active event handlers eagerly waiting for replies. Now, let's ...

Step-by-step guide for launching a Next.js/Node application

Currently, I am developing a full-stack project utilizing a next.js application for the front-end and a node/express server for the API. The front-end and back-end are running on separate ports. Here is how my application is configured: https://i.stack.im ...

Having trouble with installing NPM and ng commands, neither of them is working. I may have to uninstall everything and begin from scratch

Learning Angular and how to use the terminal is all new to me. I recently installed NPM and attempted to use ng serve, but encountered a series of issues. At this point, I am considering completely uninstalling everything so I can start fresh. I've d ...

I am unsure about implementing the life cycle in Svelte.js

Unknown Territory I am not well-versed in front-end development. Desire to Achieve I aim to utilize the lifecycle method with SvelteJS. Error Alert An error has occurred and the lifecycle method is inaccessible: ERROR in ./node_modules/svelte/index.m ...

Switching between different elements in an array using React

I've got a collection of appointments and I need to create a React view that will show them one by one. Users should be able to navigate through the appointments using arrow buttons. Here's an example of what the data looks like: const arr = [ ...

jquery is in motion while svg paths are at a standstill, waiting to

i have been attempting to incorporate a css-animated svg into my project. initially, the animation would start automatically, which was undesirable. after some research, i discovered that by declaring it as paused and then triggering it using jQuery with $ ...

Why doesn't jQuery ajax work when sourcing the URL from a variable but works with a hard-coded URL?

During my experimentation with setting and getting the URL for a jQuery Ajax (post) call, I realized the value of dynamically setting the destination URL for the request. Here's how I attempted to achieve this: To set the URL to 'store.php' ...

How should I integrate my JS authentication function in Rshiny to enable the app to utilize the outcome?

Currently, I have an Rshiny application set to be published on the server but in order to ensure that a specific user has access, we require an API authentication token. The process of authentication is handled within JS tags outside of the application, wh ...

The ajax keypress event is malfunctioning and the ActionResult parameter is failing to capture any data

I am facing an issue where I want to update the value of a textbox using AJAX on keypress event, but the controller is not receiving any value to perform the calculation (it's receiving null). <script> $('#TotDiscnt').keypress(fu ...

Inquiring about how to make the pieces move on the checker boards I created

I'm having trouble getting my SVG pieces to move on the checkerboard. Can someone please help me figure out how to make them move, even if it's not a valid move? I just want to see them in motion! The important thing is that the pieces stay withi ...

$http({method}) is malfunctioning while $http.get is functioning properly

Issue Description: While working on my project, I encountered an issue where using $http({ method : 'GET', url : data : ..... param works fine for both GET and POST requests. However, when the same method is used in JSFiddle, it blocks my reques ...

Integrate ruby code within a javascript string

I am looking to insert tfx-<%= @doc.doc[:b].metadata['filename']} %> into a JavaScript string called 'url' url = "<%= @document.doc[:a].url(response_content_disposition: ContentDisposition.attachment( [INSERT HERE] )) %>"; ...

Tips on separating a function into two separate files in Node.js

Hey there! I am just starting to explore Node.js so bear with me if I make any mistakes. So, I have this file: exports.Client = function() { this.example = function(name, callback) { console.log(name); }; ...

Encountering an issue while attempting to integrate mongoose with vue and receiving an error

Whenever I attempt to import this code, the page throws an error: Uncaught TypeError: Cannot read properties of undefined (reading 'split') import { User } from '@/assets/schemas' export default { name: 'HomeView', mount ...

What is the best way to create a slideshow that automatically starts upon loading and pauses when hovered over?

I have recently set up a div element for my slideshow. I've included a script to enable navigation using next and previous arrows. However, I am looking to add an automatic slideshow feature that stops on hover. As a beginner, I would appreciate any a ...

Troubleshooting: Issue with AngularJS $location.path functionality

I have some queries related to the usage of $location.path(/helpmeunderstand). I have a method called login() and when the login credentials are successful, I want to redirect to $location.path(/login/:username). However, instead of displaying the username ...