working on bids

This commit is contained in:
2019-04-28 19:16:43 -05:00
parent af97cb54a9
commit 0abc86e5a2
2 changed files with 16 additions and 1 deletions

View File

@@ -130,10 +130,21 @@ class ContractController extends Controller
'bid' => 'required',
]);
$amount = 0.00;
//Convert the amount to a whole number from abbreviations
if($request->suffix == 'B') {
$amount = $request->bid * 1000000000.00;
} else if($request->suffix == 'M') {
$amount = $request->bid * 1000000.00;
} else {
$amount = $request->bid;
}
//Create the model object to save data to
$bid = new Bid;
$bid->contract_id = $request->contract_id;
$bid->bid = $request->bid;
$bid->bid_amount = $amount;
$bid->accepted = false;
$bid->save();

View File

@@ -19,6 +19,10 @@
{{ Form::label('bid', 'Bid') }}
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '1.0B']) }}
{{ Form::hidden('contract_id', $contractId) }}
{{ Form::label('suffix', 'M') }}
{{ Form::radio('suffix', 'M', false) }}
{{ Form::label('suffix', 'B') }}
{{ Form::radio('suffix', 'B', false) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}