modify bids

This commit is contained in:
2019-04-28 23:56:44 -05:00
parent 2143dfb1d1
commit 6cf3f6b196
3 changed files with 33 additions and 71 deletions
+4 -4
View File
@@ -184,11 +184,11 @@ class ContractController extends Controller
* Controller function to display modify bid page
*/
public function displayModifyBid($id) {
$contractId = $id;
$contract = Contract::where(['contract_id' => $contractId])->get()->toArray();
//With the bid id number, look up the bid in the database to get the contract information
$bid = Bid::where(['id' => $id])->get()->toArray();
dd($contract);
//Retrieve the contract from the database
$contract = Contract::where(['contract_id' => $bid['contract_id']])->get()->toArray();
return view('contracts.modifybid')->with('contract', $contract);
}
@@ -25,13 +25,34 @@
</div>
</span>
<hr>
<span class="border-dark">
@if(count($data['bids']))
@include('contracts.includes.biddisplay')
@else
No Bids have been entered.
@endif
</span>
<!-- Count the number of bids for the current contract -->
@if($contract['bid_count'] > 0)
<span class="border-dark">
<table class="table table-striped">
<thead>
<th>Corporation</th>
<th>Amount</th>
<th></th>
</thead>
<tbody>
@foreach($contract['bids'] as $bid)
<tr>
<td>{{ $bid['corporation_name'] }}</td>
<td>{{ $bid['bid_amount'] }}</td>
@if(auth()->user()->character_id == $bid['character_id'])
<td>
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
</td>
@else
<td></td>
@endif
</tr>
@endforeach
</tbody>
</table>
</span>
@endif
</div>
</div>
</div>
@@ -8,66 +8,7 @@
<br>
@if(count($contracts))
@foreach($contracts as $contract)
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-sm" align="left">
{{ $contract['title'] }}
</div>
<div class="col-sm" align="center">
Type: Public
</div>
<div class="col-sm" align="right">
<a href="/contracts/display/newbid/{{ $contract['contract_id'] }}" class="btn btn-primary" role="button">Bid on Contract</a>
</div>
</div>
</div>
<div class="card-body">
<div class="container">
End Date: {{ $contract['end_date'] }}
</div>
<span class="border-dark">
<div class="container">
{{ $contract['body'] }}
</div>
</span>
<hr>
<!-- Count the number of bids for the current contract -->
@if($contract['bid_count'] > 0)
<span class="border-dark">
<table class="table table-striped">
<thead>
<th>Corporation</th>
<th>Amount</th>
<th></th>
</thead>
<tbody>
@foreach($contract['bids'] as $bid)
<tr>
<td>{{ $bid['corporation_name'] }}</td>
<td>{{ $bid['bid_amount'] }}</td>
@if(auth()->user()->character_id == $bid['character_id'])
<td>
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
</td>
@else
<td></td>
@endif
</tr>
@endforeach
</tbody>
</table>
</span>
@endif
</div>
</div>
</div>
</div>
</div>
@include('contracts.includes.public')
@endforeach
@else
@include('contracts.includes.nocontracts')