public contracts

This commit is contained in:
2019-04-28 18:52:18 -05:00
parent edd7c8950d
commit de5fd2935f
2 changed files with 75 additions and 13 deletions

View File

@@ -73,18 +73,16 @@ class ContractController extends Controller
//Get all of the bids for the current contract //Get all of the bids for the current contract
$bids = Bid::where(['contract_id' => $contract->id])->get(); $bids = Bid::where(['contract_id' => $contract->id])->get();
//Build the data structure //Build the data structure
$temp = [ if(count($bids)) {
'contract' => [ $temp = [
'con' => $contract, 'contract' => $contract,
'bids' => $bids, 'bids' =>$bids,
], ];
]; } else {
/* $temp = [
$temp = [ 'contract' => $contract,
'contract' => $contract, ];
'bids' => $bids, }
];
*/
//Push the new contract onto the stack //Push the new contract onto the stack
array_push($data, $temp); array_push($data, $temp);

View File

@@ -8,7 +8,71 @@
<br> <br>
@if(count($data)) @if(count($data))
@foreach($data as $contract) @foreach($data as $contract)
@include('contracts.includes.public') <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>
<span class="border-dark">
@if(count($data['bids']))
<table class="table table-striped">
<thead>
<th>Corporation</th>
<th>Amount</th>
</thead>
<tbody>
@foreach($data['bids'] as $bid)
<tr>
<td>{{ $bid['corporation_name'] }}</td>
<td>{{ $bid['bid_amount'] }}</td>
@if(auth()->user()->character_id == $bid['character_id'])
{{ Form::open(['action' => 'ContractController@displayModifyBid', 'method' => 'POST']) }}
{{ Form::hidden('id', $bid['id']) }}
{{ Form::hidden('contract_id', $bid['contract_id']) }}
{{ Form::submit('Modify Bid', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
{{ Form::open(['action' => 'ContractController@deleteBid', 'method' => 'POST']) }}
{{ Form::hidden('id', $bid['id']) }}
{{ Form::hidden('contract_id', $bid['contract_id']) }}
{{ Form::submit('Delete Bid', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
@endif
</tr>
@endforeach
</tbody>
</table>
@else
No Bids have been entered.
@endif
</span>
</div>
</div>
</div>
</div>
</div>
@endforeach @endforeach
<br> <br>
@else @else