removed tabs

added setting
corrected code
This commit is contained in:
lordwilbur 2018-05-19 02:03:06 +02:00
parent 0d53c5487d
commit 650d9884b0
3 changed files with 27 additions and 15 deletions

View File

@ -276,6 +276,14 @@ class CreateSettingsTable extends Migration
'type' => 'boolean',
'description' => 'Don\'t show inactive pilots in the public view',
]);
$this->addSetting('pilots.restrict_to_company', [
'name' => 'Restrict the flights to company',
'group' => 'pilots',
'value' => false,
'type' => 'boolean',
'description' => 'Restrict flights to the user\'s airline',
]);
}
/**

View File

@ -53,8 +53,10 @@ class FlightController extends Controller
{
$where = [
'active' => true,
'airline_id' => Auth::user()->airline_id,
];
if(setting('pilots.restrict_to_company')) {
$where['airline_id'] = Auth::user()->airline_id;
}
// default restrictions on the flights shown. Handle search differently
if (setting('pilots.only_flights_from_current')) {
@ -70,7 +72,6 @@ class FlightController extends Controller
$flights = $this->flightRepo
->orderBy('flight_number', 'asc')
->orderBy('route_leg', 'asc')
->orderBy('route_code', 'asc')
->paginate();
$saved_flights = Bid::where('user_id', Auth::id())
@ -113,14 +114,17 @@ class FlightController extends Controller
*/
public function search(Request $request)
{
$request['airline_id'] = Auth::user()->airline_id;
$flights = $this->flightRepo->searchCriteria($request)
->orderBy('flight_number', 'asc')
->orderBy('route_leg', 'asc')
->orderBy('route_code', 'asc')
->paginate();
if(setting('pilots.restrict_to_company')) {
$flights = $this->flightRepo
->pushCriteria(New WhereCriteria($request, ['airline_id' => Auth::user()->airline_id]))
->paginate();
}
$saved_flights = Bid::where('user_id', Auth::id())
->pluck('flight_id')->toArray();

View File

@ -24,7 +24,7 @@
x-id="{{ $flight->id }}"
x-saved-class="btn-info"
type="button"
title="@lang('frontend.flights.addremovebid')"
title="Add/Remove Bid"
>
<i class="fas fa-map-marker"></i>
</button>
@ -34,14 +34,14 @@
<div class="row">
<div class="col-sm-5">
{{--<table class="table-condensed"></table>--}}
<span class="title">{{ strtoupper(trans('frontend.flights.dep')) }}&nbsp;</span>
<span class="title">DEP&nbsp;</span>
{{ $flight->dpt_airport->name }}
(<a href="{{route('frontend.airports.show', [
'id' => $flight->dpt_airport->icao
])}}">{{$flight->dpt_airport->icao}}</a>)
@if($flight->dpt_time), {{ $flight->dpt_time }}@endif
<br />
<span class="title">{{ strtoupper(trans('frontend.flights.arr')) }}&nbsp;</span>
<span class="title">ARR&nbsp;</span>
{{ $flight->arr_airport->name }}
(<a href="{{route('frontend.airports.show', [
'id' => $flight->arr_airport->icao
@ -49,19 +49,19 @@
@if($flight->arr_time), {{ $flight->arr_time }}@endif
<br />
@if($flight->distance)
<span class="title">{{ strtoupper(trans('frontend.global.distance')) }}&nbsp;</span>
<span class="title">DISTANCE&nbsp;</span>
{{ $flight->distance }} {{ setting('units.distance') }}
@endif
<br />
@if($flight->level)
<span class="title">{{ strtoupper(trans('frontend.flights.level')) }}&nbsp;</span>
<span class="title">LEVEL&nbsp;</span>
{{ $flight->level }} {{ setting('units.altitude') }}
@endif
</div>
<div class="col-sm-7">
<div class="row">
<div class="col-sm-12">
<span class="title">{{ strtoupper(trans('frontend.global.route')) }}&nbsp;</span>
<span class="title">ROUTE&nbsp;</span>
{{ $flight->route }}
</div>
</div>