diff --git a/app/Http/Controllers/ContractController.php b/app/Http/Controllers/ContractController.php index 140adbde8..367c670d5 100644 --- a/app/Http/Controllers/ContractController.php +++ b/app/Http/Controllers/ContractController.php @@ -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) { + + } } diff --git a/app/Models/Contracts/Contract.php b/app/Models/Contracts/Contract.php index dfb03ebaf..999f7ad37 100644 --- a/app/Models/Contracts/Contract.php +++ b/app/Models/Contracts/Contract.php @@ -19,6 +19,7 @@ class Contract extends Model */ protected $fillable = [ 'title', + 'type', 'end_date', 'body', 'final_cost', diff --git a/database/migrations/2019_04_24_000001_create_contracts_table.php b/database/migrations/2019_04_24_000001_create_contracts_table.php index 734604b00..83e74101c 100644 --- a/database/migrations/2019_04_24_000001_create_contracts_table.php +++ b/database/migrations/2019_04_24_000001_create_contracts_table.php @@ -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'); diff --git a/resources/views/contracts/admin/contractpanel.blade.php b/resources/views/contracts/admin/contractpanel.blade.php index 851266b70..b4d21f96e 100644 --- a/resources/views/contracts/admin/contractpanel.blade.php +++ b/resources/views/contracts/admin/contractpanel.blade.php @@ -14,6 +14,9 @@
{{ $contract['title'] }}
++ Type: {{ $contract['type'] }} +
{!! Form::open(['action' => 'ContractAdminController@deleteContract', 'method' => 'POST']) !!} {{ Form::hidden('contract_id', $contract['contract_id']) }} diff --git a/resources/views/contracts/admin/newcontract.blade.php b/resources/views/contracts/admin/newcontract.blade.php index 83b11217b..5aa2f0355 100644 --- a/resources/views/contracts/admin/newcontract.blade.php +++ b/resources/views/contracts/admin/newcontract.blade.php @@ -18,13 +18,19 @@ {{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'Some Name']) }}
+ {{ $contract['title'] }} +
++ Type: {{ $contract['type'] }} +
++ {!! Form::open(['action' => 'ContractController@displayBid', 'method' => 'POST']) !!} + {{ Form::hidden('contract_id', $contract['contract_id']) }} + {{ Form::submit('Bid', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+| Number | -Name | -Items | -End Date | - - -
|---|---|---|---|
| 1 | -Name | -2 Nags | -24-04-2019 | -
+ {{ $contract['title'] }} +
++ Type: Private +
++ {!! Form::open(['action' => 'ContractController@displayBid', 'method' => 'POST']) !!} + {{ Form::hidden('contract_id', $contract['contract_id']) }} + {{ Form::submit('Bid', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+| Number | -Name | -Items | -End Date | - - -
|---|---|---|---|
| 1 | -Name | -2 Nags | -24-04-2019 | -
+ {{ $contract['title'] }} +
++ Type: Public +
++ {!! Form::open(['action' => 'ContractController@displayBid', 'method' => 'POST']) !!} + {{ Form::hidden('contract_id', $contract['contract_id']) }} + {{ Form::submit('Bid', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+| Corporation | +Amount | + + + @foreach($data['bids'] as $bid) +
|---|---|
| {{ $bid['corporation_name'] }} | +{{ $bid['bid_amount'] }} | + @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 +