Miguel Nogueira
5f1f92a9ce
This commit fixes some superficial instances of Broken Access Control (https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A5-Broken_Access_Control). There may be some more instances of this, as authorization was only done after most of the controllers were done (big mistake). Some refactoring was also performed, where Route Model Binding with DI (dependency injection) was used whenever possible, to increase testability of the codebase. Some reused code was also moved to Helper classes as to enforce DRY; There may be some lines of code that are still copy-pasted from other parts of the codebase for reuse. Non-breaking refactoring changes were made, but the app as a whole still needs full manual testing, and customised responses to HTTP 500 responses. Some errors are also not handled gracefully and this wasn't checked in this commit.
103 lines
3.0 KiB
PHP
103 lines
3.0 KiB
PHP
@extends('adminlte::page')
|
|
|
|
@section('title', 'Raspberry Network | Application Form Management Tool')
|
|
|
|
@section('content_header')
|
|
|
|
<h4>Administration / Forms</h4>
|
|
|
|
@stop
|
|
|
|
@section('js')
|
|
|
|
<x-global-errors></x-global-errors>
|
|
|
|
@stop
|
|
|
|
@section('content')
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<div class="card bg-gray-dark">
|
|
|
|
<div class="card-header bg-indigo">
|
|
<div class="card-title"><h4 class="text-bold">Available Forms</h4></div>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
@if(!$forms->isEmpty())
|
|
|
|
<table class="table table-active table-borderless" style="white-space: nowrap">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Form Title</th>
|
|
<th>Created On</th>
|
|
<th>Updated On</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach($forms as $form)
|
|
|
|
<tr>
|
|
<td>{{$form->id}}</td>
|
|
<td>{{$form->formName}}</td>
|
|
<td>{{$form->created_at}}</td>
|
|
<td>{{ $form->updated_at }}</td>
|
|
<td>
|
|
<form style="display: inline-block; white-space: nowrap" action="{{route('destroyForm', ['form' => $form->id])}}" method="POST">
|
|
|
|
@method('DELETE')
|
|
@csrf
|
|
|
|
<button type="submit" class="btn btn-sm btn-danger mr-2"><i class="fa fa-trash"></i> Delete</button>
|
|
</form>
|
|
<button type="button" class="btn btn-sm btn-success" onclick="window.location.href='{{ route('previewForm', ['form' => $form->id]) }}'"><i class="fa fa-eye"></i> Preview</button>
|
|
</td>
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
@else
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
Nothing to see here! Please add some forms first.
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
<div class="card-footer">
|
|
|
|
<button type="button" class="btn btn-outline-primary" onclick="window.location.href='{{route('showFormBuilder')}}'">NEW FORM</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@stop
|
|
|
|
@section('footer')
|
|
@include('breadcrumbs.dashboard.footer')
|
|
@stop
|