srp form
This commit is contained in:
@@ -2,15 +2,18 @@
|
||||
|
||||
namespace App\Http\Controllers\Dashboard;
|
||||
|
||||
//Internal Libraries
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
//Models
|
||||
use App\Models\Esi\EsiScope;
|
||||
use App\Models\Esi\EsiToken;
|
||||
use App\Models\User\UserPermission;
|
||||
use App\Models\User\UserRole;
|
||||
use App\Models\SRP\SRPShip;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
@@ -32,6 +35,47 @@ class DashboardController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//Set some variables to be used in if statements
|
||||
$open = null;
|
||||
$approved = null;
|
||||
$denied = null;
|
||||
|
||||
//See if we can get all of the open SRP requests
|
||||
$openCount = SRPShip::where([
|
||||
'character_id' => auth()->user()->character_id,
|
||||
'approved' => 'Under Review',
|
||||
])->count();
|
||||
if($openCount > 0) {
|
||||
$open = SRPShip::where([
|
||||
'character_id' => auth()->user()->character_id,
|
||||
'approved' => 'Under Review'
|
||||
])->get();
|
||||
}
|
||||
|
||||
//See if we can get all of the closed and approved SRP requests
|
||||
$approvedCount = SRPShip::where([
|
||||
'character_id' => auth()->user()->character_id,
|
||||
'approved' => 'Approved',
|
||||
])->count();
|
||||
if($approvedCount > 0) {
|
||||
$approved = SRPShip::where([
|
||||
'character_id' => auth()->user()->character_id,
|
||||
'approved' => 'Approved',
|
||||
])->get();
|
||||
}
|
||||
|
||||
//See if we can get all of the closed and denied SRP requests
|
||||
$deniedCount = SRPShip::where([
|
||||
'character_id' => auth()->user()->character_id,
|
||||
'approved' => 'Denied',
|
||||
])->count();
|
||||
if($deniedCount > 0) {
|
||||
$denied = SRPShip::where([
|
||||
'character_id' => auth()->user()->character_id,
|
||||
'approved' => 'Denied',
|
||||
])->get();
|
||||
}
|
||||
|
||||
return view('dashboard');
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ class SRPAdminController extends Controller
|
||||
public function displaySRPRequests() {
|
||||
$this->middleware('permission:srp.admin');
|
||||
|
||||
$requests = Ship::where(['approved' => 'Not Paid'])->get();
|
||||
$requests = Ship::where(['approved' => 'Under Review'])->get();
|
||||
|
||||
return view('srp.admin.process')->with('requests', $request);
|
||||
return view('srp.admin.process')->with('requests', $requests);
|
||||
}
|
||||
|
||||
public function processSRPRequest() {
|
||||
@@ -38,12 +38,24 @@ class SRPAdminController extends Controller
|
||||
'paid_value' => 'required',
|
||||
]);
|
||||
|
||||
$srp = SRPShip::where(['id' => $id])->update([
|
||||
'approved' => $request->approved,
|
||||
'paid_value' => $request->paid_value,
|
||||
'paid_by_id' => auth()->user()->character_id,
|
||||
'paid_by_name' => auth()->user()->name,
|
||||
]);
|
||||
if($request->notes != null) {
|
||||
$srp = SRPShip::where(['id' => $id])->update([
|
||||
'approved' => $request->approved,
|
||||
'paid_value' => $request->paid_value,
|
||||
'paid_by_id' => auth()->user()->character_id,
|
||||
'paid_by_name' => auth()->user()->name,
|
||||
'notes' => $request->notes,
|
||||
]);
|
||||
} else {
|
||||
$srp = SRPShip::where(['id' => $id])->update([
|
||||
'approved' => $request->approved,
|
||||
'paid_value' => $request->paid_value,
|
||||
'paid_by_id' => auth()->user()->character_id,
|
||||
'paid_by_name' => auth()->user()->name,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($request->approved == 'Yes') {
|
||||
return redirect('/srp/admin/display')->with('success', 'SRP Marked as Paid');
|
||||
@@ -51,4 +63,8 @@ class SRPAdminController extends Controller
|
||||
return redirect('/srp/admin/display')->with('error', 'SRP Request Denied.');
|
||||
}
|
||||
}
|
||||
|
||||
public function displayStatistics() {
|
||||
return view('srp.admin.statistics');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user