javascript test for srp admin dashboard

This commit is contained in:
2020-03-06 20:24:40 -06:00
parent 0df2cea80c
commit a55a99e5bb
3 changed files with 15 additions and 22 deletions

View File

@@ -106,22 +106,20 @@ class SRPAdminController extends Controller
->with('viewShipTypes', $viewShipTypes);
}
public function changeSRPRequest(Request $request) {
//Validate the request
$this->validate($request, [
'id' => 'required',
'approved' => 'required',
'ship_type' => 'required',
'total_loss' => 'required',
public function updateLossValue($id, $value) {
SRPShip::where(['id' => $id])->update([
'loss_value' => $value,
]);
$current = SRPShip::where([
'id' => $request->id,
])->get();
if($current->ship_type != $request->ship_type || $current->loss_value != $request->total_loss) {
return redirect('/srp/admin/display');
}
public function updateShipType($id, $value) {
SRPShip::where(['id' => $id])->update([
'ship_type' => $value,
]);
return redirect('/srp/admin/display');
}
public function processSRPRequest(Request $request) {

View File

@@ -83,11 +83,11 @@
<script>
function UpdateTotalLoss(val,id) {
alert("The input value has changed. The new value is: " + val + " " + id);
window.location.href.replace("https://services.w4rp.space/srp/admin/update/lossvalue/" + id + "/" + val);
}
function UpdateShipType(val, id) {
alert("The input value for ship type has changed. Thew new value is: " + val + " " + id);
window.location.href.replace("https://services.w4rp.space/srp/admin/update/shiptype/" + id + "/" + val);
}
</script>
@else

View File

@@ -51,13 +51,6 @@ Route::group(['middleware' => ['auth']], function(){
Route::post('/admin/dashboard/wiki/newgroup', 'Dashboard\AdminController@insertNewWikiUserGroup');
Route::post('/admin/dashboard/wiki/purge', 'Dashboard\AdminController@purgeWikiUsers');
/**
* AJAX Test pages
*/
Route::get('/ajax', 'Ajax\LiveSearch@index');
Route::post('/ajax/action', 'Ajax\LiveSearch@action')->name('live_search.action');
/**
* Blacklist Controller display pages
*/
@@ -165,6 +158,8 @@ Route::group(['middleware' => ['auth']], function(){
Route::post('/srp/admin/costcodes/add', 'SRP\SRPAdminController@addCostCode');
Route::post('/srp/admin/costcodes/modify', 'SRP\SRPAdminController@modifyCostCodes');
Route::get('/srp/admin/display/history', 'SRP\SRPAdminController@displayHistory');
Route::get('/srp/admin/update/shiptype/{id}/{value}', 'SRP\AdminController@updateShipType');
Route::get('/srp/admin/update/lossvalue/{id}/{value}', 'SRP\AdminController@updateLossValue');
/**
* Structure Request Controller display pages