modify bids
This commit is contained in:
@@ -184,9 +184,11 @@ class ContractController extends Controller
|
||||
* Controller function to display modify bid page
|
||||
*/
|
||||
public function displayModifyBid($id) {
|
||||
$contract_id = $id;
|
||||
$contractId = $id;
|
||||
|
||||
return view('contracts.modifybid')->with('contract_id', $contract_id);
|
||||
$contract = Contract::where(['contract_id' => $contractId])->get()->toArray();
|
||||
|
||||
return view('contracts.modifybid')->with('contract', $contract);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,18 +196,25 @@ class ContractController extends Controller
|
||||
*/
|
||||
public function modifyBid(Request $request) {
|
||||
$this->validate($request, [
|
||||
'bid_amount',
|
||||
'bid',
|
||||
]);
|
||||
|
||||
$amount = $request->bid;
|
||||
$type = $request->type;
|
||||
$contractId = $request->contract_id;
|
||||
$bidAmount = $request->bid_amount;
|
||||
|
||||
if($request->suffix == 'B') {
|
||||
$amount = $amount * 1000000000.00;
|
||||
} else if($request->suffix == 'M') {
|
||||
$amount = $amount * 1000000.00;
|
||||
} else {
|
||||
$amount = $amount * 1.00;
|
||||
}
|
||||
|
||||
Bid::where([
|
||||
'character_id' => auth()->user()->getId(),
|
||||
'contract_id' => $contractId,
|
||||
])->update([
|
||||
'bid_amount' => $bidAmount,
|
||||
'bid_amount' => $amount,
|
||||
]);
|
||||
|
||||
if($type == 'public') {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{!! Form::open(['action' => 'ContractController@storeBid', 'method' => 'POST']) !!}
|
||||
<div class="form-group">
|
||||
{{ Form::label('bid', 'Bid') }}
|
||||
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '1.0B']) }}
|
||||
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '1.0']) }}
|
||||
{{ Form::hidden('contract_id', $contractId) }}
|
||||
{{ Form::label('suffix', 'M') }}
|
||||
{{ Form::radio('suffix', 'M', false) }}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<h2>Modify Bid</h2>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{ $contract['title'] }}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
Type: {{ $contract['type'] }}<br>
|
||||
End Date: {{ $contract['end_date'] }}<br>
|
||||
Description: {{ $contract['body'] }}<br>
|
||||
{!! Form::open(['action' => 'ContractController@modifyBid', 'method' => 'POST']) !!}
|
||||
<div class="form-group">
|
||||
{{ Form::label('bid', 'Bid') }}
|
||||
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' = '1.0']) }}
|
||||
{{ Form::label('suffix', 'M') }}
|
||||
{{ Form::radio('suffix', 'M', false) }}
|
||||
{{ Form::label('suffix', 'B') }}
|
||||
{{ Form::radio('suffix', 'B', false) }}
|
||||
{{ Form::hidden('type', $contract['type']) }}
|
||||
</div>
|
||||
{{ Form::submit('Modify Bid', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user