Add fares and set prices on flights #125
This commit is contained in:
@@ -30,9 +30,10 @@ class CreateSettingsTable extends Migration
|
|||||||
$this->addCounterGroups([
|
$this->addCounterGroups([
|
||||||
'general' => 1,
|
'general' => 1,
|
||||||
'flights' => 20,
|
'flights' => 20,
|
||||||
'bids' => 40,
|
'finances' => 40,
|
||||||
'pireps' => 60,
|
'bids' => 60,
|
||||||
'pilots' => 80,
|
'pireps' => 80,
|
||||||
|
'pilots' => 100,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,6 +141,15 @@ class CreateSettingsTable extends Migration
|
|||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'description' => 'Whether or not someone can bid on multiple flights',
|
'description' => 'Whether or not someone can bid on multiple flights',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FINANCES
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PIREPS
|
||||||
|
*/
|
||||||
|
|
||||||
[
|
[
|
||||||
'id' => $this->formatSettingId('pireps.duplicate_check_time'),
|
'id' => $this->formatSettingId('pireps.duplicate_check_time'),
|
||||||
'order' => $this->getNextOrderNumber('pireps'),
|
'order' => $this->getNextOrderNumber('pireps'),
|
||||||
@@ -160,6 +170,11 @@ class CreateSettingsTable extends Migration
|
|||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'description' => 'Hide any cancelled PIREPs in the front-end',
|
'description' => 'Hide any cancelled PIREPs in the front-end',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PILOTS
|
||||||
|
*/
|
||||||
|
|
||||||
[
|
[
|
||||||
'id' => $this->formatSettingId('pilots.id_length'),
|
'id' => $this->formatSettingId('pilots.id_length'),
|
||||||
'order' => $this->getNextOrderNumber('pilots'),
|
'order' => $this->getNextOrderNumber('pilots'),
|
||||||
|
|||||||
@@ -2,14 +2,19 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Models\Flight;
|
||||||
use App\Models\FlightFields;
|
use App\Models\FlightFields;
|
||||||
use App\Http\Requests\CreateFlightRequest;
|
use App\Http\Requests\CreateFlightRequest;
|
||||||
use App\Http\Requests\UpdateFlightRequest;
|
use App\Http\Requests\UpdateFlightRequest;
|
||||||
use App\Repositories\AirlineRepository;
|
use App\Repositories\AirlineRepository;
|
||||||
use App\Repositories\AirportRepository;
|
use App\Repositories\AirportRepository;
|
||||||
|
use App\Repositories\FareRepository;
|
||||||
use App\Repositories\FlightRepository;
|
use App\Repositories\FlightRepository;
|
||||||
use App\Repositories\SubfleetRepository;
|
use App\Repositories\SubfleetRepository;
|
||||||
|
|
||||||
|
use App\Services\FareService;
|
||||||
use App\Services\FlightService;
|
use App\Services\FlightService;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Flash;
|
use Flash;
|
||||||
use Response;
|
use Response;
|
||||||
@@ -18,20 +23,26 @@ class FlightController extends BaseController
|
|||||||
{
|
{
|
||||||
private $airlineRepo,
|
private $airlineRepo,
|
||||||
$airportRepo,
|
$airportRepo,
|
||||||
|
$fareRepo,
|
||||||
$flightRepo,
|
$flightRepo,
|
||||||
|
$fareSvc,
|
||||||
$flightSvc,
|
$flightSvc,
|
||||||
$subfleetRepo;
|
$subfleetRepo;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AirlineRepository $airlineRepo,
|
AirlineRepository $airlineRepo,
|
||||||
AirportRepository $airportRepo,
|
AirportRepository $airportRepo,
|
||||||
|
FareRepository $fareRepo,
|
||||||
FlightRepository $flightRepo,
|
FlightRepository $flightRepo,
|
||||||
|
FareService $fareSvc,
|
||||||
FlightService $flightSvc,
|
FlightService $flightSvc,
|
||||||
SubfleetRepository $subfleetRepo
|
SubfleetRepository $subfleetRepo
|
||||||
) {
|
) {
|
||||||
$this->airlineRepo = $airlineRepo;
|
$this->airlineRepo = $airlineRepo;
|
||||||
$this->airportRepo = $airportRepo;
|
$this->airportRepo = $airportRepo;
|
||||||
|
$this->fareRepo = $fareRepo;
|
||||||
$this->flightRepo = $flightRepo;
|
$this->flightRepo = $flightRepo;
|
||||||
|
$this->fareSvc = $fareSvc;
|
||||||
$this->flightSvc = $flightSvc;
|
$this->flightSvc = $flightSvc;
|
||||||
$this->subfleetRepo = $subfleetRepo;
|
$this->subfleetRepo = $subfleetRepo;
|
||||||
}
|
}
|
||||||
@@ -135,6 +146,7 @@ class FlightController extends BaseController
|
|||||||
'flight' => $flight,
|
'flight' => $flight,
|
||||||
'airlines' => $this->airlineRepo->selectBoxList(),
|
'airlines' => $this->airlineRepo->selectBoxList(),
|
||||||
'airports' => $this->airportRepo->selectBoxList(),
|
'airports' => $this->airportRepo->selectBoxList(),
|
||||||
|
'avail_fares' => $this->getAvailFares($flight),
|
||||||
'avail_subfleets' => $avail_subfleets,
|
'avail_subfleets' => $avail_subfleets,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -270,4 +282,71 @@ class FlightController extends BaseController
|
|||||||
|
|
||||||
return $this->return_subfleet_view($flight);
|
return $this->return_subfleet_view($flight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the fares that haven't been assigned to a given subfleet
|
||||||
|
*/
|
||||||
|
protected function getAvailFares($flight)
|
||||||
|
{
|
||||||
|
$retval = [];
|
||||||
|
$all_fares = $this->fareRepo->all();
|
||||||
|
$avail_fares = $all_fares->except($flight->fares->modelKeys());
|
||||||
|
foreach ($avail_fares as $fare) {
|
||||||
|
$retval[$fare->id] = $fare->name .
|
||||||
|
' (base price: '.$fare->price.')';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Flight $flight
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
protected function return_fares_view(Flight $flight)
|
||||||
|
{
|
||||||
|
$flight->refresh();
|
||||||
|
return view('admin.flights.fares', [
|
||||||
|
'flight' => $flight,
|
||||||
|
'avail_fares' => $this->getAvailFares($flight),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function fares(Request $request)
|
||||||
|
{
|
||||||
|
$id = $request->id;
|
||||||
|
|
||||||
|
$flight = $this->flightRepo->findWithoutFail($id);
|
||||||
|
if (empty($flight)) {
|
||||||
|
return $this->return_fares_view($flight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->isMethod('get')) {
|
||||||
|
return $this->return_fares_view($flight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update specific fare data
|
||||||
|
*/
|
||||||
|
if ($request->isMethod('post')) {
|
||||||
|
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
||||||
|
$this->fareSvc->setForFlight($flight, $fare);
|
||||||
|
} // update the pivot table with overrides for the fares
|
||||||
|
elseif ($request->isMethod('put')) {
|
||||||
|
$override = [];
|
||||||
|
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
||||||
|
$override[$request->name] = $request->value;
|
||||||
|
$this->fareSvc->setForFlight($flight, $fare, $override);
|
||||||
|
} // dissassociate fare from teh aircraft
|
||||||
|
elseif ($request->isMethod('delete')) {
|
||||||
|
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
||||||
|
$this->fareSvc->delFareFromFlight($flight, $fare);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->return_fares_view($flight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,19 @@ use App\Models\Enums\FuelType;
|
|||||||
|
|
||||||
use App\Models\Airline;
|
use App\Models\Airline;
|
||||||
use App\Models\Subfleet;
|
use App\Models\Subfleet;
|
||||||
|
|
||||||
use App\Http\Requests\CreateSubfleetRequest;
|
use App\Http\Requests\CreateSubfleetRequest;
|
||||||
use App\Http\Requests\UpdateSubfleetRequest;
|
use App\Http\Requests\UpdateSubfleetRequest;
|
||||||
|
|
||||||
use App\Repositories\FareRepository;
|
use App\Repositories\FareRepository;
|
||||||
use App\Repositories\SubfleetRepository;
|
use App\Repositories\SubfleetRepository;
|
||||||
|
|
||||||
|
use App\Services\FareService;
|
||||||
|
|
||||||
class SubfleetController extends BaseController
|
class SubfleetController extends BaseController
|
||||||
{
|
{
|
||||||
/** @var SubfleetRepository */
|
/** @var SubfleetRepository */
|
||||||
private $subfleetRepo, $fareRepo;
|
private $subfleetRepo, $fareRepo, $fareSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SubfleetController constructor.
|
* SubfleetController constructor.
|
||||||
@@ -29,10 +33,12 @@ class SubfleetController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SubfleetRepository $subfleetRepo,
|
SubfleetRepository $subfleetRepo,
|
||||||
FareRepository $fareRepo
|
FareRepository $fareRepo,
|
||||||
|
FareService $fareSvc
|
||||||
) {
|
) {
|
||||||
$this->subfleetRepo = $subfleetRepo;
|
$this->subfleetRepo = $subfleetRepo;
|
||||||
$this->fareRepo = $fareRepo;
|
$this->fareRepo = $fareRepo;
|
||||||
|
$this->fareSvc = $fareSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,10 +90,9 @@ class SubfleetController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a newly created Subfleet in storage.
|
* Store a newly created Subfleet in storage.
|
||||||
*
|
|
||||||
* @param CreateSubfleetRequest $request
|
* @param CreateSubfleetRequest $request
|
||||||
*
|
|
||||||
* @return Response
|
* @return Response
|
||||||
|
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||||
*/
|
*/
|
||||||
public function store(CreateSubfleetRequest $request)
|
public function store(CreateSubfleetRequest $request)
|
||||||
{
|
{
|
||||||
@@ -100,9 +105,7 @@ class SubfleetController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the specified Subfleet.
|
* Display the specified Subfleet.
|
||||||
*
|
|
||||||
* @param int $id
|
* @param int $id
|
||||||
*
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
@@ -123,9 +126,7 @@ class SubfleetController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for editing the specified Subfleet.
|
* Show the form for editing the specified Subfleet.
|
||||||
*
|
|
||||||
* @param int $id
|
* @param int $id
|
||||||
*
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
@@ -148,11 +149,10 @@ class SubfleetController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified Subfleet in storage.
|
* Update the specified Subfleet in storage.
|
||||||
*
|
* @param int $id
|
||||||
* @param int $id
|
|
||||||
* @param UpdateSubfleetRequest $request
|
* @param UpdateSubfleetRequest $request
|
||||||
*
|
|
||||||
* @return Response
|
* @return Response
|
||||||
|
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||||
*/
|
*/
|
||||||
public function update($id, UpdateSubfleetRequest $request)
|
public function update($id, UpdateSubfleetRequest $request)
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ class SubfleetController extends BaseController
|
|||||||
return redirect(route('admin.subfleets.index'));
|
return redirect(route('admin.subfleets.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$subfleet = $this->subfleetRepo->update($request->all(), $id);
|
$this->subfleetRepo->update($request->all(), $id);
|
||||||
|
|
||||||
Flash::success('Subfleet updated successfully.');
|
Flash::success('Subfleet updated successfully.');
|
||||||
return redirect(route('admin.subfleets.index'));
|
return redirect(route('admin.subfleets.index'));
|
||||||
@@ -171,9 +171,7 @@ class SubfleetController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified Subfleet from storage.
|
* Remove the specified Subfleet from storage.
|
||||||
*
|
|
||||||
* @param int $id
|
* @param int $id
|
||||||
*
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
@@ -191,6 +189,10 @@ class SubfleetController extends BaseController
|
|||||||
return redirect(route('admin.subfleets.index'));
|
return redirect(route('admin.subfleets.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Subfleet $subfleet
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
protected function return_fares_view(Subfleet $subfleet)
|
protected function return_fares_view(Subfleet $subfleet)
|
||||||
{
|
{
|
||||||
$subfleet->refresh();
|
$subfleet->refresh();
|
||||||
@@ -204,7 +206,6 @@ class SubfleetController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function fares(Request $request)
|
public function fares(Request $request)
|
||||||
@@ -217,8 +218,6 @@ class SubfleetController extends BaseController
|
|||||||
//return view('admin.aircraft.fares', ['fares' => []]);
|
//return view('admin.aircraft.fares', ['fares' => []]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fare_svc = app('App\Services\FareService');
|
|
||||||
|
|
||||||
if ($request->isMethod('get')) {
|
if ($request->isMethod('get')) {
|
||||||
return $this->return_fares_view($subfleet);
|
return $this->return_fares_view($subfleet);
|
||||||
}
|
}
|
||||||
@@ -228,7 +227,7 @@ class SubfleetController extends BaseController
|
|||||||
*/
|
*/
|
||||||
if ($request->isMethod('post')) {
|
if ($request->isMethod('post')) {
|
||||||
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
||||||
$fare_svc->setForSubfleet($subfleet, $fare);
|
$this->fareSvc->setForSubfleet($subfleet, $fare);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the pivot table with overrides for the fares
|
// update the pivot table with overrides for the fares
|
||||||
@@ -236,13 +235,13 @@ class SubfleetController extends BaseController
|
|||||||
$override = [];
|
$override = [];
|
||||||
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
||||||
$override[$request->name] = $request->value;
|
$override[$request->name] = $request->value;
|
||||||
$fare_svc->setForSubfleet($subfleet, $fare, $override);
|
$this->fareSvc->setForSubfleet($subfleet, $fare, $override);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dissassociate fare from teh aircraft
|
// dissassociate fare from teh aircraft
|
||||||
elseif ($request->isMethod('delete')) {
|
elseif ($request->isMethod('delete')) {
|
||||||
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
$fare = $this->fareRepo->findWithoutFail($request->fare_id);
|
||||||
$fare_svc->delFareFromSubfleet($subfleet, $fare);
|
$this->fareSvc->delFareFromSubfleet($subfleet, $fare);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->return_fares_view($subfleet);
|
return $this->return_fares_view($subfleet);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Route::group([
|
|||||||
|
|
||||||
# flights and aircraft associations
|
# flights and aircraft associations
|
||||||
Route::resource('flights', 'FlightController');
|
Route::resource('flights', 'FlightController');
|
||||||
|
Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/fares', 'FlightController@fares');
|
||||||
Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/fields', 'FlightController@fields');
|
Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/fields', 'FlightController@fields');
|
||||||
Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/subfleets', 'FlightController@subfleets');
|
Route::match(['get', 'post', 'put', 'delete'], 'flights/{id}/subfleets', 'FlightController@subfleets');
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
"axios": "^0.17",
|
"axios": "^0.17",
|
||||||
"bootstrap-sass": "^3.3.7",
|
"bootstrap-sass": "^3.3.7",
|
||||||
"bootstrap3": "^3.3.5",
|
"bootstrap3": "^3.3.5",
|
||||||
"marked": "0.3.9",
|
|
||||||
"cross-env": "^5.1.3",
|
"cross-env": "^5.1.3",
|
||||||
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
|
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
|
||||||
"icheck": "^1.0.2",
|
"icheck": "^1.0.2",
|
||||||
@@ -25,6 +24,7 @@
|
|||||||
"leaflet-ajax": "2.1.0",
|
"leaflet-ajax": "2.1.0",
|
||||||
"leaflet-rotatedmarker": "^0.2.0",
|
"leaflet-rotatedmarker": "^0.2.0",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.4",
|
||||||
|
"marked": "0.3.9",
|
||||||
"moment": "^2.20.1",
|
"moment": "^2.20.1",
|
||||||
"pjax": "^0.2.4",
|
"pjax": "^0.2.4",
|
||||||
"popper.js": "^1.13.0",
|
"popper.js": "^1.13.0",
|
||||||
|
|||||||
4
public/assets/admin/css/vendor.min.css
vendored
4
public/assets/admin/css/vendor.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -40,7 +40,7 @@
|
|||||||
padding: 15px 15px 10px 15px;
|
padding: 15px 15px 10px 15px;
|
||||||
}
|
}
|
||||||
.header{
|
.header{
|
||||||
padding: 20px 20px 0;
|
padding: 0px 0px 10px 0;
|
||||||
}
|
}
|
||||||
.description{
|
.description{
|
||||||
font-size: $font-paragraph;
|
font-size: $font-paragraph;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"/assets/admin/vendor/paper-dashboard.css": "/assets/admin/vendor/paper-dashboard.css?id=233e12aabc29a3c6fba3",
|
"/assets/admin/vendor/paper-dashboard.css": "/assets/admin/vendor/paper-dashboard.css?id=c179175d87a4cef3a3f1",
|
||||||
"/assets/frontend/css/now-ui-kit.css": "/assets/frontend/css/now-ui-kit.css?id=58ec3dc768f07fee143a",
|
"/assets/frontend/css/now-ui-kit.css": "/assets/frontend/css/now-ui-kit.css?id=58ec3dc768f07fee143a",
|
||||||
"/assets/system/js/jquery.js": "/assets/system/js/jquery.js?id=09dd64a64ba840c31a81",
|
"/assets/system/js/jquery.js": "/assets/system/js/jquery.js?id=09dd64a64ba840c31a81",
|
||||||
"/assets/fonts/glyphicons-halflings-regular.woff2": "/assets/fonts/glyphicons-halflings-regular.woff2?id=b5b5055c6d812c0f9f0d",
|
"/assets/fonts/glyphicons-halflings-regular.woff2": "/assets/fonts/glyphicons-halflings-regular.woff2?id=b5b5055c6d812c0f9f0d",
|
||||||
"/assets/admin/fonts/glyphicons-halflings-regular.woff2": "/assets/admin/fonts/glyphicons-halflings-regular.woff2?id=b5b5055c6d812c0f9f0d",
|
"/assets/admin/fonts/glyphicons-halflings-regular.woff2": "/assets/admin/fonts/glyphicons-halflings-regular.woff2?id=b5b5055c6d812c0f9f0d",
|
||||||
"/assets/admin/css/clear.png": "/assets/admin/css/clear.png?id=0e92f4c3efc6988a3c96",
|
"/assets/admin/css/clear.png": "/assets/admin/css/clear.png?id=0e92f4c3efc6988a3c96",
|
||||||
"/assets/admin/css/loading.gif": "/assets/admin/css/loading.gif?id=90a4b76b4f11558691f6",
|
"/assets/admin/css/loading.gif": "/assets/admin/css/loading.gif?id=90a4b76b4f11558691f6",
|
||||||
"/assets/admin/css/vendor.min.css": "/assets/admin/css/vendor.min.css?id=dd0f6c4b8953c784240e",
|
"/assets/admin/css/vendor.min.css": "/assets/admin/css/vendor.min.css?id=09dd40e12d15cdfce5b9",
|
||||||
"/assets/admin/js/vendor.js": "/assets/admin/js/vendor.js?id=0f6b516f7ea80d70d407",
|
"/assets/admin/js/vendor.js": "/assets/admin/js/vendor.js?id=0f6b516f7ea80d70d407",
|
||||||
"/assets/admin/css/blue.png": "/assets/admin/css/blue.png?id=753a3c0dec86d3a38d9c",
|
"/assets/admin/css/blue.png": "/assets/admin/css/blue.png?id=753a3c0dec86d3a38d9c",
|
||||||
"/assets/admin/css/blue@2x.png": "/assets/admin/css/blue@2x.png?id=97da23d47b838cbd4bef",
|
"/assets/admin/css/blue@2x.png": "/assets/admin/css/blue@2x.png?id=97da23d47b838cbd4bef",
|
||||||
|
|||||||
@@ -22,5 +22,11 @@
|
|||||||
@include('admin.flights.subfleets')
|
@include('admin.flights.subfleets')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card border-blue-bottom">
|
||||||
|
<div class="content">
|
||||||
|
@include('admin.flights.fares')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@include('admin.flights.scripts')
|
@include('admin.flights.scripts')
|
||||||
|
|||||||
78
resources/views/admin/flights/fares.blade.php
Normal file
78
resources/views/admin/flights/fares.blade.php
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<div id="flight_fares_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
||||||
|
<div class="header">
|
||||||
|
<h3>fares</h3>
|
||||||
|
<p class="category">
|
||||||
|
<i class="icon fa fa-info"> </i>
|
||||||
|
Fares assigned to the current flight. These can be overridden,
|
||||||
|
otherwise, the values used come from the subfleet of the aircraft
|
||||||
|
that the flight is filed with. Only assign the fares you want to
|
||||||
|
override.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table id="flight_fares"
|
||||||
|
class="table table-hover"
|
||||||
|
role="grid" aria-describedby="aircraft_fares_info">
|
||||||
|
<thead>
|
||||||
|
<tr role="row">
|
||||||
|
<th>name</th>
|
||||||
|
<th style="text-align: center;">code</th>
|
||||||
|
<th>capacity</th>
|
||||||
|
<th>price</th>
|
||||||
|
<th>cost</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($flight->fares as $atf)
|
||||||
|
<tr>
|
||||||
|
<td class="sorting_1">{!! $atf->name !!}</td>
|
||||||
|
<td style="text-align: center;">{!! $atf->code !!}</td>
|
||||||
|
<td>
|
||||||
|
<a href="#" data-pk="{!! $atf->id !!}" data-name="capacity">{!! $atf->pivot->capacity !!}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#" data-pk="{!! $atf->id !!}" data-name="price">{!! $atf->pivot->price !!}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#" data-pk="{!! $atf->id !!}" data-name="cost">{!! $atf->pivot->cost !!}</a>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: right; width:3%;">
|
||||||
|
{!! Form::open(['url' => '/admin/flights/'.$flight->id.'/fares',
|
||||||
|
'method' => 'delete',
|
||||||
|
'class' => 'pjax_fares_form'
|
||||||
|
])
|
||||||
|
!!}
|
||||||
|
{!! Form::hidden('fare_id', $atf->id) !!}
|
||||||
|
{!! Form::button('<i class="fa fa-times"></i>',
|
||||||
|
['type' => 'submit',
|
||||||
|
'class' => 'btn btn-sm btn-danger btn-icon']) !!}
|
||||||
|
{!! Form::close() !!}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<hr />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="text-right">
|
||||||
|
{!! Form::open(['url' => '/admin/flights/'.$flight->id.'/fares',
|
||||||
|
'method' => 'post',
|
||||||
|
'class' => 'pjax_fares_form form-inline'
|
||||||
|
])
|
||||||
|
!!}
|
||||||
|
{!! Form::select('fare_id', $avail_fares, null, [
|
||||||
|
'placeholder' => 'Select Fare',
|
||||||
|
'class' => 'ac-fare-dropdown form-control input-lg select2',
|
||||||
|
|
||||||
|
])
|
||||||
|
!!}
|
||||||
|
{!! Form::button('<i class="glyphicon glyphicon-plus"></i> add',
|
||||||
|
['type' => 'submit',
|
||||||
|
'class' => 'btn btn-success btn-s']) !!}
|
||||||
|
{!! Form::close() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -24,4 +24,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@include('admin.flights.scripts')
|
|
||||||
|
|||||||
@@ -1,35 +1,64 @@
|
|||||||
@section('scripts')
|
@section('scripts')
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
|
||||||
|
|
||||||
$('#flight_fields_wrapper a.inline').editable({
|
function setEditable() {
|
||||||
type: 'text',
|
$('#flight_fares a').editable({
|
||||||
mode: 'inline',
|
type: 'text',
|
||||||
emptytext: '0',
|
mode: 'inline',
|
||||||
url: '/admin/flights/{!! $flight->id !!}/fields',
|
emptytext: 'inherited',
|
||||||
ajaxOptions: {'type': 'put'},
|
url: '{!! url('/admin/flights/'.$flight->id.'/fares') !!}',
|
||||||
params: function (params) {
|
title: 'Enter override value',
|
||||||
return {
|
ajaxOptions: {'type': 'put'},
|
||||||
field_id: params.pk,
|
params: function (params) {
|
||||||
name: params.name,
|
return {
|
||||||
value: params.value
|
fare_id: params.pk,
|
||||||
}
|
name: params.name,
|
||||||
|
value: params.value
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
$(document).on('submit', 'form.pjax_flight_fields', function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
$.pjax.submit(event, '#flight_fields_wrapper', {push: false});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('submit', 'form.pjax_subfleet_form', function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
$.pjax.submit(event, '#subfleet_flight_wrapper', {push: false});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('pjax:complete', function () {
|
|
||||||
$(".select2").select2();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
setEditable();
|
||||||
|
|
||||||
|
$('#flight_fields_wrapper a.inline').editable({
|
||||||
|
type: 'text',
|
||||||
|
mode: 'inline',
|
||||||
|
emptytext: '0',
|
||||||
|
url: '/admin/flights/{!! $flight->id !!}/fields',
|
||||||
|
ajaxOptions: {'type': 'put'},
|
||||||
|
params: function (params) {
|
||||||
|
return {
|
||||||
|
field_id: params.pk,
|
||||||
|
name: params.name,
|
||||||
|
value: params.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('submit', 'form.pjax_flight_fields', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$.pjax.submit(event, '#flight_fields_wrapper', {push: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('submit', 'form.pjax_subfleet_form', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$.pjax.submit(event, '#subfleet_flight_wrapper', {push: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('submit', 'form.pjax_fares_form', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
console.log(event);
|
||||||
|
$.pjax.submit(event, '#flight_fares_wrapper', {push: false});
|
||||||
|
setEditable();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('pjax:complete', function () {
|
||||||
|
$(".select2").select2();
|
||||||
|
setEditable();
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -10,21 +10,10 @@
|
|||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card border-blue-bottom">
|
<div class="card border-blue-bottom">
|
||||||
<div class="header">
|
|
||||||
<h3>fares</h3>
|
|
||||||
<p class="category">
|
|
||||||
<i class="icon fa fa-info"> </i>
|
|
||||||
Fares assigned to the current subfleet. These can be overridden,
|
|
||||||
otherwise, the value used is the default, which comes from the fare.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="row">
|
@include('admin.subfleets.fares')
|
||||||
<div class="col-xs-12">
|
|
||||||
@include('admin.subfleets.fares')
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,42 +1,30 @@
|
|||||||
{{--<div class="row"> <div class="col-12">--}}
|
{{--<div class="row"> <div class="col-12">--}}
|
||||||
<div id="aircraft_fares_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
<div id="aircraft_fares_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
||||||
|
<div class="header">
|
||||||
|
<h3>fares</h3>
|
||||||
|
<p class="category">
|
||||||
|
<i class="icon fa fa-info"> </i>
|
||||||
|
Fares assigned to the current subfleet. These can be overridden,
|
||||||
|
otherwise, the value used is the default, which comes from the fare.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<table id="aircraft_fares"
|
<table id="aircraft_fares"
|
||||||
class="table table-bordered table-hover dataTable"
|
class="table table-bordered table-hover dataTable"
|
||||||
role="grid" aria-describedby="aircraft_fares_info">
|
role="grid" aria-describedby="aircraft_fares_info">
|
||||||
<thead>
|
<thead>
|
||||||
<tr role="row">
|
<tr>
|
||||||
<th class="sorting" tabindex="0" aria-controls="aircraft_fares"
|
<th>name</th>
|
||||||
rowspan="1" colspan="1"
|
<th>code</th>
|
||||||
aria-label="name: activate to sort column ascending">
|
<th>capacity (default)</th>
|
||||||
name
|
<th>price (default)</th>
|
||||||
</th>
|
<th>cost (default)</th>
|
||||||
<th class="sorting_asc" tabindex="0" style="text-align: center;"
|
|
||||||
aria-controls="aircraft_fares" rowspan="1" colspan="1"
|
|
||||||
aria-sort="ascending"
|
|
||||||
aria-label="code: activate to sort column descending">
|
|
||||||
code
|
|
||||||
</th>
|
|
||||||
<th class="sorting" tabindex="0" aria-controls="aircraft_fares"
|
|
||||||
rowspan="1" colspan="1"
|
|
||||||
aria-label="capacity: activate to sort column ascending">
|
|
||||||
capacity (default)
|
|
||||||
</th>
|
|
||||||
<th class="sorting" tabindex="0" aria-controls="aircraft_fares"
|
|
||||||
rowspan="1" colspan="1"
|
|
||||||
aria-label="price: activate to sort column ascending">
|
|
||||||
price (default)
|
|
||||||
</th>
|
|
||||||
<th class="sorting" tabindex="0" aria-controls="aircraft_fares"
|
|
||||||
rowspan="1" colspan="1"
|
|
||||||
aria-label="cost: activate to sort column ascending">
|
|
||||||
cost (default)
|
|
||||||
</th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($subfleet->fares as $atf)
|
@foreach($subfleet->fares as $atf)
|
||||||
<tr role="row" class="@if ($loop->iteration % 2) even @else odd @endif">
|
<tr>
|
||||||
<td class="sorting_1">{!! $atf->name !!}</td>
|
<td class="sorting_1">{!! $atf->name !!}</td>
|
||||||
<td style="text-align: center;">{!! $atf->code !!}</td>
|
<td style="text-align: center;">{!! $atf->code !!}</td>
|
||||||
<td><a href="#" data-pk="{!! $atf->id !!}" data-name="capacity">{!! $atf->pivot->capacity !!}</a>
|
<td><a href="#" data-pk="{!! $atf->id !!}" data-name="capacity">{!! $atf->pivot->capacity !!}</a>
|
||||||
@@ -65,7 +53,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="input-group input-group-lg pull-right">
|
<div class="text-right">
|
||||||
{!! Form::open(['url' => '/admin/subfleets/'.$subfleet->id.'/fares',
|
{!! Form::open(['url' => '/admin/subfleets/'.$subfleet->id.'/fares',
|
||||||
'method' => 'post',
|
'method' => 'post',
|
||||||
'class' => 'rm_fare form-inline'
|
'class' => 'rm_fare form-inline'
|
||||||
|
|||||||
Reference in New Issue
Block a user