Added ability to delete single application

Also moved User observer code to Application observer
This commit is contained in:
2020-07-12 17:01:33 +01:00
parent 4dc412e53c
commit e978a5417b
11 changed files with 265 additions and 34 deletions

View File

@@ -0,0 +1,74 @@
@if ($inDashboard)
<div class="row mb-4">
<div class="col-6 offset-5">
<img src="/img/403.svg" width="150px" alt="Access denied" />
</div>
</div>
<div class="row">
<!-- People find pleasure in different ways. I find it in keeping my mind clear. - Marcus Aurelius -->
<div class="col">
<div class="alert alert-{{$type}}">
<h4><i class="fas fa-user-lock"></i> Access Denied</h2>
<p>
We're sorry, but you do not have permission to access this web page.
</p>
<p>
Please contact your administrator if you believe this was in error.
</p>
</div>
</div>
</div>
@else
@extends('adminlte::page')
@section('title', 'Raspberry Network | Access Denied')
@section('content_header')
<h4>Access Denied - HTTP 403</h4>
@stop
@section('content')
<div class="row mb-4">
<div class="col-6 offset-5">
<img src="/img/403.svg" width="150px" alt="Access denied" />
</div>
</div>
<div class="row">
<div class="col">
<div class="alert alert-{{$type}}">
<h4><i class="fas fa-user-lock"></i> Access Denied</h2>
<p class="text-muted">
@if (isset($slot))
{{ $slot }}
@endif
</p>
<p>
We're sorry, but you do not have permission to access this web page.
</p>
<p>
Please contact your administrator if you believe this was in error.
</p>
</div>
</div>
</div>
@stop
@endif

View File

@@ -4,7 +4,11 @@
@section('content_header')
<h4>Administration / Open Positions</h4>
@if (Auth::user()->hasAnyRole('admin', 'hiringManager'))
<h4>Administration / Open Positions</h4>
@else
<h4>Application Access Denied</h4>
@endif
@stop
@@ -33,7 +37,7 @@
@stop
@section('content')
@if (Auth::user()->hasAnyRole('admin', 'hiringManager'))
<!-- todo: switch to modal component -->
<div class="modal fade" tabindex="-1" id="newVacancyForm" role="dialog" aria-labelledby="modalFormLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
@@ -157,9 +161,8 @@
<thead>
<tr>
<th>#</th>
<th>Vacancy Name</th>
<th>Vacancy Description</th>
<th>Name</th>
<th>Description</th>
<th>Discord Role ID</th>
<th>Perm. Group Name</th>
<th>Open Slots</th>
@@ -175,8 +178,6 @@
@foreach($vacancies as $vacancy)
<tr>
<td>{{$vacancy->id}}</td>
<td>{{$vacancy->vacancyName}}</td>
<td>{{substr($vacancy->vacancyDescription, 0, 20)}}...</td>
<td><span class="badge badge-success">{{$vacancy->discordRoleID}}</span></td>
@@ -194,7 +195,7 @@
@if ($vacancy->vacancyStatus == 'OPEN')
<form action="{{route('updatePositionAvailability', ['status' => 'close', 'id' => $vacancy->id])}}" method="POST" id="closePosition">
<form action="{{route('updatePositionAvailability', ['status' => 'close', 'id' => $vacancy->id])}}" method="POST" id="closePosition" style="display: inline">
@csrf
@method('PATCH')
<button type="submit" class="btn btn-sm btn-danger"><i class="fa fa-ban"></i></button>
@@ -202,7 +203,7 @@
@else
<form action="{{route('updatePositionAvailability', ['status' => 'open', 'id' => $vacancy->id])}}" method="POST" id="openPosition">
<form action="{{route('updatePositionAvailability', ['status' => 'open', 'id' => $vacancy->id])}}" method="POST" id="openPosition" style="display: inline">
@csrf
@method('PATCH')
<button type="submit" class="btn btn-sm btn-success"><i class="fa fa-check"></i></button>
@@ -239,5 +240,7 @@
</div>
</div>
@else
<x-no-permission type="danger"></x-no-permission>
@endif
@stop

View File

@@ -11,12 +11,37 @@
@section('js')
<script type="text/javascript" src="/js/app.js"></script>
<x-global-errors></x-global-errors>
@stop
@section('content')
@foreach($applications as $application)
<x-modal id="deletionConfirmationModal-{{ $application->id }}" modal-label="deletion-{{ $application->id }}" modal-title="Are you sure?" include-close-button="true">
<h4><i class="fas fa-exclamation-triangle"></i> Really delete this?</h3>
<p>
This action is <b>IRREVERSBILE.</b>
</p>
<p>Comments, appointments and any votes attached to this application WILL be deleted too. Please make sure this application really needs to be deleted.</p>
<x-slot name="modalFooter">
<form method="POST" action="{{ route('deleteApplication', ['application' => $application->id]) }}">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger"><i class="fas fa-check-double"></i> Confirm</button>
</form>
</x-slot>
</x-modal>
@endforeach
<div class="row">
@@ -167,6 +192,7 @@
<td>{{ $application->created_at }}</td>
<td>
<button type="button" class="btn btn-success btn-sm" onclick="window.location.href='{{ route('showUserApp', ['id' => $application->id]) }}'"><i class="fas fa-eye"></i> View</button>
<button type="button" class="btn btn-danger btn-sm ml-2" onclick="$('#deletionConfirmationModal-{{ $application->id }}').modal('show')"><i class="fa fa-trash"></i> Delete</button>
</td>
</tr>