user dashboard shows real data
This commit is contained in:
parent
c42b920903
commit
eb6e624a4d
@ -18,11 +18,12 @@ users:
|
||||
rank_id: 1
|
||||
home_airport_id: KAUS
|
||||
curr_airport_id: KJFK
|
||||
flights: 1
|
||||
flights: 3
|
||||
flight_time: 43200
|
||||
last_pirep_id: pirepid_3
|
||||
state: 1
|
||||
created_at: now
|
||||
updated_at: now
|
||||
state: 1
|
||||
- id: 2
|
||||
name: Carla Walters
|
||||
email: carla.walters68@example.com
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Log;
|
||||
use Exception;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
@ -17,7 +18,7 @@ class Handler extends ExceptionHandler
|
||||
\Illuminate\Auth\AuthenticationException::class,
|
||||
\Illuminate\Auth\Access\AuthorizationException::class,
|
||||
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
||||
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
|
||||
#\Illuminate\Database\Eloquent\ModelNotFoundException::class,
|
||||
\Illuminate\Session\TokenMismatchException::class,
|
||||
\Illuminate\Validation\ValidationException::class,
|
||||
];
|
||||
@ -80,7 +81,10 @@ class Handler extends ExceptionHandler
|
||||
__DIR__ . '/views',
|
||||
]);
|
||||
|
||||
Log::info('error status '. $status);
|
||||
|
||||
if (view()->exists("errors::{$status}")) {
|
||||
#if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) {
|
||||
return response()->view("errors::{$status}", ['exception' => $e], $status, $e->getHeaders());
|
||||
} else {
|
||||
return $this->convertExceptionToResponse($e);
|
||||
|
@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\Repositories\PirepRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
|
||||
|
||||
class DashboardController extends AppBaseController
|
||||
{
|
||||
private $pirepRepo, $userRepo;
|
||||
@ -28,10 +29,21 @@ class DashboardController extends AppBaseController
|
||||
$pireps = $this->pirepRepo->recent();
|
||||
$users = $this->userRepo->recent();
|
||||
|
||||
$last_pirep = null;
|
||||
$user = Auth::user();
|
||||
|
||||
try {
|
||||
$last_pirep = $this->pirepRepo->find($user->last_pirep_id);
|
||||
} catch(\Exception $e) {
|
||||
Log::info('No last PIREP for ' . $user->pilot_id);
|
||||
}
|
||||
|
||||
|
||||
return $this->view('dashboard.index', [
|
||||
'user' => Auth::user(),
|
||||
'user' => $user,
|
||||
'pireps' => $pireps,
|
||||
'users' => $users,
|
||||
'last_pirep' => $last_pirep,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
<div style="float: left; position: absolute; display:block; top: 0px;font-size: 150px">
|
||||
<i class="fa fa-clock-o" style="opacity: .1;"></i>
|
||||
</div>
|
||||
<h4 class="">{!! \App\Facades\Utils::secondsToTimeString($user->flight_time, false)!!}</h4>
|
||||
<h4 class="">{!! \App\Facades\Utils::minutesToTimeString($user->flight_time, false)!!}</h4>
|
||||
<h5 class="description" style="color: white;">total hours</h5>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,17 +41,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($last_pirep === null)
|
||||
<div class="card">
|
||||
<div class="nav nav-tabs" role="tablist" style="background: #067ec1; color: #FFF;">
|
||||
Your Last Report
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
|
||||
</div>
|
||||
<div class="card-block" style="text-align:center;">
|
||||
No reports yet. <a href="{!! route('frontend.pireps.create') !!}">File one now.</a>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="nav nav-tabs" role="tablist" style="background: #067ec1; color: #FFF;">
|
||||
Your Last Report
|
||||
</div>
|
||||
@include('layouts.default.pireps.pirep_card', ['pirep' => $last_pirep])
|
||||
@endif
|
||||
|
||||
<div class="card">
|
||||
<div class="nav nav-tabs" role="tablist" style="background: #067ec1; color: #FFF;">
|
||||
|
@ -1,7 +1,8 @@
|
||||
@extends('layouts.default.app')
|
||||
@section('title', 'not authorized')
|
||||
@section('content')
|
||||
<div class="container registered-page">
|
||||
<h3>Unauthorized</h3>
|
||||
<p>Well, this is embarrassing, you are not authorized to access or perform this function. Click <a href="{{ url()->previous() }}">here</a> to go back to the home page.</p>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
@ -1,4 +1,5 @@
|
||||
@extends('layouts.default.app')
|
||||
@section('title', 'not found')
|
||||
@section('content')
|
||||
<div class="container registered-page">
|
||||
<h3>Page Not Found</h3>
|
||||
|
59
resources/views/layouts/default/pireps/pirep_card.blade.php
Normal file
59
resources/views/layouts/default/pireps/pirep_card.blade.php
Normal file
@ -0,0 +1,59 @@
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="card-block" style="min-height: 0px">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 text-center">
|
||||
<h5>
|
||||
<a class="text-c" href="{!! route('frontend.pireps.show', [$pirep->id]) !!}">
|
||||
{!! $pirep->airline->code !!}
|
||||
@if($pirep->flight_id)
|
||||
{!! $pirep->flight->flight_number !!}
|
||||
@else
|
||||
{!! $pirep->flight_number !!}
|
||||
@endif
|
||||
</a>
|
||||
</h5>
|
||||
<div>
|
||||
@if($pirep->state == PirepState::PENDING)
|
||||
<div class="badge badge-warning">Pending</div>
|
||||
@elseif($pirep->state == PirepState::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::minutesToTimeString($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>
|
@ -1,61 +1 @@
|
||||
@foreach($pireps as $pirep)
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="card-block" style="min-height: 0px">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 text-center">
|
||||
<h5>
|
||||
<a class="text-c" href="{!! route('frontend.pireps.show', [$pirep->id]) !!}">
|
||||
{!! $pirep->airline->code !!}
|
||||
@if($pirep->flight_id)
|
||||
{!! $pirep->flight->flight_number !!}
|
||||
@else
|
||||
{!! $pirep->flight_number !!}
|
||||
@endif
|
||||
</a>
|
||||
</h5>
|
||||
<div>
|
||||
@if($pirep->state == PirepState::PENDING)
|
||||
<div class="badge badge-warning">Pending</div>
|
||||
@elseif($pirep->state == PirepState::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::minutesToTimeString($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
|
||||
@each('layouts.default.pireps.pirep_card', $pireps, 'pirep')
|
||||
|
Loading…
Reference in New Issue
Block a user