fix+add: seats + seat-chooser
This commit is contained in:
parent
2c6745e812
commit
b0cc5b5278
31 changed files with 808 additions and 115 deletions
|
@ -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