From b23d7195c59870486d474a7e9a9febc9bda88c48 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Mon, 15 Mar 2021 00:52:39 +0900 Subject: [PATCH] after action reports --- .../AfterActionReportsController.php | 5 +- .../AfterActionReports/AfterActionReport.php | 5 +- .../views/reports/user/displayform.blade.php | 50 ++++++++++++++++++- .../reports/user/displayreports.blade.php | 10 ++++ 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php b/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php index 7b8e07208..56b2c8da3 100644 --- a/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php +++ b/app/Http/Controllers/AfterActionReports/AfterActionReportsController.php @@ -48,7 +48,7 @@ class AfterActionReportsController extends Controller $report->summary = $request->summary; $report->improvements = $request->improvements; $report->worked_well = $request->well; - $report->additon_comments = $request->comments; + $report->additonal_comments = $request->comments; $report->save(); return redirect('/reports/display/all')->with('success', 'Added report to the database.'); @@ -71,9 +71,6 @@ class AfterActionReportsController extends Controller } public function DisplayAllReports() { - //Declare variables - $comments = array(); - //Grab all the reports $reports = AfterActionReports::where('created_at', '>=', Carbon::now()->subDays(30))->toArray(); diff --git a/app/Models/AfterActionReports/AfterActionReport.php b/app/Models/AfterActionReports/AfterActionReport.php index 4c238c54d..09b204d56 100644 --- a/app/Models/AfterActionReports/AfterActionReport.php +++ b/app/Models/AfterActionReports/AfterActionReport.php @@ -36,7 +36,8 @@ class AfterActionReport extends Model ]; public function comments() { - return $this->hasMany(App\Models\AfterActionReports\AfterActionReportComment::class, 'report_id', 'id'); - + return $this->hasMany(App\Models\AfterActionReports\AfterActionReportComment::class, 'report_id', 'id'); } + + } diff --git a/resources/views/reports/user/displayform.blade.php b/resources/views/reports/user/displayform.blade.php index b687d43ed..286df9180 100644 --- a/resources/views/reports/user/displayform.blade.php +++ b/resources/views/reports/user/displayform.blade.php @@ -4,10 +4,56 @@
- +

After Action Report Form

- + {!! Form::open([ + 'action' => 'AfterActionReports\AfterActionReportsController@StoreReport', + 'method' => 'POST', + ]) + !!} +
+ {{ Form::label('location', 'Location') }} + {{ Form::text('location', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('time', 'Time') }} + {{ Form::dateTime('time', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('comms', 'Comms') }} + {{ Form::text('comms', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('doctrine', 'Doctrine') }} + {{ Form::text('doctrine', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('objective', 'Objective') }} + {{ Form::text('objective', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('result', 'Result') }} + {{ Form::select('result', ['Win', 'Loss', 'Neither'], ['class' => 'form-control']) }} +
+
+ {{ Form::label('summary', 'Summary') }} + {{ Form::textarea('summary', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('improvements', 'Improvements') }} + {{ Form::textarea('improvements', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('well', 'What Worked Well?') }} + {{ Form::textarea('well', '', ['class' => 'form-control']) }} +
+
+ {{ Form::label('comments', 'Additional Comments') }} + {{ Form::textarea('comments', '', ['class' => 'form-control']) }} +
+ {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!}
diff --git a/resources/views/reports/user/displayreports.blade.php b/resources/views/reports/user/displayreports.blade.php index 611c41198..b370afbdc 100644 --- a/resources/views/reports/user/displayreports.blade.php +++ b/resources/views/reports/user/displayreports.blade.php @@ -1,4 +1,14 @@ @extends('layouts.user.dashb4') @section('content') +
+@foreach($reports as $report) +
+
+
+
+ +
+
+@endforeach @endsection \ No newline at end of file