set/add timezone information for airports and users

This commit is contained in:
Nabeel Shahzad
2017-12-06 16:07:25 -06:00
parent 43e9603fbc
commit f0309e65de
13 changed files with 124 additions and 52 deletions

View File

@@ -7,6 +7,7 @@ use App\Http\Requests\UpdateAirportRequest;
use App\Repositories\AirportRepository;
use Illuminate\Http\Request;
use Flash;
use Jackiedo\Timezonelist\Facades\Timezonelist;
use Prettus\Repository\Criteria\RequestCriteria;
use Response;
@@ -96,6 +97,7 @@ class AirportController extends BaseController
}
return view('admin.airports.edit', [
'timezones' => Timezonelist::toArray(),
'airport' => $airport,
]);
}

View File

@@ -10,6 +10,7 @@ use Hash;
use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;
use Flash;
use Jackiedo\Timezonelist\Facades\Timezonelist;
use Prettus\Repository\Criteria\RequestCriteria;
use Response;
@@ -118,6 +119,7 @@ class UserController extends BaseController
return view('admin.users.edit', [
'user' => $user,
'timezones' => Timezonelist::toArray(),
'airports' => Airport::all()->pluck('icao', 'id'),
'airlines' => Airline::all()->pluck('name', 'id'),
'ranks' => Rank::all()->pluck('name', 'id'),

View File

@@ -12,6 +12,7 @@ class Airport extends Model
{
public $table = 'airports';
public $timestamps = false;
public $incrementing = false;
public $fillable = [
'id',
@@ -20,11 +21,15 @@ class Airport extends Model
'location',
'lat',
'lon',
'timezone',
'fuel_100ll_cost',
'fuel_jeta_cost',
'fuel_mogas_cost',
];
protected $casts = [
'id' => 'string',
];
/**
* Validation rules
*

View File

@@ -64,6 +64,7 @@ class User extends Authenticatable
'home_airport_id',
'curr_airport_id',
'rank_id',
'timezone',
'active',
];

View File

@@ -46,7 +46,9 @@
"nwidart/laravel-modules": "2.6.0",
"sebastiaanluca/laravel-helpers": "1.0.2",
"nabeel/laravel-installer": "dev-master",
"tivie/php-os-detector": "1.1.0"
"tivie/php-os-detector": "1.1.0",
"jackiedo/timezonelist": "^5.0",
"nesbot/carbon": "^1.22"
},
"require-dev": {
"phpunit/phpunit": "6.4.0",

139
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "df8634a2bf7eeab2eab737e82bd163bb",
"content-hash": "f2bce1dffa47efbd492ce598ca910d39",
"packages": [
{
"name": "anlutro/l4-settings",
@@ -50,7 +50,7 @@
"anlutro\\LaravelSettings\\": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -92,7 +92,7 @@
"Chrisbjr\\ApiGuard\\": "src"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"authors": [
{
"name": "Chris Bautista",
@@ -536,7 +536,7 @@
"Doctrine\\DBAL\\": "lib/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -859,7 +859,7 @@
"Egulias\\EmailValidator\\": "EmailValidator"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -966,7 +966,7 @@
"Parsedown": ""
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1020,7 +1020,7 @@
"Hashids\\": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1127,7 +1127,7 @@
"InfyOm\\AdminLTETemplates\\": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1146,7 +1146,7 @@
"laravel",
"templates"
],
"time": "2017-11-25 04:43:54"
"time": "2017-11-25T04:43:54+00:00"
},
{
"name": "infyomlabs/laravel-generator",
@@ -1188,7 +1188,7 @@
"src/helpers.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1212,7 +1212,50 @@
"test",
"view"
],
"time": "2017-11-25 05:18:22"
"time": "2017-11-25T05:18:22+00:00"
},
{
"name": "jackiedo/timezonelist",
"version": "5.0.1",
"source": {
"type": "git",
"url": "https://github.com/JackieDo/Timezone-List.git",
"reference": "e7bdd089209840dadaef5ab32574f1b5abd16ae3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JackieDo/Timezone-List/zipball/e7bdd089209840dadaef5ab32574f1b5abd16ae3",
"reference": "e7bdd089209840dadaef5ab32574f1b5abd16ae3",
"shasum": ""
},
"require": {
"illuminate/support": "5.*",
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Jackiedo\\Timezonelist\\": "src/Jackiedo/Timezonelist"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jackie Do",
"email": "anhvudo@gmail.com"
}
],
"description": "A small package use to create a timezone list box in Laravel",
"keywords": [
"laravel",
"timezone",
"timezonelist",
"timezones"
],
"time": "2017-05-16T04:31:37+00:00"
},
{
"name": "jeremeamia/SuperClosure",
@@ -1441,7 +1484,7 @@
"Illuminate\\": "src/Illuminate/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1864,7 +1907,7 @@
}
],
"description": "Bloom filter implementation",
"time": "2017-11-30 17:51:14"
"time": "2017-11-30T17:51:14+00:00"
},
{
"name": "monolog/monolog",
@@ -1970,7 +2013,7 @@
"Cron\\": "src/Cron/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2019,7 +2062,7 @@
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2066,7 +2109,7 @@
"src/Helpers/functions.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2081,7 +2124,7 @@
}
],
"description": "Laravel web installer",
"time": "2017-12-04 19:05:57"
"time": "2017-12-04T19:05:57+00:00"
},
{
"name": "nesbot/carbon",
@@ -2171,7 +2214,7 @@
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
@@ -2604,7 +2647,7 @@
]
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2757,7 +2800,7 @@
"Prophecy\\": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -2875,7 +2918,7 @@
"src/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
@@ -3016,7 +3059,7 @@
"src/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
@@ -3097,7 +3140,7 @@
"src/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
@@ -3220,7 +3263,7 @@
"Prettus\\Repository\\": "src/Prettus/Repository/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -3823,7 +3866,7 @@
"src/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
@@ -4398,7 +4441,7 @@
"src/helpers.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -4581,7 +4624,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -4690,7 +4733,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -4858,7 +4901,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -4912,7 +4955,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5000,7 +5043,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5201,7 +5244,7 @@
"bootstrap.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5258,7 +5301,7 @@
"bootstrap.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5317,7 +5360,7 @@
"Resources/stubs"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5369,7 +5412,7 @@
"Symfony\\Polyfill\\Util\\": ""
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5424,7 +5467,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5481,7 +5524,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5564,7 +5607,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5648,7 +5691,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5716,7 +5759,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5781,7 +5824,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -5974,7 +6017,7 @@
"Tivie\\OS\\": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"APACHE 2.0"
],
@@ -6195,7 +6238,7 @@
"Webpatser\\Uuid": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -6324,7 +6367,7 @@
"src/helper.php"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -6381,7 +6424,7 @@
"Zend\\Diactoros\\": "src/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
@@ -6460,7 +6503,7 @@
"permission",
"roles"
],
"time": "2016-12-29 06:25:06"
"time": "2016-12-29T06:25:06+00:00"
}
],
"packages-dev": [
@@ -6675,7 +6718,7 @@
"Whoops\\": "src/Whoops/"
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -7067,7 +7110,7 @@
"/Tests/"
]
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],

View File

@@ -63,6 +63,7 @@ return [
SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class,
SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class,
Toin0u\Geotools\GeotoolsServiceProvider::class,
//Jackiedo\Timezonelist\TimezonelistServiceProvider::class,
/*
* Application Service Providers...

View File

@@ -26,7 +26,7 @@ class CreateUsersTable extends Migration
$table->bigInteger('flights')->unsigned()->default(0);
$table->bigInteger('flight_time')->unsigned()->default(0);
$table->decimal('balance', 19, 2)->nullable();
$table->tinyInteger('timezone')->default(0);
$table->string('timezone', 64)->nullable();
$table->boolean('active')->nullable();
$table->rememberToken();
$table->timestamps();

View File

@@ -20,6 +20,7 @@ class CreateAirportsTable extends Migration
$table->string('name', 50);
$table->string('location', 50)->nullable();
$table->string('country', 50)->nullable();
$table->string('timezone', 64)->nullable();
$table->double('fuel_100ll_cost', 19, 2)->default(0);
$table->double('fuel_jeta_cost', 19, 2)->default(0);
$table->double('fuel_mogas_cost', 19, 2)->default(0);

View File

@@ -94,18 +94,21 @@ airports:
location: Austin, Texas, USA
lat: 30.1945278
lon: -97.6698889
timezone: America/Chicago
- id: KJFK
icao: KJFK
name: John F Kennedy
location: New York, New York, USA
lat: 40.6399257
lon: -73.7786950
timezone: America/New_York
- id: EGLL
icao: EGLL
name: London Heathrow
location: London, England
lat: 51.4775
lon: -0.4614
timezone: Europe/London
#
aircraft:

View File

@@ -25,6 +25,11 @@
{!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001']) !!}
</div>
<div class="form-group col-sm-6">
{!! Form::label('timezone', 'Timezone:') !!}
{!! Form::select('timezone', $timezones, null, ['id' => 'timezone', 'class' => 'select2' ]); !!}
</div>
<!-- Submit Field -->
<div class="form-group col-sm-12">
<div class="pull-right">

View File

@@ -4,6 +4,7 @@
<th>ICAO</th>
<th>Name</th>
<th>Location</th>
<th>Timezone</th>
<th style="text-align: center;">100LL</th>
<th style="text-align: center;">JetA</th>
<th style="text-align: center;">MOGAS</th>
@@ -15,6 +16,7 @@
<td>{!! $airport->icao !!}</td>
<td>{!! $airport->name !!}</td>
<td>{!! $airport->location !!}</td>
<td>{!! $airport->timezone !!}</td>
<td style="text-align: center;">
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_100ll_cost">{!! $airport->fuel_100ll_cost !!}</a>
</td>

View File

@@ -1,13 +1,18 @@
<div class="row">
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{!! Form::label('name', 'Name:') !!}
{!! Form::text('name', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{!! Form::label('email', 'Email:') !!}
{!! Form::text('email', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group col-sm-4">
{!! Form::label('timezone', 'Timezone:') !!}
{!! Form::select('timezone', $timezones, null, ['id' => 'timezone', 'class' => 'select2' ]); !!}
</div>
</div>
<div class="row">