Add days of week to flights table; add to import/export for flights

This commit is contained in:
Nabeel Shahzad
2018-03-22 21:21:35 -05:00
parent 8b53ca2fdc
commit 7105e82922
17 changed files with 310 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin;
use App\Http\Requests\CreateFlightRequest;
use App\Http\Requests\UpdateFlightRequest;
use App\Interfaces\Controller;
use App\Models\Enums\Days;
use App\Models\Enums\FlightType;
use App\Models\Flight;
use App\Models\FlightField;
@@ -143,6 +144,7 @@ class FlightController extends Controller
{
return view('admin.flights.create', [
'flight' => null,
'days' => [],
'flight_fields' => $this->flightFieldRepo->all(),
'airlines' => $this->airlineRepo->selectBoxList(),
'airports' => $this->airportRepo->selectBoxList(true, false),
@@ -179,6 +181,7 @@ class FlightController extends Controller
return redirect()->back()->withInput($request->all());
}
$input['days'] = Days::getDaysMask($input['days']);
$input['active'] = get_truth_state($input['active']);
$time = new Time($input['minutes'], $input['hours']);
@@ -232,6 +235,7 @@ class FlightController extends Controller
return view('admin.flights.edit', [
'flight' => $flight,
'days' => $flight->days,
'flight_fields' => $this->flightFieldRepo->all(),
'airlines' => $this->airlineRepo->selectBoxList(),
'airports' => $this->airportRepo->selectBoxList(),
@@ -279,6 +283,8 @@ class FlightController extends Controller
return redirect()->back()->withInput($request->all());
}
$input['days'] = Days::getDaysMask($input['days']);
$input['flight_time'] = Time::init(
$input['minutes'],
$input['hours'])->getMinutes();