From a5b83185f59a22755e4c8a4c0369ec8f08de8eae Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" <74361521+FatihKoz@users.noreply.github.com> Date: Sun, 17 Jan 2021 20:23:23 +0300 Subject: [PATCH] Search Flights By Flight Type (#987) Flight Controller : Added flight_type to return Flight Repository : Made flight_type searchable and added its where criteria Flight.Search.Blade : Added the flight types in a reasonable order as a dropdown (like schedule pax,charter pax,cargo,others) Co-authored-by: Nabeel S --- .../Controllers/Frontend/FlightController.php | 1 + app/Repositories/FlightRepository.php | 5 ++++ .../layouts/default/flights/search.blade.php | 24 ++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Frontend/FlightController.php b/app/Http/Controllers/Frontend/FlightController.php index 95301b9a..d3e2e79d 100644 --- a/app/Http/Controllers/Frontend/FlightController.php +++ b/app/Http/Controllers/Frontend/FlightController.php @@ -120,6 +120,7 @@ class FlightController extends Controller 'saved' => $saved_flights, 'subfleets' => $this->subfleetRepo->selectBoxList(true), 'flight_number' => $request->input('flight_number'), + 'flight_type' => $request->input('flight_type'), 'arr_icao' => $request->input('arr_icao'), 'dep_icao' => $request->input('dep_icao'), 'subfleet_id' => $request->input('subfleet_id'), diff --git a/app/Repositories/FlightRepository.php b/app/Repositories/FlightRepository.php index 36a7f62b..f74e1e18 100644 --- a/app/Repositories/FlightRepository.php +++ b/app/Repositories/FlightRepository.php @@ -20,6 +20,7 @@ class FlightRepository extends Repository implements CacheableInterface 'arr_airport_id', 'distance', 'dpt_airport_id', + 'flight_type', 'flight_number' => 'like', 'route_code' => 'like', 'route_leg' => 'like', @@ -93,6 +94,10 @@ class FlightRepository extends Repository implements CacheableInterface $where['flight_number'] = $request->input('flight_number'); } + if ($request->filled('flight_type')) { + $where['flight_type'] = $request->input('flight_type'); + } + if ($request->filled('route_code')) { $where['route_code'] = $request->input('route_code'); } diff --git a/resources/views/layouts/default/flights/search.blade.php b/resources/views/layouts/default/flights/search.blade.php index b41f4d9d..c0472e4a 100644 --- a/resources/views/layouts/default/flights/search.blade.php +++ b/resources/views/layouts/default/flights/search.blade.php @@ -11,7 +11,29 @@

@lang('common.airline')

{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }} - + +
+ + +
+

@lang('flights.flightnumber')

{{ Form::text('flight_number', null, ['class' => 'form-control']) }}