Skip to content

Commit

Permalink
Merge pull request #17 from FSVAOS/fix-branch
Browse files Browse the repository at this point in the history
Updated MaterialCrewRedux module to VAOS 2.1 standards. Fixed routing…
  • Loading branch information
BossOfGames authored Jan 7, 2021
2 parents 2e5612f + 31fdf43 commit 4a2492c
Show file tree
Hide file tree
Showing 23 changed files with 363 additions and 318 deletions.
79 changes: 0 additions & 79 deletions Http/Controllers/FlightController.php

This file was deleted.

46 changes: 46 additions & 0 deletions Http/Controllers/FlightsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace Modules\MaterialCrewRedux\Http\Controllers;

use App\Classes\VAOS_Schedule;
use App\Models\Schedule;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class FlightsController extends Controller
{
public function __construct()
{
$this->middleware('auth:api');
}
public function getSchedule() {
$schedules = Schedule::with('depapt')->with('arrapt')->with('airline')->with('aircraft_group')->get();
//$schedules = Schedule::all();
//dd($schedules);
// Return the view
$output = [];
foreach ($schedules as $s) {
$s->primary_aircraft = null;
if (is_null($s->deptime)) {
$s->deptime = 'N/A';
}
if (is_null($s->arrtime)) {
$s->arrtime = 'N/A';
}
foreach ($s->aircraft_group as $a) {
if ($a['pivot']['primary']) {
$s->primary_aircraft = $a->icao;
}
}
$s->callsign = $s->getCallsign();
}

//return $schedules;
return \response()->json($schedules);
}
public function createBid(Request $request) {
$inputs = $request->all();
VAOS_Schedule::fileBid($request->user(), $inputs['id']);
}
}
63 changes: 4 additions & 59 deletions Http/Controllers/MaterialCrewReduxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Modules\MaterialCrewRedux\Http\Controllers;

use App\Models\Schedule;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
Expand All @@ -15,70 +16,14 @@ public function __construct()

/**
* Display a listing of the resource.
* @return Response
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
return view('materialcrewredux::index');
}

/**
* Show the form for creating a new resource.
* @return Response
*/
public function create()
{
return view('materialcrewredux::create');
}

/**
* Store a newly created resource in storage.
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}

/**
* Show the specified resource.
* @param int $id
* @return Response
*/
public function show($id)
{
return view('materialcrewredux::show');
}

/**
* Show the form for editing the specified resource.
* @param int $id
* @return Response
*/
public function edit($id)
{
return view('materialcrewredux::edit');
}

/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
public function getSchedule() {
return \response()->json(Schedule::allFK());
}
}
76 changes: 14 additions & 62 deletions Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,30 @@

namespace Modules\MaterialCrewRedux\Http\Controllers;

use App\Models\User;
use App\Models\Flight;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;

class ProfileController extends Controller
{
/**
* Display a listing of the resource.
* @return Response
*/
public function index()
{
return view('materialcrewredux::index');
}

/**
* Show the form for creating a new resource.
* @return Response
*/
public function create()
{
return view('materialcrewredux::create');
}

/**
* Store a newly created resource in storage.
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}

/**
* Show the specified resource.
* @param int $id
* @return Response
*/
public function show($id)
public function __construct()
{
return view('materialcrewredux::show');
$this->middleware('auth:api');
}

/**
* Show the form for editing the specified resource.
* @param int $id
* @return Response
*/
public function edit($id)
{
return view('materialcrewredux::edit');
}

/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
* @param int $id
* @return Response
* Display a listing of the resource.
*
*/
public function destroy($id)
public function index(Request $request)
{
//
$user = $request->user();
$upcoming = Flight::where('user_id', $request->user()->id)->filed()->count();
$completed = Flight::where('user_id', $request->user()->id)->completed()->count();
return response()->json([
'user' => $user, 'upcoming' => $upcoming, 'completed' => $completed
]);
}
}
3 changes: 0 additions & 3 deletions Resources/assets/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
</template>

<style>
.v-application {
font-family: Europa Roboto sans-serif;
}
</style>
<script>
const default_layout = "main";
Expand Down
Loading

0 comments on commit 4a2492c

Please sign in to comment.