Commit 29eee4a8 authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

style changes fixing exceptions idk lots of stuff. New image assets

parent b12df85c
......@@ -20,3 +20,5 @@ DB_PASSWORD=secret
SAML_SIMPLESAMLPHP_AUTOLOAD=/var/simplesamlphp/lib/_autoload.php
SAML_SIMPLESAMLPHP_AUTH_SOURCE=default-sp
FRONTEND_URL=https://localhost:8080
SUPPORT_EMAIL=elock@persignum.com
......@@ -10,6 +10,7 @@ use Source\Exceptions\EntityExistsException;
use Source\Exceptions\AuthorizationException;
use Source\Exceptions\EntityNotFoundException;
use Source\UseCases\Door\ScheduleEvents\JsonPresenter;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Source\UseCases\Door\ScheduleEvents\ScheduleEventsUseCase;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Source\Exceptions\AuthenticationException as SourceAuthenticationException;
......@@ -81,6 +82,13 @@ class Handler extends ExceptionHandler
}
}
if ($e instanceof EntityNotFoundException ||
$e instanceof SourceAuthenticationException ||
$e instanceof AuthorizationException ||
$e instanceof EntityExistsException) {
throw new HttpException($e->getCode(), $e->getMessage());
}
return parent::render($request, $e);
}
}
......@@ -6,6 +6,8 @@ namespace App\Http\Controllers\Web\Admin;
use Illuminate\View\View;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Source\Exceptions\EntityExistsException;
use Illuminate\Validation\ValidationException;
use Source\UseCases\Doors\GetDoor\GetDoorUseCase;
use Source\UseCases\Doors\GetDoors\GetDoorsUseCase;
use Source\UseCases\Groups\GetGroups\GetGroupsUseCase;
......@@ -73,7 +75,6 @@ class DoorsController extends Controller
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\EntityNotFoundException
* @throws \Source\Exceptions\EntityExistsException
*/
public function update(string $doorId, UpdateDoorUseCase $updateDoor): RedirectResponse
{
......@@ -83,7 +84,11 @@ class DoorsController extends Controller
]);
$presenter = new UpdateDoorPresenter();
try {
$updateDoor->update($doorId, $this->request->all(), $presenter);
} catch (EntityExistsException $e) {
throw ValidationException::withMessages(['errors' => $e->getMessage()]);
}
return redirect(route('web.admin.doors.index'))->with($presenter->getViewModel());
}
......@@ -92,7 +97,6 @@ class DoorsController extends Controller
* @param \Source\UseCases\Doors\CreateDoor\CreateDoorUseCase $createDoor
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\EntityExistsException
*/
public function store(CreateDoorUseCase $createDoor): RedirectResponse
{
......@@ -103,7 +107,11 @@ class DoorsController extends Controller
$presenter = new CreateDoorPresenter();
try {
$createDoor->create($this->request->all(), $presenter);
} catch (EntityExistsException $e) {
throw ValidationException::withMessages(['errors' => $e->getMessage()]);
}
return redirect(route('web.admin.doors.index'))->with($presenter->getViewModel());
}
......@@ -127,14 +135,18 @@ class DoorsController extends Controller
* @param string $doorId
* @param \Source\UseCases\Doors\GenerateDoorToken\GenerateDoorTokenUseCase $tokenGenerator
* @return \Illuminate\Http\RedirectResponse
* @throws \Source\Exceptions\EntityExistsException
* @throws \Source\Exceptions\EntityNotFoundException
* @throws \Illuminate\Validation\ValidationException
*/
public function regenerateToken(string $doorId, GenerateDoorTokenUseCase $tokenGenerator): RedirectResponse
{
$presenter = new WebTokenGeneratePresenter();
try {
$tokenGenerator->generate($doorId, $presenter);
} catch (EntityExistsException $e) {
throw ValidationException::withMessages(['error' => 'Please re-perform this action. ' . $e->getMessage()]);
}
return redirect()->back()->with($presenter->getViewModel());
}
......
......@@ -6,7 +6,9 @@ use Illuminate\View\View;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Source\Exceptions\DeleteFailedException;
use Source\Exceptions\EntityExistsException;
use Source\Exceptions\AuthorizationException;
use Illuminate\Validation\ValidationException;
use Source\UseCases\Users\GetUser\GetUserUseCase;
use Source\UseCases\Doors\GetDoors\GetDoorsUseCase;
use Source\UseCases\Users\GetUsers\GetUsersUseCase;
......@@ -52,7 +54,6 @@ class UsersController extends Controller
* @param \Source\UseCases\Users\CreateUser\CreateUserUseCase $createUser
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\EntityExistsException
*/
public function store(CreateUserUseCase $createUser): RedirectResponse
{
......@@ -69,7 +70,11 @@ class UsersController extends Controller
$presenter = new CreateUserPresenter();
try {
$createUser->create($this->request->all(), $presenter);
} catch (EntityExistsException $e) {
throw ValidationException::withMessages(['error' => $e->getMessage()]);
}
return redirect(route('web.admin.users.index'))->with($presenter->getViewModel());
}
......@@ -98,7 +103,6 @@ class UsersController extends Controller
* @param \Source\UseCases\Users\UpdateUser\UpdateUserUseCase $updateUser
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\EntityExistsException
*/
public function update(string $userId, UpdateUserUseCase $updateUser): RedirectResponse
{
......@@ -118,7 +122,7 @@ class UsersController extends Controller
try {
$updateUser->update($userId, $this->request->all(), $presenter);
} catch (AuthorizationException $e) {
return redirect()->back()->with(['error' => $e->getMessage()]);
throw ValidationException::withMessages(['error' => $e->getMessage()]);
}
return redirect(route('web.admin.users.index'))->with($presenter->getViewModel());
......
......@@ -31,7 +31,6 @@ class MeController extends Controller
* @return \Illuminate\View\View
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\AuthorizationException
* @throws \Source\Exceptions\EntityExistsException
*/
public function doorcodeUpdate(UpdateCurrentUser $userUpdate): View
{
......@@ -55,7 +54,6 @@ class MeController extends Controller
* @return \Illuminate\View\View
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\AuthorizationException
* @throws \Source\Exceptions\EntityExistsException
*/
public function passwordUpdate(UpdateCurrentUser $userUpdate): View
{
......
......@@ -16,7 +16,7 @@
</div>
<div class="form-group col-3">
<button id="submitDoorId" type="submit" class="btn btn-primary">View Access</button>
<a href="{{ route('web.requests.build') }}" class="btn btn-success">Request Door Access</a>
<a href="{{ route('web.requests.build') }}" class="btn btn-secondary">Request Door Access</a>
</div>
</div>
</form>
......
@extends('layouts.admin')
@section('main-content')
<!-- Page Heading -->
<h1 class="h3 mb-4 text-gray-800">{{ __('About') }}</h1>
@section('title', 'About')
@section('main-content')
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="card shadow mb-4">
<div class="card-profile-image mt-4">
<img src="{{ asset('img/favicon.png') }}" class="rounded-circle" alt="user-image">
</div>
{{-- <div class="card-profile-image mt-4">--}}
{{-- <img src="{{ asset('img/favicon.png') }}" class="rounded-circle" alt="user-image">--}}
{{-- </div>--}}
<div class="card-body">
<div class="row">
<div class="col-lg-12 mb-1">
<div class="text-center">
<h5 class="font-weight-bold">Alejandro RH</h5>
<h5 class="font-weight-bold">E-Lock/Doorcode</h5>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4 mb-1 text-center">
<a href="https://facebook.com/aleckrh" target="_blank" class="btn btn-facebook btn-circle btn-lg"><i class="fab fa-facebook-f fa-fw"></i></a>
</div>
<div class="col-md-4 mb-1 text-center">
<a href="https://github.com/aleckrh" target="_blank" class="btn btn-github btn-circle btn-lg"><i class="fab fa-github fa-fw"></i></a>
</div>
<div class="col-md-4 mb-1 text-center">
<a href="https://twitter.com/aleckrh" target="_blank" class="btn btn-twitter btn-circle btn-lg"><i class="fab fa-twitter fa-fw"></i></a>
<div class="col-lg-12">
<h5 class="font-weight-bold">General Information</h5>
<p>
The E-Lock system controls access to all the doors with keypads in Kretschmar Hall and
Chan Shun Pavilion at Walla Walla University. It allows students and faculty to manage
their own door code to enter doors, as well as shows users what doors they have access
to and when. It has an API to allow users a nice programmatic interface for the system.
It also allows administrators to manage the door system in the building.
</p>
</div>
</div>
......@@ -40,12 +42,15 @@
<div class="row">
<div class="col-lg-12">
<h5 class="font-weight-bold">Laravel SB Admin 2</h5>
<p>SB Admin 2 for Laravel.</p>
<p>Recommend to install this preset on a project that you are starting from scratch, otherwise your project's design might break.</p>
<a href="https://github.com/aleckrh/laravel-sb-admin-2" target="_blank" class="btn btn-github">
<i class="fab fa-github fa-fw"></i> Go to repository
</a>
<h5 class="font-weight-bold">Support</h5>
<p>
The creator (JD), is available for support and fixing bugs. Please post any bugs as
issues onto the
<a href="https://gitlab.cs.wallawalla.edu/elock" target="_blank">GitLab</a> repository.
He will get to them if he sees them. Alternatively you can also shoot an email to
<a href="mailto:{{env('SUPPORT_EMAIL', 'blank')}}">{{ env('SUPPORT_EMAIL', '(You can\'t because no support email is configured)') }}</a>
for any questions, concerns, or for faster response time on bug fixes.
</p>
</div>
</div>
......@@ -54,20 +59,16 @@
<div class="row">
<div class="col-lg-12">
<h5 class="font-weight-bold">Credits</h5>
<p>Laravel SB Admin 2 uses some open-source third-party libraries/packages, many thanks to the web community.</p>
<p>The E-Lock system was written by Jacob Priddy, a 2020 EE and CS graduate.</p>
<ul>
<li><a href="https://laravel.com" target="_blank">Laravel</a> - Open source framework.</li>
<li><a href="https://github.com/DevMarketer/LaravelEasyNav" target="_blank">LaravelEasyNav</a> - Making managing navigation in Laravel easy.</li>
<li><a href="https://gitlab.cs.wallawalla.edu/elock" target="_blank">GitLab</a> - Source code for the project.</li>
<li><a href="https://startbootstrap.com/themes/sb-admin-2" target="_blank">SB Admin 2</a> - Thanks to Start Bootstrap.</li>
<li><a href="https://laravel.com" target="_blank">Laravel</a> - Open source framework.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
......@@ -7,26 +7,26 @@
])
@section('filters')
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="doorId">
Door ID:
</label>
<input type="number" name="door_id" id="doorId" class="form-control" value="{{ request('door_id') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="start">
Start:
</label>
<input type="date" name="start" id="start" class="form-control" value="{{ request('start') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="end">
End:
</label>
<input type="date" name="end" id="end" class="form-control" value="{{ request('end') }}">
</div>
<div class="col-sm-12 col-md-6 col-xl-3">
<div class="col-sm-12 col-md-6 col-xl-3 text-center">
<input class="btn btn-primary" type="submit" value="Filter">
</div>
@endsection
......
......@@ -8,21 +8,21 @@
])
@section('filters')
<div class="col-sm-12 col-md-6 col-xl-3 text-center">
<div class="col-sm-12 col-md-6 col-xl-3 text-center mb-3">
<label class="sr-only" for="query">
Search
</label>
<input id="query" type="text" name="query" placeholder="Search"
value="{{ request('query') }}">
</div>
<div class="col-sm-12 col-md-4 col-xl-2 text-center">
<div class="col-sm-12 col-md-4 col-xl-2 text-center mb-3">
<label class="sr-only" for="query">
Seen within seconds.
</label>
<input id="query" type="number" name="active_seconds" placeholder="Seen within (seconds)"
value="{{ request('active_seconds') }}">
</div>
<div class="col-sm-12 col-md-4 col-xl-2 text-center">
<div class="col-sm-12 col-md-4 col-xl-2 text-center mb-3">
<label class="sr-only" for="query">
Not seen since in seconds.
</label>
......
......@@ -15,7 +15,7 @@
</h1>
</div>
<div class="col-md-4 col-sm-12 text-center">
<a href="{{ url()->previous() }}" class="btn btn-primary btn-lg">
<a href="javascript:history.back()" class="btn btn-primary btn-lg">
Back
</a>
</div>
......
......@@ -15,7 +15,7 @@
</h1>
</div>
<div class="col-md-4 col-sm-12 text-center">
<a href="{{ url()->previous() }}" class="btn btn-primary btn-lg">
<a href="javascript:history.back()" class="btn btn-primary btn-lg">
Back
</a>
</div>
......
......@@ -7,32 +7,32 @@
])
@section('filters')
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="userId">
User ID:
</label>
<input type="number" name="user_id" id="userId" class="form-control" value="{{ request('user_id') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="doorId">
Door ID:
</label>
<input type="number" name="door_id" id="doorId" class="form-control" value="{{ request('door_id') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="start">
Start:
</label>
<input type="date" name="start" id="start" class="form-control" value="{{ request('start') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-md-0">
<label for="end">
End:
</label>
<input type="date" name="end" id="end" class="form-control" value="{{ request('end') }}">
</div>
<div class="col-sm-12 col-md-6 col-xl-3">
<div class="col-sm-12 col-md-6 col-xl-3 text-center">
<input class="btn btn-primary" type="submit" value="Filter">
</div>
@endsection
......
......@@ -8,7 +8,7 @@
])
@section('filters')
<div class="form-inline col-sm-12 col-md-6">
<div class="form-inline col-sm-12 col-md-6 text-center">
<label class="sr-only" for="query">
Search
</label>
......
......@@ -25,11 +25,12 @@
<div class="row">
<div class="col-xl-3 col-md-6 mb-4">
<a href="{{ route('web.admin.doors.index', ['active_seconds' => \Source\Entities\Door::AWOL_TIME_SECONDS]) }}">
<div class="card border-left-primary shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Doors
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Active Doors
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ $doorCount }}</div>
</div>
......@@ -39,9 +40,11 @@
</div>
</div>
</div>
</a>
</div>
<div class="col-xl-3 col-md-6 mb-4">
<a href="{{ route('web.admin.doors.index', ['awol_seconds' => \Source\Entities\Door::AWOL_TIME_SECONDS]) }}">
<div class="card border-left-success shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
......@@ -56,9 +59,11 @@
</div>
</div>
</div>
</a>
</div>
<div class="col-xl-3 col-md-6 mb-4">
<a href="{{ route('web.admin.requests.index', ['resolved' => 0]) }}">
<div class="card border-left-info shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
......@@ -73,6 +78,7 @@
</div>
</div>
</div>
</a>
</div>
<div class="col-xl-3 col-md-6 mb-4">
......
......@@ -8,32 +8,32 @@
])
@section('filters')
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3">
<label for="userId">
User ID:
</label>
<input type="number" name="user_id" id="userId" class="form-control" value="{{ request('user_id') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3">
<label for="doorId">
Door ID:
</label>
<input type="number" name="door_id" id="doorId" class="form-control" value="{{ request('door_id') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3">
<label for="start">
Start:
</label>
<input type="date" name="start" id="start" class="form-control" value="{{ request('start') }}">
</div>
<div class="form-inline col-sm-12 col-md-6 col-xl-3">
<div class="form-inline col-sm-12 col-md-6 col-xl-3 text-center mb-3 mb-xl-0">
<label for="end">
End:
</label>
<input type="date" name="end" id="end" class="form-control" value="{{ request('end') }}">
</div>
<div class="col-sm-12 col-md-6 col-xl-3">
<div class="col-sm-12 col-md-6 col-xl-3 text-center">
<input class="btn btn-primary" type="submit" value="Filter">
</div>
@endsection
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment