Allow user to set country
This commit is contained in:
@@ -21,6 +21,7 @@ class CreateUsersTable extends Migration
|
|||||||
$table->string('api_key', 40)->nullable();
|
$table->string('api_key', 40)->nullable();
|
||||||
$table->unsignedInteger('airline_id');
|
$table->unsignedInteger('airline_id');
|
||||||
$table->unsignedInteger('rank_id')->nullable();
|
$table->unsignedInteger('rank_id')->nullable();
|
||||||
|
$table->string('country', 2)->nullable();
|
||||||
$table->string('home_airport_id', 5)->nullable();
|
$table->string('home_airport_id', 5)->nullable();
|
||||||
$table->string('curr_airport_id', 5)->nullable();
|
$table->string('curr_airport_id', 5)->nullable();
|
||||||
$table->string('last_pirep_id', 12)->nullable();
|
$table->string('last_pirep_id', 12)->nullable();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ users:
|
|||||||
api_key: testadminapikey
|
api_key: testadminapikey
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
rank_id: 1
|
rank_id: 1
|
||||||
|
country: us
|
||||||
home_airport_id: KAUS
|
home_airport_id: KAUS
|
||||||
curr_airport_id: KJFK
|
curr_airport_id: KJFK
|
||||||
last_pirep_id: pirepid_3
|
last_pirep_id: pirepid_3
|
||||||
|
|||||||
@@ -136,9 +136,15 @@ class UserController extends BaseController
|
|||||||
->whereOrder(['user_id' => $id], 'created_at', 'desc')
|
->whereOrder(['user_id' => $id], 'created_at', 'desc')
|
||||||
->paginate();
|
->paginate();
|
||||||
|
|
||||||
|
$countries = collect((new \League\ISO3166\ISO3166)->all())
|
||||||
|
->mapWithKeys(function ($item, $key) {
|
||||||
|
return [strtolower($item['alpha2']) => $item['name']];
|
||||||
|
});
|
||||||
|
|
||||||
return view('admin.users.edit', [
|
return view('admin.users.edit', [
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'pireps' => $pireps,
|
'pireps' => $pireps,
|
||||||
|
'countries' => $countries,
|
||||||
'timezones' => Timezonelist::toArray(),
|
'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'),
|
||||||
|
|||||||
@@ -73,10 +73,16 @@ class ProfileController extends AppBaseController
|
|||||||
$airlines = $this->airlineRepo->selectBoxList();
|
$airlines = $this->airlineRepo->selectBoxList();
|
||||||
$airports = $this->airportRepo->selectBoxList();
|
$airports = $this->airportRepo->selectBoxList();
|
||||||
|
|
||||||
|
$countries = collect((new \League\ISO3166\ISO3166)->all())
|
||||||
|
->mapWithKeys(function($item, $key) {
|
||||||
|
return [strtolower($item['alpha2']) => $item['name']];
|
||||||
|
});
|
||||||
|
|
||||||
return $this->view('profile.edit', [
|
return $this->view('profile.edit', [
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'airlines' => $airlines,
|
'airlines' => $airlines,
|
||||||
'airports' => $airports,
|
'airports' => $airports,
|
||||||
|
'countries' => $countries,
|
||||||
'timezones' => Timezonelist::toArray(),
|
'timezones' => Timezonelist::toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class User extends Authenticatable
|
|||||||
'airline_id',
|
'airline_id',
|
||||||
'rank_id',
|
'rank_id',
|
||||||
'api_key',
|
'api_key',
|
||||||
|
'country',
|
||||||
'home_airport_id',
|
'home_airport_id',
|
||||||
'curr_airport_id',
|
'curr_airport_id',
|
||||||
'last_pirep_id',
|
'last_pirep_id',
|
||||||
|
|||||||
@@ -10,15 +10,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-4">
|
<div class="form-group col-sm-4">
|
||||||
{!! Form::label('timezone', 'Timezone:') !!}
|
{!! Form::label('password', 'Password:') !!}
|
||||||
{!! Form::select('timezone', $timezones, null, ['id' => 'timezone', 'class' => 'select2' ]); !!}
|
{!! Form::password('password', ['class' => 'form-control']) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
{!! Form::label('password', 'Password:') !!}
|
<div class="form-group">
|
||||||
{!! Form::password('password', ['class' => 'form-control']) !!}
|
{!! Form::label('country', 'Country:') !!} <br />
|
||||||
|
{!! Form::select('country', $countries, null, ['class' => 'select2' ]); !!}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
{!! Form::label('timezone', 'Timezone:') !!} <br/>
|
||||||
|
{!! Form::select('timezone', $timezones, null, ['id' => 'timezone', 'class' => 'select2' ]); !!}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
{!! Form::label('home_airport_id', 'Home Airport:') !!}
|
{!! Form::label('home_airport_id', 'Home Airport:') !!}
|
||||||
|
|||||||
@@ -37,6 +37,18 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Country</td>
|
||||||
|
<td>
|
||||||
|
<div class="input-group form-group-no-border{{ $errors->has('country') ? ' has-danger' : '' }}">
|
||||||
|
{!! Form::select('country', $countries, null, ['class' => 'form-control select2' ]); !!}
|
||||||
|
</div>
|
||||||
|
@if ($errors->has('country'))
|
||||||
|
<p class="text-danger">{{ $errors->first('country') }}</p>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Timezone</td>
|
<td>Timezone</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<img src="{!! public_asset('/assets/frontend/img/logo.svg') !!}" alt="">
|
<img src="{!! public_asset('/assets/frontend/img/logo.svg') !!}" alt="">
|
||||||
</div>
|
</div>
|
||||||
<h3 class="title">{!! $user->name !!}</h3>
|
<h3 class="title">{!! $user->name !!}</h3>
|
||||||
|
<h6><span class="flag-icon flag-icon-{!! $user->country !!}"></span></h6>
|
||||||
<h6>{!! $user->pilot_id !!}</h6>
|
<h6>{!! $user->pilot_id !!}</h6>
|
||||||
<h6>{!! $user->rank->name !!}</h6>
|
<h6>{!! $user->rank->name !!}</h6>
|
||||||
<p class="description" style="color: #9A9A9A;">
|
<p class="description" style="color: #9A9A9A;">
|
||||||
|
|||||||
Reference in New Issue
Block a user