fix+add: seats + seat-chooser
This commit is contained in:
parent
2c6745e812
commit
b0cc5b5278
31 changed files with 808 additions and 115 deletions
33
resources/views/components/seat-chooser.blade.old.php
Normal file
33
resources/views/components/seat-chooser.blade.old.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
@extends('layout')
|
||||
|
||||
@push('head')
|
||||
<link rel="stylesheet" href="{{ asset('css/seat-chooser.css') }}">
|
||||
<script src="{{ asset('js/seat-chooser.js') }}" defer></script>
|
||||
@endpush
|
||||
|
||||
<div id="load-screen">
|
||||
<div id="loading">
|
||||
<div class="spinner"></div>
|
||||
<div class="loading-text">Loading...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="seat-chooser">
|
||||
@foreach($seatmatrix as $row)
|
||||
<div class="row">
|
||||
@foreach($row as $seat)
|
||||
@if($seat)
|
||||
<div class="seat @if($seat->isReserved($showing_id)) reserved @endif"
|
||||
data-seat-id="{{ $seat->seat_id }}"
|
||||
data-seat-status="{{ $seat->seat_status }}"
|
||||
data-seat-row="{{ $seat->seat_row }}"
|
||||
data-seat-column="{{ $seat->seat_column }}">
|
||||
<div class="seat-number">{{ $seat->seat_row }}-{{ $seat->seat_column }}</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="no-seat"></div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
|
@ -2,26 +2,7 @@
|
|||
|
||||
@push('head')
|
||||
<link rel="stylesheet" href="{{ asset('css/seat-chooser.css') }}">
|
||||
<style>
|
||||
:root {
|
||||
--rows: {{ $room->room_rows }};
|
||||
--cols: {{ $room->room_columns }};
|
||||
}
|
||||
</style>
|
||||
<script src="{{ asset('js/seat-chooser.js') }}" defer></script>
|
||||
@endpush
|
||||
|
||||
<div class="seat-chooser">
|
||||
@foreach($seatmatrix as $row)
|
||||
<div class="row">
|
||||
@foreach($row as $seat)
|
||||
<div class="seat @if($seat->isReserved) reserved @endif"
|
||||
data-seat-id="{{ $seat->seat_id }}"
|
||||
data-seat-status="{{ $seat->seat_status }}"
|
||||
data-seat-row="{{ $seat->seat_row }}"
|
||||
data-seat-column="{{ $seat->seat_column }}">
|
||||
<div class="seat-number">{{ $seat->seat_row }}{{ $seat->seat_column }}</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div id="seat-chooser"></div>
|
||||
|
|
34
resources/views/main/cinemas/cinema.blade.php
Normal file
34
resources/views/main/cinemas/cinema.blade.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
@extends('main.layout')
|
||||
|
||||
@section('content')
|
||||
|
||||
<section>
|
||||
<h1>{{$cinema->cinema_name}}</h1>
|
||||
<hr/>
|
||||
<div id="cinema">
|
||||
<div class="details">
|
||||
<span>{{$cinema->address->string()}}</span><br/>
|
||||
<span>{{$cinema->cinema_open}} - {{$cinema->cinema_close}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Now playing:</h1>
|
||||
<hr/>
|
||||
<div id="showings">
|
||||
@foreach($cinema->showings as $showing)
|
||||
<a href="/showing/{{$showing->showing_id}}">
|
||||
<img src="{{$showing->movie->movie_image}}" alt="{{$showing->movie->movie_name}} Poster"
|
||||
width="200px">
|
||||
<div class="details">
|
||||
<span>{{$showing->movie->movie_name}}</span><br/>
|
||||
<span>{{$showing->showing_date}}</span><br/>
|
||||
<span>{{$showing->showing_time}}</span>
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@endsection
|
30
resources/views/main/genres/genre.blade.php
Normal file
30
resources/views/main/genres/genre.blade.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
@extends('main.layout')
|
||||
|
||||
@section('content')
|
||||
|
||||
<section>
|
||||
<h1>{{$genre->genre_name}}</h1>
|
||||
<hr/>
|
||||
<div id="genre">
|
||||
<div class="details">
|
||||
<span>{{$genre->genre_description}}</span><br/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Movies:</h1>
|
||||
<hr/>
|
||||
<div id="movies">
|
||||
@foreach($genre->movies as $movie)
|
||||
<a href="/movie/{{$movie->movie_id}}">
|
||||
<img src="{{$movie->movie_image}}" alt="{{$movie->movie_name}} Poster" width="200px">
|
||||
<div class="details">
|
||||
<span>{{$movie->movie_name}}</span><br/>
|
||||
<span>{{$movie->movie_length}} min</span>
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
|
@ -1,20 +1,17 @@
|
|||
@extends('main.layout')
|
||||
|
||||
@push('head')
|
||||
<link rel="stylesheet" href="{{asset('css/movies.css')}}">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<section>
|
||||
<h1>Now playing:</h1>
|
||||
<hr/>
|
||||
<div id="movies">
|
||||
@foreach($showings as $showing)
|
||||
<a href="/movie/{{$showing->movie->movie_id}}">
|
||||
<img src="{{$showing->movie->movie_image}}" alt="{{$showing->movie->movie_name}} Poster"
|
||||
width="200px">
|
||||
<div class="details">
|
||||
<span>{{$showing->movie->movie_name}}</span><br/>
|
||||
<span>{{$showing->movie->movie_length}} min</span>
|
||||
</div>
|
||||
</a>
|
||||
@foreach($movies as $showing)
|
||||
|
||||
@endforeach
|
||||
</section>
|
||||
|
||||
|
|
37
resources/views/main/showings/showing.blade.php
Normal file
37
resources/views/main/showings/showing.blade.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
@extends('main.layout')
|
||||
|
||||
@section('content')
|
||||
|
||||
<section>
|
||||
<h1><img src="{{$showing->movie->movie_image}}" alt="{{$showing->movie->movie_name}} Poster" width="60px">
|
||||
{{$showing->movie->movie_name}}</h1>
|
||||
<hr/>
|
||||
<div id="showing">
|
||||
<div class="details">
|
||||
<span>Cinema: <a
|
||||
href="/cinema/{{$showing->room->cinema->cinema_id}}">{{$showing->room->cinema->cinema_name}}</a></span><br/>
|
||||
<span>Showing: {{$showing->showing_start}} - {{$showing->end_time()}}</span><br/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Details</h1>
|
||||
<hr/>
|
||||
<span>{{$showing->movie->movie_description}}</span><br/>
|
||||
<hr/>
|
||||
<span>Runtime: {{$showing->movie->movie_length }} minutes</span><br/>
|
||||
<span>Year: {{$showing->movie->movie_year}}</span><br/>
|
||||
<span>Age limit: {{$showing->movie->movie_age_limit}}</span><br/>
|
||||
<span>Genre: <a
|
||||
href="/genre/{{$showing->movie->genre->genre_id}}">{{$showing->movie->genre->genre_name}}</a></span><br/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Tickets:</h1>
|
||||
<hr/>
|
||||
<span>Tickets available: {{$showing->tickets_available()}}</span><br/>
|
||||
<span>Buy tickets?</span>
|
||||
{{-- todo--}}
|
||||
</section>
|
||||
@endsection
|
|
@ -1,7 +1,7 @@
|
|||
{{-- Layout for admins --}}
|
||||
{{-- Will have a sidebar with links --}}
|
||||
{{-- Will have a top bar with account and link to main site--}}
|
||||
{{--@extends('layout')--}}
|
||||
@extends('layout')
|
||||
|
||||
@push('head')
|
||||
<link rel="stylesheet" href="{{ asset('css/generic.css') }}">
|
||||
|
@ -19,9 +19,10 @@
|
|||
<div id="sidebar"> {{-- Page Aware --}}
|
||||
<a class="{{ Request::is('manage') ? 'active' : '' }}" href="{{ route('manage') }}">Dashboard</a>
|
||||
{{-- manage cinemas--}}
|
||||
<a class="{{ Request::is('manage/cinemas') ? 'active' : '' }}" href="{{ route('manage.cinemas') }}">Cinemas</a>
|
||||
{{-- <a class="{{ Request::is('manage/cinemas') ? 'active' : '' }}" href="{{ route('manage.cinemas') }}">Cinemas</a>--}}
|
||||
{{-- <a class="{{ Request::is('manage/cinemas/employees') ? 'active' : '' }} child" href="{{ route('manage.cinemas.employees') }}">Employees</a>--}}
|
||||
<a class="{{ Request::is('manage/movies') ? 'active' : '' }}" href="{{ route('manage.movies') }}">Movies</a>
|
||||
<a class="child {{ Request::is('manage/showings') ? 'active' : '' }}" href="{{ route('manage.showings') }}">Showings</a>
|
||||
<a class="{{ Request::is('manage/genres') ? 'active' : '' }}" href="{{ route('manage.genres') }}">Genres</a>
|
||||
</div>
|
||||
<main>
|
||||
|
|
32
resources/views/manage/showings/index.blade.php
Normal file
32
resources/views/manage/showings/index.blade.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
@extends('manage.layout')
|
||||
|
||||
@section('content')
|
||||
<h1>Showing Management</h1>
|
||||
<div id="showings">
|
||||
@foreach($showings as $showing)
|
||||
<div class="showing">
|
||||
<div class="movie">
|
||||
<h2>{{ $showing->movie->movie_name }}</h2>
|
||||
<p>{{ $showing->movie->movie_description }}</p>
|
||||
<p>{{ $showing->movie->genre->genre_name }}</p>
|
||||
</div>
|
||||
<div class="cinema">
|
||||
<h3>{{ $showing->room->cinema->cinema_name }} - {{ $showing->room->room_name }}</h3>
|
||||
<p>{{ $showing->room->cinema->address->string() }}</p>
|
||||
</div>
|
||||
<div class="time">
|
||||
<h3>Times</h3>
|
||||
<span class="mono">
|
||||
Start: {{ $showing->showing_start }}<br>
|
||||
Ends : {{ $showing->end_time() }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="button" href="{{ route('manage.showing', ['id' => $showing->showing_id]) }}">Edit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<a href="{{ route('manage.showings.create') }}">Create Showing</a>
|
||||
@endsection
|
84
resources/views/manage/showings/showing.blade.php
Normal file
84
resources/views/manage/showings/showing.blade.php
Normal file
|
@ -0,0 +1,84 @@
|
|||
@extends('manage.layout')
|
||||
|
||||
@section('content')
|
||||
<h1>Showing - {{ $showing->showing_start }}</h1>
|
||||
<form method="POST" action="{{ route('manage.showing', ['id' => $showing->showing_id]) }}" class="form">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="form-group">
|
||||
<label for="movie_id">Movie</label>
|
||||
<select name="movie_id" id="movie_id">
|
||||
@foreach($movies as $movie)
|
||||
<option value="{{ $movie->movie_id }}" {{ $movie->movie_id == $showing->movie_id ? 'selected' : '' }}>{{ $movie->movie_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="showing_start">Showing Start</label>
|
||||
<input type="datetime-local" name="showing_start" id="showing_start" value="{{ $showing->showing_start }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="room_id">Cinema</label>
|
||||
<select name="cinema_id" id="cinema_id">
|
||||
@foreach($cinemas as $cinema)
|
||||
<option value="{{ $cinema->cinema_id }}" {{ $cinema->cinema_id == $showing->room->cinema_id ? 'selected' : '' }}>{{ $cinema->cinema_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="room_id">Room</label>
|
||||
<select name="room_id" id="room_id">
|
||||
@foreach($showing->room->cinema->rooms as $room)
|
||||
<option value="{{ $room->room_id }}" {{ $room->room_id == $showing->room_id ? 'selected' : '' }}>{{ $room->room_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<script>
|
||||
// select the current room
|
||||
document.getElementById('cinema_id').addEventListener('change', function() {
|
||||
var cinema_id = this.value;
|
||||
var room_id = document.getElementById('room_id');
|
||||
var rooms = @json($rooms);
|
||||
var options = '';
|
||||
for (var i = 0; i < rooms.length; i++) {
|
||||
if (rooms[i].cinema_id == cinema_id) {
|
||||
options += '<option value="' + rooms[i].room_id + '">' + rooms[i].room_name + '</option>';
|
||||
}
|
||||
}
|
||||
room_id.innerHTML = options;
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('cinema_id').addEventListener('change', function() {
|
||||
var cinema_id = this.value;
|
||||
var room_id = document.getElementById('room_id');
|
||||
room_id.innerHTML = '';
|
||||
fetch('/api/cinemas/' + cinema_id + '/rooms')
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(rooms) {
|
||||
rooms.forEach(function(room) {
|
||||
var option = document.createElement('option');
|
||||
option.value = room.room_id;
|
||||
option.innerHTML = room.room_name;
|
||||
if (room.room_id == {{ $showing->room_id }}) {
|
||||
option.selected = true;
|
||||
}
|
||||
room_id.appendChild(option);
|
||||
});
|
||||
room_id.disabled = false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="button">Update Showing</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="{{ route('manage.showing', ['id' => $showing->showing_id]) }}">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="button">Delete Showing</button>
|
||||
</form>
|
||||
@endsection
|
Loading…
Add table
Add a link
Reference in a new issue