javascript test for srp admin dashboard
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<th>Process</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{!! Form::open(['action' => 'SRP\SRPAdminController@processSRPRequest', 'method' => 'POST']) !!}
|
||||
@foreach($requests as $row)
|
||||
<tr>
|
||||
{!! Form::open(['action' => 'SRP\SRPAdminController@processSRPRequest', 'method' => 'POST']) !!}
|
||||
<td><!-- Timestamp -->
|
||||
{{ Form::hidden('id', $row['id'], ['class' => 'form-control']) }}
|
||||
{{ $row['created_at'] }}
|
||||
@@ -37,7 +37,7 @@
|
||||
<a href="{{ $row['zkillboard'] }}" target="_blank">zKill Link</a>
|
||||
</td>
|
||||
<td><!-- Total Loss -->
|
||||
{{ 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)']) }}
|
||||
</td>
|
||||
<td><!-- Ship Type -->
|
||||
{{ Form::select('ship_type', $viewShipTypes, $row['cost_code']) }}
|
||||
@@ -49,7 +49,7 @@
|
||||
{{ $row['fleet_type'] }}
|
||||
</td>
|
||||
<td><!-- Actual SRP -->
|
||||
{{ Form::text('paid_value', number_format($row['actual_srp'], 2, ".", ","), ['class' => 'form-control']) }}
|
||||
{{ number_format($row['actual_srp', 2, ".", ","]) }}
|
||||
</td>
|
||||
<td><!-- Notes -->
|
||||
{{ 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']) }}
|
||||
</td>
|
||||
</tr>
|
||||
{!! Form::close() !!}
|
||||
</tr>
|
||||
@endforeach
|
||||
{!! Form::close() !!}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -80,6 +80,12 @@
|
||||
Total Actual Value: {{ $sum_actual }}<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function myFunction(val) {
|
||||
alert("The input value has changed. The new value is: " + val);
|
||||
}
|
||||
</script>
|
||||
@else
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
|
||||
@@ -35,4 +35,13 @@
|
||||
</div>
|
||||
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||
</div>
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Notes:</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
1.) Capitals recieve a ship hull replacement versus an ISK replacement.<br>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user