From 188ef7bff5524d2e77cfbeca53f2866fba465913 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Fri, 6 Mar 2020 19:46:47 -0600 Subject: [PATCH] javascript test for srp admin dashboard --- .../Controllers/SRP/SRPAdminController.php | 23 +++++++++++++++---- resources/views/srp/admin/process.blade.php | 14 +++++++---- resources/views/srp/srpform.blade.php | 9 ++++++++ 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/SRP/SRPAdminController.php b/app/Http/Controllers/SRP/SRPAdminController.php index 85742afe1..dfb6518ab 100644 --- a/app/Http/Controllers/SRP/SRPAdminController.php +++ b/app/Http/Controllers/SRP/SRPAdminController.php @@ -106,18 +106,33 @@ 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', + ]); + + $current = SRPShip::where([ + 'id' => $request->id, + ])->get(); + + if($current->ship_type != $request->ship_type || $current->loss_value != $request->total_loss) { + + } + } + public function processSRPRequest(Request $request) { //Validate the request $this->validate($request, [ 'id' => 'required', 'approved' => 'required', - 'paid_value' => 'required', 'ship_type' => 'required', 'total_loss' => 'required', ]); - //Get the paid value from the form - $paidValue = str_replace(',', '', $request->paid_value); //Get the total loss value from the form $totalLoss = str_replace(',', '', $request->total_loss); @@ -125,7 +140,6 @@ class SRPAdminController extends Controller if($request->notes != null) { $srp = SRPShip::where(['id' => $request->id])->update([ 'approved' => $request->approved, - 'paid_value' => $paidValue, 'paid_by_id' => auth()->user()->character_id, 'paid_by_name' => auth()->user()->name, 'notes' => $request->notes, @@ -135,7 +149,6 @@ class SRPAdminController extends Controller } else { $srp = SRPShip::where(['id' => $request->id])->update([ 'approved' => $request->approved, - 'paid_value' => $paidValue, 'paid_by_id' => auth()->user()->character_id, 'paid_by_name' => auth()->user()->name, 'ship_type' => $request->ship_type, diff --git a/resources/views/srp/admin/process.blade.php b/resources/views/srp/admin/process.blade.php index bb557299b..fcedd217e 100644 --- a/resources/views/srp/admin/process.blade.php +++ b/resources/views/srp/admin/process.blade.php @@ -20,9 +20,9 @@ Process + {!! Form::open(['action' => 'SRP\SRPAdminController@processSRPRequest', 'method' => 'POST']) !!} @foreach($requests as $row) - {!! Form::open(['action' => 'SRP\SRPAdminController@processSRPRequest', 'method' => 'POST']) !!} {{ Form::hidden('id', $row['id'], ['class' => 'form-control']) }} {{ $row['created_at'] }} @@ -37,7 +37,7 @@ zKill Link - {{ Form::text('total_loss', number_format($row['loss_value'], 2, ".", ","), ['class' => 'form-control']) }} + {{ Form::text('total_loss', number_format($row['loss_value'], 2, ".", ","), ['class' => 'form-control', 'onchange' => 'UpdateTotalLoss(this.Value)']) }} {{ Form::select('ship_type', $viewShipTypes, $row['cost_code']) }} @@ -49,7 +49,7 @@ {{ $row['fleet_type'] }} - {{ Form::text('paid_value', number_format($row['actual_srp'], 2, ".", ","), ['class' => 'form-control']) }} + {{ number_format($row['actual_srp', 2, ".", ","]) }} {{ Form::textarea('notes', null, ['class' => 'form-control', 'id' => 'notes', 'rows' => 2, 'cols' => 15, 'style' => 'resize:none']) }} @@ -64,9 +64,9 @@ {{ Form::submit('Process', ['class' => 'btn btn-primary']) }} - {!! Form::close() !!} @endforeach + {!! Form::close() !!} @@ -80,6 +80,12 @@ Total Actual Value: {{ $sum_actual }}
+ + @else
diff --git a/resources/views/srp/srpform.blade.php b/resources/views/srp/srpform.blade.php index 317f29d8b..fe6482232 100644 --- a/resources/views/srp/srpform.blade.php +++ b/resources/views/srp/srpform.blade.php @@ -35,4 +35,13 @@
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
+
+
+
+

Notes:

+
+
+ 1.) Capitals recieve a ship hull replacement versus an ISK replacement.
+
+
@endsection \ No newline at end of file