megacommit

This commit is contained in:
Didier Slof 2023-02-02 08:17:38 +01:00
parent 2451ab45cb
commit 34ed81516b
Signed by: didier
GPG key ID: 01E71F18AA4398E5
51 changed files with 1200 additions and 251 deletions

View file

@ -3,46 +3,27 @@
@section('content')
<h1>Cinemas</h1>
<hr/><br/>
<h2>Stats:</h2>
<div class="spread-h">
<a class="clicky-card" href="{{ route('manage.cinemas') }}">
<div class="card">
<h3>Amount Cinemas</h3>
<span class="big-stat">{{ $cinemas->count() }}</span>
<h2>Cinemas ({{ count(Auth::user()->cinemas()) }} / {{ $cinemas->count() }})</h2>
<div>
@if (count(Auth::user()->cinemas()) > 0)
<ul>
@foreach(Auth::user()->cinemas() as $cinema)
<li>
<a href="{{ route('manage.cinema', ['id' => $cinema->cinema_id]) }}">
<div>
<h3>{{ $cinema->cinema_name }}</h3>
<span class="big-stat">{{ $cinema->address->address_city }}</span>
</div>
</a>
</li>
@endforeach
</ul>
@else
<div class="warning">
<h3>No Cinemas</h3>
<span>Did you have permission?</span>
</div>
</a>
<a class="clicky-card" href="{{ route('manage.cinemas.employees') }}">
<div class="card">
<h3>Amount Employees</h3>
<span class="big-stat">{{ $employees->count() }}</span>
</div>
</a>
@endif
</div>
<br/>
<h2>Cinemas:</h2>
<div class="spread-h">
@foreach($cinemas as $cinema)
<a class="clicky-card" href="{{ route('manage.cinemas.show', ['id' => $cinema->id]) }}">
<div class="card">
<h3>{{ $cinema->name }}</h3>
<span class="big-stat">{{ $cinema->address->address_city }}</span>
</div>
</a>
@endforeach
</div>
<br/>
<h2>Employees:</h2>
<div class="spread-h">
@foreach($employees as $employee)
<a class="clicky-card" href="{{ route('manage.cinemas.employees.show', ['id' => $employee->id]) }}">
<div class="card">
<h3>{{ $employee->name }}</h3>
<span class="big-stat">{{ $employee->cinema->name }}</span>
</div>
</a>
@endforeach
</div>
<br/>
<a class="btn btn-primary" href="{{ route('manage') }}">Back</a>
@endsection

View file

@ -5,7 +5,7 @@
<hr/><br/>
<h2>Stats:</h2>
<div class="spread-h">
<a class="clicky-card" href="{{ route('manage') }}">
<a class="clicky-card" href="{{ route('manage.users') }}">
<div class="card">
<h3>Amount Users</h3>
<span class="big-stat">{{ $users->count() }}</span>
@ -23,7 +23,7 @@
<span class="big-stat">{{ $genres->count() }}</span>
</div>
</a>
<a class="clicky-card" href="{{ route('manage') }}">
<a class="clicky-card" href="{{ route('manage.showings') }}">
<div class="card">
<h3>Amount Showings</h3>
<span class="big-stat">{{ $showings->count() }}</span>

View file

@ -18,12 +18,26 @@
</header>
<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/employees') ? 'active' : '' }} child" href="{{ route('manage.cinemas.employees') }}">Employees</a>--}}
@if (Auth::user()->hasPermission("READ_CINEMAS"))
<a class="{{ Request::is('manage/cinemas') ? 'active' : '' }}" href="{{ route('manage.cinemas') }}">Cinemas</a>
@endif
@if (Auth::user()->hasPermission("READ_MOVIES"))
<a class="{{ Request::is('manage/movies') ? 'active' : '' }}" href="{{ route('manage.movies') }}">Movies</a>
@endif
@if (Auth::user()->hasPermission("READ_SHOWINGS"))
<a class="child {{ Request::is('manage/showings') ? 'active' : '' }}" href="{{ route('manage.showings') }}">Showings</a>
@endif
@if (Auth::user()->hasPermission("READ_GENRES"))
<a class="{{ Request::is('manage/genres') ? 'active' : '' }}" href="{{ route('manage.genres') }}">Genres</a>
@endif
@if(Auth::user()->atleast('manage') && Auth::user()->hasPermission("READ_USERS"))
<a class="{{ Request::is('manage/users') ? 'active' : '' }}" href="{{ route('manage.users') }}">Users</a>
@endif
</div>
<main>
@yield('content')

