From 3911d95107ef9e587e9327d6786dc4fffdd2f3f2 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 21 Sep 2018 22:40:30 -0400 Subject: [PATCH] Set the currect aircraft location #277 --- .../Controllers/Admin/AircraftController.php | 9 +++++++- .../views/admin/aircraft/fields.blade.php | 21 ++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/Admin/AircraftController.php b/app/Http/Controllers/Admin/AircraftController.php index 121e2b51..30974c1a 100644 --- a/app/Http/Controllers/Admin/AircraftController.php +++ b/app/Http/Controllers/Admin/AircraftController.php @@ -11,6 +11,7 @@ use App\Models\Enums\AircraftStatus; use App\Models\Expense; use App\Models\Subfleet; use App\Repositories\AircraftRepository; +use App\Repositories\AirportRepository; use App\Services\ExportService; use App\Services\ImportService; use Flash; @@ -24,19 +25,23 @@ use Storage; class AircraftController extends Controller { private $aircraftRepo; + private $airportRepo; private $importSvc; /** * AircraftController constructor. * + * @param AirportRepository $airportRepo * @param AircraftRepository $aircraftRepo * @param ImportService $importSvc */ public function __construct( + AirportRepository $airportRepo, AircraftRepository $aircraftRepo, ImportService $importSvc ) { $this->aircraftRepo = $aircraftRepo; + $this->airportRepo = $airportRepo; $this->importSvc = $importSvc; } @@ -75,6 +80,7 @@ class AircraftController extends Controller public function create(Request $request) { return view('admin.aircraft.create', [ + 'airports' => $this->airportRepo->selectBoxList(), 'subfleets' => Subfleet::all()->pluck('name', 'id'), 'statuses' => AircraftStatus::select(true), 'subfleet_id' => $request->query('subfleet'), @@ -133,9 +139,10 @@ class AircraftController extends Controller } return view('admin.aircraft.edit', [ + 'aircraft' => $aircraft, + 'airports' => $this->airportRepo->selectBoxList(), 'subfleets' => Subfleet::all()->pluck('name', 'id'), 'statuses' => AircraftStatus::select(true), - 'aircraft' => $aircraft, ]); } diff --git a/resources/views/admin/aircraft/fields.blade.php b/resources/views/admin/aircraft/fields.blade.php index 0b9fde4a..ad9c014e 100644 --- a/resources/views/admin/aircraft/fields.blade.php +++ b/resources/views/admin/aircraft/fields.blade.php @@ -5,7 +5,7 @@  Subfleet and Status
-
+
{{ Form::label('subfleet_id', 'Subfleet:') }} {{ Form::select('subfleet_id', $subfleets, $subfleet_id ?? null, [ 'class' => 'form-control select2', @@ -15,11 +15,19 @@

{{ $errors->first('subfleet_id') }}

-
+
{{ Form::label('status', 'Status:') }} {{ Form::select('status', $statuses, null, ['class' => 'form-control select2', 'placeholder' => 'Select Status']) }}

{{ $errors->first('subfleet_id') }}

+ +
+ {{ Form::label('airport_id', 'Location:') }} + {{ Form::select('airport_id', $airports, null, [ + 'class' => 'form-control select2' + ]) }} +

{{ $errors->first('airport_id') }}

+
@@ -50,25 +58,22 @@
-
+
{{ Form::label('iata', 'IATA:') }} {{ Form::text('iata', null, ['class' => 'form-control']) }}

{{ $errors->first('iata') }}

-
+
{{ Form::label('icao', 'ICAO:') }} {{ Form::text('icao', null, ['class' => 'form-control']) }}

{{ $errors->first('icao') }}

-
+
{{ Form::label('registration', 'Registration:') }} {{ Form::text('registration', null, ['class' => 'form-control']) }}

{{ $errors->first('registration') }}

- {{--{{ Form::label('zfw', 'Zero Fuel Weight:') }} - {{ Form::text('zfw', null, ['class' => 'form-control']) }} -

{{ $errors->first('zfw') }}

--}}