javascript test for srp admin dashboard
This commit is contained in:
@@ -106,18 +106,33 @@ class SRPAdminController extends Controller
|
|||||||
->with('viewShipTypes', $viewShipTypes);
|
->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) {
|
public function processSRPRequest(Request $request) {
|
||||||
//Validate the request
|
//Validate the request
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'id' => 'required',
|
'id' => 'required',
|
||||||
'approved' => 'required',
|
'approved' => 'required',
|
||||||
'paid_value' => 'required',
|
|
||||||
'ship_type' => 'required',
|
'ship_type' => 'required',
|
||||||
'total_loss' => '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
|
//Get the total loss value from the form
|
||||||
$totalLoss = str_replace(',', '', $request->total_loss);
|
$totalLoss = str_replace(',', '', $request->total_loss);
|
||||||
|
|
||||||
@@ -125,7 +140,6 @@ class SRPAdminController extends Controller
|
|||||||
if($request->notes != null) {
|
if($request->notes != null) {
|
||||||
$srp = SRPShip::where(['id' => $request->id])->update([
|
$srp = SRPShip::where(['id' => $request->id])->update([
|
||||||
'approved' => $request->approved,
|
'approved' => $request->approved,
|
||||||
'paid_value' => $paidValue,
|
|
||||||
'paid_by_id' => auth()->user()->character_id,
|
'paid_by_id' => auth()->user()->character_id,
|
||||||
'paid_by_name' => auth()->user()->name,
|
'paid_by_name' => auth()->user()->name,
|
||||||
'notes' => $request->notes,
|
'notes' => $request->notes,
|
||||||
@@ -135,7 +149,6 @@ class SRPAdminController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$srp = SRPShip::where(['id' => $request->id])->update([
|
$srp = SRPShip::where(['id' => $request->id])->update([
|
||||||
'approved' => $request->approved,
|
'approved' => $request->approved,
|
||||||
'paid_value' => $paidValue,
|
|
||||||
'paid_by_id' => auth()->user()->character_id,
|
'paid_by_id' => auth()->user()->character_id,
|
||||||
'paid_by_name' => auth()->user()->name,
|
'paid_by_name' => auth()->user()->name,
|
||||||
'ship_type' => $request->ship_type,
|
'ship_type' => $request->ship_type,
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
<th>Process</th>
|
<th>Process</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{!! Form::open(['action' => 'SRP\SRPAdminController@processSRPRequest', 'method' => 'POST']) !!}
|
||||||
@foreach($requests as $row)
|
@foreach($requests as $row)
|
||||||
<tr>
|
<tr>
|
||||||
{!! Form::open(['action' => 'SRP\SRPAdminController@processSRPRequest', 'method' => 'POST']) !!}
|
|
||||||
<td><!-- Timestamp -->
|
<td><!-- Timestamp -->
|
||||||
{{ Form::hidden('id', $row['id'], ['class' => 'form-control']) }}
|
{{ Form::hidden('id', $row['id'], ['class' => 'form-control']) }}
|
||||||
{{ $row['created_at'] }}
|
{{ $row['created_at'] }}
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<a href="{{ $row['zkillboard'] }}" target="_blank">zKill Link</a>
|
<a href="{{ $row['zkillboard'] }}" target="_blank">zKill Link</a>
|
||||||
</td>
|
</td>
|
||||||
<td><!-- Total Loss -->
|
<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>
|
||||||
<td><!-- Ship Type -->
|
<td><!-- Ship Type -->
|
||||||
{{ Form::select('ship_type', $viewShipTypes, $row['cost_code']) }}
|
{{ Form::select('ship_type', $viewShipTypes, $row['cost_code']) }}
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
{{ $row['fleet_type'] }}
|
{{ $row['fleet_type'] }}
|
||||||
</td>
|
</td>
|
||||||
<td><!-- Actual SRP -->
|
<td><!-- Actual SRP -->
|
||||||
{{ Form::text('paid_value', number_format($row['actual_srp'], 2, ".", ","), ['class' => 'form-control']) }}
|
{{ number_format($row['actual_srp', 2, ".", ","]) }}
|
||||||
</td>
|
</td>
|
||||||
<td><!-- Notes -->
|
<td><!-- Notes -->
|
||||||
{{ Form::textarea('notes', null, ['class' => 'form-control', 'id' => 'notes', 'rows' => 2, 'cols' => 15, 'style' => 'resize:none']) }}
|
{{ 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::submit('Process', ['class' => 'btn btn-primary']) }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{!! Form::close() !!}
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
{!! Form::close() !!}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,6 +80,12 @@
|
|||||||
Total Actual Value: {{ $sum_actual }}<br>
|
Total Actual Value: {{ $sum_actual }}<br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function myFunction(val) {
|
||||||
|
alert("The input value has changed. The new value is: " + val);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@else
|
@else
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|||||||
@@ -35,4 +35,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||||
</div>
|
</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
|
@endsection
|
||||||
Reference in New Issue
Block a user