show dates/times in user's timezone
This commit is contained in:
@@ -18,9 +18,10 @@ users:
|
|||||||
rank_id: 1
|
rank_id: 1
|
||||||
home_airport_id: KAUS
|
home_airport_id: KAUS
|
||||||
curr_airport_id: KJFK
|
curr_airport_id: KJFK
|
||||||
|
last_pirep_id: pirepid_3
|
||||||
flights: 3
|
flights: 3
|
||||||
flight_time: 43200
|
flight_time: 43200
|
||||||
last_pirep_id: pirepid_3
|
timezone: America/Chicago
|
||||||
state: 1
|
state: 1
|
||||||
created_at: now
|
created_at: now
|
||||||
updated_at: now
|
updated_at: now
|
||||||
@@ -197,6 +198,8 @@ flights:
|
|||||||
route: KAUS SID TNV J87 IAH J2 LCH J22 MEI J239 ATL J52 AJFEB J14 BYJAC Q60 JAXSN J14 COLIN J61 HUBBS J55 SIE STAR KJFK
|
route: KAUS SID TNV J87 IAH J2 LCH J22 MEI J239 ATL J52 AJFEB J14 BYJAC Q60 JAXSN J14 COLIN J61 HUBBS J55 SIE STAR KJFK
|
||||||
dpt_time: 6PM CST
|
dpt_time: 6PM CST
|
||||||
arr_time: 11PM EST
|
arr_time: 11PM EST
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
- id: flightid_2
|
- id: flightid_2
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
flight_number: 101
|
flight_number: 101
|
||||||
@@ -205,6 +208,8 @@ flights:
|
|||||||
dpt_time: 9AM EST
|
dpt_time: 9AM EST
|
||||||
arr_time: 12PM CST
|
arr_time: 12PM CST
|
||||||
route: KJFK KAUS
|
route: KJFK KAUS
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
- id: flightid_3
|
- id: flightid_3
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
flight_number: 200
|
flight_number: 200
|
||||||
@@ -213,6 +218,8 @@ flights:
|
|||||||
dpt_time: 9AM EST
|
dpt_time: 9AM EST
|
||||||
arr_time: 12PM CST
|
arr_time: 12PM CST
|
||||||
route: KJFK KAUS
|
route: KJFK KAUS
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
- id: flightid_4
|
- id: flightid_4
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
flight_number: 201
|
flight_number: 201
|
||||||
@@ -221,6 +228,8 @@ flights:
|
|||||||
dpt_time: 10AM EST
|
dpt_time: 10AM EST
|
||||||
arr_time: 1PM CST
|
arr_time: 1PM CST
|
||||||
route: KJFK KAUS
|
route: KJFK KAUS
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
- id: flightid_5
|
- id: flightid_5
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
flight_number: 202
|
flight_number: 202
|
||||||
@@ -340,6 +349,8 @@ pireps:
|
|||||||
state: 0
|
state: 0
|
||||||
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
||||||
notes: just a pilot report
|
notes: just a pilot report
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
- id: pirepid_2
|
- id: pirepid_2
|
||||||
user_id: 1
|
user_id: 1
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
@@ -351,6 +362,8 @@ pireps:
|
|||||||
state: 0
|
state: 0
|
||||||
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
||||||
notes: just a pilot report
|
notes: just a pilot report
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
- id: pirepid_3
|
- id: pirepid_3
|
||||||
user_id: 1
|
user_id: 1
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
@@ -362,6 +375,8 @@ pireps:
|
|||||||
state: 0
|
state: 0
|
||||||
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
|
||||||
notes: just a pilot report
|
notes: just a pilot report
|
||||||
|
created_at: NOW
|
||||||
|
updated_at: NOW
|
||||||
|
|
||||||
pirep_fields:
|
pirep_fields:
|
||||||
- id: 1
|
- id: 1
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ namespace App\Http\Controllers\Auth;
|
|||||||
|
|
||||||
use Log;
|
use Log;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||||
use Illuminate\Http\Request;
|
use Jackiedo\Timezonelist\Facades\Timezonelist;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Facades\Utils;
|
use App\Facades\Utils;
|
||||||
@@ -53,6 +54,7 @@ class RegisterController extends Controller
|
|||||||
return $this->view('auth.register', [
|
return $this->view('auth.register', [
|
||||||
'airports' => $airports,
|
'airports' => $airports,
|
||||||
'airlines' => $airlines,
|
'airlines' => $airlines,
|
||||||
|
'timezones' => Timezonelist::toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class DatabaseService extends BaseService
|
|||||||
|
|
||||||
# if any time fields are == to "now", then insert the right time
|
# if any time fields are == to "now", then insert the right time
|
||||||
foreach($this->time_fields as $tf) {
|
foreach($this->time_fields as $tf) {
|
||||||
if(array_key_exists($tf, $row) && $row[$tf] === 'now') {
|
if(array_key_exists($tf, $row) && strtolower($row[$tf]) === 'now') {
|
||||||
$row[$tf] = $this->time();
|
$row[$tf] = $this->time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,13 +178,26 @@ class GeoService extends BaseService
|
|||||||
* @param Pirep $pirep
|
* @param Pirep $pirep
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function pirepGeoJson(Pirep $pirep)
|
public function pirepGeoJson($pirep)
|
||||||
{
|
{
|
||||||
$coords = [];
|
$coords = [];
|
||||||
$coords[] = [$pirep->dpt_airport->lon, $pirep->dpt_airport->lat];
|
$coords[] = [$pirep->dpt_airport->lon, $pirep->dpt_airport->lat];
|
||||||
|
|
||||||
// TODO: Add markers for the start/end airports
|
// TODO: Add markers for the start/end airports
|
||||||
// TODO: Read from the ACARS data table
|
|
||||||
|
// TODO: Check if there's data in the ACARS table
|
||||||
|
if (!empty($pirep->route)) {
|
||||||
|
$route_coords = $this->getCoordsFromRoute(
|
||||||
|
$pirep->dpt_airport->icao,
|
||||||
|
$pirep->arr_airport->icao,
|
||||||
|
[$pirep->dpt_airport->lat, $pirep->dpt_airport->lon],
|
||||||
|
$pirep->route);
|
||||||
|
|
||||||
|
// lat, lon needs to be reversed for GeoJSON
|
||||||
|
foreach ($route_coords as $rc) {
|
||||||
|
$coords[] = [$rc[1], $rc[0]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$coords[] = [$pirep->arr_airport->lon, $pirep->arr_airport->lat];
|
$coords[] = [$pirep->arr_airport->lon, $pirep->arr_airport->lat];
|
||||||
|
|
||||||
|
|||||||
+47
-2
@@ -3,7 +3,8 @@
|
|||||||
/**
|
/**
|
||||||
* Shortcut for retrieving a setting value
|
* Shortcut for retrieving a setting value
|
||||||
*/
|
*/
|
||||||
if (!function_exists('setting')) {
|
if (!function_exists('setting'))
|
||||||
|
{
|
||||||
function setting($key, $value = null)
|
function setting($key, $value = null)
|
||||||
{
|
{
|
||||||
$settingRepo = app('setting'); // defined in AppServiceProvider
|
$settingRepo = app('setting'); // defined in AppServiceProvider
|
||||||
@@ -19,7 +20,8 @@ if (!function_exists('setting')) {
|
|||||||
* Wrap the asset URL in the publicBaseUrl that's been
|
* Wrap the asset URL in the publicBaseUrl that's been
|
||||||
* set
|
* set
|
||||||
*/
|
*/
|
||||||
if (!function_exists('public_asset')) {
|
if (!function_exists('public_asset'))
|
||||||
|
{
|
||||||
function public_asset($path, $parameters = [], $secure = null)
|
function public_asset($path, $parameters = [], $secure = null)
|
||||||
{
|
{
|
||||||
$publicBaseUrl = app()->publicUrlPath();
|
$publicBaseUrl = app()->publicUrlPath();
|
||||||
@@ -32,3 +34,46 @@ if (!function_exists('public_asset')) {
|
|||||||
return url($path, $parameters, $secure);
|
return url($path, $parameters, $secure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a date/time in the proper timezone for a user
|
||||||
|
*/
|
||||||
|
if(!function_exists('show_datetime'))
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Format the a Carbon date into the datetime string
|
||||||
|
* but convert it into the user's timezone
|
||||||
|
* @param \Carbon\Carbon $date
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function show_datetime(\Carbon\Carbon $date)
|
||||||
|
{
|
||||||
|
$timezone = 'UTC';
|
||||||
|
if (Auth::check()) {
|
||||||
|
$timezone = Auth::user()->timezone ?: $timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date->timezone($timezone)->toDayDateTimeString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a date/time in the proper timezone for a user
|
||||||
|
*/
|
||||||
|
if (!function_exists('show_date')) {
|
||||||
|
/**
|
||||||
|
* Format the a Carbon date into the datetime string
|
||||||
|
* but convert it into the user's timezone
|
||||||
|
* @param \Carbon\Carbon $date
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function show_date(\Carbon\Carbon $date)
|
||||||
|
{
|
||||||
|
$timezone = 'UTC';
|
||||||
|
if (Auth::check()) {
|
||||||
|
$timezone = Auth::user()->timezone ?: $timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date->timezone($timezone)->toFormattedDateString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ return [
|
|||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
'version' => '7.0',
|
'version' => '7.0',
|
||||||
|
|
||||||
|
# DON'T CHANGE THIS OR ELSE YOUR TIMES WILL BE MESSED UP!
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'UTC',
|
||||||
|
|
||||||
'locale' => env('APP_LOCALE', 'en'),
|
'locale' => env('APP_LOCALE', 'en'),
|
||||||
'fallback_locale' => 'en',
|
'fallback_locale' => 'en',
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<div>
|
<div>
|
||||||
<span class="description">DEP </span>
|
<span class="description">DEP </span>
|
||||||
{!! $pirep->dpt_airport->icao !!}
|
{!! $pirep->dpt_airport->icao !!}
|
||||||
@@ -41,13 +41,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="description">File Date </span>
|
<span class="description">File Date </span>
|
||||||
{!! $pirep->created_at !!}
|
{!! show_datetime($pirep->created_at) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<span class="description">more data </span>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<span class="description">more data </span>
|
<span class="description">more data </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
|
<th>Registered</th>
|
||||||
<th class="text-center">Active</th>
|
<th class="text-center">Active</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{!! $user->name !!}</td>
|
<td>{!! $user->name !!}</td>
|
||||||
<td>{!! $user->email !!}</td>
|
<td>{!! $user->email !!}</td>
|
||||||
|
<td>{!! show_date($user->created_at) !!}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@if($user->state == PilotState::ACTIVE)
|
@if($user->state == PilotState::ACTIVE)
|
||||||
<span class="label label-success">
|
<span class="label label-success">
|
||||||
|
|||||||
@@ -42,6 +42,14 @@
|
|||||||
<p class="text-danger">{{ $errors->first('home_airport_id') }}</p>
|
<p class="text-danger">{{ $errors->first('home_airport_id') }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<label for="timezone" class="control-label">Timezone</label>
|
||||||
|
<div class="input-group form-group-no-border{{ $errors->has('timezone') ? ' has-danger' : '' }}">
|
||||||
|
{!! Form::select('timezone', $timezones, null, ['id'=>'timezone', 'class' => 'form-control select2' ]); !!}
|
||||||
|
</div>
|
||||||
|
@if ($errors->has('timezone'))
|
||||||
|
<p class="text-danger">{{ $errors->first('timezone') }}</p>
|
||||||
|
@endif
|
||||||
|
|
||||||
<label for="password" class="control-label">Password</label>
|
<label for="password" class="control-label">Password</label>
|
||||||
<div class="input-group form-group-no-border{{ $errors->has('password') ? ' has-danger' : '' }}">
|
<div class="input-group form-group-no-border{{ $errors->has('password') ? ' has-danger' : '' }}">
|
||||||
{!! Form::password('password', ['class' => 'form-control']) !!}
|
{!! Form::password('password', ['class' => 'form-control']) !!}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<div>
|
<div>
|
||||||
<span class="description">DEP </span>
|
<span class="description">DEP </span>
|
||||||
{!! $pirep->dpt_airport->icao !!}
|
{!! $pirep->dpt_airport->icao !!}
|
||||||
@@ -42,15 +42,12 @@
|
|||||||
{!! $pirep->level !!}
|
{!! $pirep->level !!}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="description">File Date </span>
|
<span class="description">Filed On: </span>
|
||||||
{!! $pirep->created_at !!}
|
{!! show_datetime($pirep->created_at) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<span class="description">more data </span>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<span class="description">more data </span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Route</td>
|
<td>Filed Route</td>
|
||||||
<td>
|
<td>
|
||||||
{!! $pirep->route !!}
|
{!! $pirep->route !!}
|
||||||
</td>
|
</td>
|
||||||
@@ -57,6 +57,13 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Filed On</td>
|
||||||
|
<td>
|
||||||
|
{!! show_datetime($pirep->created_at) !!}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user