From dd6401023612bc58a5797d9001121ffa49a9bcad Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Fri, 19 Mar 2021 21:31:14 +0900 Subject: [PATCH] after action reports --- .../AfterActionReportsController.php | 16 +++++++--- .../AfterActionReports/AfterActionReport.php | 4 +-- .../layouts/user/dashboard/main.blade.php | 5 +++ .../user/sidebarmenu/reports.blade.php | 22 +++++++++++++ .../reports/user/displayreports.blade.php | 32 +++++++++++++++++-- .../views/reports/user/form/comment.blade.php | 21 ++++++++++++ .../report.blade.php} | 0 routes/web.php | 15 ++++++++- 8 files changed, 104 insertions(+), 11 deletions(-) create mode 100644 resources/views/layouts/user/sidebarmenu/reports.blade.php create mode 100644 resources/views/reports/user/form/comment.blade.php rename resources/views/reports/user/{displayform.blade.php => form/report.blade.php} (100%) diff --git a/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php b/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php index 56b2c8da3..66b7c17da 100644 --- a/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php +++ b/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php @@ -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); } } diff --git a/app/Models/AfterActionReports/AfterActionReport.php b/app/Models/AfterActionReports/AfterActionReport.php index 09b204d56..680adfe6a 100644 --- a/app/Models/AfterActionReports/AfterActionReport.php +++ b/app/Models/AfterActionReports/AfterActionReport.php @@ -37,7 +37,5 @@ class AfterActionReport extends Model public function comments() { return $this->hasMany(App\Models\AfterActionReports\AfterActionReportComment::class, 'report_id', 'id'); - } - - + } } diff --git a/resources/views/layouts/user/dashboard/main.blade.php b/resources/views/layouts/user/dashboard/main.blade.php index f8d06ec81..e0e1ab3dd 100644 --- a/resources/views/layouts/user/dashboard/main.blade.php +++ b/resources/views/layouts/user/dashboard/main.blade.php @@ -25,6 +25,11 @@ @include('layouts.user.sidebarmenu.miningtax') + + @if(auth()->user()->hasPermission('fc.team')) + @include('layouts.user.sidebarmenu.reports') + @endif + @include('layouts.user.sidebarmenu.srp') diff --git a/resources/views/layouts/user/sidebarmenu/reports.blade.php b/resources/views/layouts/user/sidebarmenu/reports.blade.php new file mode 100644 index 000000000..72a787f18 --- /dev/null +++ b/resources/views/layouts/user/sidebarmenu/reports.blade.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/resources/views/reports/user/displayreports.blade.php b/resources/views/reports/user/displayreports.blade.php index b370afbdc..7874d8cab 100644 --- a/resources/views/reports/user/displayreports.blade.php +++ b/resources/views/reports/user/displayreports.blade.php @@ -1,14 +1,42 @@ @extends('layouts.user.dashb4') @section('content')
+if($reports != null) @foreach($reports as $report)
- + + FC: {{ $report->fc_name }}
+ Formup: {{ $report->formup_location }}@{{ $report->formup_time }}
+ Comms: {{ $report->comms }}
+ Doctrine: {{ $report->doctrine }}
+ Objective: {{ $report->objective }}
+ Fleet Result: {{ $report->objective_result }}
+ Summary: {{ $report->summary }}
+ Improvements: {{ $report->improvements }}
+ Worked Well: {{ $report->worked_well }}
+ Additional Comments: {{ $report->additional_comments }}
+ Click to Comment
- + @foreach($comments as $comment) + @if($comment->report_id == $report->id) + Name: {{$comment->character_name }}
+ Comments: {{ $comment->comments }}
+
+ @endif + @endforeach
@endforeach +@else +
+
+

Heads Be Rolling Soon

+
+
+ No fc's have submitted reports recently. +
+
+@endif @endsection \ No newline at end of file diff --git a/resources/views/reports/user/form/comment.blade.php b/resources/views/reports/user/form/comment.blade.php new file mode 100644 index 000000000..31ddae12e --- /dev/null +++ b/resources/views/reports/user/form/comment.blade.php @@ -0,0 +1,21 @@ +@extends('layouts.user.dashb4') +@section('content') +
+
+
+
+

Add New Comment for After Action Report

+
+
+ {!! Form::open(['action' => 'AfterActionReports\AfterActionReportsController@StoreComment', 'method' => 'POST']) !!} + {{ Form::hidden('reportId', $id) }} +
+ {{ Form::label('comments', 'Comments') }} + {{ Form::textarea('comments', '', ['class' => 'form-control']) }} +
+ {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/reports/user/displayform.blade.php b/resources/views/reports/user/form/report.blade.php similarity index 100% rename from resources/views/reports/user/displayform.blade.php rename to resources/views/reports/user/form/report.blade.php diff --git a/routes/web.php b/routes/web.php index b6b82d40c..efb97011b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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 */