diff --git a/app/Http/Controllers/Frontend/AirportController.php b/app/Http/Controllers/Frontend/AirportController.php new file mode 100644 index 00000000..04714470 --- /dev/null +++ b/app/Http/Controllers/Frontend/AirportController.php @@ -0,0 +1,57 @@ +airportRepo = $airportRepo; + $this->flightRepo = $flightRepo; + } + + /** + * Show the airport + */ + public function show($id, Request $request) + { + $id = strtoupper($id); + + $airport = $this->airportRepo->find($id); + if (empty($airport)) { + Flash::error('Airport not found!'); + return redirect(route('frontend.dashboard.index')); + } + + $inbound_flights = $this->flightRepo->findWhere([ + 'arr_airport_id' => $id, + ])->all(); + + $outbound_flights = $this->flightRepo->findWhere([ + 'dpt_airport_id' => $id, + ])->all(); + + return view('airports.show', [ + 'airport' => $airport, + 'inbound_flights' => $inbound_flights, + 'outbound_flights' => $outbound_flights, + ]); + } +} diff --git a/app/Http/Controllers/Frontend/FlightController.php b/app/Http/Controllers/Frontend/FlightController.php index 95693346..e06589f1 100644 --- a/app/Http/Controllers/Frontend/FlightController.php +++ b/app/Http/Controllers/Frontend/FlightController.php @@ -9,6 +9,7 @@ use App\Repositories\AirportRepository; use App\Repositories\Criteria\WhereCriteria; use App\Repositories\FlightRepository; use App\Services\GeoService; +use Flash; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Log; @@ -132,7 +133,6 @@ class FlightController extends Controller $flight = $this->flightRepo->find($id); if (empty($flight)) { Flash::error('Flight not found!'); - return redirect(route('frontend.dashboard.index')); } diff --git a/app/Routes/web.php b/app/Routes/web.php index 71564077..ce33b1ec 100755 --- a/app/Routes/web.php +++ b/app/Routes/web.php @@ -25,6 +25,8 @@ Route::group([ ], function () { Route::resource('dashboard', 'DashboardController'); + Route::get('airports/{id}', 'AirportController@show')->name('airports.show'); + Route::get('flights/bids', 'FlightController@bids')->name('flights.bids'); Route::get('flights/search', 'FlightController@search')->name('flights.search'); Route::resource('flights', 'FlightController'); diff --git a/app/Widgets/AirspaceMap.php b/app/Widgets/AirspaceMap.php new file mode 100644 index 00000000..26b0e0b6 --- /dev/null +++ b/app/Widgets/AirspaceMap.php @@ -0,0 +1,29 @@ + '800px', + 'width' => '100%', + 'lat' => 0, + 'lon' => 0, + ]; + + /** + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function run() + { + return view('widgets.airspace_map', [ + 'config' => $this->config, + ]); + } +} diff --git a/public/assets/frontend/css/styles.css b/public/assets/frontend/css/styles.css index 6b462fd0..5e6112b0 100644 --- a/public/assets/frontend/css/styles.css +++ b/public/assets/frontend/css/styles.css @@ -2,6 +2,13 @@ * */ +.mini-splash { + padding: 30px 0; + text-align: center; + color: #9A9A9A; + font-weight: 300; +} + .font-large { font-size: 20px; } diff --git a/resources/views/admin/flights/table.blade.php b/resources/views/admin/flights/table.blade.php index 596924dd..18e830c4 100644 --- a/resources/views/admin/flights/table.blade.php +++ b/resources/views/admin/flights/table.blade.php @@ -16,10 +16,7 @@ - {{ $flight->airline->code }}{{ $flight->flight_number }} - @if($flight->route_code) - (C: {{ $flight->route_code }} L: {{ $flight->route_leg }}) - @endif + {{$flight->ident}} {{ $flight->dpt_airport->icao }} diff --git a/resources/views/layouts/default/airports/show.blade.php b/resources/views/layouts/default/airports/show.blade.php new file mode 100644 index 00000000..8b9335aa --- /dev/null +++ b/resources/views/layouts/default/airports/show.blade.php @@ -0,0 +1,34 @@ +@extends('app') +@section('title', $airport->full_name) + +@section('content') +
+
+

{{ $airport->full_name }}

+
+
+ {{ Widget::airspaceMap([ + 'width' => '100%', + 'height' => '250px', + 'lat' => $airport->lat, + 'lon' => $airport->lon, + ]) }} +
+
+ +
+
+

Inbound Flights

+ @if(!$inbound_flights) +
+ no flights found +
+ @else + @each('airports.table', $inbound_flights, 'flight') + @endif + +

Outbound Flights

+ @each('airports.table', $outbound_flights, 'flight') +
+
+@endsection diff --git a/resources/views/layouts/default/airports/table.blade.php b/resources/views/layouts/default/airports/table.blade.php new file mode 100644 index 00000000..58a09f34 --- /dev/null +++ b/resources/views/layouts/default/airports/table.blade.php @@ -0,0 +1,19 @@ + + + + + + {{----}} + + + +
+ + {{ $flight->ident }} + + {{ $flight->dpt_airport->icao }} + {{ $flight->arr_airport->icao }} + @if($flight->alt_airport) + (Alt: {{ $flight->alt_airport->icao }}) + @endif + {{ $flight->route }}{{ $flight->dpt_time }}{{ $flight->arr_time }}{{ $flight->notes }}
diff --git a/resources/views/layouts/default/widgets/airspace_map.blade.php b/resources/views/layouts/default/widgets/airspace_map.blade.php new file mode 100644 index 00000000..9506b8d6 --- /dev/null +++ b/resources/views/layouts/default/widgets/airspace_map.blade.php @@ -0,0 +1,10 @@ +
+ +@section('scripts') + +@endsection