Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Added a lot of features I cannot track. Better tracking next time.
Browse files Browse the repository at this point in the history
  • Loading branch information
BossOfGames committed Nov 18, 2017
1 parent 364857e commit 2e483d7
Show file tree
Hide file tree
Showing 19 changed files with 250 additions and 46 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/API/PIREPAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,8 @@ private static function getProperFlightNum($flightnum, $userid) {
$ret['flightnum'] = $flightnum;
return Bid::where(['user_id' => $userid, 'flightnum' => $ret['flightnum']])->with('depapt')->with('arrapt')->with('airline')->with('aircraft')->first();
}
public function getFlight($id)
{
return PIREP::where('id', $id)->with('airline')->with('depapt')->with('arrapt')->with('aircraft')->first();
}
}
4 changes: 4 additions & 0 deletions app/Http/Controllers/Admin/AirlineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,8 @@ public function destroy($id)
{
//
}
public function addHub(Request $request)
{

}
}
4 changes: 3 additions & 1 deletion app/Http/Controllers/Admin/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Support\Facades\Config;
use Brotzka\DotenvEditor\DotenvEditor as Env;
use App\User;
use Illuminate\Support\Facades\Session;


class InstallController extends Controller {
Expand Down Expand Up @@ -148,9 +149,10 @@ public function phpVMSTransfer(Request $request) {
$aircraft = $oldDB->getTable('aircraft')->get();
$aircraft = $oldDB->getTable('aircraft')->get();
}
public function dbMigrate()
public function dbMigrate(Request $request)
{
Artisan::call('migrate');
$request->session()->flash('success', true);
return redirect('/admin/migrations');
}
public function viewMigrations()
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/CrewOps/CrewOpsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,9 @@ public function postManualPirep(Request $request)
$request->session()->flash('success', 'Manual PIREP submitted for manual approval.');
return redirect('/flightops');
}
public function getLogbookDetailed($id)
{
$pirep = PIREP::where('id', $id)->with('airline')->with('depapt')->with('arrapt')->with('aircraft')->with('user')->first();
return view('crewops.logbook.show', ['p' => $pirep]);
}
}
2 changes: 2 additions & 0 deletions app/Http/Controllers/LegacyACARS/smartCARS.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ public function filePIREP(Request $request)
$pirep->flightnum = $flightinfo->flightnum;
$pirep->route = "NOT SUPPORTED";
$pirep->status = 0;
$pirep->distance = 0;
$pirep->landingrate = $request->input('landingrate');
$pirep->flighttime = $request->input('flighttime');
$pirep->acars_client = $request->input('source');
$pirep->fuel_used = $request->input('fuelused');
$pirep->flight_data = $request->input('log');

