contract blades
This commit is contained in:
@@ -63,7 +63,8 @@ class ContractController extends Controller
|
||||
$data = array();
|
||||
|
||||
//Fetch all of the current contracts from the database
|
||||
$contracts = Contract::where(['end_date', '>=', $today])->get();
|
||||
$contracts = Contract::where(['end_date', '>=', $today])
|
||||
->where(['type' => 'public'])->get();
|
||||
|
||||
//Check if no contracts were pulled from the database
|
||||
if($contracts != null) {
|
||||
@@ -96,11 +97,26 @@ class ContractController extends Controller
|
||||
$today = Carbon::now();
|
||||
|
||||
//Fetch all of the current contracts from the database
|
||||
$contracts = Contract::where(['end_date', '>=', $today])->get();
|
||||
$contracts = Contract::where(['end_date', '>=', $today])
|
||||
->where(['type' => 'private'])->get();
|
||||
|
||||
return view ('contracts.privatecontracts')->with('contracts', $contracts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller function to display a page to allow a bid
|
||||
*
|
||||
*/
|
||||
public function displayBid(Request $request) {
|
||||
$this->validate($request, [
|
||||
'contract_id',
|
||||
]);
|
||||
|
||||
$contractId = $request->contract_id;
|
||||
|
||||
return view('contracts.enterbid')->with('contractId', $contractId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller function to store a new bid
|
||||
*/
|
||||
@@ -140,4 +156,18 @@ class ContractController extends Controller
|
||||
|
||||
return redirect('contracts/display/public')->with('success', 'Bid deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller function to display modify bid page
|
||||
*/
|
||||
public function displayModifyBid(Request $request) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller function to modify a bid
|
||||
*/
|
||||
public function modifyBid(Request $request) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class Contract extends Model
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'type',
|
||||
'end_date',
|
||||
'body',
|
||||
'final_cost',
|
||||
|
||||
@@ -17,6 +17,7 @@ class CreateContractsTable extends Migration
|
||||
Schema::create('contracts', function(Blueprint $table) {
|
||||
$table->increments('contract_id')->unique();
|
||||
$table->string('title');
|
||||
$table->string('type');
|
||||
$table->date('end_date');
|
||||
$table->text('body');
|
||||
$table->boolean('finished');
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<p align="text-left">
|
||||
{{ $contract['title'] }}
|
||||
</p>
|
||||
<p align="text-center">
|
||||
Type: {{ $contract['type'] }}
|
||||
</p>
|
||||
<p align="text-right">
|
||||
{!! Form::open(['action' => 'ContractAdminController@deleteContract', 'method' => 'POST']) !!}
|
||||
{{ Form::hidden('contract_id', $contract['contract_id']) }}
|
||||
|
||||
@@ -18,13 +18,19 @@
|
||||
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'Some Name']) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ Form::label('description', 'Description') }}
|
||||
{{ Form::textarea('description', '', ['class' => 'form-control']) }}
|
||||
{{ Form::label('body', 'Description') }}
|
||||
{{ Form::textarea('body', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ Form::label('date', 'End Date') }}
|
||||
{{ Form::text('date', '', ['class' => 'form-control', 'placeholder' => '4/24/2019']) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ Form::label('type', 'Public Contract') }}
|
||||
{{ Form::radio('type', 'public', true) }}
|
||||
{{ Form::label('type', 'Private Contract') }}
|
||||
{{ Form::radio('type', 'private', false) }}
|
||||
</div>
|
||||
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,57 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
|
||||
<div class="container">
|
||||
<h2>All Contracts</h2>
|
||||
</div>
|
||||
<br>
|
||||
@if($contracts != null)
|
||||
@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">
|
||||
<p align="text-left">
|
||||
{{ $contract['title'] }}
|
||||
</p>
|
||||
<p align="text-center">
|
||||
Type: {{ $contract['type'] }}
|
||||
</p>
|
||||
<p align="text-right">
|
||||
{!! Form::open(['action' => 'ContractController@displayBid', 'method' => 'POST']) !!}
|
||||
{{ Form::hidden('contract_id', $contract['contract_id']) }}
|
||||
{{ Form::submit('Bid', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
</p>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@endforeach
|
||||
@else
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
No Contracts Issued
|
||||
</div>
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,7 +1,7 @@
|
||||
@extends('layouts.b4')
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2>Test Page - Enter Bid</h2>
|
||||
<h2>Bid on Contract</h2>
|
||||
</div>
|
||||
<br>
|
||||
<div class="container">
|
||||
@@ -16,6 +16,7 @@
|
||||
<div class="form-group">
|
||||
{{ Form::label('bid', 'Bid') }}
|
||||
{{ Form::text('bid', '', ['class' => 'form-control', 'placeholder' => '1.0B']) }}
|
||||
{{ Form::hidden('contract_id', $contractId) }}
|
||||
</div>
|
||||
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
|
||||
@@ -4,31 +4,53 @@
|
||||
<h2>Test Page</h2>
|
||||
</div>
|
||||
<br>
|
||||
@if($contracts != null)
|
||||
<div class="container">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
New Contracts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Number</th>
|
||||
<th>Name</th>
|
||||
<th>Items</th>
|
||||
<th>End Date</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Name</td>
|
||||
<td>2 Nags</td>
|
||||
<td>24-04-2019</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<p align="text-left">
|
||||
{{ $contract['title'] }}
|
||||
</p>
|
||||
<p align="text-center">
|
||||
Type: Private
|
||||
</p>
|
||||
<p align="text-right">
|
||||
{!! Form::open(['action' => 'ContractController@displayBid', 'method' => 'POST']) !!}
|
||||
{{ Form::hidden('contract_id', $contract['contract_id']) }}
|
||||
{{ Form::submit('Bid', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
</p>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@else
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
No Contracts Issued
|
||||
</div>
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@@ -4,42 +4,87 @@
|
||||
<h2>Test Page</h2>
|
||||
</div>
|
||||
<br>
|
||||
@if($contracts != null)
|
||||
<div class="container">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
New Contracts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Number</th>
|
||||
<th>Name</th>
|
||||
<th>Items</th>
|
||||
<th>End Date</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Name</td>
|
||||
<td>2 Nags</td>
|
||||
<td>24-04-2019</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<p align="text-left">
|
||||
{{ $contract['title'] }}
|
||||
</p>
|
||||
<p align="text-center">
|
||||
Type: Public
|
||||
</p>
|
||||
<p align="text-right">
|
||||
{!! Form::open(['action' => 'ContractController@displayBid', 'method' => 'POST']) !!}
|
||||
{{ Form::hidden('contract_id', $contract['contract_id']) }}
|
||||
{{ Form::submit('Bid', ['class' => 'btn btn-primary']) }}
|
||||
{!! Form::close() !!}
|
||||
</p>
|
||||
</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($data['bids'] != null)
|
||||
<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>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
@else
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Current Top Bid
|
||||
</div>
|
||||
<div class="card-body">
|
||||
Some corporation and the price
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
No Contracts Issued
|
||||
</div>
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
Reference in New Issue
Block a user