Set the currect aircraft location #277

This commit is contained in:
Nabeel Shahzad 2018-09-21 22:40:30 -04:00
parent 61c7a3d54d
commit 3911d95107
2 changed files with 21 additions and 9 deletions

View File

@ -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,
]);
}

View File

@ -5,7 +5,7 @@
 Subfleet and Status
</h6>
<div class="form-container-body row">
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{{ Form::label('subfleet_id', 'Subfleet:') }}
{{ Form::select('subfleet_id', $subfleets, $subfleet_id ?? null, [
'class' => 'form-control select2',
@ -15,11 +15,19 @@
<p class="text-danger">{{ $errors->first('subfleet_id') }}</p>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{{ Form::label('status', 'Status:') }}
{{ Form::select('status', $statuses, null, ['class' => 'form-control select2', 'placeholder' => 'Select Status']) }}
<p class="text-danger">{{ $errors->first('subfleet_id') }}</p>
</div>
<div class="form-group col-sm-4">
{{ Form::label('airport_id', 'Location:') }}
{{ Form::select('airport_id', $airports, null, [
'class' => 'form-control select2'
]) }}
<p class="text-danger">{{ $errors->first('airport_id') }}</p>
</div>
</div>
</div>
@ -50,25 +58,22 @@
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
<div class="form-group col-sm-3">
{{ Form::label('iata', 'IATA:') }}
{{ Form::text('iata', null, ['class' => 'form-control']) }}
<p class="text-danger">{{ $errors->first('iata') }}</p>
</div>
<div class="form-group col-sm-4">
<div class="form-group col-sm-3">
{{ Form::label('icao', 'ICAO:') }}
{{ Form::text('icao', null, ['class' => 'form-control']) }}
<p class="text-danger">{{ $errors->first('icao') }}</p>
</div>
<div class="form-group col-sm-4">
<div class="form-group col-sm-3">
{{ Form::label('registration', 'Registration:') }}
{{ Form::text('registration', null, ['class' => 'form-control']) }}
<p class="text-danger">{{ $errors->first('registration') }}</p>
{{--{{ Form::label('zfw', 'Zero Fuel Weight:') }}
{{ Form::text('zfw', null, ['class' => 'form-control']) }}
<p class="text-danger">{{ $errors->first('zfw') }}</p>--}}
</div>
</div>
</div>