// Auto Accept System
if (env('VAOS_AA_ENABLED')) {
Expand Down
31 changes: 0 additions & 31 deletions database/migrations/2017_11_14_001950_addhubs.php

This file was deleted.

2 changes: 1 addition & 1 deletion public/legacy_ACARS/smartCARS/frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* If you are unsure if you are using an original, unmodified copy of the smartCARS web interface, we recommend obtaining new copies of the files from the TFDi Design website.
*/
define('version','official-w3052-3/12/2016');
define('version','vaos-1.0.0');
define('LOAD_TYPE_RANDOM_EDITABLE','randomopen');
define('LOAD_TYPE_RANDOM_LOCKED','randomlocked');
require_once("interface.php");
Expand Down
2 changes: 1 addition & 1 deletion public/legacy_ACARS/smartCARS/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

define('skip_retired_check', false); //should 'retired' (inactive) pilots be able to log in?
define('include_pending_flights_in_stats', false); //should flights that haven't been accepted/rejected yet be used to compute pilot stats in the smartCARS client?
define('interface_version', 'vaos-official-v1-1/21/2017');
define('interface_version', 'vaos-v1.0.3');
define('TABLE_PREFIX', $_ENV['DB_PREFIX']);
define('WEB_URL', $_ENV['APP_URL']);

Expand Down
1 change: 1 addition & 0 deletions resources/views/admin/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


@section('content')
<div id="#updateCheck"></div>
<div class="col-xs-6 col-lg-3">
<div class="card">
<div class="card-block">
Expand Down
101 changes: 101 additions & 0 deletions resources/views/admin/hubs/view.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@extends('layouts.admin')
@section('head')
<link href="{{URL::asset('https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap4.min.css')}}" rel="stylesheet">
<link href="{{URL::asset('/crewops/vendor/datatables-responsive/dataTables.responsive.css')}}" rel="stylesheet">
@endsection
@section('breadcrumb')
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item"><a href="{{ url('admin/') }}">Admin</a>
</li>
<li class="breadcrumb-item active">Hubs</li>
@endsection

@section('content')
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<i class="fa fa-align-justify"></i> Airline Hubs
</div>
<div class="card-block">
<div class="card-block">

@if(session('hub_created'))
<div class="alert alert-success">Hub successfully created.</div>
@elseif(session('hub_updated'))
<div class="alert alert-success">Hub successfully updated.</div>
@endif

<a href="{{ url('admin/airlines/hub/create') }}" role="button" class="button btn btn-primary"><i class="fa fa-plus"></i>&nbsp; New Hub</a>
</div>
@if($fleet == '[]')
<div class="alert alert-info" role="alert">
<strong>No Hubs Found:</strong> The server returned no hubs in the system.
</div>
@else
<table id="table_id" class="table table-striped table-hover">
<thead>
<tr>
<th>Airline</th>
<th>Airport</th>
</tr>
</thead>
<tbody>
@foreach($hub as $a)
<tr>
@if($a->airline != null)
<td>{{$a->airline->icao}}</td>
@else
<td>N/A</td>
@endif
<td>{{$a->icao}}</td>
<td>{{$a->manufacturer}}</td>
<td>{{$a->name}}</td>
<td>{{$a->registration}}</td>
@if($a->hub == null)
<td>Not Assigned</td>
@else
<td>{{$a->hub->icao}}</td>
@endif
@if($a->location == null)
<td>N/A</td>
@else
<td>{{$a->location->icao}}</td>
@endif

<td>
<a href="{{ url('/admin/fleet/'.$a->id.'/edit') }}" class="btn btn-primary btn-sm">Edit</a>
</td>

</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div>
</div>
@endsection
@section('js')
<script type="text/javascript">
$(document).ready( function () {
$('#table_id').DataTable( {
responsive: true,
"autoWidth": false
});
/*
$(".clickable-row").click(function() {
window.document.location = $(this).data("href");
});
*/
$(".clickable-row").click(function() {
return false;
}).dblclick(function() {
window.document.location = this.href;
return false;
});
});
</script>
<script src="{{URL::asset('/crewops/vendor/datatables/js/jquery.dataTables.min.js')}}"></script>
<script src="{{URL::asset('/crewops/vendor/datatables-plugins/dataTables.bootstrap.min.js')}}"></script>
<script src="{{URL::asset('/crewops/vendor/datatables-responsive/dataTables.responsive.js')}}"></script>
@endsection
14 changes: 8 additions & 6 deletions resources/views/admin/migrations.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<i class="fa fa-align-justify"></i> Schedules Table
<i class="fa fa-align-justify"></i> Database Migrations
</div>
<div class="card-block">
<div class="card-block">

@if(session('schedule_created'))
<div class="alert alert-success">Route successfully created.</div>
@if(session('success'))
<div class="alert alert-success">Database Migrations Successful. Check Batch: {{ $migrations->last()->batch }} for latest changes.</div>
@elseif(session('schedule_updated'))
<div class="alert alert-success">Route successfully updated.</div>
@endif

<a href="{{ url('admin/migrate') }}" role="button" class="button btn btn-primary"><i class="fa fa-plus"></i>&nbsp; Run Migrations</a>
<p> The primary purpose of this page is to track updates and changes to the database throughout the
release cycle of VAOS for technical support reasons. Currently there is no way to rollback migrations
at this time other than restoring from database backup, however that should be a feature in the future.</p>
<p style="color: red;"><b>BEFORE RUNNING NEW MIGRATIONS, BACKUP YOUR ENTIRE DATABASE SCHEMA!!!</b></p>
<a href="{{ url('admin/migrate') }}" role="button" class="button btn btn-primary"><i class="fa fa-plus"></i>&nbsp; Run New Migrations</a>
</div>
<table id="table_id" class="table table-striped table-hover">
<thead>
Expand All @@ -40,7 +43,6 @@
@endforeach
</tbody>
</table>
@endif
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion resources/views/crewops/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<tbody>
@foreach(\App\PIREP::where('user_id', Auth::user()->id)->orderBy('id', 'desc')->limit(10)->get() as $p)
<tr>
<td>{{ $p->airline->icao . $p->flightnum }}</td>
<td><a href="{{ url('crewops/logbook/'.$p->id) }}">{{ $p->airline->icao . $p->flightnum }}</a></td>
<td>{{ $p->depapt->icao }}</td>
<td>{{ $p->arrapt->icao }}</td>
<td>{{ date('d/m/Y', strtotime($p->created_at)) }}</td>
Expand Down Expand Up @@ -95,6 +95,7 @@
<li class="collection-item"><div>Total Flights<div class="secondary-content">{{ count(Auth::user()->pirep) }}</div></div></li>
<li class="collection-item"><div>Avg Landing Rate<div class="secondary-content">{{ \App\PIREP::where('user_id', Auth::user()->id)->avg('landingrate') }}</div></div></li>
</ul>
<a class="btn blue" href="https://tfdidesign.com/smartcars/app.php?action=download&airlineid=482&language=en-US" role="button">Download smartCARS</a>
</div>
</div>
</div>
Expand Down
Empty file.
107 changes: 107 additions & 0 deletions resources/views/crewops/logbook/show.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
@extends('layouts.crewops')

@section('content')
<div class="z-depth-2" style="position: relative; width: 100%; height: 300px; overflow: hidden; background: url('{{ Auth::user()->cover_url }}'), url(http://i.imgur.com/3UZDNCM.png); background-repeat: no-repeat;
background-position: center;
background-size: cover;">
<div style="height: 100%; background: linear-gradient(rgba(255,0,0,0), rgba(255,0,0,0), rgba(69,69,69,0.9))">
</div>
<div class="container" style="position: inherit;">
<div style="position: absolute; right: 0; bottom: 1rem;">
<div id="status" class="card">
<div id="status-text" class="card-content white-text"></div>
</div>
</div>
</div>
<h3 class="white-text" style="position: absolute; bottom: 0; left: 2rem;">{{ $p->airline->icao }}{{ $p->flightnum }} Details</h3>
</div>
<div class="container">
<div class="row">
<div class="col l6 s12">
<div class="card">
<div class="card-content">
<h4>Crew Information</h4>
<div id="captain">
<ul class="collection with-header">
<li class="collection-item"><div>Username<div class="secondary-content">{{ $p->user->username }}</div></div></li>
<li class="collection-item"><div>Pilot ID<div class="secondary-content">{{ $p->user->pilotid }}</div></div></li>
<li class="collection-item"><div>Full Name<div class="secondary-content">{{ $p->user->first_name }} {{ $p->user->last_name }}</div></div></li>
<li class="collection-item"><div>Join Date<div class="secondary-content">{{ date('d/m/Y', strtotime($p->user->created_at)) }}</div></div></li>
<li class="collection-item"><div>Avg Landing Rate<div class="secondary-content">{{ \App\PIREP::where('user_id', $p->user->id)->avg('landingrate') }}</div></div></li>
<li class="collection-item"><div>Total Hours<div class="secondary-content">{{ \App\PIREP::where('user_id', $p->user->id)->sum('flighttime') }}</div></div></li>

</ul>
</div>
</div>
</div>
</div>
<div class="col l6 s12">
<div class="card">
<div class="card-content">
<h4>Flight Information</h4>
<ul class="tabs tabs-fixed-width">
<li class="tab"><a href="#basic">Basic Information</a></li>
@if($p->acars_client === "smartCARS")
<li class="tab"><a href="#sclogtab">smartCARS Logs</a></li>
@endif
</ul>
<div id="basic">
<ul class="collection with-header">
<li class="collection-item"><div>Airline<div class="secondary-content">{{ $p->airline->name }}</div></div></li>
<li class="collection-item"><div>Flight<div class="secondary-content">{{ $p->flightnum }}</div></div></li>
<li class="collection-item"><div>Departure<div class="secondary-content">{{ $p->depapt->icao }} {{ $p->depapt->name }}</div></div></li>
<li class="collection-item"><div>Arrival<div class="secondary-content">{{ $p->arrapt->icao }} {{ $p->arrapt->name }}</div></div></li>
<li class="collection-item"><div>Aircraft<div class="secondary-content">{{ $p->aircraft->name }} - {{ $p->aircraft->registration }}</div></div></li>
<li class="collection-item"><div>Distance Flown<div class="secondary-content">{{ $p->distance }}</div></div></li>
<li class="collection-item"><div>Fuel Used<div class="secondary-content">{{ $p->fuel_used }}</div></div></li>
<li class="collection-item"><div>Flight Time<div class="secondary-content">{{ $p->flighttime }}</div></div></li>
<li class="collection-item"><div>Landing Rate<div class="secondary-content">{{ $p->landingrate }}</div></div></li>
<li class="collection-item"><div>Aircraft<div class="secondary-content">{{ $p->aircraft->name }} - {{ $p->aircraft->registration }}</div></div></li>
</ul>
</div>
<div id="sclogtab">
@if($p->acars_client === "smartCARS")
<ul id="scLogs" class="collection with-header">

</ul>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

@section('js')
<script>
$(document).ready(function () {
// Pull the data from the API so we can add stuff
$.getJSON( "{{ config('app.url') }}api/v1/logbook/{{$p->id}}", function( data ) {
console.log(data);
if(data.acars_client = "smartCARS") {
var logSplit = data.flight_data.split("*");
$.each(logSplit, function( index, value) {
$("#scLogs").append('<li class="collection-item"><div>'+ value +'</div></li>')
});
}
// time to apply the flight status.
switch(data.status) {
case 0:
$("#status").addClass("yellow darken-2");
$("#status-text").append('STATUS: <b>PENDING</b>');
break;
case 1:
$("#status").addClass("green");
$("#status-text").append('STATUS: <b>APPROVED</b>');
break;
case 2:
$("#status").addClass("red");
$("#status-text").append('STATUS: <b>DENIED</b>');
break;
}
});
});
</script>
@endsection
Loading

0 comments on commit 2e483d7

Please sign in to comment.