Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions submissions/VBystrov/html-movie-seat-booking/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ body {
min-height: 100vh;
}

.tickets {
background-color: #e0e0d1;
margin: 20px;
box-shadow: 0 0 5px 5px grey;
border-radius: 25px;
align-self: flex-start;
min-height: 400px;
min-width: 250px;
overflow-y: auto;
}

.ticket {
display: flex;
justify-content: space-around;
margin: 15px 25px;
padding: 5px;
background-color: #8585ad;
border-radius: 25px;
}

.cinema {
width: 900px;
background-color: #e0e0d1;
Expand Down
9 changes: 8 additions & 1 deletion submissions/VBystrov/html-movie-seat-booking/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta name="description" content="movie seat booking" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/index.js"></script>
</head>
<body>
<div class="wrapper">
Expand All @@ -24,7 +25,7 @@ <h1>Hypno Cinema</h1>
d="M 100 60 q 350 -60 700 0"
></path>
</svg>
<div class="seats">
<div class="seats" id="seats">
<div class="row-count">1</div>
<div class="row">
<label class="seat-place">
Expand Down Expand Up @@ -285,6 +286,12 @@ <h1>Hypno Cinema</h1>
</div>
</div>
</main>
<aside class="tickets">
<header class="header">
<h2>Tickets</h2>
</header>
<div class="tickets-list" id="tickets-list"></div>
</aside>
</div>
</body>
</html>
25 changes: 25 additions & 0 deletions submissions/VBystrov/html-movie-seat-booking/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
document.addEventListener('DOMContentLoaded', () => {
const seats = document.getElementById('seats');
const tickets = document.getElementById('tickets-list');

seats.addEventListener('click', ({ target }) => {
if (target.classList.contains('seat-checkbox')) {
const seatValue = target.getAttribute('value').split(/[rs]/g);
const rowNumber = seatValue[1];
const seatNumber = seatValue[2];
if (target.checked) {
tickets.insertAdjacentHTML(
'beforeend',
`<div class='ticket' place='r${rowNumber}s${seatNumber}''>
<div>Row: ${rowNumber}</div>
<div>Seat: ${seatNumber}</div>
</div>`
);
} else {
tickets
.querySelector(`.ticket[place='r${rowNumber}s${seatNumber}']`)
.remove();
}
}
});
});