Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d23f558dd | ||
|
|
baf63361a0 | ||
|
|
b4d5c0fbcd | ||
|
|
6b7eab05e2 | ||
|
|
4c8e31ac6f | ||
|
|
fe41e61c02 | ||
|
|
bd85a04530 | ||
|
|
cbb7d6e274 | ||
|
|
8907527872 | ||
|
|
942c060c99 | ||
|
|
68a9421445 | ||
|
|
4e652c91ae | ||
|
|
a6f62045c4 | ||
|
|
3f3b63da6f | ||
|
|
dd7812e5c5 | ||
|
|
447d02bd4f | ||
|
|
be9b698f14 | ||
|
|
d110c2d951 | ||
|
|
4d20998368 | ||
|
|
4a20b41b25 | ||
|
|
8c2513eb3d | ||
|
|
2dbd58e59e | ||
|
|
bf77f7dd96 | ||
|
|
5a570989de | ||
|
|
6b3207377a | ||
|
|
ac1d5e1555 | ||
|
|
0d45fc287b | ||
|
|
4911f6799d | ||
|
|
5821067231 | ||
|
|
fc7ad7eb6a | ||
|
|
101b3261f5 | ||
|
|
fb0027b140 | ||
|
|
066702e490 | ||
|
|
b4e0515405 | ||
|
|
f5ca8ce6e3 | ||
|
|
7e9196c7e6 | ||
|
|
a2916bf536 | ||
|
|
0578f98b58 | ||
|
|
2e0f0b00ef | ||
|
|
d5d9010134 | ||
|
|
bd8e13e78f | ||
|
|
c4dee07b7f | ||
|
|
f8a44d8c6d | ||
|
|
617cea5df7 | ||
|
|
3a99fe9e0e |
@@ -33,4 +33,4 @@ echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
||||
echo "TAR_NAME=${TAR_NAME}" >> $GITHUB_ENV
|
||||
echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV
|
||||
echo "BASE_DIR=${BASE_DIR}" >> $GITHUB_ENV
|
||||
echo "DISCORD_MSG=A new build is available at http://downloads.phpvms.net/$TAR_NAME (${FULL_VERSION})" >> $GITHUB_ENV
|
||||
echo "DISCORD_MSG=Version ${FULL_VERSION} is available, download: [zip](http://downloads.phpvms.net/$ZIP_NAME) | [tar](http://downloads.phpvms.net/$TAR_NAME)" >> $GITHUB_ENV
|
||||
|
||||
+49
-5
@@ -12,13 +12,24 @@ abstract class Metar
|
||||
{
|
||||
/**
|
||||
* Implement retrieving the METAR - return the METAR string. Needs to be protected,
|
||||
* since this shouldn't be directly called. Call `get_metar($icao)` instead
|
||||
* since this shouldn't be directly called. Call `metar($icao)`. If not implemented,
|
||||
* return a blank string
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function metar($icao): string;
|
||||
abstract protected function get_metar($icao): string;
|
||||
|
||||
/**
|
||||
* Implement retrieving the TAF - return the string. Call `taf($icao)`. If not implemented,
|
||||
* return a blank string
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function get_taf($icao): string;
|
||||
|
||||
/**
|
||||
* Download the METAR, wrap in caching
|
||||
@@ -27,9 +38,9 @@ abstract class Metar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_metar($icao): string
|
||||
public function metar($icao): string
|
||||
{
|
||||
$cache = config('cache.keys.WEATHER_LOOKUP');
|
||||
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
|
||||
$key = $cache['key'].$icao;
|
||||
|
||||
if (Cache::has($key)) {
|
||||
@@ -40,7 +51,7 @@ abstract class Metar
|
||||
}
|
||||
|
||||
try {
|
||||
$raw_metar = $this->metar($icao);
|
||||
$raw_metar = $this->get_metar($icao);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
|
||||
return '';
|
||||
@@ -52,4 +63,37 @@ abstract class Metar
|
||||
|
||||
return $raw_metar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the TAF, wrap in caching
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function taf($icao): string
|
||||
{
|
||||
$cache = config('cache.keys.TAF_WEATHER_LOOKUP');
|
||||
$key = $cache['key'].$icao;
|
||||
|
||||
if (Cache::has($key)) {
|
||||
$taf = Cache::get($key);
|
||||
if ($taf !== '') {
|
||||
return $taf;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$taf = $this->get_taf($icao);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error getting TAF: '.$e->getMessage(), $e->getTrace());
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($taf !== '') {
|
||||
Cache::put($key, $taf, $cache['time']);
|
||||
}
|
||||
|
||||
return $taf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ namespace App\Cron\Nightly;
|
||||
|
||||
use App\Contracts\Listener;
|
||||
use App\Events\CronNightly;
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Models\User;
|
||||
use App\Services\UserService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Determine if any pilots should be set to ON LEAVE status
|
||||
@@ -18,6 +16,8 @@ class PilotLeave extends Listener
|
||||
|
||||
/**
|
||||
* PilotLeave constructor.
|
||||
*
|
||||
* @param UserService $userSvc
|
||||
*/
|
||||
public function __construct(UserService $userSvc)
|
||||
{
|
||||
@@ -34,14 +34,7 @@ class PilotLeave extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
if (setting('pilots.auto_leave_days') === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$date = Carbon::now()->subDay(setting('pilots.auto_leave_days'));
|
||||
$users = User::where('status', UserState::ACTIVE)
|
||||
->whereDate('updated_at', '<', $date);
|
||||
|
||||
$users = $this->userSvc->findUsersOnLeave();
|
||||
foreach ($users as $user) {
|
||||
Log::info('Setting user '.$user->ident.' to ON LEAVE status');
|
||||
$this->userSvc->setStatusOnLeave($user);
|
||||
|
||||
@@ -42,23 +42,18 @@ class SetActiveFlights extends Listener
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set to visible by default
|
||||
$flight->visible = true;
|
||||
|
||||
// dates aren't set, so just save if there were any changes above
|
||||
// and move onto the next one
|
||||
if ($flight->start_date === null || $flight->end_date === null) {
|
||||
if ($flight->days !== null && $flight->days > 0) {
|
||||
$visible = Days::isToday($flight->days);
|
||||
if ($flight->visible !== $visible) {
|
||||
Log::info('Flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden'));
|
||||
|
||||
$flight->visible = $visible;
|
||||
if ($visible === false) {
|
||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||
}
|
||||
$flight->visible = Days::isToday($flight->days);
|
||||
if (!$flight->visible) {
|
||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||
}
|
||||
} else {
|
||||
Log::info('Toggling flight '.$flight->ident.' to visible');
|
||||
$flight->visible = true;
|
||||
}
|
||||
|
||||
$flight->save();
|
||||
@@ -71,20 +66,11 @@ class SetActiveFlights extends Listener
|
||||
// and then make sure if days of the week are specified, check that too
|
||||
if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
|
||||
if ($flight->days !== null && $flight->days > 0) {
|
||||
$visible = Days::isToday($flight->days);
|
||||
if ($flight->visible !== $visible) {
|
||||
Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').'');
|
||||
|
||||
$flight->visible = $visible;
|
||||
if ($visible === false) {
|
||||
Log::info('Today='.date('N').', start='.$flight->start_date
|
||||
.', end='.$flight->end_date.', mask='.$flight->days.', in='
|
||||
$flight->visible = Days::isToday($flight->days);
|
||||
if (!$flight->visible) {
|
||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log::info('Toggling flight '.$flight->ident.' to visible');
|
||||
$flight->visible = true;
|
||||
}
|
||||
} else {
|
||||
$flight->visible = false;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Change the vertical speed for the acars table to a double
|
||||
*/
|
||||
class ChangeAcarsVsType extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('acars', function (Blueprint $table) {
|
||||
$table->float('vs')->change()->default(0.0)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Bring the sessions table in line with the latest
|
||||
*/
|
||||
class UpdateSessionsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('sessions', function (Blueprint $table) {
|
||||
$table->index('user_id');
|
||||
$table->index('last_activity');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -186,13 +186,13 @@ class AwardController extends Controller
|
||||
{
|
||||
$award = $this->awardRepository->findWithoutFail($id);
|
||||
if (empty($award)) {
|
||||
Flash::error('Fare not found');
|
||||
Flash::error('Award not found');
|
||||
|
||||
return redirect(route('admin.awards.index'));
|
||||
}
|
||||
|
||||
$this->awardRepository->delete($id);
|
||||
Flash::success('Fare deleted successfully.');
|
||||
Flash::success('Award deleted successfully.');
|
||||
|
||||
return redirect(route('admin.awards.index'));
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Exceptions\AssetNotFound;
|
||||
use App\Exceptions\Unauthorized;
|
||||
use App\Http\Resources\Flight as FlightResource;
|
||||
use App\Http\Resources\Navdata as NavdataResource;
|
||||
use App\Models\SimBrief;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Criteria\WhereCriteria;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Services\FareService;
|
||||
@@ -152,20 +154,25 @@ class FlightController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
*/
|
||||
public function briefing($id)
|
||||
public function briefing(string $id)
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$w = [
|
||||
'user_id' => $user->id,
|
||||
'flight_id' => $id,
|
||||
'id' => $id,
|
||||
];
|
||||
|
||||
/** @var SimBrief $simbrief */
|
||||
$simbrief = SimBrief::where($w)->first();
|
||||
|
||||
if ($simbrief === null) {
|
||||
throw new AssetNotFound(new Exception('Flight briefing not found'));
|
||||
}
|
||||
|
||||
/*if ($simbrief->user_id !== $user->id) {
|
||||
throw new Unauthorized(new Exception('User cannot access another user\'s simbrief'));
|
||||
}*/
|
||||
|
||||
return response($simbrief->acars_xml, 200, [
|
||||
'Content-Type' => 'application/xml',
|
||||
]);
|
||||
|
||||
@@ -22,8 +22,6 @@ use App\Models\Acars;
|
||||
use App\Models\Enums\AcarsType;
|
||||
use App\Models\Enums\PirepFieldSource;
|
||||
use App\Models\Enums\PirepSource;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Models\Enums\PirepStatus;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\PirepComment;
|
||||
use App\Repositories\AcarsRepository;
|
||||
@@ -38,9 +36,6 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class PirepController
|
||||
*/
|
||||
class PirepController extends Controller
|
||||
{
|
||||
private $acarsRepo;
|
||||
@@ -93,6 +88,10 @@ class PirepController extends Controller
|
||||
$attrs['created_at'] = Carbon::createFromTimeString($attrs['created_at']);
|
||||
}
|
||||
|
||||
if (array_key_exists('submitted_at', $attrs)) {
|
||||
$attrs['submitted_at'] = Carbon::createFromTimeString($attrs['submitted_at']);
|
||||
}
|
||||
|
||||
if (array_key_exists('updated_at', $attrs)) {
|
||||
$attrs['updated_at'] = Carbon::createFromTimeString($attrs['updated_at']);
|
||||
}
|
||||
@@ -306,14 +305,8 @@ class PirepController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$attrs['state'] = PirepState::PENDING;
|
||||
$attrs['status'] = PirepStatus::ARRIVED;
|
||||
$attrs['submitted_at'] = Carbon::now('UTC');
|
||||
|
||||
$pirep = $this->pirepRepo->update($attrs, $pirep_id);
|
||||
|
||||
try {
|
||||
$pirep = $this->pirepSvc->create($pirep);
|
||||
$pirep = $this->pirepSvc->file($pirep, $attrs);
|
||||
$this->updateFields($pirep, $request);
|
||||
$this->updateFares($pirep, $request);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Models\Bid;
|
||||
use App\Models\Enums\FlightType;
|
||||
use App\Repositories\AirlineRepository;
|
||||
use App\Repositories\AirportRepository;
|
||||
use App\Repositories\Criteria\WhereCriteria;
|
||||
@@ -120,6 +121,7 @@ class FlightController extends Controller
|
||||
'saved' => $saved_flights,
|
||||
'subfleets' => $this->subfleetRepo->selectBoxList(true),
|
||||
'flight_number' => $request->input('flight_number'),
|
||||
'flight_types' => FlightType::select(true),
|
||||
'flight_type' => $request->input('flight_type'),
|
||||
'arr_icao' => $request->input('arr_icao'),
|
||||
'dep_icao' => $request->input('dep_icao'),
|
||||
@@ -145,6 +147,12 @@ class FlightController extends Controller
|
||||
$flights = collect();
|
||||
$saved_flights = [];
|
||||
foreach ($user->bids as $bid) {
|
||||
// Remove any invalid bids (flight doesn't exist or something)
|
||||
if (!$bid->flight) {
|
||||
$bid->delete();
|
||||
continue;
|
||||
}
|
||||
|
||||
$flights->add($bid->flight);
|
||||
$saved_flights[] = $bid->flight->id;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class ProfileController extends Controller
|
||||
{
|
||||
// Is the ACARS module enabled?
|
||||
$acars_enabled = false;
|
||||
$acars = Module::find('VMSACARS');
|
||||
$acars = Module::find('VMSAcars');
|
||||
if ($acars) {
|
||||
$acars_enabled = $acars->isEnabled();
|
||||
}
|
||||
@@ -95,6 +95,7 @@ class ProfileController extends Controller
|
||||
'user' => $user,
|
||||
'userFields' => $userFields,
|
||||
'airports' => $airports,
|
||||
'acars' => $this->acarsEnabled(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ class ProfileController extends Controller
|
||||
|
||||
$airlines = $this->airlineRepo->selectBoxList();
|
||||
$airports = $this->airportRepo->selectBoxList(false, setting('pilots.home_hubs_only'));
|
||||
$userFields = $this->userRepo->getUserFields($user, false);
|
||||
$userFields = $this->userRepo->getUserFields($user, true);
|
||||
|
||||
return view('profile.edit', [
|
||||
'user' => $user,
|
||||
|
||||
@@ -3,22 +3,34 @@
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Exceptions\AssetNotFound;
|
||||
use App\Models\Aircraft;
|
||||
use App\Models\Enums\FlightType;
|
||||
use App\Models\SimBrief;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Services\FareService;
|
||||
use App\Services\SimBriefService;
|
||||
use App\Services\UserService;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class SimBriefController
|
||||
{
|
||||
private $fareSvc;
|
||||
private $flightRepo;
|
||||
private $simBriefSvc;
|
||||
private $userSvc;
|
||||
|
||||
public function __construct(FlightRepository $flightRepo, SimBriefService $simBriefSvc)
|
||||
{
|
||||
public function __construct(
|
||||
FareService $fareSvc,
|
||||
FlightRepository $flightRepo,
|
||||
SimBriefService $simBriefSvc,
|
||||
UserService $userSvc
|
||||
) {
|
||||
$this->fareSvc = $fareSvc;
|
||||
$this->flightRepo = $flightRepo;
|
||||
$this->simBriefSvc = $simBriefSvc;
|
||||
$this->userSvc = $userSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,8 +44,14 @@ class SimBriefController
|
||||
*/
|
||||
public function generate(Request $request)
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = Auth::user();
|
||||
|
||||
$flight_id = $request->input('flight_id');
|
||||
$flight = $this->flightRepo->find($flight_id);
|
||||
$aircraft_id = $request->input('aircraft_id');
|
||||
$flight = $this->flightRepo->with(['subfleets'])->find($flight_id);
|
||||
$flight = $this->fareSvc->getReconciledFaresForFlight($flight);
|
||||
|
||||
if (!$flight) {
|
||||
flash()->error('Unknown flight');
|
||||
return redirect(route('frontend.flights.index'));
|
||||
@@ -45,7 +63,7 @@ class SimBriefController
|
||||
return redirect(route('frontend.flights.index'));
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
// Check if a Simbrief profile already exists
|
||||
$simbrief = SimBrief::select('id')->where([
|
||||
'flight_id' => $flight_id,
|
||||
'user_id' => $user->id,
|
||||
@@ -55,8 +73,57 @@ class SimBriefController
|
||||
return redirect(route('frontend.simbrief.briefing', [$simbrief->id]));
|
||||
}
|
||||
|
||||
// Simbrief Profile doesn't exist; prompt the user to create a new one
|
||||
$aircraft = Aircraft::select('registration', 'name', 'icao', 'iata', 'subfleet_id')
|
||||
->where('id', $aircraft_id)
|
||||
->get();
|
||||
|
||||
if ($flight->subfleets->count() > 0) {
|
||||
$subfleets = $flight->subfleets;
|
||||
} else {
|
||||
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||
}
|
||||
|
||||
if ($flight->flight_type === FlightType::CHARTER_PAX_ONLY) {
|
||||
$pax_weight = 197;
|
||||
} else {
|
||||
$pax_weight = 208;
|
||||
}
|
||||
|
||||
// No aircraft selected, show that form
|
||||
if (!$aircraft_id) {
|
||||
return view('flights.simbrief_aircraft', [
|
||||
'flight' => $flight,
|
||||
'aircraft' => $aircraft,
|
||||
'subfleets' => $subfleets,
|
||||
'pax_weight' => $pax_weight,
|
||||
]);
|
||||
}
|
||||
|
||||
// Get the correct load factors
|
||||
$lfactor = $flight->load_factor ?? setting('flights.default_load_factor');
|
||||
$lfactorv = $flight->load_factor_variance ?? setting('flights.load_factor_variance');
|
||||
|
||||
$loadmin = $lfactor - $lfactorv;
|
||||
$loadmin = $loadmin < 0 ? 0 : $loadmin;
|
||||
|
||||
$loadmax = $lfactor + $lfactorv;
|
||||
$loadmax = $loadmax > 100 ? 100 : $loadmax;
|
||||
|
||||
// Failsafe for admins not defining load values for their flights
|
||||
// and also leave the general settings empty, set loadmax to 100
|
||||
if ($loadmax === 0) {
|
||||
$loadmax = 100;
|
||||
}
|
||||
|
||||
// Show the main simbrief form
|
||||
return view('flights.simbrief_form', [
|
||||
'flight' => $flight,
|
||||
'flight' => $flight,
|
||||
'aircraft' => $aircraft,
|
||||
'subfleets' => $subfleets,
|
||||
'pax_weight' => $pax_weight,
|
||||
'loadmin' => $loadmin,
|
||||
'loadmax' => $loadmax,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -75,8 +142,18 @@ class SimBriefController
|
||||
return redirect(route('frontend.flights.index'));
|
||||
}
|
||||
|
||||
$str = $simbrief->xml->aircraft->equip;
|
||||
$wc = stripos($str, '-');
|
||||
$tr = stripos($str, '/');
|
||||
$wakecat = substr($str, 0, $wc);
|
||||
$equipment = substr($str, $wc + 1, $tr - 2);
|
||||
$transponder = substr($str, $tr + 1);
|
||||
|
||||
return view('flights.simbrief_briefing', [
|
||||
'simbrief' => $simbrief,
|
||||
'simbrief' => $simbrief,
|
||||
'wakecat' => $wakecat,
|
||||
'equipment' => $equipment,
|
||||
'transponder' => $transponder,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -86,21 +163,30 @@ class SimBriefController
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function remove(Request $request)
|
||||
public function generate_new(Request $request)
|
||||
{
|
||||
$sb_pack = SimBrief::find($request->id);
|
||||
if ($sb_pack) {
|
||||
if (!$sb_pack->pirep_id) {
|
||||
$sb_pack->delete();
|
||||
} else {
|
||||
$sb_pack->flight_id = null;
|
||||
$sb_pack->save();
|
||||
}
|
||||
$simbrief = SimBrief::find($request->id);
|
||||
|
||||
// Invalid Simbrief ID/profile, go back to the main flight index
|
||||
if (!$simbrief) {
|
||||
return redirect(route('frontend.flights.index'));
|
||||
}
|
||||
|
||||
return redirect(route('frontend.flights.index'));
|
||||
// Cleanup the current Simbrief entry and redirect to the new generation form
|
||||
// If there isn't a PIREP ID, then delete the entry, otherwise, remove the flight
|
||||
$flight_id = $simbrief->flight_id;
|
||||
if (!$simbrief->pirep_id) {
|
||||
$simbrief->delete();
|
||||
} else {
|
||||
$simbrief->flight_id = null;
|
||||
$simbrief->save();
|
||||
}
|
||||
|
||||
return redirect(route('frontend.simbrief.generate').'?flight_id='.$flight_id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +238,7 @@ class SimBriefController
|
||||
$ofp_id = $request->input('ofp_id');
|
||||
$flight_id = $request->input('flight_id');
|
||||
|
||||
$simbrief = $this->simBriefSvc->checkForOfp(Auth::user()->id, $ofp_id, $flight_id);
|
||||
$simbrief = $this->simBriefSvc->downloadOfp(Auth::user()->id, $ofp_id, $flight_id);
|
||||
if ($simbrief === null) {
|
||||
$error = new AssetNotFound(new Exception('Simbrief OFP not found'));
|
||||
return $error->getResponse();
|
||||
|
||||
@@ -27,6 +27,7 @@ class Pirep extends Resource
|
||||
{
|
||||
$res = parent::toArray($request);
|
||||
$res['ident'] = $this->ident;
|
||||
$res['phase'] = $this->status;
|
||||
$res['status_text'] = PirepStatus::label($this->status);
|
||||
|
||||
// Set these to the response units
|
||||
|
||||
@@ -13,7 +13,7 @@ class SimBrief extends Resource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'url' => url(route('api.flights.briefing', ['id' => $this->flight_id])),
|
||||
'url' => url(route('api.flights.briefing', ['id' => $this->id])),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class User extends Resource
|
||||
'last_pirep_id' => $this->last_pirep_id,
|
||||
'flights' => $this->flights,
|
||||
'flight_time' => $this->flight_time,
|
||||
'transfer_time' => $this->transfer_time,
|
||||
'timezone' => $this->timezone,
|
||||
'state' => $this->state,
|
||||
];
|
||||
|
||||
@@ -4,6 +4,14 @@ namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* @property int id
|
||||
* @property string pirep_id
|
||||
* @property int fare_id
|
||||
* @property int count
|
||||
* @property Pirep pirep
|
||||
* @property Fare fare
|
||||
*/
|
||||
class PirepFare extends Model
|
||||
{
|
||||
public $table = 'pirep_fares';
|
||||
|
||||
@@ -19,5 +19,9 @@ class DirectiveServiceProvider extends ServiceProvider
|
||||
Blade::directive('minutestohours', function ($expr) {
|
||||
return "<?php echo \App\Support\Units\Time::minutesToHours($expr); ?>";
|
||||
});
|
||||
|
||||
Blade::directive('secstohhmm', function ($expr) {
|
||||
return "<?php echo secstohhmm($expr); ?>";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
Route::get('simbrief/{id}', 'SimBriefController@briefing')->name('simbrief.briefing');
|
||||
Route::get('simbrief/{id}/prefile', 'SimBriefController@prefile')->name('simbrief.prefile');
|
||||
Route::get('simbrief/{id}/cancel', 'SimBriefController@cancel')->name('simbrief.cancel');
|
||||
Route::get('simbrief/{id}/remove', 'SimBriefController@remove')->name('simbrief.remove');
|
||||
Route::get('simbrief/{id}/generate_new', 'SimBriefController@generate_new')->name('simbrief.generate_new');
|
||||
});
|
||||
|
||||
Route::group([
|
||||
|
||||
@@ -94,7 +94,7 @@ class FlightRepository extends Repository implements CacheableInterface
|
||||
$where['flight_number'] = $request->input('flight_number');
|
||||
}
|
||||
|
||||
if ($request->filled('flight_type')) {
|
||||
if ($request->filled('flight_type') && $request->input('flight_type') !== '0') {
|
||||
$where['flight_type'] = $request->input('flight_type');
|
||||
}
|
||||
|
||||
|
||||
@@ -46,12 +46,32 @@ class AirportService extends Service
|
||||
return;
|
||||
}
|
||||
|
||||
$raw_metar = $this->metarProvider->get_metar($icao);
|
||||
$raw_metar = $this->metarProvider->metar($icao);
|
||||
if ($raw_metar && $raw_metar !== '') {
|
||||
return new Metar($raw_metar);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the METAR for a given airport
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return Metar|null
|
||||
*/
|
||||
public function getTaf($icao)
|
||||
{
|
||||
$icao = trim($icao);
|
||||
if ($icao === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$raw_taf = $this->metarProvider->taf($icao);
|
||||
if ($raw_taf && $raw_taf !== '') {
|
||||
return new Metar($raw_taf, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup an airport's information from a remote provider. This handles caching
|
||||
* the data internally
|
||||
|
||||
@@ -92,6 +92,6 @@ class CronService extends Service
|
||||
|
||||
// More than 5 minutes... there's a problem
|
||||
$diff = $dt_now->diff($dt);
|
||||
return $diff->i > 5;
|
||||
return $diff->i > 60 * 12; // Hasn't run for 12 hours
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,9 +286,7 @@ class FareService extends Service
|
||||
*/
|
||||
public function getForPirep(Pirep $pirep)
|
||||
{
|
||||
$found_fares = PirepFare::where('pirep_id', $pirep->id)->get();
|
||||
|
||||
return $found_fares;
|
||||
return PirepFare::where('pirep_id', $pirep->id)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,6 +311,8 @@ class FareService extends Service
|
||||
$fare['pirep_id'] = $pirep->id;
|
||||
// other fields: ['fare_id', 'count']
|
||||
|
||||
Log::info('Saving fare pirep='.$pirep->id.', fare='.$fare['count']);
|
||||
|
||||
$field = new PirepFare($fare);
|
||||
$field->save();
|
||||
}
|
||||
|
||||
@@ -137,6 +137,13 @@ class FlightService extends Service
|
||||
{
|
||||
/** @var \Illuminate\Support\Collection $subfleets */
|
||||
$subfleets = $flight->subfleets;
|
||||
|
||||
// If no subfleets assigned to a flight get users allowed subfleets
|
||||
if ($subfleets === null || $subfleets->count() === 0) {
|
||||
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||
}
|
||||
|
||||
// If subfleets are still empty return the flight
|
||||
if ($subfleets === null || $subfleets->count() === 0) {
|
||||
return $flight;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,16 @@ use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Return the raw METAR string from the NOAA Aviation Weather Service
|
||||
* Return the raw METAR/TAF string from the NOAA Aviation Weather Service
|
||||
*/
|
||||
class AviationWeather extends Metar
|
||||
{
|
||||
private const METAR_URL =
|
||||
'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=';
|
||||
|
||||
private const TAF_URL =
|
||||
'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=';
|
||||
|
||||
private $httpClient;
|
||||
|
||||
public function __construct(HttpClient $httpClient)
|
||||
@@ -33,7 +36,7 @@ class AviationWeather extends Metar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function metar($icao): string
|
||||
protected function get_metar($icao): string
|
||||
{
|
||||
if ($icao === '') {
|
||||
return '';
|
||||
@@ -67,7 +70,53 @@ class AviationWeather extends Metar
|
||||
return $xml->data->METAR->raw_text->__toString();
|
||||
} catch (Exception $e) {
|
||||
Log::error('Error reading METAR: '.$e->getMessage());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the actual retrieval of the TAF
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_taf($icao): string
|
||||
{
|
||||
if ($icao === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tafurl = static::TAF_URL.$icao;
|
||||
|
||||
try {
|
||||
$tafres = $this->httpClient->get($tafurl, []);
|
||||
$tafxml = simplexml_load_string($tafres);
|
||||
|
||||
$tafattrs = $tafxml->data->attributes();
|
||||
if (!isset($tafattrs['num_results'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tafnum_results = $tafattrs['num_results'];
|
||||
if (empty($tafnum_results)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tafnum_results = (int) $tafnum_results;
|
||||
if ($tafnum_results === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (count($tafxml->data->TAF->raw_text) === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $tafxml->data->TAF->raw_text->__toString();
|
||||
} catch (Exception $e) {
|
||||
Log::error('Error reading TAF: '.$e->getMessage());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ use App\Models\Enums\PirepStatus;
|
||||
use App\Models\Navdata;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\PirepFieldValue;
|
||||
use App\Models\SimBrief;
|
||||
use App\Models\User;
|
||||
use App\Repositories\AircraftRepository;
|
||||
use App\Repositories\AirportRepository;
|
||||
@@ -40,17 +41,16 @@ class PirepService extends Service
|
||||
private $airportSvc;
|
||||
private $geoSvc;
|
||||
private $pirepRepo;
|
||||
private $simBriefSvc;
|
||||
private $userSvc;
|
||||
|
||||
/**
|
||||
* @param AircraftRepository $aircraftRepo
|
||||
* @param GeoService $geoSvc
|
||||
* @param PirepRepository $pirepRepo
|
||||
* @param UserService $userSvc
|
||||
* @param AirportRepository $airportRepo
|
||||
* @param AirportService $airportSvc
|
||||
* @param GeoService $geoSvc
|
||||
* @param PirepRepository $pirepRepo
|
||||
* @param SimBriefService $simBriefSvc
|
||||
* @param UserService $userSvc
|
||||
*/
|
||||
public function __construct(
|
||||
@@ -59,14 +59,16 @@ class PirepService extends Service
|
||||
AircraftRepository $aircraftRepo,
|
||||
GeoService $geoSvc,
|
||||
PirepRepository $pirepRepo,
|
||||
SimBriefService $simBriefSvc,
|
||||
UserService $userSvc
|
||||
) {
|
||||
$this->airportRepo = $airportRepo;
|
||||
$this->airportSvc = $airportSvc;
|
||||
$this->aircraftRepo = $aircraftRepo;
|
||||
$this->geoSvc = $geoSvc;
|
||||
$this->userSvc = $userSvc;
|
||||
$this->pirepRepo = $pirepRepo;
|
||||
$this->simBriefSvc = $simBriefSvc;
|
||||
$this->userSvc = $userSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +117,7 @@ class PirepService extends Service
|
||||
|
||||
// See if this user is at the current airport
|
||||
/* @noinspection NotOptimalIfConditionsInspection */
|
||||
if (setting('pilots.only_flights_from_current')
|
||||
if (setting('pilots.only_flights_from_current', false)
|
||||
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
|
||||
throw new UserNotAtAirport($user, $pirep->dpt_airport);
|
||||
}
|
||||
@@ -206,6 +208,72 @@ class PirepService extends Service
|
||||
return $pirep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalize a PIREP (meaning it's been filed)
|
||||
*
|
||||
* @param Pirep $pirep
|
||||
* @param array $attrs
|
||||
* @param array PirepFieldValue[] $field_values
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return Pirep
|
||||
*/
|
||||
public function file(Pirep $pirep, array $attrs = [], array $field_values = []): Pirep
|
||||
{
|
||||
if (empty($field_values)) {
|
||||
$field_values = [];
|
||||
}
|
||||
|
||||
$attrs['state'] = PirepState::PENDING;
|
||||
$attrs['status'] = PirepStatus::ARRIVED;
|
||||
$attrs['submitted_at'] = Carbon::now('UTC');
|
||||
|
||||
$this->pirepRepo->update($attrs, $pirep->id);
|
||||
$pirep->refresh();
|
||||
|
||||
// Check if there is a simbrief_id, change it to be set to the PIREP
|
||||
// at the end of the flight when it's been filed
|
||||
if (array_key_exists('simbrief_id', $attrs)) {
|
||||
/** @var SimBrief $simbrief */
|
||||
$simbrief = SimBrief::find($attrs['simbrief_id']);
|
||||
if ($simbrief) {
|
||||
$this->simBriefSvc->attachSimbriefToPirep($pirep, $simbrief);
|
||||
}
|
||||
}
|
||||
|
||||
// Check the block times. If a block on (arrival) time isn't
|
||||
// specified, then use the time that it was submitted. It won't
|
||||
// be the most accurate, but that might be OK
|
||||
if (!$pirep->block_on_time) {
|
||||
if ($pirep->submitted_at) {
|
||||
$pirep->block_on_time = $pirep->submitted_at;
|
||||
} else {
|
||||
$pirep->block_on_time = Carbon::now('UTC');
|
||||
}
|
||||
}
|
||||
|
||||
// Check that there's a submit time
|
||||
if (!$pirep->submitted_at) {
|
||||
$pirep->submitted_at = Carbon::now('UTC');
|
||||
}
|
||||
|
||||
// Copy some fields over from Flight if we have it
|
||||
if ($pirep->flight) {
|
||||
$pirep->planned_distance = $pirep->flight->distance;
|
||||
$pirep->planned_flight_time = $pirep->flight->flight_time;
|
||||
}
|
||||
|
||||
$pirep->save();
|
||||
$pirep->refresh();
|
||||
|
||||
if (count($field_values) > 0) {
|
||||
$this->updateCustomFields($pirep->id, $field_values);
|
||||
}
|
||||
|
||||
return $pirep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find if there are duplicates to a given PIREP. Ideally, the passed
|
||||
* in PIREP hasn't been saved or gone through the create() method
|
||||
@@ -306,18 +374,6 @@ class PirepService extends Service
|
||||
return $pirep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias to submit()
|
||||
*
|
||||
* @param \App\Models\Pirep $pirep
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function file(Pirep $pirep)
|
||||
{
|
||||
return $this->submit($pirep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the PIREP. Figure out its default state
|
||||
*
|
||||
|
||||
@@ -32,7 +32,7 @@ class SimBriefService extends Service
|
||||
*
|
||||
* @return SimBrief|null
|
||||
*/
|
||||
public function checkForOfp(string $user_id, string $ofp_id, string $flight_id)
|
||||
public function downloadOfp(string $user_id, string $ofp_id, string $flight_id)
|
||||
{
|
||||
$uri = str_replace('{id}', $ofp_id, config('phpvms.simbrief_url'));
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ use App\Repositories\SubfleetRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Support\Units\Time;
|
||||
use App\Support\Utils;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use function is_array;
|
||||
@@ -254,6 +255,41 @@ class UserService extends Service
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all of the users that are determined to be on leave. Only goes through the
|
||||
* currently active users. If the user doesn't have a PIREP, then the creation date
|
||||
* of the user record is used to determine the difference
|
||||
*/
|
||||
public function findUsersOnLeave(): array
|
||||
{
|
||||
$leave_days = setting('pilots.auto_leave_days');
|
||||
if ($leave_days === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$return_users = [];
|
||||
|
||||
$date = Carbon::now('UTC');
|
||||
$users = User::with(['last_pirep'])->where('state', UserState::ACTIVE)->get();
|
||||
|
||||
/** @var User $user */
|
||||
foreach ($users as $user) {
|
||||
// If they haven't submitted a PIREP, use the date that the user was created
|
||||
if (!$user->last_pirep) {
|
||||
$diff_date = $user->created_at;
|
||||
} else {
|
||||
$diff_date = $user->last_pirep->submitted_at;
|
||||
}
|
||||
|
||||
// See if the difference is larger than what the setting calls for
|
||||
if ($date->diffInDays($diff_date) > $leave_days) {
|
||||
$return_users[] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
return $return_users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the subfleets this user is allowed access to,
|
||||
* based on their current rank
|
||||
@@ -426,7 +462,7 @@ class UserService extends Service
|
||||
$user->state = UserState::ON_LEAVE;
|
||||
$user->save();
|
||||
|
||||
event(new UserStateChanged($user, UserState::ACTIVE));
|
||||
event(new UserStateChanged($user, UserState::ON_LEAVE));
|
||||
|
||||
$user->refresh();
|
||||
return $user;
|
||||
|
||||
@@ -123,6 +123,10 @@ class Utils
|
||||
return $val;
|
||||
}
|
||||
|
||||
if ($result->hostname === 'localhost') {
|
||||
return 'localhost';
|
||||
}
|
||||
|
||||
// Couldn't validate a domain, see if this is an IP address?
|
||||
if (filter_var($url, FILTER_VALIDATE_IP)) {
|
||||
return $url;
|
||||
|
||||
@@ -11,7 +11,8 @@ use App\Services\AirportService;
|
||||
class Weather extends Widget
|
||||
{
|
||||
protected $config = [
|
||||
'icao' => null,
|
||||
'icao' => null,
|
||||
'raw_only' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -22,10 +23,12 @@ class Weather extends Widget
|
||||
/** @var \App\Services\AirportService $airportSvc */
|
||||
$airportSvc = app(AirportService::class);
|
||||
$metar = $airportSvc->getMetar($this->config['icao']);
|
||||
$taf = $airportSvc->getTaf($this->config['icao']);
|
||||
|
||||
return view('widgets.weather', [
|
||||
'config' => $this->config,
|
||||
'metar' => $metar,
|
||||
'taf' => $taf,
|
||||
'unit_alt' => setting('units.altitude'),
|
||||
'unit_dist' => setting('units.distance'),
|
||||
'unit_temp' => setting('units.temperature'),
|
||||
|
||||
@@ -161,6 +161,7 @@ if (!function_exists('setting')) {
|
||||
*/
|
||||
function setting($key, $default = null)
|
||||
{
|
||||
/** @var \App\Repositories\SettingRepository $settingRepo */
|
||||
$settingRepo = app(SettingRepository::class);
|
||||
|
||||
try {
|
||||
@@ -181,6 +182,7 @@ if (!function_exists('setting')) {
|
||||
if (!function_exists('setting_save')) {
|
||||
function setting_save($key, $value)
|
||||
{
|
||||
/** @var \App\Repositories\SettingRepository $settingRepo */
|
||||
$settingRepo = app(SettingRepository::class);
|
||||
$settingRepo->save($key, $value);
|
||||
return $value;
|
||||
@@ -355,6 +357,20 @@ if (!function_exists('show_datetime_format')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('secstohhmm')) {
|
||||
/**
|
||||
* Convert seconds to hhmm format
|
||||
*
|
||||
* @param $seconds
|
||||
*/
|
||||
function secstohhmm($seconds)
|
||||
{
|
||||
$seconds = round($seconds);
|
||||
$hhmm = sprintf('%02d%02d', ($seconds / 3600), ($seconds / 60 % 60));
|
||||
echo $hhmm;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('_fmt')) {
|
||||
/**
|
||||
* Replace strings
|
||||
|
||||
+2
-1
@@ -58,7 +58,8 @@
|
||||
"webpatser/laravel-uuid": "~3.0",
|
||||
"oomphinc/composer-installers-extender": "^1.1",
|
||||
"laravel/ui": "^2.0",
|
||||
"madnest/madzipper": "^1.0"
|
||||
"madnest/madzipper": "^1.0",
|
||||
"elcobvg/laravel-opcache": "^0.4.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.0",
|
||||
|
||||
Generated
+58
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6f5fb0bd12dc789b1ad1613ddf907a80",
|
||||
"content-hash": "5bd282b9602f7922883277e45c82603e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "akaunting/money",
|
||||
@@ -1655,6 +1655,63 @@
|
||||
],
|
||||
"time": "2020-08-08T21:28:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "elcobvg/laravel-opcache",
|
||||
"version": "0.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/elcobvg/laravel-opcache.git",
|
||||
"reference": "a9af6d12f8bda562dd187f6d5368c647c1f02a44"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/elcobvg/laravel-opcache/zipball/a9af6d12f8bda562dd187f6d5368c647c1f02a44",
|
||||
"reference": "a9af6d12f8bda562dd187f6d5368c647c1f02a44",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "1.0",
|
||||
"orchestra/testbench": "3.5",
|
||||
"phpunit/phpunit": "6.5",
|
||||
"squizlabs/php_codesniffer": "3.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"ElcoBvg\\Opcache\\ServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ElcoBvg\\Opcache\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Elco Brouwer von Gonzenbach",
|
||||
"email": "elco.brouwer@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Custom OPcache Cache Driver for Laravel. Faster than Redis or memcached.",
|
||||
"homepage": "https://github.com/elcobvg/laravel-opcache",
|
||||
"keywords": [
|
||||
"Opcache",
|
||||
"cache",
|
||||
"driver",
|
||||
"laravel",
|
||||
"webprofiler"
|
||||
],
|
||||
"time": "2020-05-16T00:51:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "facade/flare-client-php",
|
||||
"version": "1.3.5",
|
||||
|
||||
+6
-6
@@ -135,7 +135,7 @@ return [
|
||||
*/
|
||||
'monitor_backups' => [
|
||||
[
|
||||
'name' => config(config('app.name'), 'phpvms-backup'),
|
||||
'name' => config('app.name'),
|
||||
'disks' => ['local'],
|
||||
'health_checks' => [
|
||||
MaximumAgeInDays::class => 1,
|
||||
@@ -172,27 +172,27 @@ return [
|
||||
/*
|
||||
* The number of days for which backups must be kept.
|
||||
*/
|
||||
'keep_all_backups_for_days' => 7,
|
||||
'keep_all_backups_for_days' => 3,
|
||||
|
||||
/*
|
||||
* The number of days for which daily backups must be kept.
|
||||
*/
|
||||
'keep_daily_backups_for_days' => 7,
|
||||
'keep_daily_backups_for_days' => 2,
|
||||
|
||||
/*
|
||||
* The number of weeks for which one weekly backup must be kept.
|
||||
*/
|
||||
'keep_weekly_backups_for_weeks' => 4,
|
||||
'keep_weekly_backups_for_weeks' => 2,
|
||||
|
||||
/*
|
||||
* The number of months for which one monthly backup must be kept.
|
||||
*/
|
||||
'keep_monthly_backups_for_months' => 4,
|
||||
'keep_monthly_backups_for_months' => 1,
|
||||
|
||||
/*
|
||||
* The number of years for which one yearly backup must be kept.
|
||||
*/
|
||||
'keep_yearly_backups_for_years' => 2,
|
||||
'keep_yearly_backups_for_years' => 1,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
|
||||
+6
-2
@@ -9,14 +9,18 @@ return [
|
||||
'key' => 'airports.lookup:',
|
||||
'time' => 60 * 30,
|
||||
],
|
||||
'WEATHER_LOOKUP' => [
|
||||
'key' => 'airports.weather.', // append icao
|
||||
'METAR_WEATHER_LOOKUP' => [
|
||||
'key' => 'airports.weather.metar.', // append icao
|
||||
'time' => 60 * 60, // Cache for 60 minutes
|
||||
],
|
||||
'RANKS_PILOT_LIST' => [
|
||||
'key' => 'ranks.pilot_list',
|
||||
'time' => 60 * 10,
|
||||
],
|
||||
'TAF_WEATHER_LOOKUP' => [
|
||||
'key' => 'airports.weather.taf.', // append icao
|
||||
'time' => 60 * 60, // Cache for 60 minutes
|
||||
],
|
||||
'USER_API_KEY' => [
|
||||
'key' => 'user.apikey',
|
||||
'time' => 60 * 5, // 5 min
|
||||
|
||||
@@ -23,6 +23,7 @@ return [
|
||||
'tokenizer',
|
||||
'json',
|
||||
'curl',
|
||||
'dom',
|
||||
],
|
||||
|
||||
// Make sure these are writable
|
||||
|
||||
+18
-2
@@ -15,8 +15,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('MAIL_DRIVER', 'smtp'),
|
||||
|
||||
'default' => env('MAIL_DRIVER', 'smtp'),
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
@@ -71,4 +70,21 @@ return [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'no-reply@phpvms.net'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ return [
|
||||
'expire_on_close' => false,
|
||||
'encrypt' => false,
|
||||
'files' => storage_path('framework/sessions'),
|
||||
'connection' => null,
|
||||
'connection' => 'mysql',
|
||||
'table' => 'sessions',
|
||||
'store' => null,
|
||||
'lottery' => [1, 100],
|
||||
|
||||
@@ -42,7 +42,7 @@ class PilotHoursAwards extends Award
|
||||
*/
|
||||
public function check($flight_minutes = null): bool
|
||||
{
|
||||
if (!is_int($flight_minutes)) {
|
||||
if (!is_numeric($flight_minutes)) {
|
||||
Log::error('PilotHourAwards: Flight time "'.$flight_minutes.'" is not a valid flight time');
|
||||
return false;
|
||||
}
|
||||
|
||||
Generated
+6
-11
@@ -1983,11 +1983,6 @@
|
||||
"resolved": "https://registry.npmjs.org/bootstrap-sass/-/bootstrap-sass-3.4.1.tgz",
|
||||
"integrity": "sha512-p5rxsK/IyEDQm2CwiHxxUi0MZZtvVFbhWmyMOt4lLkA4bujDA1TGoKT0i1FKIWiugAdP+kK8T5KMDFIKQCLYIA=="
|
||||
},
|
||||
"bootstrap3": {
|
||||
"version": "npm:bootstrap@3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.4.1.tgz",
|
||||
"integrity": "sha512-yN5oZVmRCwe5aKwzRj6736nSmKDX7pLYwsXiCj/EYmo16hODaBiT4En5btW/jhBF/seV+XMx3aYwukYC3A49DA=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@@ -5130,9 +5125,9 @@
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||
},
|
||||
"inquirer": {
|
||||
"version": "7.3.3",
|
||||
@@ -5817,9 +5812,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"lodash.memoize": {
|
||||
"version": "4.1.2",
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
"leaflet-providers": "1.0.*",
|
||||
"leaflet-rotatedmarker": "^0.2.0",
|
||||
"leaflet.geodesic": "^2.5.2",
|
||||
"lodash": ">=4.17.19",
|
||||
"lodash": ">=4.17.21",
|
||||
"marked": "^1.2.2",
|
||||
"minimist": "^1.2.2",
|
||||
"moment": "^2.29.1",
|
||||
|
||||
@@ -130,3 +130,11 @@
|
||||
border-radius: 5px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
/*
|
||||
* fix the dropdown menu on mobile view
|
||||
*/
|
||||
.dropdown-menu:not(.show) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ return [
|
||||
|
||||
// Overrides config/mail.php
|
||||
'mail' => [
|
||||
'driver' => 'mail', # Default is to use the mail() fn
|
||||
'default' => 'mail', # Default is to use the mail() fn
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
@@ -107,7 +107,8 @@ return [
|
||||
|
||||
// Overrides config/session.php
|
||||
'session' => [
|
||||
'default' => 'file',
|
||||
'driver' => 'database',
|
||||
'connection' => 'mysql',
|
||||
'lifetime' => 60 * 24, # 24 hours
|
||||
],
|
||||
];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="content">
|
||||
@if($cron_problem_exists)
|
||||
<div class="alert alert-danger" role="alert">
|
||||
There was a problem running the cron; make sure it's setup and check logs at
|
||||
The cron has not run in more than 12 hours; make sure it's setup and check logs at
|
||||
<span class="text-monospace bg-gradient-dark">storage/logs/cron.log</span>.
|
||||
<a href="{{ docs_link('cron') }}" target="_blank">See the docs</a>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<div class="card">
|
||||
<div class="card-block" style="min-height: 0px; display: flex; justify-content: center; align-items: center;">
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ route('frontend.flights.bids') }}" class="btn btn-outline-primary">{{ trans_choice('flights.mybid', 2) }}</a>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ route('frontend.flights.bids') }}"
|
||||
class="btn btn-outline-primary">{{ trans_choice('flights.mybid', 2) }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,40 +1,25 @@
|
||||
<h3 class="description">@lang('flights.search')</h3>
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="card-body ml-1 mr-1" style="min-height: 0px; display: flex; justify-content: center; align-items: center;">
|
||||
<h4 class="description">@lang('flights.search')</h4>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-group search-form">
|
||||
{{ Form::open([
|
||||
'route' => 'frontend.flights.search',
|
||||
'method' => 'GET',
|
||||
'class'=>'form-inline'
|
||||
]) }}
|
||||
|
||||
<div class="mt-1">
|
||||
<p>@lang('common.airline')</p>
|
||||
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
|
||||
<div class="form-group">
|
||||
<p>@lang('common.airline')</p>
|
||||
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>@lang('flights.flighttype')</label>
|
||||
<select id="flight_type" name="flight_type" class="custom-select select2">
|
||||
<option value=""></option>
|
||||
<option value="J">@lang('flights.type.pass_scheduled')</option>
|
||||
<option value="G">@lang('flights.type.pass_addtl')</option>
|
||||
<option value="C">@lang('flights.type.charter_pass_only')</option>
|
||||
<option value="O">@lang('flights.type.charter_special')</option>
|
||||
<option value="E">@lang('flights.type.special_vip')</option>
|
||||
<option value="F">@lang('flights.type.cargo_scheduled')</option>
|
||||
<option value="A">@lang('flights.type.addtl_cargo_mail')</option>
|
||||
<option value="H">@lang('flights.type.charter_cargo')</option>
|
||||
<option value="M">@lang('flights.type.mail_service')</option>
|
||||
<option value="I">@lang('flights.type.ambulance')</option>
|
||||
<option value="K">@lang('flights.type.training_flight')</option>
|
||||
<option value="P">@lang('flights.type.positioning')</option>
|
||||
<option value="T">@lang('flights.type.technical_test')</option>
|
||||
<option value="X">@lang('flights.type.technical_stop')</option>
|
||||
<option value="W">@lang('flights.type.military')</option>
|
||||
</select>
|
||||
<div class="mt-1">
|
||||
<p>@lang('flights.flighttype')</p>
|
||||
{{ Form::select('flight_type', $flight_types, null , ['class' => 'form-control select2']) }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="mt-1">
|
||||
<p>@lang('flights.flightnumber')</p>
|
||||
{{ Form::text('flight_number', null, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
@extends('app')
|
||||
@section('title', 'SimBrief Flight Planning')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Select Aircraft for Flight</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<select id="aircraftselection" class="form-control select2" onchange="checkacselection()">
|
||||
<option value="ZZZZZ">Please Select An Aircraft</option>
|
||||
@foreach($subfleets as $subfleet)
|
||||
@foreach($subfleet->aircraft as $ac)
|
||||
<option value="{{ $ac->id }}">[ {{ $ac->icao }} ] {{ $ac->registration }}</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 text-right">
|
||||
<a id="generate_link" style="visibility: hidden"
|
||||
href="{{ route('frontend.simbrief.generate') }}?flight_id={{ $flight->id }}"
|
||||
class="btn btn-primary">Proceed To Flight Planning</a>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('scripts')
|
||||
<script type="text/javascript">
|
||||
// Simple Aircraft Selection With Dropdown Change
|
||||
// Also keep Generate button hidden until a valid AC selection
|
||||
const $oldlink = document.getElementById("generate_link").href;
|
||||
|
||||
function checkacselection() {
|
||||
if (document.getElementById("aircraftselection").value === "ZZZZZ") {
|
||||
document.getElementById('generate_link').style.visibility = 'hidden';
|
||||
} else {
|
||||
document.getElementById('generate_link').style.visibility = 'visible';
|
||||
}
|
||||
const selectedac = document.getElementById("aircraftselection").value;
|
||||
const newlink = "&aircraft_id=".concat(selectedac);
|
||||
|
||||
document.getElementById("generate_link").href = $oldlink.concat(newlink);
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
@@ -10,14 +10,14 @@
|
||||
<div class="col-sm-3">
|
||||
@if (empty($simbrief->pirep_id))
|
||||
<a class="btn btn-outline-info pull-right btn-lg"
|
||||
style="margin-top: -10px;margin-bottom: 5px"
|
||||
style="margin-top: -10px; margin-bottom: 5px"
|
||||
href="{{ url(route('frontend.simbrief.prefile', [$simbrief->id])) }}">Prefile PIREP</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<a class="btn btn-primary pull-right btn-lg"
|
||||
style="margin-top: -10px;margin-bottom: 5px"
|
||||
href="{{ url(route('frontend.simbrief.remove', [$simbrief->id])) }}">Generate New OFP</a>
|
||||
<a class="btn btn-primary pull-right btn-lg"
|
||||
style="margin-top: -10px; margin-bottom: 5px"
|
||||
href="{{ url(route('frontend.simbrief.generate_new', [$simbrief->id])) }}">Generate New OFP</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -72,9 +72,9 @@
|
||||
</div>
|
||||
|
||||
<div class="col-4 text-center">
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Enroute Time</p>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Est. Enroute Time</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">
|
||||
@minutestotime($simbrief->xml->times->sched_time_enroute / 60)</p>
|
||||
@minutestotime($simbrief->xml->times->est_time_enroute / 60)</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -134,24 +134,30 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Departure METAR</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->orig_metar }}</p>
|
||||
<p
|
||||
class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->orig_metar }}</p>
|
||||
</div>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Departure TAF</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->orig_taf }}</p>
|
||||
<p
|
||||
class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->orig_taf }}</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Destination METAR</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->dest_metar }}</p>
|
||||
<p
|
||||
class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->dest_metar }}</p>
|
||||
</div>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Destination TAF</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->dest_taf }}</p>
|
||||
<p
|
||||
class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->dest_taf }}</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Alternate METAR</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->altn_metar }}</p>
|
||||
<hr/>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Alternate METAR</p>
|
||||
<p
|
||||
class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->altn_metar }}</p>
|
||||
</div>
|
||||
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Alternate TAF</p>
|
||||
<p class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->altn_taf }}</p>
|
||||
<p
|
||||
class="border border-dark rounded p-1 small text-monospace">{{ $simbrief->xml->weather->altn_taf }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -181,66 +187,55 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-container">
|
||||
<h6><i class="fas fa-info-circle"></i> Prefile ATC Flight Plan</h6>
|
||||
<div class="form-container-body">
|
||||
<div class="row">
|
||||
<div class="col-4" align="center">
|
||||
@php
|
||||
$str = $simbrief->xml->aircraft->equip ;
|
||||
$wc = stripos($str,"-");
|
||||
$tr = stripos($str,"/");
|
||||
$wakecat = substr($str,0,$wc);
|
||||
$equipment = substr($str,$wc+1,$tr-2);
|
||||
$transponder = substr($str,$tr+1);
|
||||
function secstohhmm($seconds) {
|
||||
$seconds = round($seconds);
|
||||
$hhmm = sprintf('%02d%02d', ($seconds/ 3600),($seconds/ 60 % 60));
|
||||
echo $hhmm ;
|
||||
}
|
||||
@endphp
|
||||
<form action="https://fpl.ivao.aero/api/fp/load" method="POST" target="_blank">
|
||||
<input type="hidden" name="CALLSIGN" value="{{ $simbrief->xml->atc->callsign }}" />
|
||||
<input type="hidden" name="RULES" value="I" />
|
||||
<input type="hidden" name="FLIGHTTYPE" value="N" />
|
||||
<input type="hidden" name="NUMBER" value="1" />
|
||||
<input type="hidden" name="ACTYPE" value="{{ $simbrief->xml->aircraft->icaocode }}" />
|
||||
<input type="hidden" name="WAKECAT" value="{{ $wakecat }}" />
|
||||
<input type="hidden" name="EQUIPMENT" value="{{ $equipment }}" />
|
||||
<input type="hidden" name="TRANSPONDER" value="{{ $transponder }}" />
|
||||
<input type="hidden" name="DEPICAO" value="{{ $simbrief->xml->origin->icao_code}}" />
|
||||
<input type="hidden" name="DEPTIME" value="{{ date('Hi', $simbrief->xml->times->est_out->__toString())."" }}" />
|
||||
<input type="hidden" name="SPEEDTYPE" value="{{ $simbrief->xml->atc->initial_spd_unit }}" />
|
||||
<input type="hidden" name="SPEED" value="{{ $simbrief->xml->atc->initial_spd }}" />
|
||||
<input type="hidden" name="LEVELTYPE" value="{{ $simbrief->xml->atc->initial_alt_unit }}" />
|
||||
<input type="hidden" name="LEVEL" value="{{ $simbrief->xml->atc->initial_alt }}" />
|
||||
<input type="hidden" name="ROUTE" value="{{ $simbrief->xml->general->route_ifps }}" />
|
||||
<input type="hidden" name="DESTICAO" value="{{ $simbrief->xml->destination->icao_code }}" />
|
||||
<input type="hidden" name="EET" value="@php secstohhmm($simbrief->xml->times->est_time_enroute) @endphp" />
|
||||
<input type="hidden" name="ALTICAO" value="{{ $simbrief->xml->alternate->icao_code}}" />
|
||||
<input type="hidden" name="ALTICAO2" value="{{ $simbrief->xml->alternate2->icao_code}}" />
|
||||
<input type="hidden" name="OTHER" value="{{ $simbrief->xml->atc->section18 }}" />
|
||||
<input type="hidden" name="ENDURANCE" value="@php secstohhmm($simbrief->xml->times->endurance) @endphp" />
|
||||
<input type="hidden" name="POB" value="{{ $simbrief->xml->weights->pax_count }}" />
|
||||
<input id="ivao_prefile" type="submit" class="btn btn-primary" value="File ATC on IVAO" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-4" align="center">
|
||||
<form action="https://my.vatsim.net/pilots/flightplan" method="GET" target="_blank">
|
||||
<input type="hidden" name="raw" value="{{ $simbrief->xml->atc->flightplan_text }}">
|
||||
<input type="hidden" name="fuel_time" value="@php secstohhmm($simbrief->xml->times->endurance) @endphp">
|
||||
<input type="hidden" name="speed" value="{{ $simbrief->xml->atc->initial_spd }}">
|
||||
<input type="hidden" name="altitude" value="{{ $simbrief->xml->atc->initial_alt }}">
|
||||
<input id="vatsim_prefile" type="submit" class="btn btn-primary" value="File ATC on VATSIM"/>
|
||||
</form>
|
||||
<form action="https://fpl.ivao.aero/api/fp/load" method="POST" target="_blank">
|
||||
<input type="hidden" name="CALLSIGN" value="{{ $simbrief->xml->atc->callsign }}"/>
|
||||
<input type="hidden" name="RULES" value="I"/>
|
||||
<input type="hidden" name="FLIGHTTYPE" value="N"/>
|
||||
<input type="hidden" name="NUMBER" value="1"/>
|
||||
<input type="hidden" name="ACTYPE" value="{{ $simbrief->xml->aircraft->icaocode }}"/>
|
||||
<input type="hidden" name="WAKECAT" value="{{ $wakecat }}"/>
|
||||
<input type="hidden" name="EQUIPMENT" value="{{ $equipment }}"/>
|
||||
<input type="hidden" name="TRANSPONDER" value="{{ $transponder }}"/>
|
||||
<input type="hidden" name="DEPICAO" value="{{ $simbrief->xml->origin->icao_code}}"/>
|
||||
<input type="hidden" name="DEPTIME" value="{{ date('Hi', $simbrief->xml->times->est_out->__toString()) }}"/>
|
||||
<input type="hidden" name="SPEEDTYPE" value="{{ $simbrief->xml->atc->initial_spd_unit }}"/>
|
||||
<input type="hidden" name="SPEED" value="{{ $simbrief->xml->atc->initial_spd }}"/>
|
||||
<input type="hidden" name="LEVELTYPE" value="{{ $simbrief->xml->atc->initial_alt_unit }}"/>
|
||||
<input type="hidden" name="LEVEL" value="{{ $simbrief->xml->atc->initial_alt }}"/>
|
||||
<input type="hidden" name="ROUTE" value="{{ $simbrief->xml->general->route_ifps }}"/>
|
||||
<input type="hidden" name="DESTICAO" value="{{ $simbrief->xml->destination->icao_code }}"/>
|
||||
<input type="hidden" name="EET" value="@secstohhmm($simbrief->xml->times->est_time_enroute)"/>
|
||||
<input type="hidden" name="ALTICAO" value="{{ $simbrief->xml->alternate->icao_code}}"/>
|
||||
<input type="hidden" name="ALTICAO2" value="{{ $simbrief->xml->alternate2->icao_code}}"/>
|
||||
<input type="hidden" name="OTHER" value="{{ $simbrief->xml->atc->section18 }}"/>
|
||||
<input type="hidden" name="ENDURANCE" value="@secstohhmm($simbrief->xml->times->endurance)"/>
|
||||
<input type="hidden" name="POB" value="{{ $simbrief->xml->weights->pax_count }}"/>
|
||||
<input id="ivao_prefile" type="submit" class="btn btn-primary" value="File ATC on IVAO"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-4" align="center">
|
||||
<form action="https://my.vatsim.net/pilots/flightplan" method="GET" target="_blank">
|
||||
<input type="hidden" name="raw" value="{{ $simbrief->xml->atc->flightplan_text }}">
|
||||
<input type="hidden" name="fuel_time" value="@secstohhmm($simbrief->xml->times->endurance)">
|
||||
<input type="hidden" name="speed" value="@if(substr($simbrief->xml->atc->initial_spd,0,1) === '0') {{ substr($simbrief->xml->atc->initial_spd,1) }} @else {{ $simbrief->xml->atc->initial_spd }} @endif">
|
||||
<input type="hidden" name="altitude" value="{{ $simbrief->xml->general->initial_altitude }}">
|
||||
<input id="vatsim_prefile" type="submit" class="btn btn-primary" value="File ATC on VATSIM"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-4" align="center">
|
||||
<a
|
||||
href="http://skyvector.com/?chart=304&fpl={{ $simbrief->xml->origin->icao_code}} {{ $simbrief->xml->general->route }} {{ $simbrief->xml->destination->icao_code}}"
|
||||
target="_blank" class="btn btn-info">View Route At SkyVector</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4" align="center">
|
||||
<a href="http://skyvector.com/?chart=304&fpl={{ $simbrief->xml->origin->icao_code}} {{ $simbrief->xml->general->route }} {{ $simbrief->xml->destination->icao_code}}" target="_blank" class="btn btn-info">View Route At SkyVector</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-container">
|
||||
<h6><i class="fas fa-info-circle"></i>
|
||||
OFP
|
||||
|
||||
@@ -1,269 +1,416 @@
|
||||
@extends('app')
|
||||
@section('title', 'Generate OFP')
|
||||
@section('title', 'SimBrief Flight Planning')
|
||||
|
||||
@section('content')
|
||||
@foreach($aircraft as $acdetails)
|
||||
@php
|
||||
$simbrieftype = $acdetails->icao ;
|
||||
$subflid = $acdetails->subfleet_id ;
|
||||
if($acdetails->icao === 'A20N') { $simbrieftype = 'A320'; }
|
||||
if($acdetails->icao === 'A21N') { $simbrieftype = 'A321'; }
|
||||
if($acdetails->icao === 'B77L') { $simbrieftype = 'B77F'; }
|
||||
if($acdetails->icao === 'B773') { $simbrieftype = 'B77W'; }
|
||||
if($acdetails->icao === 'E35L') { $simbrieftype = 'E135'; }
|
||||
@endphp
|
||||
@endforeach
|
||||
|
||||
<form id="sbapiform">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Create Flight Briefing</h2>
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="form-container">
|
||||
<h6><i class="fas fa-info-circle"></i>
|
||||
@lang('pireps.flightinformations')
|
||||
</h6>
|
||||
<div class="form-container-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<label for="orig">Departure Airport</label>
|
||||
<input id="orig"
|
||||
name="orig"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="ZZZZ"
|
||||
maxlength="4"
|
||||
value="{{ $flight->dpt_airport_id }}"/>
|
||||
<h2>Create Simbrief Briefing</h2>
|
||||
<div class="card">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="form-container">
|
||||
<div class="form-container-body">
|
||||
<h6><i class="fas fa-info-circle"></i> Aircraft Details</h6>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<label for="type">Type</label>
|
||||
<input type="text" class="form-control" value="{{ $acdetails->icao }}" maxlength="4" disabled/>
|
||||
<input type="hidden" id="type" name="type" class="form-control" value="{{ $simbrieftype }}"
|
||||
maxlength="4"/>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label for="reg">Registration</label>
|
||||
<input type="text" class="form-control" value="{{ $acdetails->registration }}" maxlength="6"
|
||||
disabled/>
|
||||
<input type="hidden" id="reg" name="reg" value="{{ $acdetails->registration }}"/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<label for="dest">Arrival Airport</label>
|
||||
<input id="dest"
|
||||
name="dest"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder=""
|
||||
maxlength="4"
|
||||
value="{{ $flight->arr_airport_id }}"/>
|
||||
<div class="form-container-body">
|
||||
<h6><i class="fas fa-info-circle"></i> @lang('pireps.flightinformations') for
|
||||
<b>{{ $flight->airline->icao }} {{ $flight->flight_number }}</b></h6>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<label for="dorig">Departure Airport</label>
|
||||
<input id="dorig" type="text" class="form-control" maxlength="4"
|
||||
value="{{ $flight->dpt_airport_id }}" disabled/>
|
||||
<input id="orig" name="orig" type="hidden" maxlength="4" value="{{ $flight->dpt_airport_id }}"/>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label for="ddest">Arrival Airport</label>
|
||||
<input id="ddest" type="text" class="form-control" maxlength="4"
|
||||
value="{{ $flight->arr_airport_id }}" disabled/>
|
||||
<input id="dest" name="dest" type="hidden" maxlength="4" value="{{ $flight->arr_airport_id }}"/>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label for="altn">Alternate Airport</label>
|
||||
<input id="altn" name="altn" type="text" class="form-control" maxlength="4"
|
||||
value="{{ $flight->alt_airport_id ?? 'AUTO' }}"/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<label for="route">Preferred Company Route</label>
|
||||
<input id="route" name="route" type="text" class="form-control" placeholder="" maxlength="1000"
|
||||
value="{{ $flight->route }}"/>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label for="fl">Preferred Flight Level</label>
|
||||
<input id="fl" name="fl" type="text" class="form-control" placeholder="" maxlength="5"
|
||||
value="{{ $flight->level }}"/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<label for="std">Scheduled Departure Time (UTC)</label>
|
||||
<input id="std" type="text" class="form-control" placeholder="" maxlength="4"
|
||||
value="{{ $flight->dpt_time }}" disabled/>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label for="etd">Estimated Departure Time (UTC)</label>
|
||||
<input id="etd" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label for="dof">Date Of Flight (UTC)</label>
|
||||
<input id="dof" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<label for="type">Aircraft</label>
|
||||
<select id="type" name="type" class="custom-select select2">
|
||||
<option value="A306" title="A306">A306 - A300F4-600</option>
|
||||
<option value="A310" title="A310 / CF6-80C2A2">A310 - A310-304</option>
|
||||
<option value="A318" title="A318 / CFM56-5B9/P">A318 - A318-100</option>
|
||||
<option value="A319" title="A319 / CFM56-5B6/2P">A319 - A319-100</option>
|
||||
<option value="A320" title="A320 / CFM56-5B4/P">A320 - A320-200</option>
|
||||
<option value="A321" title="A321 / CFM56-5B3/P">A321 - A321-200</option>
|
||||
<option value="A332" title="A332 / CF6-80E1A4">A332 - A330-200</option>
|
||||
<option value="A333" title="A333 / RR Trent 772B">A333 - A330-300</option>
|
||||
<option value="A342" title="A342 / CFM56-5C2">A342 - A340-200</option>
|
||||
<option value="A343" title="A343 / CFM56-5C4">A343 - A340-300</option>
|
||||
<option value="A345" title="A345 / RB211 Trent 556-61">A345 - A340-500</option>
|
||||
<option value="A346" title="A346 / RB211 Trent 556-61">A346 - A340-600</option>
|
||||
<option value="A359" title="A359 / TRENT XWB-84">A359 - A350-900</option>
|
||||
<option value="A35K" title="A35K / TRENT XWB-97">A35K - A350-1000</option>
|
||||
<option value="A388" title="A388">A388 - A380-800</option>
|
||||
<option value="AT72" title="AT72">AT72 - ATR72-500</option>
|
||||
<option value="B190" title="B190 / PT6A-67D">B190 - B1900D</option>
|
||||
<option value="B350" title="B350">B350 - KINGAIR</option>
|
||||
<option value="B463" title="B463">B463 - BAE-146</option>
|
||||
<option value="B703" title="B703">B703 - B707-320B</option>
|
||||
<option value="B712" title="B712 / BR715-C1-30">B712 - B717-200</option>
|
||||
<option value="B722" title="B722">B722 - B727-200</option>
|
||||
<option value="B732" title="B732 / JT8D-15A">B732 - B737-200</option>
|
||||
<option value="B733" title="B733 / CFM56-3C-1">B733 - B737-300</option>
|
||||
<option value="B734" title="B734">B734 - B737-400</option>
|
||||
<option value="B735" title="B735">B735 - B737-500</option>
|
||||
<option value="B736" title="B736 / CFM56-7B22">B736 - B737-600</option>
|
||||
<option value="BBJ1" title="B737 / CFM56-7B27">BBJ1 - B737 BBJ</option>
|
||||
<option value="B737" title="B737 / CFM56-7B24">B737 - B737-700</option>
|
||||
<option value="BBJ2" title="B738 / CFM56-7B27">BBJ2 - B737 BBJ2</option>
|
||||
<option value="B738" title="B738 / CFM56-7B26">B738 - B737-800</option>
|
||||
<option value="BBJ3" title="B739 / CFM56-7B27">BBJ3 - B737 BBJ3</option>
|
||||
<option value="B739" title="B739 / CFM56-7B26">B739 - B737-900</option>
|
||||
<option value="B742" title="B742 / JT9D-7F">B742 - B747-200B</option>
|
||||
<option value="B744" title="B744 / RB211-524G/H">B744 - B747-400</option>
|
||||
<option value="B74F" title="B744 / RB211-524G/H">B74F - B747-400F</option>
|
||||
<option value="B748" title="B748 / GENX-2B67">B748 - B747-8</option>
|
||||
<option value="B48F" title="B748 / GENX-2B67">B48F - B747-8F</option>
|
||||
<option value="B752" title="B752 / PW2037">B752 - B757-200</option>
|
||||
<option value="B75F" title="B752 / PW2037">B75F - B757-200PF</option>
|
||||
<option value="B753" title="B753 / PW2037">B753 - B757-300</option>
|
||||
<option value="B762" title="B762 / CF6-80C2-B2">B762 - B767-200ER</option>
|
||||
<option value="B763" title="B763 / CF6-80C2B6F">B763 - B767-300ER</option>
|
||||
<option value="B76F" title="B763 / CF6-80C2B6F">B76F - B767-300F</option>
|
||||
<option value="B764" title="B764">B764 - B767-400ER</option>
|
||||
<option value="B772" title="B772 / GE90-94B">B772 - B777-200ER</option>
|
||||
<option value="B77L" title="B77L / GE90-110B1">B77L - B777-200LR</option>
|
||||
<option value="B77F" title="B77L / GE90-110B1">B77F - B777-F</option>
|
||||
<option value="B77W" title="B77W / GE90-115BL2">B77W - B777-300ER</option>
|
||||
<option value="B788" title="B788 / GENX-1B70">B788 - B787-8</option>
|
||||
<option value="B789" title="B789 / GENX-1B74">B789 - B787-9</option>
|
||||
<option value="B78X" title="B78X / GENX-1B76">B78X - B787-10</option>
|
||||
<option value="BE20" title="BE20">BE20 - KINGAIR</option>
|
||||
<option value="C172" title="C172 / IO-360-L2A">C172 - CESSNA 172R</option>
|
||||
<option value="C208" title="C208">C208 - CESSNA 208</option>
|
||||
<option value="C25A" title="C25A / FJ44-2C">C25A - CITATION CJ2</option>
|
||||
<option value="C404" title="C404">C404 - C404 TITAN</option>
|
||||
<option value="C510" title="C510">C510 - C510 MUSTANG</option>
|
||||
<option value="C550" title="C550">C550 - CITATION</option>
|
||||
<option value="C56X" title="C56X / PW545A">C56X - CITATION 560XL</option>
|
||||
<option value="C750" title="C750">C750 - CITATION X</option>
|
||||
<option value="CL30" title="CL30 / HTF7350">CL30 - CHALLENGER</option>
|
||||
<option value="CRJ2" title="CRJ2 / CF34-3B1">CRJ2 - CRJ-200</option>
|
||||
<option value="CRJ7" title="CRJ7 / CF34-8C1">CRJ7 - CRJ-700</option>
|
||||
<option value="CRJ9" title="CRJ9 / CF34-8C5">CRJ9 - CRJ-900</option>
|
||||
<option value="CRJX" title="CRJX / CF34-8C5A1">CRJX - CRJ-1000</option>
|
||||
<option value="DC10" title="DC10">DC10 - DC-10-30</option>
|
||||
<option value="DC6" title="DC6 / R2800-CB16">DC6 - DC-6</option>
|
||||
<option value="DC85" title="DC85 / JT3D-3B">DC85 - DC-8-55</option>
|
||||
<option value="DH8A" title="DH8A / PW120A">DH8A - DHC8-102</option>
|
||||
<option value="DH8B" title="DH8B / PW123C">DH8B - DHC8-200</option>
|
||||
<option value="DH8C" title="DH8C / PW123B">DH8C - DHC8-311</option>
|
||||
<option value="DH8D" title="DH8D / PW150A">DH8D - DHC8-402</option>
|
||||
<option value="DHC2" title="DHC2">DHC2 - BEAVER</option>
|
||||
<option value="DHC6" title="DHC6">DHC6 - TWIN OTTER</option>
|
||||
<option value="E13L" title="E135">E13L - EMB-135BJ</option>
|
||||
<option value="E135" title="E135 / AE3007-A1/3">E135 - EMB-135LR</option>
|
||||
<option value="E140" title="E135 / AE3007-A1/3">E140 - ERJ-140LR</option>
|
||||
<option value="E145" title="E145 / AE3007-A1">E145 - EMB-145LR</option>
|
||||
<option value="E170" title="E170 / CF34-8E5">E170 - EMB-170</option>
|
||||
<option value="E175" title="E170 / CF34-8E5">E175 - EMB-175</option>
|
||||
<option value="E190" title="E190 / CF34-10E6">E190 - EMB-190</option>
|
||||
<option value="E195" title="E190 / CF34-10E7">E195 - EMB-195</option>
|
||||
<option value="E50P" title="E50P / PW617F1-E">E50P - PHENOM 100</option>
|
||||
<option value="E55P" title="E55P / PW535E">E55P - PHENOM 300</option>
|
||||
<option value="EA50" title="EA50 / PW610F">EA50 - ECLIPSE 550</option>
|
||||
<option value="F50" title="F50">F50 - FOKKER F50</option>
|
||||
<option value="FA50" title="FA50 / TFE 731-40">FA50 - FALCON 50EX</option>
|
||||
<option value="GLF4" title="GLF4">GLF4 - GULFSTREAM</option>
|
||||
<option value="H25B" title="H25B">H25B - HAWKER 800A</option>
|
||||
<option value="JS41" title="JS41">JS41 - BAE JS-41</option>
|
||||
<option value="L101" title="L101 / RB211-524B">L101 - L1011-500</option>
|
||||
<option value="LJ25" title="LJ25 / CJ-610-8A">LJ25 - LEARJET 25</option>
|
||||
<option value="LJ45" title="LJ45">LJ45 - LEARJET 45</option>
|
||||
<option value="MD11" title="MD11 / CF6-80C2D1F">MD11 - MD-11</option>
|
||||
<option value="MD1F" title="MD11 / CF6-80C2D1F">MD1F - MD-11F</option>
|
||||
<option value="MD82" title="MD82 / JT8D-217">MD82 - DC-9-82</option>
|
||||
<option value="MD83" title="MD83 / JT8D-219">MD83 - DC-9-83</option>
|
||||
<option value="MD88" title="MD88 / JT8D-219">MD88 - MD-88</option>
|
||||
<option value="MD90" title="MD90">MD90 - MD-90-30</option>
|
||||
<option value="PC12" title="PC12 / PT6A-66D">PC12 - PILATUS PC12</option>
|
||||
<option value="RJ1H" title="RJ1H">RJ1H - AVRO RJ100</option>
|
||||
<option value="RJ70" title="RJ70">RJ70 - AVRO RJ70</option>
|
||||
<option value="RJ85" title="RJ85">RJ85 - AVRO RJ85</option>
|
||||
<option value="SF34" title="SF34 / GE CT7-9B">SF34 - SAAB 340B</option>
|
||||
<option value="SF50" title="SF50 / FJ33-5A">SF50 - VISION JET</option>
|
||||
<option value="SW4" title="SW4 / TPE-331">SW4 - METROLINER</option>
|
||||
<option value="T154" title="T154">T154 - TU-154B2</option>
|
||||
<option value="TBM9" title="TBM9 / PT6A-66D">TBM9 - TBM 900</option>
|
||||
</select>
|
||||
<div class="form-container-body">
|
||||
@foreach($subfleets as $subfleet)
|
||||
@if($subfleet->id == $subflid)
|
||||
<h6><i class="fas fa-info-circle"></i> Configuration And Load Information For
|
||||
<b>{{ $subfleet->name }} ; {{ $acdetails->registration }}</b></h6>
|
||||
{{-- Generate Load Figures --}}
|
||||
<div class="row">
|
||||
{{-- Create and send some data to the $loadarray for MANUALRMK generation --}}
|
||||
@php $loadarray = [] ; @endphp
|
||||
@foreach($subfleet->fares as $fare)
|
||||
@if($fare->capacity > 0)
|
||||
@php
|
||||
$randomloadperfare = ceil(($fare->capacity * (rand($loadmin, $loadmax))) /100);
|
||||
$loadarray[] = ['SeatType' => $fare->code];
|
||||
$loadarray[] = ['SeatLoad' => $randomloadperfare];
|
||||
@endphp
|
||||
<div class="col-sm-4">
|
||||
<label for="LoadFare{{ $fare->id }}">{{ $fare->name }} Load [
|
||||
Max: {{ number_format($fare->capacity) }} ]</label>
|
||||
<input id="LoadFare{{ $fare->id }}" type="text" class="form-control"
|
||||
value="{{ number_format($randomloadperfare) }} @if($randomloadperfare > '900') {{ setting('units.weight') }} @endif"
|
||||
disabled/>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
@php
|
||||
$loadcollection = collect($loadarray) ;
|
||||
$totalgenload = $loadcollection->sum('SeatLoad') ;
|
||||
@endphp
|
||||
</div>
|
||||
|
||||
@if($totalgenload > 0 && $totalgenload < 900)
|
||||
<input type="hidden" name="acdata" value="{'paxwgt':{{ $pax_weight }}}">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
@if(setting('units.weight') === 'kg')
|
||||
@php $estimatedpayload = number_format(round(($pax_weight * $totalgenload) / 2.2)) ; @endphp
|
||||
@else
|
||||
@php $estimatedpayload = number_format(round($pax_weight * $totalgenload)) ; @endphp
|
||||
@endif
|
||||
<label for="EstimatedLoad">Estimated Payload For {{ $totalgenload }} Pax</label>
|
||||
<input id="EstimatedLoad" type="text" class="form-control"
|
||||
value="{{ $estimatedpayload }} {{ setting('units.weight') }}" disabled/>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="pax" name="pax" class="form-control" value="{{ $totalgenload }}"/>
|
||||
@elseif($totalgenload > 900)
|
||||
<input type='hidden' id="pax" name='pax' value='0' maxlength='3'>
|
||||
<input type='hidden' id="cargo" name='cargo' value="{{ $totalgenload }}" maxlength='7'>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{--
|
||||
Here we generate the MANUALRMK which is sent to SimBrief and displayed in the generated
|
||||
ofp as Dispatch Remarks. $loadarray is created and filled with data during random load
|
||||
generation, it holds each fare's code and the generated load then we are imploding that
|
||||
array to get the fare codes and load counts.
|
||||
|
||||
Returned string will be like Load Distribution Y 132 C 12 F 4
|
||||
--}}
|
||||
@if($totalgenload > 0)
|
||||
@php
|
||||
$loaddisttxt = "Load Distribution ";
|
||||
$loaddist = implode(' ', array_map(
|
||||
function ($v, $k) {
|
||||
if(is_array($v)){
|
||||
return implode('&'.' '.':', $v);
|
||||
}else{
|
||||
return $k.':'.$v;
|
||||
}
|
||||
},
|
||||
$loadarray, array_keys($loadarray)
|
||||
));
|
||||
@endphp
|
||||
<input type="hidden" name="manualrmk" value="{{ $loaddisttxt }}{{ $loaddist }}">
|
||||
@endif
|
||||
<input type="hidden" name="airline" value="{{ $flight->airline->icao }}">
|
||||
<input type="hidden" name="fltnum" value="{{ $flight->flight_number }}">
|
||||
<input type="hidden" id="steh" name="steh" maxlength="2">
|
||||
<input type="hidden" id="stem" name="stem" maxlength="2">
|
||||
<input type="hidden" id="date" name="date" maxlength="9">
|
||||
<input type="hidden" id="deph" name="deph" maxlength="2">
|
||||
<input type="hidden" id="depm" name="depm" maxlength="2">
|
||||
<input type="hidden" name="selcal" value="BK-FS">
|
||||
<input type="hidden" name="planformat" value="lido">
|
||||
<input type="hidden" name="omit_sids" value="0">
|
||||
<input type="hidden" name="omit_stars" value="0">
|
||||
<input type="hidden" name="cruise" value="CI">
|
||||
<input type="hidden" name="civalue" value="AUTO">
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-container">
|
||||
<div class="form-container-body">
|
||||
<h6><i class="fas fa-info-circle"></i> Planning Options</h6>
|
||||
<table class="table table-hover table-striped">
|
||||
<tr>
|
||||
<td>Cont Fuel:</td>
|
||||
<td>
|
||||
<select name="contpct" class="form-control">
|
||||
<option value="auto">AUTO</option>
|
||||
<option value="0">0 PCT</option>
|
||||
<option value="0.02">2 PCT</option>
|
||||
<option value="0.03">3 PCT</option>
|
||||
<option value="0.05" selected>5 PCT</option>
|
||||
<option value="0.1">10 PCT</option>
|
||||
<option value="0.15">15 PCT</option>
|
||||
<option value="0.2">20 PCT</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Reserve Fuel:</td>
|
||||
<td>
|
||||
<select name="resvrule" class="form-control">
|
||||
<option value="auto">AUTO</option>
|
||||
<option value="0">0 MIN</option>
|
||||
<option value="15">15 MIN</option>
|
||||
<option value="30" selected>30 MIN</option>
|
||||
<option value="45">45 MIN</option>
|
||||
<option value="60">60 MIN</option>
|
||||
<option value="75">75 MIN</option>
|
||||
<option value="90">90 MIN</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SID/STAR Type:</td>
|
||||
<td>
|
||||
<select name="find_sidstar" class="form-control">
|
||||
<option value="C">Conventional</option>
|
||||
<option value="R" selected>RNAV</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Plan Stepclimbs:</td>
|
||||
<td>
|
||||
<select id="stepclimbs" name="stepclimbs" class="form-control" onchange="DisableFL()">
|
||||
<option value="0" selected>Disabled</option>
|
||||
<option value="1">Enabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ETOPS Planning:</td>
|
||||
<td>
|
||||
<select name="etops" class="form-control">
|
||||
<option value="0" selected>Disabled</option>
|
||||
<option value="1">Enabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-container-body">
|
||||
<h6><i class="fas fa-info-circle"></i> @lang('stisla.briefingoptions')</h6>
|
||||
<table class="table table-hover table-striped">
|
||||
<tr>
|
||||
<td>Units:</td>
|
||||
<td>
|
||||
<select id="kgslbs" name="units" class="form-control">
|
||||
@if(setting('units.weight') === 'kg')
|
||||
<option value="KGS" selected>KGS</option>
|
||||
<option value="LBS">LBS</option>
|
||||
@else
|
||||
<option value="KGS">KGS</option>
|
||||
<option value="LBS" selected>LBS</option>
|
||||
@endif
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Detailed Navlog:</td>
|
||||
<td>
|
||||
<select name="navlog" class="form-control">
|
||||
<option value="0">Disabled</option>
|
||||
<option value="1" selected>Enabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Runway Analysis:</td>
|
||||
<td>
|
||||
<select name="tlr" class="form-control">
|
||||
<option value="0">Disabled</option>
|
||||
<option value="1" selected>Enabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Include NOTAMS:</td>
|
||||
<td>
|
||||
<select name="notams" class="form-control">
|
||||
<option value="0">Disabled</option>
|
||||
<option value="1" selected>Enabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FIR NOTAMS:</td>
|
||||
<td>
|
||||
<select name="firnot" class="form-control">
|
||||
<option value="0" selected>Disabled</option>
|
||||
<option value="1">Enabled</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flight Maps:</td>
|
||||
<td>
|
||||
<select name="maps" class="form-control">
|
||||
<option value="detail" selected>Detailed</option>
|
||||
<option value="simple">Simple</option>
|
||||
<option value="none">None</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-container-body">
|
||||
<div class="float-right">
|
||||
<div class="form-group">
|
||||
<input type="button"
|
||||
onclick="simbriefsubmit('{{ $flight->id }}', '{{ url(route('frontend.simbrief.briefing', [''])) }}');"
|
||||
class="btn btn-primary" value="Generate">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-container">
|
||||
<h6><i class="fas fa-info-circle"></i>
|
||||
Briefing Options
|
||||
</h6>
|
||||
<table class="table table-hover table-striped">
|
||||
<tr>
|
||||
<td>Units:</td>
|
||||
<td><select name="units">
|
||||
<option value="KGS">KGS</option>
|
||||
<option value="LBS" selected>LBS</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cont Fuel:</td>
|
||||
<td><select name="contpct">
|
||||
<option value="auto" selected>AUTO</option>
|
||||
<option value="0">0 PCT</option>
|
||||
<option value="0.02">2 PCT</option>
|
||||
<option value="0.03">3 PCT</option>
|
||||
<option value="0.05">5 PCT</option>
|
||||
<option value="0.1">10 PCT</option>
|
||||
<option value="0.15">15 PCT</option>
|
||||
<option value="0.2">20 PCT</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Reserve Fuel:</td>
|
||||
<td><select name="resvrule">
|
||||
<option value="auto">AUTO</option>
|
||||
<option value="0">0 MIN</option>
|
||||
<option value="15">15 MIN</option>
|
||||
<option value="30">30 MIN</option>
|
||||
<option value="45" selected>45 MIN</option>
|
||||
<option value="60">60 MIN</option>
|
||||
<option value="75">75 MIN</option>
|
||||
<option value="90">90 MIN</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Detailed Navlog:</td>
|
||||
<td><input type="hidden" name="navlog" value="0"><input type="checkbox" name="navlog" value="1"
|
||||
checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ETOPS Planning:</td>
|
||||
<td><input type="hidden" name="etops" value="0"><input type="checkbox" name="etops" value="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Plan Stepclimbs:</td>
|
||||
<td><input type="hidden" name="stepclimbs" value="0"><input type="checkbox" name="stepclimbs"
|
||||
value="1"
|
||||
checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Runway Analysis:</td>
|
||||
<td><input type="hidden" name="tlr" value="0"><input type="checkbox" name="tlr" value="1" checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Include NOTAMS:</td>
|
||||
<td><input type="hidden" name="notams" value="0"><input type="checkbox" name="notams" value="1"
|
||||
checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FIR NOTAMS:</td>
|
||||
<td><input type="hidden" name="firnot" value="0"><input type="checkbox" name="firnot" value="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flight Maps:</td>
|
||||
<td><select name="maps">
|
||||
<option value="detail">Detailed</option>
|
||||
<option value="simple">Simple</option>
|
||||
<option value="none">None</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="airline" value="{{ $flight->airline->icao }}">
|
||||
<input type="hidden" name="fltnum" value="{{ $flight->flight_number }}">
|
||||
<input type="hidden" name="date" value="01JAN14">
|
||||
<input type="hidden" name="deph" value="12">
|
||||
<input type="hidden" name="depm" value="30">
|
||||
<input type="hidden" name="steh" value="2">
|
||||
<input type="hidden" name="stem" value="15">
|
||||
{{--<input type="hidden" name="reg" value="N123SB">
|
||||
<input type="hidden" name="selcal" value="GR-FS">--}}
|
||||
<input type="hidden" name="planformat" value="lido">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="float-right">
|
||||
<div class="form-group">
|
||||
<input type="button"
|
||||
onclick="simbriefsubmit('{{ $flight->id }}', '{{ url(route('frontend.simbrief.briefing', [''])) }}');"
|
||||
class="btn btn-outline-primary"
|
||||
value="Generate">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
@section('scripts')
|
||||
<script src="{{public_asset('/assets/global/js/simbrief.apiv1.js')}}"></script>
|
||||
<script src="{{public_asset('/assets/global/js/simbrief.apiv1.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
// ******
|
||||
// Disable Submitting a fixed flight level for Stepclimb option to work
|
||||
// Script is related to Plan Step Climbs selection
|
||||
function DisableFL() {
|
||||
let climb = document.getElementById("stepclimbs").value;
|
||||
if (climb === "0") {
|
||||
document.getElementById("fl").disabled = false
|
||||
}
|
||||
|
||||
if (climb === "1") {
|
||||
document.getElementById("fl").disabled = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// ******
|
||||
// Get current UTC time, add 45 minutes to it and format according to Simbrief API
|
||||
// Script also rounds the minutes to nearest 5 to avoid a Departure time like 1538 ;)
|
||||
// If you need to reduce the margin of 45 mins, change value below
|
||||
let d = new Date();
|
||||
const months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
|
||||
d.setMinutes(d.getMinutes() + 45); // Change the value here
|
||||
let deph = ("0" + d.getUTCHours(d)).slice(-2);
|
||||
let depm = d.getUTCMinutes(d);
|
||||
if (depm < 55) {
|
||||
depm = Math.ceil(depm / 5) * 5;
|
||||
}
|
||||
|
||||
if (depm > 55) {
|
||||
depm = Math.floor(depm / 5) * 5;
|
||||
}
|
||||
|
||||
depm = ("0" + depm).slice(-2);
|
||||
dept = deph + depm;
|
||||
let dof = ("0" + d.getUTCDate()).slice(-2) + months[d.getUTCMonth()] + d.getUTCFullYear();
|
||||
|
||||
document.getElementById("dof").setAttribute('value', dof);
|
||||
document.getElementById("etd").setAttribute('value', dept);
|
||||
document.getElementById("date").setAttribute('value', dof); // Sent to Simbrief
|
||||
document.getElementById("deph").setAttribute('value', deph); // Sent to SimBrief
|
||||
document.getElementById("depm").setAttribute('value', depm); // Sent to SimBrief
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// ******
|
||||
// Calculate the Scheduled Enroute Time for Simbrief API
|
||||
// Your PHPVMS flight_time value must be from BLOCK to BLOCK
|
||||
// Including departure and arrival taxi times
|
||||
// If this value is not correctly calculated and configured
|
||||
// Simbrief CI (Cost Index) calculation will not provide realistic results
|
||||
let num = {{ $flight->flight_time }};
|
||||
let hours = (num / 60);
|
||||
let rhours = Math.floor(hours);
|
||||
let minutes = (hours - rhours) * 60;
|
||||
let rminutes = Math.round(minutes);
|
||||
document.getElementById("steh").setAttribute('value', rhours.toString()); // Sent to Simbrief
|
||||
document.getElementById("stem").setAttribute('value', rminutes.toString()); // Sent to Simbrief
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// *** Simple Aircraft Selection With Dropdown Change
|
||||
// *** Also keep Generate button hidden until a valid AC selection
|
||||
const $oldlink = document.getElementById("mylink").href;
|
||||
|
||||
function checkacselection() {
|
||||
if (document.getElementById("aircraftselection").value === "ZZZZZ") {
|
||||
document.getElementById('mylink').style.visibility = 'hidden';
|
||||
} else {
|
||||
document.getElementById('mylink').style.visibility = 'visible';
|
||||
}
|
||||
var $selectedac = document.getElementById("aircraftselection").value;
|
||||
var $newlink = "&aircraft_id=".concat($selectedac);
|
||||
document.getElementById("mylink").href = $oldlink.concat($newlink);
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -133,11 +133,11 @@
|
||||
<div class="text-right">
|
||||
@if (isset($acars) && $acars === true)
|
||||
<a href="{{ route('frontend.profile.acars') }}" class="btn btn-primary"
|
||||
onclick="alert('Save to \'My Documents/phpVMS\'')">ACARS Config</a>
|
||||
onclick="alert('Copy or Save to \'My Documents/phpVMS\'')">ACARS Config</a>
|
||||
|
||||
@endif
|
||||
<a href="{{ route('frontend.profile.regen_apikey') }}" class="btn btn-warning"
|
||||
onclick="return confirm({{ __('Are you sure? This will reset your API key.') }})">@lang('profile.newapikey')</a>
|
||||
onclick="return confirm('Are you sure? This will reset your API key!')">@lang('profile.newapikey')</a>
|
||||
|
||||
<a href="{{ route('frontend.profile.edit', [$user->id]) }}"
|
||||
class="btn btn-primary">@lang('common.edit')</a>
|
||||
@@ -171,7 +171,7 @@
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-full-width">
|
||||
@foreach($userFields as $field)
|
||||
@if($field->public === true)
|
||||
@if(!$field->private)
|
||||
<tr>
|
||||
<td>{{ $field->name }}</td>
|
||||
<td>{{ $field->value }}</td>
|
||||
|
||||
@@ -4,10 +4,8 @@ If you want to edit this, you can reference the CheckWX API docs:
|
||||
https://api.checkwx.com/#metar-decoded
|
||||
|
||||
--}}
|
||||
@if(!$metar)
|
||||
<p>@lang('widgets.weather.nometar')</p>
|
||||
@else
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
@if($config['raw_only'] != true && $metar)
|
||||
<tr>
|
||||
<td>@lang('widgets.weather.conditions')</td>
|
||||
<td>{{ $metar['category'] }}</td>
|
||||
@@ -20,35 +18,35 @@ https://api.checkwx.com/#metar-decoded
|
||||
</td>
|
||||
</tr>
|
||||
@if($metar['visibility'])
|
||||
<tr>
|
||||
<td>Visibility</td>
|
||||
<td>{{ $metar['visibility'][$unit_dist] }} {{$unit_dist}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Visibility</td>
|
||||
<td>{{ $metar['visibility'][$unit_dist] }} {{$unit_dist}}</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if($metar['runways_visual_range'])
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Runway Visual Range</td>
|
||||
<td>
|
||||
@foreach($metar['runways_visual_range'] as $rvr)
|
||||
<b>RWY{{ $rvr['runway'] }}</b>; {{ $rvr['report'] }}<br>
|
||||
@endforeach
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
@endif
|
||||
@if($metar['present_weather_report'] <> 'Dry')
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Phenomena</td>
|
||||
<td>{{ $metar['present_weather_report'] }}</td>
|
||||
</tr>
|
||||
</tr>
|
||||
@endif
|
||||
@if($metar['clouds'] || $metar['cavok'])
|
||||
<tr>
|
||||
<tr>
|
||||
<td>@lang('widgets.weather.clouds')</td>
|
||||
<td>
|
||||
@if($unit_alt === 'ft') {{ $metar['clouds_report_ft'] }} @else {{ $metar['clouds_report'] }} @endif
|
||||
@if($metar['cavok'] == 1) Ceiling and Visibility OK @endif
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td>Temperature</td>
|
||||
@@ -63,20 +61,20 @@ https://api.checkwx.com/#metar-decoded
|
||||
<td>{{ number_format($metar['barometer']['hPa']) }} hPa / {{ number_format($metar['barometer']['inHg'], 2) }} inHg</td>
|
||||
</tr>
|
||||
@if($metar['recent_weather_report'])
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Recent Phenomena</td>
|
||||
<td>{{ $metar['recent_weather_report'] }}</td>
|
||||
</tr>
|
||||
</tr>
|
||||
@endif
|
||||
@if($metar['runways_report'])
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Runway Condition</td>
|
||||
<td>
|
||||
@foreach($metar['runways_report'] as $runway)
|
||||
<b>RWY{{ $runway['runway'] }}</b>; {{ $runway['report'] }}<br>
|
||||
@endforeach
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
@endif
|
||||
@if($metar['remarks'])
|
||||
<tr>
|
||||
@@ -88,9 +86,13 @@ https://api.checkwx.com/#metar-decoded
|
||||
<td>@lang('widgets.weather.updated')</td>
|
||||
<td>{{$metar['observed_time']}} ({{$metar['observed_age']}})</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td>@lang('common.metar')</td>
|
||||
<td>{{ $metar['raw'] }}</td>
|
||||
<td>@if($metar) {{ $metar['raw'] }} @else @lang('widgets.weather.nometar') @endif</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
<tr>
|
||||
<td>TAF</td>
|
||||
<td>@if($taf) {{ $taf['raw'] }} @else @lang('widgets.weather.nometar') @endif</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -230,12 +230,18 @@ class AcarsTest extends TestCase
|
||||
$this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false);
|
||||
$this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false);
|
||||
|
||||
/** @var User user */
|
||||
$this->user = factory(User::class)->create([
|
||||
'curr_airport_id' => 'KJFK',
|
||||
]);
|
||||
|
||||
/** @var Airport $airport */
|
||||
$airport = factory(Airport::class)->create();
|
||||
|
||||
/** @var Airline $airline */
|
||||
$airline = factory(Airline::class)->create();
|
||||
|
||||
/** @var Aircraft $aircraft */
|
||||
$aircraft = factory(Aircraft::class)->create([
|
||||
'airport_id' => 'KAUS',
|
||||
]);
|
||||
|
||||
@@ -168,6 +168,8 @@ class MetarTest extends TestCase
|
||||
public function testHttpCallSuccess()
|
||||
{
|
||||
$this->mockXmlResponse('aviationweather/kjfk.xml');
|
||||
|
||||
/** @var AirportService $airportSvc */
|
||||
$airportSvc = app(AirportService::class);
|
||||
|
||||
$this->assertInstanceOf(Metar::class, $airportSvc->getMetar('kjfk'));
|
||||
|
||||
+3
-1
@@ -423,14 +423,16 @@ class PIREPTest extends TestCase
|
||||
|
||||
// Submit two PIREPs
|
||||
// 1 hour flight times, but the rank should bump up because of the transfer hours
|
||||
/** @var Pirep $pirep */
|
||||
$pirep = factory(Pirep::class)->create([
|
||||
'airline_id' => $user->airline_id,
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$this->pirepSvc->create($pirep);
|
||||
$this->pirepSvc->file($pirep);
|
||||
$this->pirepSvc->submit($pirep);
|
||||
|
||||
/** @var User $user */
|
||||
$user = User::find($user->id);
|
||||
$this->assertEquals(UserState::ACTIVE, $user->state);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,9 @@ class SimBriefTest extends TestCase
|
||||
*
|
||||
* @return \App\Models\SimBrief
|
||||
*/
|
||||
protected function loadSimBrief($user): SimBrief
|
||||
protected function loadSimBrief(User $user): SimBrief
|
||||
{
|
||||
/** @var \App\Models\Flight $flight */
|
||||
$flight = factory(Flight::class)->create([
|
||||
'id' => self::$simbrief_flight_id,
|
||||
'dpt_airport_id' => 'OMAA',
|
||||
@@ -39,7 +40,7 @@ class SimBriefTest extends TestCase
|
||||
/** @var SimBriefService $sb */
|
||||
$sb = app(SimBriefService::class);
|
||||
|
||||
return $sb->checkForOfp($user->id, Utils::generateNewId(), $flight->id);
|
||||
return $sb->downloadOfp($user->id, Utils::generateNewId(), $flight->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,14 +100,13 @@ class SimBriefTest extends TestCase
|
||||
|
||||
$url = str_replace('http://', 'https://', $flight['simbrief']['url']);
|
||||
$this->assertEquals(
|
||||
'https://localhost/api/flights/'.$briefing->flight_id.'/briefing',
|
||||
'https://localhost/api/flights/'.$briefing->id.'/briefing',
|
||||
$url
|
||||
);
|
||||
|
||||
// Retrieve the briefing via API, and then check the doctype
|
||||
$response = $this->get('/api/flights/'.$briefing->flight_id.'/briefing');
|
||||
$response = $this->get('/api/flights/'.$briefing->id.'/briefing', [], $this->user);
|
||||
$response->assertOk();
|
||||
// $response->assertHeader('Content-Type', 'application/xml');
|
||||
|
||||
$xml = simplexml_load_string($response->content());
|
||||
$this->assertNotNull($xml);
|
||||
|
||||
+15
-10
@@ -3,7 +3,9 @@
|
||||
namespace Tests;
|
||||
|
||||
use App\Models\Aircraft;
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Models\Flight;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\Subfleet;
|
||||
use App\Models\User;
|
||||
use Exception;
|
||||
@@ -21,34 +23,37 @@ trait TestData
|
||||
{
|
||||
$subfleet = $this->createSubfleetWithAircraft(1);
|
||||
$rank = $this->createRank(2, [$subfleet['subfleet']->id]);
|
||||
$user = factory(User::class)->create(array_merge([
|
||||
|
||||
return factory(User::class)->create(array_merge([
|
||||
'flight_time' => 1000,
|
||||
'rank_id' => $rank->id,
|
||||
'state' => UserState::ACTIVE,
|
||||
], $attrs));
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PIREP with a proper subfleet/rank/user and an
|
||||
* aircraft that the user is allowed to fly
|
||||
*
|
||||
* @param array $user_attrs Additional attributes for the user
|
||||
* @param array $pirep_attrs Additional attributes for the PIREP
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return \App\Models\Pirep
|
||||
*/
|
||||
protected function createPirep()
|
||||
protected function createPirep(array $user_attrs = [], array $pirep_attrs = [])
|
||||
{
|
||||
$subfleet = $this->createSubfleetWithAircraft(2);
|
||||
$rank = $this->createRank(10, [$subfleet['subfleet']->id]);
|
||||
$this->user = factory(\App\Models\User::class)->create([
|
||||
$this->user = factory(\App\Models\User::class)->create(array_merge([
|
||||
'rank_id' => $rank->id,
|
||||
]);
|
||||
], $user_attrs));
|
||||
|
||||
// Return a Pirep model
|
||||
$pirep = factory(\App\Models\Pirep::class)->make([
|
||||
return factory(Pirep::class)->make(array_merge([
|
||||
'aircraft_id' => $subfleet['aircraft']->random()->id,
|
||||
]);
|
||||
|
||||
return $pirep;
|
||||
], $pirep_attrs));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,11 +5,14 @@ namespace Tests;
|
||||
use App\Exceptions\PilotIdNotFound;
|
||||
use App\Exceptions\UserPilotIdExists;
|
||||
use App\Models\Airline;
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Models\Fare;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\User;
|
||||
use App\Repositories\SettingRepository;
|
||||
use App\Services\FareService;
|
||||
use App\Services\UserService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserTest extends TestCase
|
||||
@@ -324,4 +327,48 @@ class UserTest extends TestCase
|
||||
$this->assertEquals($expected, $user->name_private);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testUserLeave(): void
|
||||
{
|
||||
$this->createUser(['status' => UserState::ACTIVE]);
|
||||
|
||||
$users_on_leave = $this->userSvc->findUsersOnLeave();
|
||||
$this->assertEquals(0, count($users_on_leave));
|
||||
|
||||
$this->updateSetting('pilots.auto_leave_days', 1);
|
||||
$user = $this->createUser([
|
||||
'status' => UserState::ACTIVE,
|
||||
'created_at' => Carbon::now('UTC')->subDays(5),
|
||||
]);
|
||||
|
||||
$users_on_leave = $this->userSvc->findUsersOnLeave();
|
||||
$this->assertEquals(1, count($users_on_leave));
|
||||
$this->assertEquals($user->id, $users_on_leave[0]->id);
|
||||
|
||||
// Give that user a new PIREP, still old
|
||||
/** @var \App\Models\Pirep $pirep */
|
||||
$pirep = factory(Pirep::class)->create(['submitted_at' => Carbon::now('UTC')->subDays(5)]);
|
||||
|
||||
$user->last_pirep_id = $pirep->id;
|
||||
$user->save();
|
||||
$user->refresh();
|
||||
|
||||
$users_on_leave = $this->userSvc->findUsersOnLeave();
|
||||
$this->assertEquals(1, count($users_on_leave));
|
||||
$this->assertEquals($user->id, $users_on_leave[0]->id);
|
||||
|
||||
// Create a new PIREP
|
||||
/** @var \App\Models\Pirep $pirep */
|
||||
$pirep = factory(Pirep::class)->create(['submitted_at' => Carbon::now('UTC')]);
|
||||
|
||||
$user->last_pirep_id = $pirep->id;
|
||||
$user->save();
|
||||
$user->refresh();
|
||||
|
||||
$users_on_leave = $this->userSvc->findUsersOnLeave();
|
||||
$this->assertEquals(0, count($users_on_leave));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,5 +100,6 @@ class UtilsTest extends TestCase
|
||||
$this->assertEquals('phpvms.co.uk', Utils::getRootDomain('http://phpvms.co.uk'));
|
||||
$this->assertEquals('phpvms.co.uk', Utils::getRootDomain('http://www.phpvms.co.uk'));
|
||||
$this->assertEquals('127.0.0.1', Utils::getRootDomain('http://127.0.0.1'));
|
||||
$this->assertEquals('localhost', Utils::getRootDomain('http://localhost'));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ function buildAdminAssets()
|
||||
'node_modules/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.js',
|
||||
'node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js',
|
||||
'node_modules/jquery-pjax/jquery.pjax.js',
|
||||
'node_modues/paper-dashboard/assets/js/paper-dashboard.js',
|
||||
'node_modules/paper-dashboard/assets/js/paper-dashboard.js',
|
||||
], 'public/assets/admin/js/vendor.js');
|
||||
|
||||
mix.copy('node_modules/ckeditor4', 'public/assets/vendor/ckeditor4/');
|
||||
|
||||
Reference in New Issue
Block a user