after action reports

This commit is contained in:
2021-03-19 21:31:14 +09:00
parent d7d98b5195
commit dd64010236
8 changed files with 104 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ class AfterActionReportsController extends Controller
}
public function DisplayReportForm() {
return view('reports.user.displayform');
return view('reports.user.form.report');
}
public function StoreReport(Request $request) {
@@ -54,14 +54,18 @@ class AfterActionReportsController extends Controller
return redirect('/reports/display/all')->with('success', 'Added report to the database.');
}
public function DisplayCommentForm($id) {
return view('reports.user.form.comment')->with('id', $id);
}
public function StoreComment(Request $request) {
$this->validate($request, [
'report_id' => 'required',
'reportId' => 'required',
'comments' => 'required',
]);
$comment = new AfterActionReportComment;
$comment->report_id = $request->report_id;
$comment->report_id = $request->reportId;
$comment->character_id = auth()->user()->getId();
$comment->character_name = auth()->user()->getName();
$comment->comments = $required->comments;
@@ -72,8 +76,10 @@ class AfterActionReportsController extends Controller
public function DisplayAllReports() {
//Grab all the reports
$reports = AfterActionReports::where('created_at', '>=', Carbon::now()->subDays(30))->toArray();
$reports = AfterActionReports::where('created_at', '>=', Carbon::now()->subDays(30));
$comments = AfterActionReportComment::where('created_at', '>=', Carbon::now()->subDays(30));
return view('reports.user.displayreports')->with('reports', $reports);
return view('reports.user.displayreports')->with('reports', $reports)
->with('comments', $comments);
}
}

View File

@@ -37,7 +37,5 @@ class AfterActionReport extends Model
public function comments() {
return $this->hasMany(App\Models\AfterActionReports\AfterActionReportComment::class, 'report_id', 'id');
}
}
}

View File

@@ -25,6 +25,11 @@
<!-- Mining Tax Items -->
@include('layouts.user.sidebarmenu.miningtax')
<!-- End Mining Tax Items -->
<!-- After Action Reports -->
@if(auth()->user()->hasPermission('fc.team'))
@include('layouts.user.sidebarmenu.reports')
@endif
<!-- End After Action Reports -->
<!-- SRP Items -->
@include('layouts.user.sidebarmenu.srp')
<!-- SRP Items -->

View File

@@ -0,0 +1,22 @@
<li class="nav-item has-treeview">
<a href="#" class="nav-link">
<i class="nav-icon fas fa-cubes"></i>
<p>After Action Reports<br>
<i class="right fas fa-angle-left"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="/reports/display/all" class="nav-link">
<i class="fas fa-cog nav-icon"></i>
<p>Display Reports</p>
</a>
</li>
<li class="nav-item">
<a href="/reports/display/report/form" class="nav-link">
<i class="fas fa-cog nav-icon"></i>
<p>Report Form</p>
</a>
</li>
</ul>
</li>

View File

@@ -1,14 +1,42 @@
@extends('layouts.user.dashb4')
@section('content')
<br>
if($reports != null)
@foreach($reports as $report)
<div class="card">
<div class="card-header">
<!-- Body of report goes here -->
FC: {{ $report->fc_name }}<br>
Formup: {{ $report->formup_location }}@{{ $report->formup_time }}<br>
Comms: {{ $report->comms }}<br>
Doctrine: {{ $report->doctrine }}<br>
Objective: {{ $report->objective }}<br>
Fleet Result: {{ $report->objective_result }}<br>
Summary: {{ $report->summary }}<br>
Improvements: {{ $report->improvements }}<br>
Worked Well: {{ $report->worked_well }}<br>
Additional Comments: {{ $report->additional_comments }}<br>
<a class="btn btn-outline-dark" href="/reports/display/comment/form/{{$report->id}}" role="button">Click to Comment</a>
</div>
<div class="card-body">
@foreach($comments as $comment)
@if($comment->report_id == $report->id)
Name: {{$comment->character_name }}<br>
Comments: {{ $comment->comments }}<br>
<br>
@endif
@endforeach
</div>
</div>
@endforeach
@else
<div class="card">
<div class="card-header">
<h2>Heads Be Rolling Soon</h2>
</div>
<div class="card-body">
No fc's have submitted reports recently.
</div>
</div>
@endif
@endsection

View File

@@ -0,0 +1,21 @@
@extends('layouts.user.dashb4')
@section('content')
<br>
<div class="container">
<div class="card">
<div class="card-header">
<h2>Add New Comment for After Action Report</h2>
</div>
<div class="card-body">
{!! Form::open(['action' => 'AfterActionReports\AfterActionReportsController@StoreComment', 'method' => 'POST']) !!}
{{ Form::hidden('reportId', $id) }}
<div class="form-group">
{{ Form::label('comments', 'Comments') }}
{{ Form::textarea('comments', '', ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
</div>
</div>
@endsection

View File

@@ -41,9 +41,22 @@ Route::group(['middleware' => ['auth']], function(){
Route::post('/admin/remove/user', 'Dashboard\AdminDashboardController@removeUser');
Route::post('/admin/modify/user/display', 'Dashboard\AdminDashboardController@displayModifyUser');
Route::post('/admin/add/allowedlogin', 'Dashboard\AdminDashboardController@addAllowedLogin');
Route::post('/admin/rmoeve/allowedlogin', 'Dashboard\AdminDashboardController@removeAllowedLogin');
Route::post('/admin/remove/allowedlogin', 'Dashboard\AdminDashboardController@removeAllowedLogin');
Route::get('/admin/dashboard', 'Dashboard\AdminDashboardController@displayAdminDashboard');
/**
* After Action Report display pages
*/
Route::get('/reports/display/all', 'AfterActionReports\AfterActionReportsController@DisplayAllReports');
Route::get('/reports/display/report/form', 'AfterActionReports\AfterActionReportsController@DisplayReportForm');
Route::get('/reports/display/comment/form/{id}', 'AfterActionReports\AfterActionReportsController@DisplayCommentForm');
Route::post('/reports/store/new/report', 'AfterActionReports\AfterActionReportsController@StoreReport');
Route::post('/reports/store/new/comments', 'AfterActionReports\AfterActionReportsController@StoreComment');
/**
* After Action Reports Admin display pages
*/
/**
* Blacklist Controller display pages
*/