srp admin dashboard stuff

This commit is contained in:
2020-03-06 19:16:23 -06:00
parent 88697d30c5
commit ff8b19c75b
3 changed files with 8 additions and 1 deletions

View File

@@ -113,10 +113,14 @@ class SRPAdminController extends Controller
'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);
//If the notes are not null update like this.
if($request->notes != null) {
$srp = SRPShip::where(['id' => $request->id])->update([
@@ -126,6 +130,7 @@ class SRPAdminController extends Controller
'paid_by_name' => auth()->user()->name,
'notes' => $request->notes,
'ship_type' => $request->ship_type,
'loos_value' => $totalLoss,
]);
} else {
$srp = SRPShip::where(['id' => $request->id])->update([
@@ -134,6 +139,7 @@ class SRPAdminController extends Controller
'paid_by_id' => auth()->user()->character_id,
'paid_by_name' => auth()->user()->name,
'ship_type' => $request->ship_type,
'loss_value' => $request->total_loss,
]);
}

View File

@@ -111,6 +111,7 @@ class SRPController extends Controller
$fcId = User::where(['name' => $request->FC])->get(['character_id']);
//Take the loss value and remove ' ISK' from it. Convert the string to a number
//May need to work on some locale stuff here but will think about it first.
$lossValue = str_replace(' ISK', '', $request->LossValue);
$lossValue = str_replace(',', '', $lossValue);
$lossValue = floatval($lossValue);

View File

@@ -37,7 +37,7 @@
<a href="{{ $row['zkillboard'] }}" target="_blank">zKill Link</a>
</td>
<td><!-- Total Loss -->
{{ number_format($row['loss_value'], 2, '.', ',') }}
{{ Form::text('total_loss', number_format($row['loss_value'], 2, ".", ","), ['class' => 'form-control']) }}
</td>
<td><!-- Ship Type -->
{{ Form::select('ship_type', $viewShipTypes, $row['cost_code']) }}