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

View File

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

View File

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

View File

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

View File

@@ -46,7 +46,9 @@
"nwidart/laravel-modules": "2.6.0", "nwidart/laravel-modules": "2.6.0",
"sebastiaanluca/laravel-helpers": "1.0.2", "sebastiaanluca/laravel-helpers": "1.0.2",
"nabeel/laravel-installer": "dev-master", "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": { "require-dev": {
"phpunit/phpunit": "6.4.0", "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", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "df8634a2bf7eeab2eab737e82bd163bb", "content-hash": "f2bce1dffa47efbd492ce598ca910d39",
"packages": [ "packages": [
{ {
"name": "anlutro/l4-settings", "name": "anlutro/l4-settings",
@@ -50,7 +50,7 @@
"anlutro\\LaravelSettings\\": "src/" "anlutro\\LaravelSettings\\": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -92,7 +92,7 @@
"Chrisbjr\\ApiGuard\\": "src" "Chrisbjr\\ApiGuard\\": "src"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"authors": [ "authors": [
{ {
"name": "Chris Bautista", "name": "Chris Bautista",
@@ -536,7 +536,7 @@
"Doctrine\\DBAL\\": "lib/" "Doctrine\\DBAL\\": "lib/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -859,7 +859,7 @@
"Egulias\\EmailValidator\\": "EmailValidator" "Egulias\\EmailValidator\\": "EmailValidator"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -966,7 +966,7 @@
"Parsedown": "" "Parsedown": ""
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -1020,7 +1020,7 @@
"Hashids\\": "src/" "Hashids\\": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -1127,7 +1127,7 @@
"InfyOm\\AdminLTETemplates\\": "src/" "InfyOm\\AdminLTETemplates\\": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -1146,7 +1146,7 @@
"laravel", "laravel",
"templates" "templates"
], ],
"time": "2017-11-25 04:43:54" "time": "2017-11-25T04:43:54+00:00"
}, },
{ {
"name": "infyomlabs/laravel-generator", "name": "infyomlabs/laravel-generator",
@@ -1188,7 +1188,7 @@
"src/helpers.php" "src/helpers.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -1212,7 +1212,50 @@
"test", "test",
"view" "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", "name": "jeremeamia/SuperClosure",
@@ -1441,7 +1484,7 @@
"Illuminate\\": "src/Illuminate/" "Illuminate\\": "src/Illuminate/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -1864,7 +1907,7 @@
} }
], ],
"description": "Bloom filter implementation", "description": "Bloom filter implementation",
"time": "2017-11-30 17:51:14" "time": "2017-11-30T17:51:14+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
@@ -1970,7 +2013,7 @@
"Cron\\": "src/Cron/" "Cron\\": "src/Cron/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -2019,7 +2062,7 @@
"src/DeepCopy/deep_copy.php" "src/DeepCopy/deep_copy.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -2066,7 +2109,7 @@
"src/Helpers/functions.php" "src/Helpers/functions.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -2081,7 +2124,7 @@
} }
], ],
"description": "Laravel web installer", "description": "Laravel web installer",
"time": "2017-12-04 19:05:57" "time": "2017-12-04T19:05:57+00:00"
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
@@ -2171,7 +2214,7 @@
"PhpParser\\": "lib/PhpParser" "PhpParser\\": "lib/PhpParser"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@@ -2604,7 +2647,7 @@
] ]
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -2757,7 +2800,7 @@
"Prophecy\\": "src/" "Prophecy\\": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -2875,7 +2918,7 @@
"src/" "src/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@@ -3016,7 +3059,7 @@
"src/" "src/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@@ -3097,7 +3140,7 @@
"src/" "src/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@@ -3220,7 +3263,7 @@
"Prettus\\Repository\\": "src/Prettus/Repository/" "Prettus\\Repository\\": "src/Prettus/Repository/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -3823,7 +3866,7 @@
"src/" "src/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@@ -4398,7 +4441,7 @@
"src/helpers.php" "src/helpers.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -4581,7 +4624,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -4690,7 +4733,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -4858,7 +4901,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -4912,7 +4955,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5000,7 +5043,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5201,7 +5244,7 @@
"bootstrap.php" "bootstrap.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5258,7 +5301,7 @@
"bootstrap.php" "bootstrap.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5317,7 +5360,7 @@
"Resources/stubs" "Resources/stubs"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5369,7 +5412,7 @@
"Symfony\\Polyfill\\Util\\": "" "Symfony\\Polyfill\\Util\\": ""
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5424,7 +5467,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5481,7 +5524,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5564,7 +5607,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5648,7 +5691,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5716,7 +5759,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5781,7 +5824,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -5974,7 +6017,7 @@
"Tivie\\OS\\": "src/" "Tivie\\OS\\": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"APACHE 2.0" "APACHE 2.0"
], ],
@@ -6195,7 +6238,7 @@
"Webpatser\\Uuid": "src/" "Webpatser\\Uuid": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -6324,7 +6367,7 @@
"src/helper.php" "src/helper.php"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -6381,7 +6424,7 @@
"Zend\\Diactoros\\": "src/" "Zend\\Diactoros\\": "src/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-2-Clause" "BSD-2-Clause"
], ],
@@ -6460,7 +6503,7 @@
"permission", "permission",
"roles" "roles"
], ],
"time": "2016-12-29 06:25:06" "time": "2016-12-29T06:25:06+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -6675,7 +6718,7 @@
"Whoops\\": "src/Whoops/" "Whoops\\": "src/Whoops/"
} }
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -7067,7 +7110,7 @@
"/Tests/" "/Tests/"
] ]
}, },
"notification-url": "http://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],

View File

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

View File

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

View File

@@ -20,6 +20,7 @@ class CreateAirportsTable extends Migration
$table->string('name', 50); $table->string('name', 50);
$table->string('location', 50)->nullable(); $table->string('location', 50)->nullable();
$table->string('country', 50)->nullable(); $table->string('country', 50)->nullable();
$table->string('timezone', 64)->nullable();
$table->double('fuel_100ll_cost', 19, 2)->default(0); $table->double('fuel_100ll_cost', 19, 2)->default(0);
$table->double('fuel_jeta_cost', 19, 2)->default(0); $table->double('fuel_jeta_cost', 19, 2)->default(0);
$table->double('fuel_mogas_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 location: Austin, Texas, USA
lat: 30.1945278 lat: 30.1945278
lon: -97.6698889 lon: -97.6698889
timezone: America/Chicago
- id: KJFK - id: KJFK
icao: KJFK icao: KJFK
name: John F Kennedy name: John F Kennedy
location: New York, New York, USA location: New York, New York, USA
lat: 40.6399257 lat: 40.6399257
lon: -73.7786950 lon: -73.7786950
timezone: America/New_York
- id: EGLL - id: EGLL
icao: EGLL icao: EGLL
name: London Heathrow name: London Heathrow
location: London, England location: London, England
lat: 51.4775 lat: 51.4775
lon: -0.4614 lon: -0.4614
timezone: Europe/London
# #
aircraft: aircraft:

View File

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

View File

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

View File

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