Compare commits

...
Author SHA1 Message Date
snyk-bot 077b9aa491 fix: package.json & package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-1038255
2020-12-24 02:26:09 +00:00
B.Fatih KOZ 18e1d63760 Update User.php (#968)
We should be able to send the private name with the api too.
2020-12-23 11:27:01 -05:00
Nabeel S 4bda494c6b Add helpers kvp() and kvp_save() (#966) 2020-12-21 11:30:44 -05:00
B.Fatih KOZ a5513b6fbb Fixes for reported pressure in METAR parsing (#965)
* Update Metar.php

The reported pressure was always being assigned as hPa thus resulting display and conversion errors when the reported pressure was inHg.

Also the VFR/IFR (VMC/IMC) determination was using minimum 5 nmi and 3000 ft cloud base, it must be 5 km and 3000 ft.

With this state, this PR should fix issue #948 and partly fixes issue #963

* MetarTest Fix for inHg/hPa
2020-12-21 10:53:50 -05:00
B.Fatih KOZ e4972eaae3 Download screen enhancements
Changed the group name according to its category , aircrafts will show icao type and registration , airports will be displayed with their icao codes names and countries. Rest will be showed with their names (exp airlines)

This will result a much better look on the downloads page for end users while looking for a specific type's files (like a repaint for a B738).
2020-12-18 14:34:05 -05:00
Nabeel Shahzad e95e61d4b4 Fix tests #807 2020-12-07 10:19:43 -05:00
Nabeel Shahzad f92912dff4 Fix test 2020-12-07 09:50:00 -05:00
Nabeel Shahzad f62c607138 Change fuel calculation to fuel used #807 2020-12-07 09:46:07 -05:00
B.Fatih KOZ d1a3155653 Fixed EET and ENDURANCE values at IVAO & VATSIM prefile (#954)
Fixed wrong EET and ENDURANCE values at IVAO & VATSIM prefile forms with a php function converting seconds to HHmm format. 

Also added View Route At SkyVector link (uses auto zoom to fpl route on High Enroute Charts) , thx Maco for his idea and original link.
2020-12-06 17:18:55 -05:00
B.Fatih KOZ 883e8786e0 Formatting on admin pirep page #952
* Fix For Issue #952 / Admin Pirep Display

Removed unnecessary div tags to fix the broken display problem, defined the div class with a php code

* Fix and Update for Admin Pirep Index

Fixed the page width problem and search error , added the ability to also search for Rejected and Accepted pireps.
2020-12-05 20:27:03 -05:00
B.Fatih KOZ fb44b73f44 Fix METAR decoding (text correction only) (#950)
* Update Metar Decoding (Text Correction Only)

SKC means Sky Clear or Clear Skies.

Rest is ok

* Update MetarTest.php
2020-12-04 12:47:42 -05:00
B.Fatih KOZ 7379e93c46 Update simbrief_briefing.blade.php (#944)
1. Added ATC Prefile options for IVAO and VATSIM
2. Added TAF reports for Orig, Dest and Altn airports. (Technically TAF reports are required for flights more than 1 hour, so we need to see them on the briefing page too)
3. Adjusted the height of OFP division to match the page with the WX section changes
2020-12-04 11:20:12 -05:00
B.Fatih KOZandNabeel S d4bb5605de Update search.blade.php (#943)
Added the ability to select and search an airline's flights. Will be usefull in multiple airline installations/configs.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2020-12-04 11:12:41 -05:00
B.Fatih KOZ 8ecc096bf7 Update Latest Pireps Widget (#945)
Added flight number, used aircraft registration (and icao type) instead of name
2020-12-04 11:04:47 -05:00
Nabeel S 6b5cf38224 Calculate percentage properly instead of adding to the base value #925 (#942)
* Calculate percentage properly instead of adding to the base value #925
2020-11-26 16:44:57 -05:00
Nabeel S 2ecf366670 Add missing columns from subfleet export #926 (#941) 2020-11-26 13:34:04 -05:00
Nabeel Shahzad a7981c0a87 Redirect to the subfleet aircraft list on save #932 2020-11-26 13:15:56 -05:00
Nabeel Shahzad 9cf07c47c7 Fix notifications error for collect() #937 2020-11-26 13:08:32 -05:00
Nabeel S 8f4219bc95 Download path size too small; fix migrations #935 (#940) 2020-11-26 13:03:59 -05:00
Nabeel Shahzad eae345efa7 Fix dropping of unique index when table prefix is present #934 2020-11-26 12:27:26 -05:00
Nabeel Shahzad be15426b5b Fix public path in application bootstrap #887 2020-11-23 13:39:26 -05:00
Nabeel Shahzad 7e4c652330 Log for avatar upload 2020-11-22 09:59:09 -05:00
Nabeel S ced2c150b7 Change the body size to medium text #920 (#930)
Change the body size to medium text (16MB) #920
2020-11-20 12:00:37 -05:00
Nabeel Shahzad a2de532f72 Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2020-11-02 11:57:27 -05:00
Nabeel Shahzad a52d844719 Set flight_id to be fillable 2020-11-02 11:57:25 -05:00
Timothy Sturm fd814bc79e * Fixed broken links on README
* Fixed broken links on README

* Misc. edits to markdown formatting, Title Grammer, and Stylizing the phpVMS brand.
2020-10-31 18:43:00 -04:00
Nabeel Shahzad 0fa00206ce Make sure stdclass is returned in flight fields 2020-10-29 12:38:40 -04:00
74 changed files with 415 additions and 612 deletions
+2
View File
@@ -28,6 +28,8 @@ services:
install:
- php --version
- mysql --version
# Downgrade composer version to 1.x
- composer self-update --1
- composer install --dev --no-interaction --verbose
- npm i tar-to-zip -g
- cp .travis/env.travis.php env.php
+9 -12
View File
@@ -1,18 +1,15 @@
# phpvms <sup>7</sup>
# phpVMS <sup>7</sup>
[![Build Status](https://travis-ci.org/nabeelio/phpvms.svg)](https://travis-ci.org/nabeelio/phpvms) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) ![StyleCI](https://github.styleci.io/repos/93688482/shield?branch=dev) [![License](https://poser.pugx.org/nabeel/phpvms/license)](https://packagist.org/packages/nabeel/phpvms)
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available
[on the phpVMS documentation](http://docs.phpvms.net/) page.
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available [on the phpVMS documentation](https://docs.phpvms.net/) page.
# installation
## Installation
A full distribution, with all of the composer dependencies, is available at this
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
## Requirements
### Requirements
- PHP 7.3+, extensions:
- cURL
@@ -24,16 +21,16 @@ A full distribution, with all of the composer dependencies, is available at this
- Database:
- MySQL 5.5+ (or MySQL variant, including MariaDB and Percona)
[View more details on requirements](http://docs.phpvms.net/setup/requirements)
[View more details on requirements](https://docs.phpvms.net/requirements)
## Installer
### Installer
1. Upload to your server
1. Visit the site, and follow the link to the installer
[View installation details](http://docs.phpvms.net/setup/installation)
[View installation details](https://docs.phpvms.net/installation/installation)
# development environment
## Development Environment
A full development environment can be brought up using Docker:
@@ -50,7 +47,7 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
127.0.0.1 phpvms.test
```
## Building JS/CSS assets
### Building JS/CSS assets
Yarn is required, run:
-1
View File
@@ -2,7 +2,6 @@
namespace App\Contracts;
use App\Models\Module;
use App\Support\Database;
use Exception;
use Illuminate\Support\Facades\DB;
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class RolesPermissionsTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Create table for storing roles
@@ -79,11 +74,6 @@ class RolesPermissionsTables extends Migration
$this->addData('roles', $roles);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permission_user');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
@@ -20,11 +15,6 @@ class CreatePasswordResetsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
@@ -23,11 +18,6 @@ class CreateSessionsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class CreateAirlinesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('airlines', function (Blueprint $table) {
@@ -32,11 +27,6 @@ class CreateAirlinesTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('airlines');
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class CreateFaresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fares', function (Blueprint $table) {
@@ -25,11 +20,6 @@ class CreateFaresTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('fares');
@@ -7,11 +7,6 @@ use Illuminate\Database\Schema\Blueprint;
class CreateFlightTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
class CreateRanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ranks', function (Blueprint $table) {
@@ -30,11 +25,6 @@ class CreateRanksTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ranks');
@@ -3,9 +3,6 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateSubfleetTables
*/
class CreateSubfleetTables extends Migration
{
public function up()
@@ -48,11 +45,6 @@ class CreateSubfleetTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subfleets');
@@ -7,11 +7,6 @@ use Illuminate\Support\Facades\Schema;
class CreateBidsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bids', function (Blueprint $table) {
@@ -25,11 +20,6 @@ class CreateBidsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bids');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
@@ -24,11 +19,6 @@ class CreateJobsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
@@ -23,11 +18,6 @@ class CreateFailedJobsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateNavdataTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
/*
@@ -31,11 +26,6 @@ class CreateNavdataTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('navdata');
@@ -7,11 +7,6 @@ use Illuminate\Support\Facades\Schema;
class CreateAcarsTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('acars', function (Blueprint $table) {
@@ -44,11 +39,6 @@ class CreateAcarsTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('acars');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateStatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('stats', function (Blueprint $table) {
@@ -25,11 +20,6 @@ class CreateStatsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('stats');
@@ -17,11 +17,6 @@ class CreateNewsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('news');
@@ -7,13 +7,6 @@ use Modules\Awards\Awards\PilotFlightAwards;
class CreateAwardsTable extends Migration
{
/**
* Run the migrations.
*
* @throws \Illuminate\Validation\ValidationException
*
* @return void
*/
public function up()
{
Schema::create('awards', function (Blueprint $table) {
@@ -54,11 +47,6 @@ class CreateAwardsTable extends Migration
$this->addAward($award);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('awards');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateJournalTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('journal_transactions', function (Blueprint $table) {
@@ -34,11 +29,6 @@ class CreateJournalTransactionsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('journal_transactions');
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateJournalsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('journals', function (Blueprint $table) {
@@ -24,11 +19,6 @@ class CreateJournalsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('journals');
@@ -1,6 +1,7 @@
<?php
use App\Contracts\Migration;
use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -14,7 +15,7 @@ class CreateFilesTable extends Migration
public function up()
{
Schema::create('files', function (Blueprint $table) {
$table->string('id', \App\Contracts\Model::ID_MAX_LENGTH);
$table->string('id', Model::ID_MAX_LENGTH);
$table->string('name');
$table->string('description')->nullable();
$table->string('disk')->nullable();
@@ -1,17 +1,12 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AddReadonlyToRoles extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::table('roles', static function (Blueprint $table) {
@@ -24,11 +19,6 @@ class AddReadonlyToRoles extends Migration
->update(['read_only' => true]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('roles', static function (Blueprint $table) {
@@ -1,21 +1,19 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Kinda of gross operations to change the pilot ID column
* 1. Add an `pilot_id` column, which will get populated with the current ID
* 2. Drop the `id` column, and then recreate it as a string field
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
* 4. Change the other tables column types that reference `user_id`
*/
class UsersAddPilotId extends Migration
{
/**
* Kinda of gross operations to change the pilot ID column
* 1. Add an `pilot_id` column, which will get populated with the current ID
* 2. Drop the `id` column, and then recreate it as a string field
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
* 4. Change the other tables column types that reference `user_id`
*
* @return void
*/
public function up()
{
Schema::table('users', static function (Blueprint $table) {
@@ -29,11 +27,6 @@ class UsersAddPilotId extends Migration
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
@@ -1,16 +1,11 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
@@ -23,11 +18,6 @@ class CreateNotificationsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
@@ -1,18 +1,16 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\PirepState;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Change the PIREP state column to be a TINYINT
*/
class PirepsChangeStateType extends Migration
{
/**
* Change the PIREP state column to be a TINYINT
*
* @return void
*/
public function up()
{
// Migrate the old rejected state
@@ -25,13 +23,4 @@ class PirepsChangeStateType extends Migration
$table->unsignedSmallInteger('state')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -5,27 +5,15 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `flight_id` column to the PIREPs table
*/
class PirepsAddFlightId extends Migration
{
/**
* Add a `flight_id` column to the PIREPs table
*/
public function up()
{
Schema::table('pireps', function (Blueprint $table) {
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pireps', function (Blueprint $table) {
$table->dropColumn('flight_id');
});
}
}
@@ -4,11 +4,11 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `flight_type` column to the expenses table
*/
class ExpensesAddFlightType extends Migration
{
/**
* Add a `flight_type` column to the expenses table
*/
public function up()
{
Schema::table('expenses', function (Blueprint $table) {
@@ -18,11 +18,6 @@ class ExpensesAddFlightType extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('expenses', function (Blueprint $table) {
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Support\Facades\Schema;
/**
@@ -25,13 +25,4 @@ class ModifyAirportsCoordinates extends Migration
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Support\Facades\Schema;
/**
@@ -8,24 +8,10 @@ use Illuminate\Support\Facades\Schema;
*/
class FlightFieldNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('flight_field_values', function ($table) {
$table->text('value')->change()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -1,14 +1,14 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
*/
class FlightsAddLoadFactor extends Migration
{
/**
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
@@ -22,11 +22,6 @@ class FlightsAddLoadFactor extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {
@@ -1,14 +1,14 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
class FlightsAddPilotPay extends Migration
{
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
@@ -18,11 +18,6 @@ class FlightsAddPilotPay extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {
@@ -1,15 +1,15 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\FareType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
class FaresAddType extends Migration
{
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
public function up()
{
Schema::table('fares', function (Blueprint $table) {
@@ -19,16 +19,4 @@ class FaresAddType extends Migration
->after('capacity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('fares', function (Blueprint $table) {
$table->dropColumn('type');
});
}
}
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -33,13 +33,4 @@ class IncreaseIdLengths extends Migration
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -15,13 +15,4 @@ class RemoveSubfleetTypeIndex extends Migration
$table->dropUnique(['type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -1,7 +1,7 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\PageType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -11,11 +11,6 @@ use Illuminate\Support\Facades\Schema;
*/
class CreatePages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pages', function (Blueprint $table) {
@@ -33,11 +28,6 @@ class CreatePages extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pages');
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -9,11 +9,7 @@ class AirlineRemoveNullable extends Migration
public function up()
{
Schema::table('airlines', function (Blueprint $table) {
$table->dropUnique('airlines_iata_unique');
$table->dropUnique(['iata']);
});
}
public function down()
{
}
}
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -12,8 +12,4 @@ class PageIconNullable extends Migration
$table->string('icon')->change()->nullable();
});
}
public function down()
{
}
}
@@ -1,15 +1,15 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `link` column and make the body optional. Also add a "new_window" bool
* which determines if we open this link in a new window or not
*/
class PagesAddLink extends Migration
{
/**
* Add a `link` column and make the body optional. Also add a "new_window" bool
* which determines if we open this link in a new window or not
*/
public function up()
{
Schema::table('pages', function (Blueprint $table) {
@@ -23,9 +23,6 @@ class PagesAddLink extends Migration
});
}
/**
* @return void
*/
public function down()
{
Schema::table('fares', function (Blueprint $table) {
@@ -5,11 +5,11 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add two tables for holding user fields and the values
*/
class CreateUserFields extends Migration
{
/**
* Add two tables for holding user fields and the values
*/
public function up()
{
/*
@@ -39,11 +39,4 @@ class CreateUserFields extends Migration
$table->index(['user_field_id', 'user_id']);
});
}
/**
* @return void
*/
public function down()
{
}
}
@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -19,11 +19,6 @@ class AircraftAddMtow extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('aircraft', function (Blueprint $table) {
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
class CreateModulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('modules', function (Blueprint $table) {
@@ -27,11 +22,6 @@ class CreateModulesTable extends Migration
$this->addModule(['name' => 'TestModule']);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('modules');
@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Change the pages body column type to a Medium Text, max size of 16MB
*/
class ModifyPagesSize extends Migration
{
public function up()
{
Schema::table('pages', function (Blueprint $table) {
$table->mediumText('body')->change()->nullable();
});
}
}
@@ -0,0 +1,19 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Change the downloads link size
*/
class ModifyDownloadLinkSize extends Migration
{
public function up()
{
Schema::table('files', function (Blueprint $table) {
$table->mediumText('disk')->change()->nullable();
$table->mediumText('path')->change()->nullable();
});
}
}
@@ -18,7 +18,7 @@ class ValidationException extends AbstractHttpException
parent::__construct(
400,
'Validation exception'
'Validation Error'
);
}
@@ -160,6 +160,7 @@ class AircraftController extends Controller
*/
public function update($id, UpdateAircraftRequest $request)
{
/** @var \App\Models\Aircraft $aircraft */
$aircraft = $this->aircraftRepo->findWithoutFail($id);
if (empty($aircraft)) {
@@ -171,7 +172,7 @@ class AircraftController extends Controller
$this->aircraftRepo->update($attrs, $id);
Flash::success('Aircraft updated successfully.');
return redirect(route('admin.aircraft.index'));
return redirect(route('admin.aircraft.index').'?subfleet='.$aircraft->subfleet_id);
}
/**
@@ -183,6 +184,7 @@ class AircraftController extends Controller
*/
public function destroy($id)
{
/** @var \App\Models\Aircraft $aircraft */
$aircraft = $this->aircraftRepo->findWithoutFail($id);
if (empty($aircraft)) {
@@ -42,7 +42,14 @@ class DownloadController extends Controller
$category = explode('\\', $class);
$category = end($category);
$group_name = $category.' - '.$obj->name;
if ($category == 'Aircraft') {
$group_name = $category.' > '.$obj->icao.' '.$obj->registration;
} elseif ($category == 'Airport') {
$group_name = $category.' > '.$obj->icao.' : '.$obj->name.' ('.$obj->country.')';
} else {
$group_name = $category.' > '.$obj->name;
}
$regrouped_files[$group_name] = $files;
}
@@ -196,6 +196,7 @@ class ProfileController extends Controller
});
$canvas->insert($image);
Log::info('Uploading avatar into folder '.public_path('uploads/avatars'));
$canvas->save(public_path('uploads/avatars/'.$file_name));
$req_data['avatar'] = $path;
+4 -4
View File
@@ -18,17 +18,17 @@ class Flight extends Resource
private function setFields()
{
/** @var \Illuminate\Support\Collection $field_values */
$return_values = new stdClass();
$field_values = $this->field_values;
if (empty($field_values) || $field_values->count() === 0) {
return new stdClass();
return $return_values;
}
$fields = [];
foreach ($field_values as $field) {
$fields[$field->name] = $field->value;
$return_values->{$field->name} = $field->value;
}
return $fields;
return $return_values;
}
/**
+1
View File
@@ -16,6 +16,7 @@ class User extends Resource
'pilot_id' => $this->pilot_id,
'ident' => $this->ident,
'name' => $this->name,
'name_private' => $this->name_private,
'email' => $this->email,
'avatar' => $this->resolveAvatarUrl(),
'rank_id' => $this->rank_id,
+1
View File
@@ -75,6 +75,7 @@ class Pirep extends Model
'flight_number',
'route_code',
'route_leg',
'flight_id',
'dpt_airport_id',
'arr_airport_id',
'alt_airport_id',
-1
View File
@@ -31,7 +31,6 @@ class Subfleet extends Model
'airline_id',
'type',
'name',
'turn_time',
'fuel_type',
'cost_block_hour',
'cost_delay_minute',
+3 -3
View File
@@ -147,7 +147,7 @@ class FareService extends Service
{
if (filled($pivot->price)) {
if (strpos($pivot->price, '%', -1) !== false) {
$fare->price = Math::addPercent($fare->price, $pivot->price);
$fare->price = Math::getPercent($fare->price, $pivot->price);
} else {
$fare->price = $pivot->price;
}
@@ -155,7 +155,7 @@ class FareService extends Service
if (filled($pivot->cost)) {
if (strpos($pivot->cost, '%', -1) !== false) {
$fare->cost = Math::addPercent($fare->cost, $pivot->cost);
$fare->cost = Math::getPercent($fare->cost, $pivot->cost);
} else {
$fare->cost = $pivot->cost;
}
@@ -163,7 +163,7 @@ class FareService extends Service
if (filled($pivot->capacity)) {
if (strpos($pivot->capacity, '%', -1) !== false) {
$fare->capacity = floor(Math::addPercent($fare->capacity, $pivot->capacity));
$fare->capacity = floor(Math::getPercent($fare->capacity, $pivot->capacity));
} else {
$fare->capacity = floor($pivot->capacity);
}
+1 -1
View File
@@ -152,7 +152,7 @@ class PirepFinanceService extends Service
public function payFuelCosts(Pirep $pirep): void
{
$ap = $pirep->dpt_airport;
$fuel_used = $pirep->block_fuel;
$fuel_used = $pirep->fuel_used;
$debit = Money::createFromAmount($fuel_used * $ap->fuel_jeta_cost);
Log::info('Finance: Fuel cost, (fuel='.$fuel_used.', cost='.$ap->fuel_jeta_cost.') D='
+11 -4
View File
@@ -19,10 +19,17 @@ class SubfleetImporter extends ImportExport
* Should match the database fields, for the most part
*/
public static $columns = [
'airline' => 'required',
'type' => 'required',
'name' => 'required',
'fares' => 'nullable',
'airline' => 'required',
'type' => 'required',
'name' => 'required',
'fuel_type' => 'nullable',
'cost_block_hour' => 'nullable',
'cost_delay_minute' => 'nullable',
'ground_handling_multiplier' => 'nullable',
'cargo_capacity' => 'nullable',
'fuel_capacity' => 'nullable',
'gross_weight' => 'nullable',
'fares' => 'nullable',
];
private $fareSvc;
+7 -4
View File
@@ -27,18 +27,19 @@ class Math
return $override_rate;
}
return static::addPercent($base_rate, $override_rate);
// It is a percent, so apply it
return static::getPercent($base_rate, $override_rate);
}
/**
* Add/subtract a percentage to a number
* Apply a percentage to a number
*
* @param $number
* @param $percent
*
* @return float
*/
public static function addPercent($number, $percent): float
public static function getPercent($number, $percent): float
{
if (!is_numeric($number)) {
$number = (float) $number;
@@ -48,6 +49,8 @@ class Math
$percent = (float) $percent;
}
return $number + ($number * ($percent / 100));
$val = $number * ($percent / 100);
return $val;
}
}
+8 -5
View File
@@ -172,11 +172,11 @@ class Metar implements \ArrayAccess
'NSW' => 'no significant weather are observed',
'NSC' => 'no significant clouds are observed',
'NCD' => 'nil cloud detected',
'SKC' => 'no significant changes expected',
'SKC' => 'sky is clear',
'CLR' => 'clear skies',
'NOBS' => 'no observation',
//
'FEW' => 'a few',
'FEW' => 'few',
'SCT' => 'scattered',
'BKN' => 'broken sky',
'OVC' => 'overcast sky',
@@ -523,6 +523,8 @@ class Metar implements \ArrayAccess
// Finally determine if it's VFR or IFR conditions
// https://www.aviationweather.gov/cva/help
// https://www.skybrary.aero/index.php/Visual_Meteorological_Conditions_(VMC)
// This may be changed to ICAO standards as VMC and IMC
$this->result['category'] = 'VFR';
if (array_key_exists('cavok', $this->result) && $this->result['cavok']) {
@@ -531,7 +533,7 @@ class Metar implements \ArrayAccess
/* @noinspection NestedPositiveIfStatementsInspection */
if (array_key_exists('cloud_height', $this->result) && $this->result['cloud_height'] !== null) {
if ($this->result['cloud_height']['ft'] > 3000
&& (empty($this->result['visibility']) || $this->result['visibility']['nmi'] > 5)) {
&& (empty($this->result['visibility']) || $this->result['visibility']['km'] > 5)) {
$this->result['category'] = 'VFR';
} else {
$this->result['category'] = 'IFR';
@@ -1231,10 +1233,11 @@ class Metar implements \ArrayAccess
$pressure = (int) $found[2];
if ($found[1] === 'A') {
$pressure /= 100;
$this->set_result_value('barometer', $this->createPressure($pressure, 'inHg'));
} else {
$this->set_result_value('barometer', $this->createPressure($pressure, 'hPa'));
}
$this->set_result_value('barometer', $this->createPressure($pressure, 'hPa'));
$this->method++;
return true;
}
+48
View File
@@ -1,6 +1,7 @@
<?php
use App\Exceptions\SettingNotFound;
use App\Repositories\KvpRepository;
use App\Repositories\SettingRepository;
use Carbon\Carbon;
use Illuminate\Contracts\View\Factory;
@@ -186,6 +187,53 @@ if (!function_exists('setting_save')) {
}
}
/*
* Shortcut for retrieving a KVP
*/
if (!function_exists('kvp')) {
/**
* Read a setting from the KVP repository
*
* @param string $key
* @param string|null $default
*
* @return mixed|null
*/
function kvp(string $key, $default = null)
{
/** @var KvpRepository $kvpRepo */
$kvpRepo = app(KvpRepository::class);
try {
$value = $kvpRepo->get($key, $default);
} catch (Exception $e) {
return $default;
}
return $value;
}
}
/*
* Shortcut for retrieving a KVP
*/
if (!function_exists('kvp_save')) {
/**
* Read a setting from the KVP repository
*
* @param string $key
* @param string $value
*
* @return mixed|null
*/
function kvp_save(string $key, string $value)
{
/** @var KvpRepository $kvpRepo */
$kvpRepo = app(KvpRepository::class);
$kvpRepo->save($key, $value);
}
}
/*
* Wrap the asset URL in the publicBaseUrl that's been
* set
+6 -6
View File
@@ -73,6 +73,7 @@ class application extends Illuminate\Foundation\Application
public function setPublicPath($publicDirPath)
{
$this->publicDirPath = $publicDirPath;
$this->instance('path.public', $publicDirPath);
}
/**
@@ -103,11 +104,6 @@ class application extends Illuminate\Foundation\Application
return $this->basePath.DS.'config'.($path ? DS.$path : $path);
}
/*public function environmentPath()
{
return $this->environmentPath ?: $this->basePath;
}*/
public function langPath()
{
return $this->resourcePath().DS.'lang';
@@ -115,7 +111,11 @@ class application extends Illuminate\Foundation\Application
public function publicPath()
{
return $this->publicDirPath ?: $this->basePath.DS.'public';
if (empty($this->publicDirPath)) {
return $this->basePath.DS.'public';
}
return $this->publicDirPath;
}
public function resourcePath($path = '')
+11 -15
View File
@@ -1651,12 +1651,18 @@
"dev": true
},
"axios": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
"follow-redirects": "^1.10.0"
},
"dependencies": {
"follow-redirects": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
}
}
},
"axobject-query": {
@@ -1977,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",
@@ -5316,11 +5317,6 @@
"binary-extensions": "^1.0.0"
}
},
"is-buffer": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
},
"is-callable": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz",
+1 -1
View File
@@ -13,7 +13,7 @@
"@turf/center": "^6.0.1",
"acorn": "^7.4.1",
"animate.css": "~3.6",
"axios": "^0.18.1",
"axios": "^0.21.1",
"bootstrap": "~4.3",
"bootstrap-sass": "^3.4.1",
"bootstrap3": "npm:bootstrap@~3.4",
@@ -96,7 +96,6 @@
<div class="form-group col-sm-12">
<div class="pull-right">
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
<a href="{{ route('admin.aircraft.index') }}" class="btn btn-default">Cancel</a>
</div>
</div>
</div>
+11 -9
View File
@@ -2,16 +2,18 @@
@section('title', 'Pilot Reports')
@section('actions')
<li><a href="{{ route('admin.pirepfields.index') }}"><i class="ti-menu-alt"></i>PIREP Fields</a></li>
<li><a href="{{ route('admin.pireps.index') }}?search=status:{{ \App\Models\Enums\PirepState::PENDING }}"><i class="ti-plus"></i>Pending</a></li>
<li><a href="{{ route('admin.pireps.index') }}"><i class="ti-plus"></i>View All</a></li>
<li><a href="{{ route('admin.pirepfields.index') }}"><i class="ti-menu-alt"></i>PIREP Fields</a></li>
<li><a href="{{ route('admin.pireps.index') }}?search=state:{{ \App\Models\Enums\PirepState::PENDING }}"><i class="ti-plus"></i>Pending</a></li>
<li><a href="{{ route('admin.pireps.index') }}?search=state:{{ \App\Models\Enums\PirepState::REJECTED }}"><i class="ti-plus"></i>Rejected</a></li>
<li><a href="{{ route('admin.pireps.index') }}?search=state:{{ \App\Models\Enums\PirepState::ACCEPTED }}"><i class="ti-plus"></i>Accepted</a></li>
<li><a href="{{ route('admin.pireps.index') }}"><i class="ti-plus"></i>View All</a></li>
@endsection
@section('content')
@include('admin.pireps.table')
<div class="row">
<div class="col-12 text-center">
{{ $pireps->links('admin.pagination.default') }}
</div>
</div>
<div class="row" style="width: 100%">
@include('admin.pireps.table')
</div>
<div class="row text-center" style="width: 100%">
{{ $pireps->links('admin.pagination.default') }}
</div>
@endsection
@include('admin.pireps.scripts')
@@ -1,87 +1,67 @@
<div id="pirep_{{ $pirep->id }}_container">
<div class="card border-blue-bottom pirep_card_container">
<div class="card-block" style="min-height: 0px">
<div class="row">
<div class="col-sm-2 text-center">
<h5>
<a class="text-c"
href="{{ route('admin.pireps.edit', [$pirep->id]) }}">
{{ $pirep->airline->code }}{{ $pirep->ident }}
</a>
</h5>
<div id="pirep_{{ $pirep->id }}_status_container">
@if($pirep->state === PirepState::PENDING)
<div class="badge badge-warning">
@elseif($pirep->state === PirepState::ACCEPTED)
<div class="badge badge-success">
@elseif($pirep->state === PirepState::REJECTED)
<div class="badge badge-danger">
@else
<div class="badge badge-info">
@endif
{{ PirepState::label($pirep->state) }}</div>
</div>
</div>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
<div>
<span class="description">
<b>DEP</b>&nbsp;
{{ $pirep->dpt_airport_id }}&nbsp;
<b>ARR</b>&nbsp;
{{ $pirep->arr_airport_id }}&nbsp;
</span>
</div>
<div>
<span class="description"><b>Flight Time</b>&nbsp;
@minutestotime($pirep->flight_time)
</span>
</div>
@if($pirep->aircraft)
<div><span class="description"><b>Aircraft</b>&nbsp;
{{ $pirep->aircraft->registration }}
({{ $pirep->aircraft->name }})
</span>
</div>
@endif
@if(filled($pirep->level))
<div>
<span class="description"><b>Flight Level</b>&nbsp;
{{ $pirep->level }}
</span>
</div>
@endif
<div>
<span class="description"><b>Filed Using</b>&nbsp;
{{ PirepSource::label($pirep->source) }}
@if(filled($pirep->source_name))
({{ $pirep->source_name }})
@endif
</span>
</div>
<div>
<span class="description"><b>File Date</b>&nbsp;
{{ show_datetime($pirep->created_at) }}
</span>
</div>
</div>
<div class="col-sm-6">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="pirep_{{ $pirep->id }}_actionbar" class="pull-right">
@include('admin.pireps.actions', ['pirep' => $pirep, 'on_edit_page' => false])
</div>
</div>
</div>
</div>
<div id="pirep_{{ $pirep->id }}_container" class="card border-blue-bottom pirep_card_container">
<div class="card-block" style="min-height: 0px">
<div class="row">
<div class="col-sm-2 text-center">
<h5><a class="text-c" href="{{ route('admin.pireps.edit', [$pirep->id]) }}">{{ $pirep->airline->code }}{{ $pirep->ident }}</a></h5>
<div id="pirep_{{ $pirep->id }}_status_container">
@php
$PirepStateClass = "badge badge-info" ;
if($pirep->state === PirepState::PENDING ) { $PirepStateClass = "badge badge-warning" ; }
if($pirep->state === PirepState::ACCEPTED ) { $PirepStateClass = "badge badge-success" ; }
if($pirep->state === PirepState::REJECTED ) { $PirepStateClass = "badge badge-danger" ; }
@endphp
<div class="{{ $PirepStateClass }}">{{ PirepState::label($pirep->state) }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
<div>
<span class="description">
<b>DEP</b>&nbsp;{{ $pirep->dpt_airport_id }}&nbsp;
<b>ARR</b>&nbsp;{{ $pirep->arr_airport_id }}&nbsp;
</span>
</div>
<div>
<span class="description">
<b>Flight Time</b>&nbsp; @minutestotime($pirep->flight_time)
</span>
</div>
@if($pirep->aircraft)
<div>
<span class="description">
<b>Aircraft</b>&nbsp;{{ $pirep->aircraft->registration }} ({{ $pirep->aircraft->name }})
</span>
</div>
@endif
@if(filled($pirep->level))
<div>
<span class="description">
<b>Flight Level</b>&nbsp;{{ $pirep->level }}
</span>
</div>
@endif
<div>
<span class="description">
<b>Filed Using</b>&nbsp; {{ PirepSource::label($pirep->source) }}
@if(filled($pirep->source_name)) ({{ $pirep->source_name }}) @endif
</span>
</div>
<div>
<span class="description">
<b>File Date</b>&nbsp; {{ show_datetime($pirep->created_at) }}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="pirep_{{ $pirep->id }}_actionbar" class="pull-right">
@include('admin.pireps.actions', ['pirep' => $pirep, 'on_edit_page' => false])
</div>
</div>
</div>
</div>
</div>
@@ -1,4 +1,4 @@
@foreach (session('flash_notification', collect())->toArray() as $message)
@foreach (collect(session('flash_notification', collect()))->toArray() as $message)
@if ($message['overlay'])
@include('flash::modal', [
'modalClass' => 'flash-modal',
@@ -7,6 +7,11 @@
'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>
<div>
<p>@lang('flights.flightnumber')</p>
{{ Form::text('flight_number', null, ['class' => 'form-control']) }}
@@ -124,22 +124,29 @@
</div>
<div class="form-container">
<h6><i class="fas fa-info-circle"></i>
&nbsp;Weather
</h6>
<h6><i class="fas fa-info-circle"></i>&nbsp;Weather</h6>
<div class="form-container-body">
<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>
</div>
<hr/>
<div><p class="small text-uppercase pb-sm-0 mb-sm-1">Arrival METAR</p>
<p class="border border-dark rounded p-1 small text-monospace">
{{ $simbrief->xml->weather->dest_metar }}</p>
<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>
</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>
</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>
</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>
</div>
</div>
</div>
@@ -169,12 +176,72 @@
</div>
</div>
</div>
<div class="form-container">
<h6><i class="fas fa-info-circle"></i>&nbsp;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>
</div>
<div class="col-4" align="center">
<a href="http://skyvector.com/?chart=304&amp;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 class="form-container">
<h6><i class="fas fa-info-circle"></i>
&nbsp;OFP
</h6>
<div class="form-container-body border border-dark">
<div class="overflow-auto" style="height: 600px;">
<div class="overflow-auto" style="height: 750px;">
{!! $simbrief->xml->text->plan_html !!}
</div>
</div>
@@ -2,14 +2,14 @@
@foreach($pireps as $p)
<tr>
<td style="padding-right: 10px;">
<span class="title">{{ $p->airline->code }}</span>
<span class="title">{{ $p->airline->code }} {{ $p->flight_number }}</span>
</td>
<td>
<a href="{{route('frontend.airports.show', [$p->dpt_airport_id])}}">{{$p->dpt_airport_id}}</a>
&nbsp;-&nbsp;
<a href="{{route('frontend.airports.show', [$p->arr_airport_id])}}">{{$p->arr_airport_id}}</a>&nbsp;
@if(!empty($p->aircraft))
{{ optional($p->aircraft)->name }}
{{ optional($p->aircraft)->registration }} ({{ $p->aircraft->icao }})
@endif
</td>
</tr>
+13 -44
View File
@@ -165,37 +165,6 @@ class FinanceTest extends TestCase
return [$user, $pirep, $fares];
}
/*public function testFlightFaresNoOverride()
{
$flight = factory(Flight::class)->create();
$fare = factory(Fare::class)->create();
$this->fareSvc->setForFlight($flight, $fare);
$subfleet_fares = $this->fareSvc->get($flight);
$this->assertCount(1, $subfleet_fares);
$this->assertEquals($fare->price, $subfleet_fares->get(0)->price);
$this->assertEquals($fare->capacity, $subfleet_fares->get(0)->capacity);
//
// set an override now
//
$this->fareSvc->setForFlight($flight, $fare, [
'price' => 50, 'capacity' => 400,
]);
// look for them again
$subfleet_fares = $this->fareSvc->getForFlight($flight);
$this->assertCount(1, $subfleet_fares);
$this->assertEquals(50, $subfleet_fares[0]->price);
$this->assertEquals(400, $subfleet_fares[0]->capacity);
// delete
$this->fareSvc->delFareFromFlight($flight, $fare);
$this->assertCount(0, $this->fareSvc->getForFlight($flight));
}*/
/**
* Make sure that the API is returning the fares properly for a subfleet on a flight
* https://github.com/nabeelio/phpvms/issues/899
@@ -355,13 +324,13 @@ class FinanceTest extends TestCase
$subfleet = factory(Subfleet::class)->create();
$this->fleetSvc->addSubfleetToFlight($subfleet, $flight);
$percent_incr = '20%';
$percent_decr = '-20%';
$percent_incr = '120%';
$percent_decr = '80%';
$percent_200 = '200%';
$new_price = Math::addPercent($fare->price, $percent_incr);
$new_cost = Math::addPercent($fare->cost, $percent_decr);
$new_capacity = Math::addPercent($fare->capacity, $percent_200);
$new_price = Math::getPercent($fare->price, $percent_incr);
$new_cost = Math::getPercent($fare->cost, $percent_decr);
$new_capacity = Math::getPercent($fare->capacity, $percent_200);
$this->fareSvc->setForFlight($flight, $fare, [
'price' => $percent_incr,
@@ -455,9 +424,9 @@ class FinanceTest extends TestCase
$percent_decr = '-20%';
$percent_200 = '200%';
$new_price = Math::addPercent($fare->price, $percent_incr);
$new_cost = Math::addPercent($fare->cost, $percent_decr);
$new_capacity = Math::addPercent($fare->capacity, $percent_200);
$new_price = Math::getPercent($fare->price, $percent_incr);
$new_cost = Math::getPercent($fare->cost, $percent_decr);
$new_capacity = Math::getPercent($fare->capacity, $percent_200);
$this->fareSvc->setForSubfleet($subfleet, $fare, [
'price' => $percent_incr,
@@ -499,7 +468,7 @@ class FinanceTest extends TestCase
'cost' => 250,
]);
$fare3_price = Math::addPercent($fare3->price, 300);
$fare3_price = Math::getPercent($fare3->price, 300);
// Assign another one to the flight, that's not on the subfleet
// This one should NOT be returned in the list of fares
@@ -623,7 +592,7 @@ class FinanceTest extends TestCase
// Change to a percentage
$manual_pay_rate = '50%';
$manual_pay_adjusted = Math::addPercent(
$manual_pay_adjusted = Math::getPercent(
$rank->manual_base_pay_rate,
$manual_pay_rate
);
@@ -931,7 +900,7 @@ class FinanceTest extends TestCase
// $this->assertCount(9, $transactions['transactions']);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2060, $transactions['debits']->getValue());
$this->assertEquals(2040, $transactions['debits']->getValue());
// Check that all the different transaction types are there
// test by the different groups that exist
@@ -987,7 +956,7 @@ class FinanceTest extends TestCase
// $this->assertCount(9, $transactions['transactions']);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2060, $transactions['debits']->getValue());
$this->assertEquals(2040, $transactions['debits']->getValue());
// Check that all the different transaction types are there
// test by the different groups that exist
@@ -1026,7 +995,7 @@ class FinanceTest extends TestCase
$transactions = $journalRepo->getAllForObject($pirep2);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2160, $transactions['debits']->getValue());
$this->assertEquals(2140, $transactions['debits']->getValue());
// Check that all the different transaction types are there
// test by the different groups that exist
+8
View File
@@ -113,12 +113,20 @@ class FlightTest extends TestCase
*/
public function testSearchFlight()
{
/** @var \App\Models\User user */
$this->user = factory(User::class)->create();
$flight = $this->addFlight($this->user);
/** @var \App\Services\FlightService $flightSvc */
$flightSvc = app(FlightService::class);
$flightSvc->updateCustomFields($flight, [
['name' => '0', 'value' => 'value'],
]);
// search specifically for a flight ID
$query = 'flight_id='.$flight->id;
$req = $this->get('/api/flights/search?'.$query);
$body = $req->json(['data']);
$req->assertStatus(200);
}
+10 -10
View File
@@ -13,16 +13,16 @@ class MathTest extends TestCase
public function testAddPercent()
{
$tests = [
['expected' => 112, 'fn' => Math::addPercent(100, 12)],
['expected' => 112, 'fn' => Math::addPercent(100, '12')],
['expected' => 112, 'fn' => Math::addPercent(100, '12%')],
['expected' => 112, 'fn' => Math::addPercent(100, '12 %')],
['expected' => 112, 'fn' => Math::addPercent('100 ', '12')],
['expected' => 112.5, 'fn' => Math::addPercent('100', '12.5')],
['expected' => 88, 'fn' => Math::addPercent('100', -12)],
['expected' => 88, 'fn' => Math::addPercent('100', '-12')],
['expected' => 88, 'fn' => Math::addPercent('100', '-12 %')],
['expected' => 88, 'fn' => Math::addPercent('100', '-12%')],
['expected' => 112, 'fn' => Math::getPercent(100, 112)],
['expected' => 112, 'fn' => Math::getPercent(100, '112')],
['expected' => 112, 'fn' => Math::getPercent(100, '112%')],
['expected' => 112, 'fn' => Math::getPercent(100, '112%')],
['expected' => 112, 'fn' => Math::getPercent('100 ', '112')],
['expected' => 112.5, 'fn' => Math::getPercent('100', '112.5')],
['expected' => 88, 'fn' => Math::getPercent('100', 88)],
['expected' => 88, 'fn' => Math::getPercent('100', '88')],
['expected' => 88, 'fn' => Math::getPercent('100', '88 %')],
['expected' => 88, 'fn' => Math::getPercent('100', '88%')],
];
foreach ($tests as $test) {
+4 -4
View File
@@ -64,7 +64,7 @@ class MetarTest extends TestCase
$this->assertCount(4, $parsed['clouds']);
$this->assertEquals(
'A few at 1676 meters; scattered at 2896 meters; broken sky at 3353 meters; broken sky at 7010 meters',
'Few at 1676 meters; scattered at 2896 meters; broken sky at 3353 meters; broken sky at 7010 meters',
$parsed['clouds_report']
);
$this->assertEquals(1676.4, $parsed['cloud_height']['m']);
@@ -77,7 +77,7 @@ class MetarTest extends TestCase
$this->assertEquals(24.8, $parsed['dew_point']['f']);
$this->assertEquals(33, $parsed['humidity']);
$this->assertEquals(29.58, $parsed['barometer']['hPa']);
$this->assertEquals(29.58, $parsed['barometer']['inHg']);
$this->assertEquals('AO2 PK WND 27045/2128 PRESRR SLP018 T01221044', $parsed['remarks']);
}
@@ -147,8 +147,8 @@ class MetarTest extends TestCase
$metar = Metar::parse($metar);
$this->assertEquals(2, count($metar['clouds']));
$this->assertEquals('A few at 457 meters; a few at 7620 meters', $metar['clouds_report']);
$this->assertEquals('A few at 1500 feet; a few at 25000 feet', $metar['clouds_report_ft']);
$this->assertEquals('Few at 457 meters; few at 7620 meters', $metar['clouds_report']);
$this->assertEquals('Few at 1500 feet; few at 25000 feet', $metar['clouds_report_ft']);
}
/**
+3 -3
View File
@@ -1,3 +1,3 @@
airline,type,name,fares
VMS,A32X,Airbus A320,Y;B?capacity=100&price=500%
VMS, ,Boeing 747-400,Y;B?capacity=100&price=500%
airline,type,name,fuel_type,cost_block_hour,cost_delay_minute,ground_handling_multiplier,cargo_capacity,fuel_capacity,gross_weight,fares
VMS,A32X,"Airbus A320",,1000,0,200,,,,Y;B?capacity=100&price=500%
VMS, ,"Boeing 747-400",,1000,0,200,,,,Y;B?capacity=100&price=500%
1 airline type name fuel_type cost_block_hour cost_delay_minute ground_handling_multiplier cargo_capacity fuel_capacity gross_weight fares
2 VMS A32X Airbus A320 1000 0 200 Y;B?capacity=100&price=500%
3 VMS Boeing 747-400 1000 0 200 Y;B?capacity=100&price=500%