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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class CreateSrpTables extends Migration
|
||||
$table->string('zkillboard');
|
||||
$table->string('ship_type');
|
||||
$table->decimal('loss_value', 20, 2);
|
||||
$table->string('approved')->default('Not Paid');
|
||||
$table->string('approved')->default('Under Review');
|
||||
$table->decimal('paid_value', 20, 2)->default(0.00);
|
||||
$table->string('notes')->nullable();
|
||||
$table->string('paid_by_id')->nullable();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<th>Type of Ship</th>
|
||||
<th>Fleet Type</th>
|
||||
<th>Actual SRP</th>
|
||||
<th>Notes</th>
|
||||
<th>Pay Out</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -25,6 +26,7 @@
|
||||
<td>{{ $row['ship_type'] }}</td>
|
||||
<td>{{ $row['fleet_type'] }}</td>
|
||||
<td>{{ $row['actual_srp'] }}</td>
|
||||
<td>{{ Form::textarea('notes', null, ['class' => 'form-control', 'id' => 'notes', 'rows' => 4, 'cols' => 30, 'style' => 'resize:none']) }}
|
||||
<td>{{ Form::radio('pay_out', $row['id'], false, ['class' => 'form-control']) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@@ -93,6 +93,19 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
Route::get('/contracts/admin/delete/{id}', 'Contracts\ContractAdminController@deleteContract');
|
||||
Route::get('/contracts/admin/end/{id}', 'Contracts\ContractAdminController@displayEndContract');
|
||||
Route::post('/contracts/admin/end', 'Contracts\ContractAdminController@storeEndContract');
|
||||
|
||||
/**
|
||||
* SRP Controller display pages
|
||||
*/
|
||||
Route::get('/srp/form/display', 'SRP\SRPController@displaySrpForm');
|
||||
Route::post('/srp/form/display', 'SRP\SRPController@storeSRPFile');
|
||||
|
||||
/**
|
||||
* SRP Admin Controller display pages
|
||||
*/
|
||||
Route::get('/srp/admin/display', 'SRP\SRPAdminController@displaySRPRequests');
|
||||
Route::post('/srp/admin/display', 'SRP\SRPAdminController@processSRPRequest');
|
||||
Route::get('/srp/admin/statistics', 'SRP\SRPAdminController@displayStatistics');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user