set country on the airline, in admin and installer #191

This commit is contained in:
Nabeel Shahzad
2018-02-12 10:51:04 -06:00
parent 61dc0a046d
commit 62506a26a1
21 changed files with 11199 additions and 2578 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Support\Countries;
use Flash;
use Response;
use Illuminate\Http\Request;
@@ -23,6 +24,7 @@ class AirlinesController extends BaseController
/**
* Display a listing of the Airlines.
* @throws \Prettus\Repository\Exceptions\RepositoryException
*/
public function index(Request $request)
{
@@ -38,7 +40,9 @@ class AirlinesController extends BaseController
*/
public function create()
{
return view('admin.airlines.create');
return view('admin.airlines.create', [
'countries' => Countries::getSelectList(),
]);
}
/**
@@ -50,7 +54,6 @@ class AirlinesController extends BaseController
$airlines = $this->airlineRepo->create($input);
Flash::success('Airlines saved successfully.');
return redirect(route('admin.airlines.index'));
}
@@ -70,14 +73,14 @@ class AirlinesController extends BaseController
return redirect(route('admin.airlines.index'));
}
return view('admin.airlines.show')->with('airlines', $airlines);
return view('admin.airlines.show', [
'airlines' => $airlines,
]);
}
/**
* Show the form for editing the specified Airlines.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
@@ -89,16 +92,18 @@ class AirlinesController extends BaseController
return redirect(route('admin.airlines.index'));
}
return view('admin.airlines.edit')->with('airline', $airline);
return view('admin.airlines.edit', [
'airline' => $airline,
'countries' => Countries::getSelectList(),
]);
}
/**
* Update the specified Airlines in storage.
*
* @param int $id
* @param int $id
* @param UpdateAirlineRequest $request
*
* @return Response
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function update($id, UpdateAirlineRequest $request)
{
@@ -118,9 +123,7 @@ class AirlinesController extends BaseController
/**
* Remove the specified Airlines from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy($id)
@@ -135,7 +138,6 @@ class AirlinesController extends BaseController
$this->airlineRepo->delete($id);
Flash::success('Airlines deleted successfully.');
return redirect(route('admin.airlines.index'));
}
}
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Frontend;
use App\Support\Countries;
use Log;
use Hash;
use Flash;
@@ -74,16 +75,11 @@ class ProfileController extends Controller
$airlines = $this->airlineRepo->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', [
'user' => $user,
'airlines' => $airlines,
'airports' => $airports,
'countries' => $countries,
'countries' => Countries::getSelectList(),
'timezones' => Timezonelist::toArray(),
]);
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Support;
/**
* Class Countries
* @package App\Support
*/
class Countries
{
/**
* Get a select box list of all the countries
* @return static
*/
public static function getSelectList()
{
$countries = collect((new \League\ISO3166\ISO3166)->all())
->mapWithKeys(function ($item, $key) {
return [strtolower($item['alpha2']) => $item['name']];
});
return $countries;
}
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace App\Support;
/**
* ICAO Helper Tools
* @package App\Support
*/
class ICAO
{
}
+2 -4
View File
@@ -82,14 +82,12 @@
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan phpvms:version --write > VERSION"
"Illuminate\\Foundation\\ComposerScripts::postInstall"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate",
"php artisan ide-helper:meta",
"php artisan phpvms:version --write > VERSION"
"php artisan ide-helper:meta"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
@@ -2,6 +2,7 @@
namespace Modules\Installer\Http\Controllers;
use App\Support\Countries;
use Log;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
@@ -226,7 +227,9 @@ class InstallerController extends Controller
*/
public function step3(Request $request)
{
return view('installer::install/steps/step3-user', []);
return view('installer::install/steps/step3-user', [
'countries' => Countries::getSelectList(),
]);
}
/**
@@ -241,6 +244,7 @@ class InstallerController extends Controller
$validator = Validator::make($request->all(), [
'airline_name' => 'required',
'airline_icao' => 'required|unique:airlines,icao',
'airline_country' => 'required',
'name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required|confirmed'
@@ -259,6 +263,7 @@ class InstallerController extends Controller
$attrs = [
'icao' => $request->get('airline_icao'),
'name' => $request->get('airline_name'),
'country' => $request->get('airline_country'),
];
$airline = $this->airlineRepo->create($attrs);
@@ -17,6 +17,7 @@
<link href="{!! public_asset('/assets/frontend/css/bootstrap.min.css') !!}" rel="stylesheet"/>
<link href="{!! public_asset('/assets/frontend/css/now-ui-kit.css') !!}" rel="stylesheet"/>
<link href="{!! public_asset('/assets/frontend/css/styles.css') !!}" rel="stylesheet"/>
<link href="{!! public_asset('/assets/system/css/installer.css') !!}" rel="stylesheet"/>
{{--<link href="/assets/frontend/css/installer.css" rel="stylesheet"/>--}}
<link rel="stylesheet"
@@ -77,6 +78,9 @@
hljs.configure({languages: ['sh']});
$(document).ready(function () {
$(".select2").select2();
$('pre code').each(function (i, block) {
hljs.fixMarkup(block);
hljs.highlightBlock(block);
@@ -31,6 +31,16 @@
</td>
</tr>
<tr>
<td><p>Airline Country</p></td>
<td>
<div class="form-group">
{!! Form::select('airline_country', $countries, null, ['class' => 'form-control select2' ]); !!}
@include('installer::flash/check_error', ['field' => 'airline_country'])
</div>
</td>
</tr>
<tr>
<td colspan="2"><h4>First User</h4></td>
</tr>
+14 -16
View File
@@ -3,7 +3,7 @@
"lockfileVersion": 1,
"dependencies": {
"Leaflet.Geodesic": {
"version": "git+https://git@github.com/henrythasler/Leaflet.Geodesic.git#befbb8f6c11d0d040ef8c3ee4a0de517581c99d5"
"version": "git+https://git@github.com/henrythasler/Leaflet.Geodesic.git#94e27c6a47d6a8e6a3cc73c182c09b9ecbd1180f"
},
"abbrev": {
"version": "1.1.1",
@@ -1870,9 +1870,9 @@
}
},
"copy-webpack-plugin": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.3.1.tgz",
"integrity": "sha512-xlcFiW/U7KrpS6dFuWq3r8Wb7koJx7QVc7LDFCosqkikaVSxkaYOnwDLwilbjrszZ0LYZXThDAJKcQCSrvdShQ==",
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.4.1.tgz",
"integrity": "sha512-ojaz8MpS3zoLJT/JbYMusYM+dCEArhW24hGAUPYPydTCS+87NFh2TWr85sywG3So4Q4E68QoerqQ+Ns1g0fhDg==",
"dev": true,
"requires": {
"cacache": "10.0.1",
@@ -1880,10 +1880,8 @@
"globby": "7.1.1",
"is-glob": "4.0.0",
"loader-utils": "0.2.17",
"lodash": "4.17.4",
"minimatch": "3.0.4",
"p-limit": "1.1.0",
"pify": "3.0.0",
"serialize-javascript": "1.4.0"
},
"dependencies": {
@@ -2786,7 +2784,7 @@
"integrity": "sha1-ekmXAEQGUnbnll79Fvgic1IZ5zU=",
"requires": {
"bootstrap": "3.3.7",
"jquery": "3.2.1",
"jquery": "3.3.1",
"moment": "2.20.1",
"moment-timezone": "0.4.1"
}
@@ -5469,9 +5467,9 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jquery": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz",
"integrity": "sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c="
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
"integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
},
"jquery-mousewheel": {
"version": "3.1.13",
@@ -5670,9 +5668,9 @@
}
},
"leaflet": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.2.0.tgz",
"integrity": "sha512-Bold8phAE6WcRsuwhofrQ7cOK1REFHaYIkKuj7+TBYK3ONKRpGGIb5oXR5akYotFnrWN0TWKh6Svlhflm3dogg=="
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.3.1.tgz",
"integrity": "sha512-adQOIzh+bfdridLM1xIgJ9VnJbAUY3wqs/ueF+ITla+PLQ1z47USdBKUf+iD9FuUA8RtlT6j6hZBfZoA6mW+XQ=="
},
"leaflet-ajax": {
"version": "2.1.0",
@@ -6978,9 +6976,9 @@
}
},
"pjax": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/pjax/-/pjax-0.2.4.tgz",
"integrity": "sha1-CuWIXP5mPranhhVu2cPeW8tidRM="
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/pjax/-/pjax-0.2.5.tgz",
"integrity": "sha512-2T3mLSXPOrCtj7Flm2Q7VlqsN2Vz6IBV7BZjYUR4MDEReBr++VFxoJ8FYbeARCykE7bqbubQ4yVdnYjnuS9v3A=="
},
"pkg-dir": {
"version": "2.0.0",
+4 -4
View File
@@ -18,22 +18,22 @@
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
"flag-icon-css": "^2.9.0",
"icheck": "^1.0.2",
"jquery": "^3.2.1",
"jquery": "^3.3.1",
"jquery-pjax": "^2.0.1",
"laravel-mix": "^1.0",
"leaflet": "^1.2.0",
"leaflet": "^1.3.1",
"leaflet-ajax": "2.1.0",
"leaflet-rotatedmarker": "^0.2.0",
"lodash": "4.17.4",
"marked": "0.3.9",
"moment": "^2.20.1",
"pjax": "^0.2.4",
"pjax": "^0.2.5",
"popper.js": "^1.13.0",
"rivets": "0.9.6",
"select2": "^4.0.5",
"x-editable": "1.5.1"
},
"devDependencies": {
"copy-webpack-plugin": "^4.3.1"
"copy-webpack-plugin": "^4.4.1"
}
}
+5 -1
View File
@@ -13678,6 +13678,7 @@ button.close {
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
@@ -13686,7 +13687,10 @@ button.close {
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
}
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -532,6 +532,7 @@
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
@@ -540,7 +541,10 @@
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
}
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
File diff suppressed because it is too large Load Diff
+455 -344
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+7 -6
View File
@@ -5,12 +5,13 @@
"/assets/admin/fonts/glyphicons-halflings-regular.woff2": "/assets/admin/fonts/glyphicons-halflings-regular.woff2?id=b5b5055c6d812c0f9f0d",
"/assets/admin/css/clear.png": "/assets/admin/css/clear.png?id=0e92f4c3efc6988a3c96",
"/assets/admin/css/loading.gif": "/assets/admin/css/loading.gif?id=90a4b76b4f11558691f6",
"/assets/admin/css/vendor.min.css": "/assets/admin/css/vendor.min.css?id=eaa4509357dab66e6809",
"/assets/admin/js/vendor.js": "/assets/admin/js/vendor.js?id=0f6b516f7ea80d70d407",
"/assets/admin/css/vendor.min.css": "/assets/admin/css/vendor.min.css?id=c8f3afb50f59bb218c37",
"/assets/admin/js/vendor.js": "/assets/admin/js/vendor.js?id=3e46e22d29a6e6d54ed5",
"/assets/admin/css/blue.png": "/assets/admin/css/blue.png?id=753a3c0dec86d3a38d9c",
"/assets/admin/css/blue@2x.png": "/assets/admin/css/blue@2x.png?id=97da23d47b838cbd4bef",
"/assets/system/js/jquery.js": "/assets/system/js/jquery.js?id=09dd64a64ba840c31a81",
"/assets/system/js/vendor.js": "/assets/system/js/vendor.js?id=c83cbe33451bdbd1ec0b",
"/assets/system/css/vendor.css": "/assets/system/css/vendor.css?id=98678d61e87fb3d17f15",
"/assets/system/js/installer-vendor.js": "/assets/system/js/installer-vendor.js?id=b2bca761f222e97bf4ff"
"/assets/system/js/jquery.js": "/assets/system/js/jquery.js?id=6a07da9fae934baf3f74",
"/assets/system/js/vendor.js": "/assets/system/js/vendor.js?id=2b0220206e2d805d8abf",
"/assets/system/css/vendor.css": "/assets/system/css/vendor.css?id=115d5c4f2370ae94a962",
"/assets/system/css/installer.css": "/assets/system/css/installer.css?id=1101b178b0383008aaa1",
"/assets/system/js/installer-vendor.js": "/assets/system/js/installer-vendor.js?id=efb330ef732d2f856623"
}
@@ -29,9 +29,15 @@
</div>
<div class="row">
<!-- Active Field -->
<div class="form-group col-sm-6">
{!! Form::label('country', 'Country:') !!} <br/>
{!! Form::select('country', $countries, null, ['class' => 'form-control select2' ]); !!}
<p class="text-danger">{{ $errors->first('country') }}</p>
</div>
<div class="form-group col-sm-6">
{!! Form::label('active', 'Active:') !!}
<br />
<label class="checkbox-inline">
{!! Form::hidden('active', 0, false) !!}
{!! Form::checkbox('active', 1, null) !!}
@@ -1,7 +1,6 @@
<table class="table table-hover table-responsive" id="airlines-table">
<thead>
<th>Code</th>
<th>IATA</th>
<th>Name</th>
<th class="text-center">Active</th>
<th></th>
@@ -9,8 +8,13 @@
<tbody>
@foreach($airlines as $al)
<tr>
<td>{!! $al->code !!}</td>
<td>{!! $al->iata !!}</td>
<td>
@if(filled($al->country))
<span class="flag-icon flag-icon-{!! $al->country !!}"></span>
&nbsp;
@endif
<a href="{!! route('admin.airlines.edit', [$al->id]) !!}">{!! $al->code !!}</a>
</td>
<td>{!! $al->name !!}</td>
<td class="text-center">
@if($al->active == 1)
+11
View File
@@ -112,10 +112,21 @@ mix.styles([
* INSTALLER VENDOR FILES
*/
mix.styles([
'node_modules/select2/dist/css/select2.css',
'node_modules/flag-icon-css/css/flag-icon.css',
], 'public/assets/system/css/installer.css')
.options({
processCssUrls: false,
compressed: true
})
.sourceMaps();
mix.scripts([
'node_modules/lodash/lodash.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/pjax/pjax.js',
'node_modules/select2/dist/js/select2.js',
], 'public/assets/system/js/installer-vendor.js');