#21 list user's pireps
This commit is contained in:
parent
c3177413dd
commit
807ac69ae9
@ -5,6 +5,8 @@ namespace App\Http\Controllers\Frontend;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
|
||||
use App\Models\Pirep;
|
||||
|
||||
|
||||
class PirepController extends AppBaseController
|
||||
{
|
||||
@ -15,8 +17,19 @@ class PirepController extends AppBaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$pireps = Pirep::where('user_id', $user->id)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
return $this->view('pireps.index', [
|
||||
'user' => Auth::user(),
|
||||
'user' => $user,
|
||||
'pireps' => $pireps,
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('pireps.create');
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<a class="nav-link" href="{!! url('/pireps') !!}">
|
||||
<i class="fa fa-cloud-upload" aria-hidden="true"></i>
|
||||
<p>PIREPs</p>
|
||||
</a>
|
||||
|
@ -0,0 +1,17 @@
|
||||
@extends('layouts.default.app')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div style="float:right;">
|
||||
<a class="btn btn-primary pull-right"
|
||||
style="margin-top: -10px;margin-bottom: 5px"
|
||||
href="{!! route('frontend.pireps.create') !!}">File New PIREP</a>
|
||||
</div>
|
||||
<h1>PIREPs</h1>
|
||||
@include('flash::message')
|
||||
@include('layouts.default.pireps.table')
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
56
resources/views/layouts/default/pireps/table.blade.php
Normal file
56
resources/views/layouts/default/pireps/table.blade.php
Normal file
@ -0,0 +1,56 @@
|
||||
@foreach($pireps as $pirep)
|
||||
<div class="card">
|
||||
<div class="card-block" style="min-height: 0px">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<h5>
|
||||
<a class="text-c" href="{!! route('frontend.flights.show', [$pirep->flight_id]) !!}">
|
||||
{!! $pirep->airline->code !!}{!! $pirep->flight->flight_number !!}
|
||||
</a>
|
||||
</h5>
|
||||
<div>
|
||||
@if($pirep->status == config('enums.pirep_status.PENDING'))
|
||||
<div class="badge badge-warning">Pending</div>
|
||||
@elseif($pirep->status == config('enums.pirep_status.ACCEPTED'))
|
||||
<div class="badge badge-success">Accepted</div>
|
||||
@else
|
||||
<div class="badge badge-danger">Rejected</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<span class="description">DEP </span>
|
||||
{!! $pirep->dpt_airport->icao !!}
|
||||
<span class="description">ARR </span>
|
||||
{!! $pirep->arr_airport->icao !!}
|
||||
</div>
|
||||
<div><span class="description">FLIGHT TIME </span>
|
||||
{!! Utils::secondsToTime($pirep->flight_time) !!}
|
||||
</div>
|
||||
<div><span class="description">Aircraft </span>
|
||||
{!! $pirep->aircraft->registration !!} ({!! $pirep->aircraft->name !!})
|
||||
</div>
|
||||
<div>
|
||||
<span class="description">Flight Level </span>
|
||||
{!! $pirep->level !!}
|
||||
</div>
|
||||
<div>
|
||||
<span class="description">File Date </span>
|
||||
{!! $pirep->created_at !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<span class="description">more data </span>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<span class="description">more data </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
@ -17,6 +17,8 @@ Route::group([
|
||||
Route::match(['post'], 'flights/save', 'FlightController@save');
|
||||
|
||||
Route::resource('profile', 'ProfileController');
|
||||
|
||||
Route::resource('pireps', 'PirepController');
|
||||
});
|
||||
|
||||
Auth::routes();
|
||||
|
Loading…
Reference in New Issue
Block a user