View file

@ -18,7 +18,7 @@
<h3>Times</h3>
<span class="mono">
Start: {{ $showing->showing_start }}<br>
Ends : {{ $showing->end_time() }}
Ends : {{ $showing->showing_end() }}
</span>
</div>
<div class="actions">

View file

@ -0,0 +1,41 @@
@extends('manage.layout')
@section('content')
<h1>Users</h1>
<hr/>
<div id="users">
<table>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Actions</th>
</tr>
@foreach($users as $user)
<tr>
<td>
<a href="{{ route('manage.user', ['id' => $user->user_id]) }}">
{{ $user->name }}
</a>
</td>
<td>
<a href="{{ route('manage.user', ['id' => $user->user_id]) }}">
{{ $user->email }}
</a>
</td>
<td>
<a href="{{ route('manage.user', ['id' => $user->user_id]) }}">
{{ $user->role }}
</a>
</td>
<td>
<a href="{{ route('manage.user', ['id' => $user->user_id]) }}">
View
</a>
</td>
</tr>
@endforeach
</table>
</div>
@endsection

View file

@ -0,0 +1,117 @@
@extends('manage.layout')
@section('content')
<h1>User: {{ $user->name }}</h1>
<hr/>
<h2>Core User Details</h2>
<form id="core-user-form" class="form" method="POST" action="{{ route('manage.user', ['id' => $user->user_id ]) }}">
@csrf
<div class="form-group">
<label for="name">Name</label>
<input type="text" name="name" id="name" value="{{ $user->name }}"/>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" placeholder="Change password" name="password" id="password"/>
</div>
<div class="form-group">
<label for="role">Role</label>
<select>
<option value="admin" {{ $user->role == 'admin' ? 'selected' : '' }}>Admin</option>
</select>
</div>
<div class="form-group">
<button type="submit">Update</button>
</div>
</form>
<script id="core-user-form-loader">
// request allowed roles to give from the API (/api/allowedRoles)
// populate the select with the allowed roles
// set the selected role to the current role
</script>
<h2>User Permissions</h2>
{{-- for loop, and make sure that only if the user has the DELETE_PERMISSION that they can delete it and if they have the UPDATE_PERMISSION that they can update it--}}
<div id="permissions">
<table id="permissions">
<thead>
<tr>
<th>Permission</th>
<th>Actions</th>
</tr>
</thead>
@foreach(auth()->user()->permissions as $permission)
<tr>
<td>{{ $permission->permission_name }}</td>
<td>
<form action="{{ route('api.user.permission', ['id' => $user->user_id, 'permission_id' => $permission->permission_id]) }}" method="DELETE">
@csrf
@method('DELETE')
<button type="submit">Delete</button>
</form>
</td>
</tr>
@endforeach
<form id="add-permission" method="POST"
action="{{ route('api.user.permission', ['id' => $user->user_id ]) }}">
@csrf
<tr>
<td>
<input class="text" type="text" name="permission_name" id="permission"/>
</td>
<td>
<button class="button" type="submit">Add</button>
</td>
</tr>
</form>
</table>
<h2>Cinema Assignments</h2>
<table id="assignments">
<thead>
<tr>
<th>Assignment</th>
<th>Actions</th>
</tr>
</thead>
@foreach(auth()->user()->cinemas() as $cinema)
<tr>
<td>{{ $cinema->cinema_name }}</td>
<td>
@if($user->hasPermission('DELETE_CINEMA_ASSIGNMENT'))
<a href="{{ route('api.user.assignment', ['id' => $cinema->cinema_id]) }}">
Delete
</a>
@endif
</td>
</tr>
@endforeach
@if ($user->hasPermission('UPDATE_USER'))
<form id="add-assignment" method="POST"
action="{{ route('api.user.assignment', ['id' => $user->user_id ]) }}">
@csrf
<tr>
<td>
<select name="cinema" id="cinema">
@foreach(auth()->user()->cinemas() as $cinema)
<option value="{{ $cinema->cinema_id }}">{{ $cinema->cinema_name }}</option>
@endforeach
</select>
</td>
<td>
<button class="button" type="submit">Add</button>
</td>
</tr>
</form>
@endif
</table>
</div>
@endsection