Compare commits
62 Commits
903-Refact
...
1007-csv-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c97977de9a | ||
|
|
bda1a91117 | ||
|
|
3f92191126 | ||
|
|
5821067231 | ||
|
|
fc7ad7eb6a | ||
|
|
101b3261f5 | ||
|
|
fb0027b140 | ||
|
|
066702e490 | ||
|
|
b4e0515405 | ||
|
|
f5ca8ce6e3 | ||
|
|
7e9196c7e6 | ||
|
|
a2916bf536 | ||
|
|
0578f98b58 | ||
|
|
2e0f0b00ef | ||
|
|
d5d9010134 | ||
|
|
bd8e13e78f | ||
|
|
c4dee07b7f | ||
|
|
f8a44d8c6d | ||
|
|
617cea5df7 | ||
|
|
3a99fe9e0e | ||
|
|
a952071cb4 | ||
|
|
157e0d830c | ||
|
|
a5b83185f5 | ||
|
|
29ff0758a7 | ||
|
|
be74d99ae8 | ||
|
|
53de2e3229 | ||
|
|
80a90c6e3c | ||
|
|
854ed9b92c | ||
|
|
46b17b5c04 | ||
|
|
0068b1215a | ||
|
|
984c1e0cec | ||
|
|
ad8b8e8945 | ||
|
|
2b0056b7c5 | ||
|
|
319a9fc8e1 | ||
|
|
a037597a21 | ||
|
|
4026fe9149 | ||
|
|
18e1d63760 | ||
|
|
4bda494c6b | ||
|
|
a5513b6fbb | ||
|
|
e4972eaae3 | ||
|
|
e95e61d4b4 | ||
|
|
f92912dff4 | ||
|
|
f62c607138 | ||
|
|
d1a3155653 | ||
|
|
883e8786e0 | ||
|
|
fb44b73f44 | ||
|
|
7379e93c46 | ||
|
|
d4bb5605de | ||
|
|
8ecc096bf7 | ||
|
|
6b5cf38224 | ||
|
|
2ecf366670 | ||
|
|
a7981c0a87 | ||
|
|
9cf07c47c7 | ||
|
|
8f4219bc95 | ||
|
|
eae345efa7 | ||
|
|
be15426b5b | ||
|
|
7e4c652330 | ||
|
|
ced2c150b7 | ||
|
|
a2de532f72 | ||
|
|
a52d844719 | ||
|
|
fd814bc79e | ||
|
|
0fa00206ce |
78
.travis/deploy_script.sh → .github/scripts/build.sh
vendored
Executable file → Normal file
78
.travis/deploy_script.sh → .github/scripts/build.sh
vendored
Executable file → Normal file
@@ -1,52 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$TRAVIS" != "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
|
||||
if test "$TRAVIS_TAG"; then
|
||||
VERSION=$TRAVIS_TAG
|
||||
|
||||
# Pass in the tag as the version to write out
|
||||
php artisan phpvms:version --write --write-full-version "${VERSION}"
|
||||
FULL_VERSION=$(php artisan phpvms:version)
|
||||
else
|
||||
echo "On branch $TRAVIS_BRANCH"
|
||||
|
||||
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
|
||||
echo "Not on valid branch, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Write the version out but place the branch ID in there
|
||||
# This is only for the dev branch
|
||||
BASE_VERSION=$(php artisan phpvms:version --base-only)
|
||||
|
||||
# This now includes the pre-release version, so "-dev" by default
|
||||
VERSION=${BASE_VERSION}
|
||||
|
||||
# Don't pass in a version here, just write out the latest hash
|
||||
php artisan phpvms:version --write "${VERSION}"
|
||||
FULL_VERSION=$(php artisan phpvms:version)
|
||||
fi
|
||||
|
||||
FILE_NAME="phpvms-${VERSION}"
|
||||
TAR_NAME="$FILE_NAME.tar.gz"
|
||||
ZIP_NAME="$FILE_NAME.zip"
|
||||
|
||||
echo "Version: ${VERSION}"
|
||||
echo "Full Version: ${FULL_VERSION}"
|
||||
echo "Package name: ${TAR_NAME}"
|
||||
|
||||
echo "==========================="
|
||||
echo "Current directory: ${BASE_DIR}"
|
||||
|
||||
echo "Cleaning files"
|
||||
|
||||
rm -rf vendor
|
||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||
|
||||
# Leftover individual files to delete
|
||||
declare -a remove_files=(
|
||||
.git
|
||||
@@ -107,44 +67,20 @@ mkdir -p storage/framework/cache
|
||||
mkdir -p storage/framework/sessions
|
||||
mkdir -p storage/framework/views
|
||||
|
||||
# Regenerate the autoloader and classes
|
||||
composer dump-autoload
|
||||
make clean
|
||||
|
||||
cd /tmp
|
||||
ls -al $TRAVIS_BUILD_DIR/../
|
||||
|
||||
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR .
|
||||
ls -al $BASE_DIR/../
|
||||
|
||||
tar -czf $TAR_NAME -C $BASE_DIR .
|
||||
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
|
||||
tar2zip $TAR_NAME
|
||||
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
|
||||
|
||||
ls -al /tmp
|
||||
|
||||
echo "Uploading to S3"
|
||||
mkdir -p $TRAVIS_BUILD_DIR/build
|
||||
cd $TRAVIS_BUILD_DIR/build
|
||||
echo "Moving to dist"
|
||||
mkdir -p $BASE_DIR/dist
|
||||
cd $BASE_DIR/dist
|
||||
|
||||
mv "/tmp/$TAR_NAME" "/tmp/$ZIP_NAME" "/tmp/$TAR_NAME.sha256" "/tmp/$ZIP_NAME.sha256" .
|
||||
artifacts upload --target-paths "/" $ZIP_NAME $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_NAME.sha256 $ZIP_NAME.sha256
|
||||
|
||||
# Upload the version for a tagged release. Move to a version file in different
|
||||
# tags. Within phpVMS, we have an option of which version to track in the admin
|
||||
if test "$TRAVIS_TAG"; then
|
||||
echo "Uploading release version file"
|
||||
cp "$TRAVIS_BUILD_DIR/VERSION" release_version
|
||||
artifacts upload --target-paths "/" release_version
|
||||
else
|
||||
echo "Uploading ${TRAVIS_BRANCH}_version file"
|
||||
cp $TRAVIS_BUILD_DIR/VERSION ${TRAVIS_BRANCH}_version
|
||||
artifacts upload --target-paths "/" ${TRAVIS_BRANCH}_version
|
||||
fi
|
||||
|
||||
#if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
|
||||
# echo "Skipping Discord branch update broadcast"
|
||||
#else
|
||||
curl -X POST \
|
||||
--data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME (${FULL_VERSION})\"}" \
|
||||
-H "Content-Type: application/json" \
|
||||
$DISCORD_WEBHOOK_URL
|
||||
#fi
|
||||
0
.travis/my.cnf → .github/scripts/my.cnf
vendored
0
.travis/my.cnf → .github/scripts/my.cnf
vendored
36
.github/scripts/version.sh
vendored
Normal file
36
.github/scripts/version.sh
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if test "$GIT_TAG_NAME"; then
|
||||
export VERSION=$GIT_TAG_NAME
|
||||
|
||||
# Pass in the tag as the version to write out
|
||||
php artisan phpvms:version --write --write-full-version "${VERSION}"
|
||||
export FULL_VERSION=$(php artisan phpvms:version)
|
||||
else
|
||||
export BRANCH=${GITHUB_REF##*/}
|
||||
echo "On branch $BRANCH"
|
||||
|
||||
# Write the version out but place the branch ID in there
|
||||
# This is only for the dev branch
|
||||
export BASE_VERSION=$(php artisan phpvms:version --base-only)
|
||||
|
||||
# This now includes the pre-release version, so "-dev" by default
|
||||
export VERSION=${BASE_VERSION}
|
||||
|
||||
# Don't pass in a version here, just write out the latest hash
|
||||
php artisan phpvms:version --write "${VERSION}"
|
||||
export FULL_VERSION=$(php artisan phpvms:version)
|
||||
fi
|
||||
|
||||
export FILE_NAME="phpvms-${VERSION}"
|
||||
export TAR_NAME="$FILE_NAME.tar.gz"
|
||||
export ZIP_NAME="$FILE_NAME.zip"
|
||||
export BASE_DIR=`pwd`
|
||||
|
||||
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
|
||||
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
|
||||
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=Version ${FULL_VERSION} is available, download: [zip](http://downloads.phpvms.net/$ZIP_NAME) | [tar](http://downloads.phpvms.net/$TAR_NAME)" >> $GITHUB_ENV
|
||||
252
.github/workflows/build.yml
vendored
Normal file
252
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
name: 'Build'
|
||||
on: ['push', 'pull_request', 'workflow_dispatch', 'release']
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
if: github.repository == 'nabeelio/phpvms'
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php-versions: ['7.3', '7.4']
|
||||
name: PHP ${{ matrix.php-versions }}
|
||||
env:
|
||||
extensions: intl, pcov, mbstring
|
||||
key: cache-v1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Configure Caching
|
||||
- name: Setup cache environment
|
||||
id: cache-env
|
||||
uses: shivammathur/cache-extensions@v1
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: ${{ env.extensions }}
|
||||
key: ${{ env.key }}
|
||||
|
||||
- name: Cache extensions
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ steps.cache-env.outputs.dir }}
|
||||
key: ${{ steps.cache-env.outputs.key }}
|
||||
restore-keys: ${{ steps.cache-env.outputs.key }}
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
# Configure PHP
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: ${{ env.extensions }}
|
||||
ini-values: post_max_size=256M, short_open_tag=On
|
||||
coverage: xdebug
|
||||
tools: php-cs-fixer, phpunit
|
||||
|
||||
- name: Shutdown Ubuntu MySQL
|
||||
run: sudo service mysql stop
|
||||
|
||||
- name: Install MariaDB
|
||||
uses: getong/mariadb-action@v1.1
|
||||
with:
|
||||
character set server: 'utf8'
|
||||
collation server: 'utf8_general_ci'
|
||||
mysql database: 'phpvms'
|
||||
mysql root password: ''
|
||||
mysql user: ''
|
||||
mysql password: ''
|
||||
|
||||
- name: Configure Environment
|
||||
run: |
|
||||
php --version
|
||||
mysql --version
|
||||
# Downgrade composer version to 1.x
|
||||
composer self-update --1
|
||||
composer install --dev --no-interaction --verbose
|
||||
cp .github/scripts/env.php env.php
|
||||
cp .github/scripts/phpunit.xml phpunit.xml
|
||||
php artisan database:create --reset
|
||||
php artisan migrate:refresh --seed
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
|
||||
vendor/bin/phpunit --debug --verbose
|
||||
|
||||
# This runs after all of the tests, run have run. Creates a cleaned up version of the
|
||||
# distro, and then creates the artifact to push up to S3 or wherever
|
||||
artifacts:
|
||||
name: 'Create dev build'
|
||||
needs: build
|
||||
runs-on: 'ubuntu-18.04'
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- uses: olegtarasov/get-tag@v2.1
|
||||
id: tagName
|
||||
|
||||
# Configure Caching
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
# Dependencies
|
||||
- name: 'Install Release Dependencies'
|
||||
run: |
|
||||
rm -rf vendor
|
||||
sudo npm i tar-to-zip -g
|
||||
composer self-update --1
|
||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||
sudo chmod +x ./.github/scripts/*
|
||||
|
||||
- name: Get version
|
||||
run: .github/scripts/version.sh
|
||||
|
||||
- name: Build Distro
|
||||
run: .github/scripts/build.sh
|
||||
|
||||
- name: Upload S3
|
||||
uses: shallwefootball/s3-upload-action@v1.1.3
|
||||
with:
|
||||
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
|
||||
source_dir: 'dist'
|
||||
destination_dir: ''
|
||||
|
||||
- name: Discord notification
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.0
|
||||
with:
|
||||
# DISCORD_MSG is defined in versions.sh
|
||||
args: '{{ DISCORD_MSG }}'
|
||||
|
||||
# This runs after all of the tests, run have run. Creates a cleaned up version of the
|
||||
# distro, and then creates the artifact to push up to S3 or wherever
|
||||
# https://github.com/actions/create-release
|
||||
release:
|
||||
name: 'Create Release'
|
||||
needs: build
|
||||
runs-on: 'ubuntu-18.04'
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- uses: olegtarasov/get-tag@v2.1
|
||||
id: tagName
|
||||
|
||||
# Configure Caching
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
# Dependencies
|
||||
- name: 'Install Release Dependencies'
|
||||
run: |
|
||||
rm -rf vendor
|
||||
sudo npm i tar-to-zip -g
|
||||
composer self-update --1
|
||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||
sudo chmod +x ./.github/scripts/*
|
||||
|
||||
- name: Get version
|
||||
run: .github/scripts/version.sh
|
||||
|
||||
- name: Build Distro
|
||||
run: .github/scripts/build.sh
|
||||
|
||||
- name: Upload S3
|
||||
uses: shallwefootball/s3-upload-action@v1.1.3
|
||||
with:
|
||||
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
|
||||
source_dir: 'dist'
|
||||
destination_dir: ''
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get version
|
||||
run: .github/scripts/version.sh
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
|
||||
# Upload the tar file to the release
|
||||
- name: Upload Tar Asset
|
||||
id: upload-tar-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: dist/{{TAR_NAME}}
|
||||
asset_name: '{{ TAR_NAME }}'
|
||||
asset_content_type: application/gzip
|
||||
|
||||
# upload the zip file to the release
|
||||
- name: Upload Zip Asset
|
||||
id: upload-zip-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: dist/{{ZIP_NAME}}
|
||||
asset_name: '{{ ZIP_NAME }}'
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Discord notification
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.0
|
||||
with:
|
||||
# DISCORD_MSG is defined in versions.sh
|
||||
args: '{{ DISCORD_MSG }}'
|
||||
160
.travis.yml
160
.travis.yml
@@ -1,160 +0,0 @@
|
||||
#
|
||||
# Travis CI config file
|
||||
#
|
||||
|
||||
language: php
|
||||
php:
|
||||
- '7.4'
|
||||
- '7.3'
|
||||
|
||||
#env:
|
||||
# - DB=mysql
|
||||
# - DB=mariadb
|
||||
|
||||
cache:
|
||||
# Cache lives for 10 min
|
||||
# Default of 3m might not be long enough for all the runs
|
||||
timeout: 600
|
||||
directories:
|
||||
- "$HOME/.composer/cache"
|
||||
- "$HOME/.npm"
|
||||
|
||||
services:
|
||||
- mysql
|
||||
|
||||
#addons:
|
||||
# mariadb: '10.2'
|
||||
|
||||
install:
|
||||
- php --version
|
||||
- mysql --version
|
||||
- composer install --dev --no-interaction --verbose
|
||||
- npm i tar-to-zip -g
|
||||
- cp .travis/env.travis.php env.php
|
||||
- cp .travis/phpunit.travis.xml phpunit.xml
|
||||
|
||||
before_script:
|
||||
- php artisan database:create --reset
|
||||
- php artisan migrate:refresh --seed
|
||||
|
||||
script:
|
||||
- vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
|
||||
- vendor/bin/phpunit --debug --verbose
|
||||
|
||||
after_failure:
|
||||
- cat storage/logs/*.log
|
||||
|
||||
# Refer to: https://github.com/doctrine/dbal/blob/master/.travis.yml#L39
|
||||
jobs:
|
||||
include:
|
||||
# Different test stages
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MySQL 5.7
|
||||
# php: 7.2
|
||||
# env: DB=mysql
|
||||
# services:
|
||||
# - mysql
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MySQL 5.7
|
||||
# php: 7.3
|
||||
# env: DB=mysql
|
||||
# services:
|
||||
# - mysql
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MySQL 5.7
|
||||
# php: 7.4
|
||||
# env: DB=mysql
|
||||
# services:
|
||||
# - mysql
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MariaDB 10.1
|
||||
# php: 7.2
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.1'
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MariaDB 10.1
|
||||
# php: 7.3
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.1'
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MariaDB 10.1
|
||||
# php: 7.4
|
||||
# env: DB=mariadb MARIADB_VERSION=10.1
|
||||
# addons:
|
||||
# mariadb: '10.1'
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MariaDB 10.2
|
||||
# php: 7.2
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.2'
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MariaDB 10.3
|
||||
# php: 7.3
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.2'
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MariaDB 10.2
|
||||
# php: 7.4
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.2'
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MariaDB 10.3
|
||||
# php: 7.2
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.3'
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MariaDB 10.3
|
||||
# php: 7.3
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.3'
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MariaDB 10.3
|
||||
# php: 7.4
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.3'
|
||||
|
||||
# Just packages up a release
|
||||
- stage: package
|
||||
script: skip
|
||||
before_deploy:
|
||||
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
|
||||
|
||||
# Configure the conditional deployment
|
||||
# https://docs.travis-ci.com/user/deployment/#examples-of-conditional-deployment
|
||||
deploy:
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: ./.travis/deploy_script.sh
|
||||
on:
|
||||
all_branches: true
|
||||
repo: nabeelio/phpvms
|
||||
php: '7.4'
|
||||
tags: false
|
||||
|
||||
# RELEASE STAGE
|
||||
# Only runs when there's a tag applied to this release (tag should be the version)
|
||||
# This uses Github Releases and posts it there (provider: releases)
|
||||
# https://docs.travis-ci.com/user/deployment/releases
|
||||
- stage: release
|
||||
script: skip
|
||||
before_deploy:
|
||||
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
|
||||
- ./.travis/deploy_script.sh
|
||||
deploy:
|
||||
provider: releases
|
||||
skip_cleanup: true
|
||||
api_key: $GITHUB_TOKEN
|
||||
file_glob: true
|
||||
file: build/*
|
||||
on:
|
||||
tags: true
|
||||
repo: nabeelio/phpvms
|
||||
php: '7.4'
|
||||
23
README.md
23
README.md
@@ -1,18 +1,15 @@
|
||||
# phpvms <sup>7</sup>
|
||||
# phpVMS <sup>7</sup>
|
||||
|
||||
[](https://travis-ci.org/nabeelio/phpvms) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](https://packagist.org/packages/nabeel/phpvms)
|
||||
[](https://github.com/nabeelio/phpvms/actions) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](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:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use Modules\Installer\Services\ConfigService;
|
||||
use App\Services\Installer\ConfigService;
|
||||
|
||||
/**
|
||||
* Create a fresh development install
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
use App\Models\Module;
|
||||
use App\Support\Database;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a hub to the subfleet is
|
||||
*/
|
||||
class AddHubToSubfleets extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('subfleets', function (Blueprint $table) {
|
||||
$table->string('hub_id', 4)
|
||||
->nullable()
|
||||
->after('airline_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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)) {
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\Traits\Importable;
|
||||
use App\Http\Requests\CreateSubfleetRequest;
|
||||
use App\Http\Requests\UpdateSubfleetRequest;
|
||||
use App\Models\Airline;
|
||||
use App\Models\Airport;
|
||||
use App\Models\Enums\FareType;
|
||||
use App\Models\Enums\FuelType;
|
||||
use App\Models\Enums\ImportExportType;
|
||||
@@ -133,6 +134,7 @@ class SubfleetController extends Controller
|
||||
{
|
||||
return view('admin.subfleets.create', [
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
'hubs' => Airport::where('hub', 1)->pluck('name', 'id'),
|
||||
'fuel_types' => FuelType::labels(),
|
||||
]);
|
||||
}
|
||||
@@ -203,6 +205,7 @@ class SubfleetController extends Controller
|
||||
|
||||
return view('admin.subfleets.edit', [
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
'hubs' => Airport::where('hub', 1)->pluck('name', 'id'),
|
||||
'fuel_types' => FuelType::labels(),
|
||||
'avail_fares' => $avail_fares,
|
||||
'avail_ranks' => $avail_ranks,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,8 @@ 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'),
|
||||
'subfleet_id' => $request->input('subfleet_id'),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,51 @@ 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;
|
||||
|
||||
// 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,11 +136,53 @@ 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,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the flight_id from the SimBrief Briefing (to a create a new one)
|
||||
* or if no pirep_id is attached to the briefing delete it completely
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function generate_new(Request $request)
|
||||
{
|
||||
$simbrief = SimBrief::find($request->id);
|
||||
|
||||
// Invalid Simbrief ID/profile, go back to the main flight index
|
||||
if (!$simbrief) {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a prefile of this PIREP with a given OFP. Then redirect the
|
||||
* user to the newly prefiled PIREP
|
||||
@@ -129,7 +232,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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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])),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -24,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,
|
||||
];
|
||||
|
||||
@@ -97,6 +97,11 @@ class Airline extends Model
|
||||
$this->attributes['icao'] = strtoupper($icao);
|
||||
}
|
||||
|
||||
public function subfleets()
|
||||
{
|
||||
return $this->hasMany(Subfleet::class, 'airline_id');
|
||||
}
|
||||
|
||||
public function flights()
|
||||
{
|
||||
return $this->belongsTo(Flight::class, 'airline_id');
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -8,30 +8,28 @@ use App\Models\Traits\ExpensableTrait;
|
||||
use App\Models\Traits\FilesTrait;
|
||||
|
||||
/**
|
||||
* Class Subfleet
|
||||
*
|
||||
* @property int id
|
||||
* @property string type
|
||||
* @property string name
|
||||
* @property int airline_id
|
||||
* @property int hub_id
|
||||
* @property string ground_handling_multiplier
|
||||
* @property Fare[] fares
|
||||
* @property float cost_block_hour
|
||||
* @property float cost_delay_minute
|
||||
* @property Airline airline
|
||||
* @property int airline_id
|
||||
* @property Airport hub
|
||||
*/
|
||||
class Subfleet extends Model
|
||||
{
|
||||
use ExpensableTrait;
|
||||
use FilesTrait;
|
||||
|
||||
public $table = 'subfleets';
|
||||
|
||||
public $fillable = [
|
||||
'airline_id',
|
||||
'hub_id',
|
||||
'type',
|
||||
'name',
|
||||
'turn_time',
|
||||
'fuel_type',
|
||||
'cost_block_hour',
|
||||
'cost_delay_minute',
|
||||
@@ -41,6 +39,8 @@ class Subfleet extends Model
|
||||
'gross_weight',
|
||||
];
|
||||
|
||||
public $table = 'subfleets';
|
||||
|
||||
public $casts = [
|
||||
'airline_id' => 'integer',
|
||||
'turn_time' => 'integer',
|
||||
@@ -56,6 +56,7 @@ class Subfleet extends Model
|
||||
public static $rules = [
|
||||
'type' => 'required',
|
||||
'name' => 'required',
|
||||
'hub_id' => 'nullable',
|
||||
'ground_handling_multiplier' => 'nullable|numeric',
|
||||
];
|
||||
|
||||
@@ -82,6 +83,11 @@ class Subfleet extends Model
|
||||
return $this->belongsTo(Airline::class, 'airline_id');
|
||||
}
|
||||
|
||||
public function hub()
|
||||
{
|
||||
return $this->hasOne(Airport::class, 'id', 'hub_id');
|
||||
}
|
||||
|
||||
public function fares()
|
||||
{
|
||||
return $this->belongsToMany(Fare::class, 'subfleet_fare')
|
||||
|
||||
@@ -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,6 +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}/generate_new', 'SimBriefController@generate_new')->name('simbrief.generate_new');
|
||||
});
|
||||
|
||||
Route::group([
|
||||
|
||||
@@ -20,6 +20,7 @@ class FlightRepository extends Repository implements CacheableInterface
|
||||
'arr_airport_id',
|
||||
'distance',
|
||||
'dpt_airport_id',
|
||||
'flight_type',
|
||||
'flight_number' => 'like',
|
||||
'route_code' => 'like',
|
||||
'route_leg' => 'like',
|
||||
@@ -93,6 +94,10 @@ class FlightRepository extends Repository implements CacheableInterface
|
||||
$where['flight_number'] = $request->input('flight_number');
|
||||
}
|
||||
|
||||
if ($request->filled('flight_type') && $request->input('flight_type') !== '0') {
|
||||
$where['flight_type'] = $request->input('flight_type');
|
||||
}
|
||||
|
||||
if ($request->filled('route_code')) {
|
||||
$where['route_code'] = $request->input('route_code');
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class AirportService extends Service
|
||||
}
|
||||
|
||||
// Don't lookup the airport, so just add in something generic
|
||||
if (!setting('general.auto_airport_lookup')) {
|
||||
if (!setting('general.auto_airport_lookup', false)) {
|
||||
$airport = new Airport([
|
||||
'id' => $icao,
|
||||
'icao' => $icao,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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='
|
||||
|
||||
@@ -51,8 +51,13 @@ class FlightImporter extends ImportExport
|
||||
'fields' => 'nullable',
|
||||
];
|
||||
|
||||
/** @var AirportService */
|
||||
private $airportSvc;
|
||||
|
||||
/** @var FareService */
|
||||
private $fareSvc;
|
||||
|
||||
/** @var FlightService */
|
||||
private $flightSvc;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,6 +6,9 @@ use App\Contracts\ImportExport;
|
||||
use App\Contracts\Service;
|
||||
use App\Models\Airport;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Fare;
|
||||
use App\Models\Flight;
|
||||
use App\Models\FlightFieldValue;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Services\ImportExport\AircraftImporter;
|
||||
use App\Services\ImportExport\AirportImporter;
|
||||
@@ -115,11 +118,7 @@ class ImportService extends Service
|
||||
// turn it into a collection and run some filtering
|
||||
$row = collect($row)->map(function ($val, $index) {
|
||||
$val = trim($val);
|
||||
if ($val === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
return $val;
|
||||
return empty($val) ? null : $val;
|
||||
})->toArray();
|
||||
|
||||
// Try to validate
|
||||
@@ -209,7 +208,7 @@ class ImportService extends Service
|
||||
public function importFares($csv_file, bool $delete_previous = true)
|
||||
{
|
||||
if ($delete_previous) {
|
||||
// TODO: Delete all from: fares
|
||||
Fare::truncate();
|
||||
}
|
||||
|
||||
$importer = new FareImporter();
|
||||
@@ -229,7 +228,8 @@ class ImportService extends Service
|
||||
public function importFlights($csv_file, bool $delete_previous = true)
|
||||
{
|
||||
if ($delete_previous) {
|
||||
// TODO: Delete all from: flights, flight_field_values
|
||||
Flight::truncate();
|
||||
FlightFieldValue::truncate();
|
||||
}
|
||||
|
||||
$importer = new FlightImporter();
|
||||
|
||||
@@ -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'));
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class LiveMap extends Widget
|
||||
protected $config = [
|
||||
'height' => '800px',
|
||||
'width' => '100%',
|
||||
'table' => true,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
@@ -160,6 +161,7 @@ if (!function_exists('setting')) {
|
||||
*/
|
||||
function setting($key, $default = null)
|
||||
{
|
||||
/** @var \App\Repositories\SettingRepository $settingRepo */
|
||||
$settingRepo = app(SettingRepository::class);
|
||||
|
||||
try {
|
||||
@@ -180,12 +182,60 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
@@ -307,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
|
||||
|
||||
@@ -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 = '')
|
||||
|
||||
@@ -131,10 +131,22 @@ return [
|
||||
'Yaml' => Symfony\Component\Yaml\Yaml::class,
|
||||
|
||||
// ENUMS
|
||||
'ActiveState' => App\Models\Enums\ActiveState::class,
|
||||
'UserState' => App\Models\Enums\UserState::class,
|
||||
'PirepSource' => App\Models\Enums\PirepSource::class,
|
||||
'PirepState' => App\Models\Enums\PirepState::class,
|
||||
'PirepStatus' => App\Models\Enums\PirepStatus::class,
|
||||
'AcarsType' => App\Models\Enums\AcarsType::class,
|
||||
'ActiveState' => App\Models\Enums\ActiveState::class,
|
||||
'AircraftState' => App\Models\Enums\AircraftState::class,
|
||||
'AircraftStatus' => App\Models\Enums\AircraftStatus::class,
|
||||
'Days' => App\Models\Enums\Days::class,
|
||||
'ExpenseType' => App\Models\Enums\ExpenseType::class,
|
||||
'FareType' => App\Models\Enums\FareType::class,
|
||||
'FlightType' => App\Models\Enums\FlightType::class,
|
||||
'FuelType' => App\Models\Enums\FuelType::class,
|
||||
'JournalType' => App\Models\Enums\JournalType::class,
|
||||
'NavaidType' => App\Models\Enums\NavaidType::class,
|
||||
'PageType' => App\Models\Enums\PageType::class,
|
||||
'PirepFieldSource' => App\Models\Enums\PirepFieldSource::class,
|
||||
'PirepSource' => App\Models\Enums\PirepSource::class,
|
||||
'PirepState' => App\Models\Enums\PirepState::class,
|
||||
'PirepStatus' => App\Models\Enums\PirepStatus::class,
|
||||
'UserState' => App\Models\Enums\UserState::class,
|
||||
],
|
||||
];
|
||||
|
||||
27
package-lock.json
generated
27
package-lock.json
generated
@@ -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": {
|
||||
@@ -5124,9 +5130,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",
|
||||
@@ -5316,11 +5322,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",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
{{ Form::open(['route' => 'admin.flights.index', 'method' => 'GET', 'class'=>'form-inline pull-right']) }}
|
||||
|
||||
|
||||
{{ Form::label('airlines', 'Airline:') }}
|
||||
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
|
||||
{{ Form::label('flight_number', 'Flight Number:') }}
|
||||
{{ Form::text('flight_number', null, ['class' => 'form-control']) }}
|
||||
|
||||
|
||||
@@ -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>
|
||||
{{ $pirep->dpt_airport_id }}
|
||||
<b>ARR</b>
|
||||
{{ $pirep->arr_airport_id }}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="description"><b>Flight Time</b>
|
||||
@minutestotime($pirep->flight_time)
|
||||
</span>
|
||||
</div>
|
||||
@if($pirep->aircraft)
|
||||
<div><span class="description"><b>Aircraft</b>
|
||||
{{ $pirep->aircraft->registration }}
|
||||
({{ $pirep->aircraft->name }})
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
@if(filled($pirep->level))
|
||||
<div>
|
||||
<span class="description"><b>Flight Level</b>
|
||||
{{ $pirep->level }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
<span class="description"><b>Filed Using</b>
|
||||
{{ PirepSource::label($pirep->source) }}
|
||||
@if(filled($pirep->source_name))
|
||||
({{ $pirep->source_name }})
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="description"><b>File Date</b>
|
||||
{{ 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> {{ $pirep->dpt_airport_id }}
|
||||
<b>ARR</b> {{ $pirep->arr_airport_id }}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="description">
|
||||
<b>Flight Time</b> @minutestotime($pirep->flight_time)
|
||||
</span>
|
||||
</div>
|
||||
@if($pirep->aircraft)
|
||||
<div>
|
||||
<span class="description">
|
||||
<b>Aircraft</b> {{ $pirep->aircraft->registration }} ({{ $pirep->aircraft->name }})
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
@if(filled($pirep->level))
|
||||
<div>
|
||||
<span class="description">
|
||||
<b>Flight Level</b> {{ $pirep->level }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
<span class="description">
|
||||
<b>Filed Using</b> {{ PirepSource::label($pirep->source) }}
|
||||
@if(filled($pirep->source_name)) ({{ $pirep->source_name }}) @endif
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="description">
|
||||
<b>File Date</b> {{ 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>
|
||||
|
||||
@@ -12,19 +12,25 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="form-group col-sm-3">
|
||||
{{ Form::label('airline_id', 'Airline:') }}
|
||||
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
|
||||
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="form-group col-sm-3">
|
||||
{{ Form::label('hub_id', 'Main Hub:') }}
|
||||
{{ Form::select('hub_id', $hubs, null , ['class' => 'form-control select2']) }}
|
||||
<p class="text-danger">{{ $errors->first('hub_id') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-3">
|
||||
{{ Form::label('type', 'Type:') }}
|
||||
{{ Form::text('type', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('type') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="form-group col-sm-3">
|
||||
{{ Form::label('name', 'Name:') }}
|
||||
{{ Form::text('name', null, ['class' => 'form-control']) }}
|
||||
<p class="text-danger">{{ $errors->first('name') }}</p>
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,13 +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>
|
||||
|
||||
<div class="mt-1">
|
||||
<div class="form-group">
|
||||
<p>@lang('common.airline')</p>
|
||||
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-1">
|
||||
<p>@lang('flights.flighttype')</p>
|
||||
{{ Form::select('flight_type', $flight_types, null , ['class' => 'form-control select2']) }}
|
||||
</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
|
||||
@@ -3,17 +3,22 @@
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-6">
|
||||
<h2>{{ $simbrief->xml->general->icao_airline }}{{ $simbrief->xml->general->flight_number }}
|
||||
: {{ $simbrief->xml->origin->icao_code }} to {{ $simbrief->xml->destination->icao_code }}</h2>
|
||||
</div>
|
||||
<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.generate_new', [$simbrief->id])) }}">Generate New OFP</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@@ -67,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>
|
||||
|
||||
@@ -124,22 +129,35 @@
|
||||
</div>
|
||||
|
||||
<div class="form-container">
|
||||
<h6><i class="fas fa-info-circle"></i>
|
||||
Weather
|
||||
</h6>
|
||||
<h6><i class="fas fa-info-circle"></i> 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 +187,61 @@
|
||||
</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">
|
||||
<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="{{ $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&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>
|
||||
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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user