public contract?
This commit is contained in:
@@ -64,8 +64,18 @@ class ContractController extends Controller
|
|||||||
|
|
||||||
//Fetch all of the current contracts from the database
|
//Fetch all of the current contracts from the database
|
||||||
$contracts = Contract::where('end_date', '>=', $today)
|
$contracts = Contract::where('end_date', '>=', $today)
|
||||||
->where(['type' => 'public'])->get();
|
->where(['type' => 'public'])->toArray()->get();
|
||||||
|
|
||||||
|
//Count the number of bids, and add them to the arrays
|
||||||
|
foreach($contracts as $contract) {
|
||||||
|
$tempCount = Bid::where(['contract_id' => $contract['id']])->count('contract_id');
|
||||||
|
$bids = Bid::where(['contract_id' => $contract['id']])->toArray()->get();
|
||||||
|
|
||||||
|
$contract['bid_count'] = $tempCount;
|
||||||
|
$contract['bids'] = $bids;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if($count($contract->contract_id) > 0) {
|
if($count($contract->contract_id) > 0) {
|
||||||
foreach($contract->contract_id as $id) {
|
foreach($contract->contract_id as $id) {
|
||||||
//Get the bid data
|
//Get the bid data
|
||||||
@@ -77,11 +87,11 @@ class ContractController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$bids = null;
|
$bids = null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
//Call for the view to be displayed
|
//Call for the view to be displayed
|
||||||
return view('contracts.publiccontracts')->with('contracts', $contracts)
|
return view('contracts.publiccontracts')->with('contracts', $contracts);
|
||||||
->with('bids', $bids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,74 +7,72 @@
|
|||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
@if(count($data))
|
@if(count($data))
|
||||||
@foreach($data as $contract)
|
@foreach($contracts as $contract)
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm" align="left">
|
<div class="col-sm" align="left">
|
||||||
{{ $contract['contract']->title }}
|
{{ $contract['contract']->title }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm" align="center">
|
<div class="col-sm" align="center">
|
||||||
Type: Public
|
Type: Public
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm" align="right">
|
<div class="col-sm" align="right">
|
||||||
<a href="/contracts/display/newbid/{{ $contract['contract']->contract_id }}" class="btn btn-primary" role="button">Bid on Contract</a>
|
<a href="/contracts/display/newbid/{{ $contract['contract']->contract_id }}" class="btn btn-primary" role="button">Bid on Contract</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="container">
|
||||||
|
End Date: {{ $contract['end_date'] }}
|
||||||
|
</div>
|
||||||
|
<span class="border-dark">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
End Date: {{ $contract['contract']->end_date }}
|
{{ $contract['body'] }}
|
||||||
</div>
|
</div>
|
||||||
|
</span>
|
||||||
|
<hr>
|
||||||
|
<!-- Count the number of bids for the current contract -->
|
||||||
|
@if($contract['bid_count'] > 0)
|
||||||
<span class="border-dark">
|
<span class="border-dark">
|
||||||
<div class="container">
|
|
||||||
{{ $contract['contract']->body }}
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<hr>
|
|
||||||
<span class="border-dark">
|
|
||||||
@if(isset($contract['bids']))
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<th>Corporation</th>
|
<th>Corporation</th>
|
||||||
<th>Amount</th>
|
<th>Amount</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($contract['bids'] as $bid)
|
@foreach($contracts['bids'] as $bid)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $bid['corporation_name'] }}</td>
|
<td>{{ $bid['corporation_name'] }}</td>
|
||||||
<td>{{ $bid['bid_amount'] }}</td>
|
<td>{{ $bid['bid_amount'] }}</td>
|
||||||
@if(auth()->user()->character_id == $bid['character_id'])
|
@if(auth()->user()->character_id == $bid['character_id'])
|
||||||
{{ Form::open(['action' => 'ContractController@displayModifyBid', 'method' => 'POST']) }}
|
{{ Form::open(['action' => 'ContractController@displayModifyBid', 'method' => 'POST']) }}
|
||||||
{{ Form::hidden('id', $bid['id']) }}
|
{{ Form::hidden('id', $bid['id']) }}
|
||||||
{{ Form::hidden('contract_id', $bid['contract_id']) }}
|
{{ Form::hidden('contract_id', $bid['contract_id']) }}
|
||||||
{{ Form::submit('Modify Bid', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Modify Bid', ['class' => 'btn btn-primary']) }}
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
|
||||||
{{ Form::open(['action' => 'ContractController@deleteBid', 'method' => 'POST']) }}
|
{{ Form::open(['action' => 'ContractController@deleteBid', 'method' => 'POST']) }}
|
||||||
{{ Form::hidden('id', $bid['id']) }}
|
{{ Form::hidden('id', $bid['id']) }}
|
||||||
{{ Form::hidden('contract_id', $bid['contract_id']) }}
|
{{ Form::hidden('contract_id', $bid['contract_id']) }}
|
||||||
{{ Form::submit('Delete Bid', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Delete Bid', ['class' => 'btn btn-primary']) }}
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
@endif
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@else
|
|
||||||
No Bids have been entered.
|
|
||||||
@endif
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
<br>
|
|
||||||
@else
|
@else
|
||||||
@include('contracts.includes.nocontracts')
|
@include('contracts.includes.nocontracts')
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
Reference in New Issue
Block a user