created new button for adding new contracts on admin dashboard for contracts

This commit is contained in:
2019-04-27 22:09:07 -05:00
parent 388017ea8d
commit 9c5ae9fe5d
2 changed files with 29 additions and 4 deletions

View File

@@ -154,20 +154,42 @@ class ContractController extends Controller
'contract_id' => $request->contract_id, 'contract_id' => $request->contract_id,
])->delete(); ])->delete();
return redirect('contracts/display/public')->with('success', 'Bid deleted.'); return redirect('/contracts/display/public')->with('success', 'Bid deleted.');
} }
/** /**
* Controller function to display modify bid page * Controller function to display modify bid page
*/ */
public function displayModifyBid(Request $request) { public function displayModifyBid($id) {
$contract_id = $id;
return view('contracts.modifybid')->with('contract_id', $contract_id);
} }
/** /**
* Controller function to modify a bid * Controller function to modify a bid
*/ */
public function modifyBid(Request $request) { public function modifyBid(Request $request) {
$this->validate($request, [
'bid_amount',
]);
$type = $request->type;
$contractId = $request->contract_id;
$bidAmount = $request->bid_amount;
Bid::where([
'character_id' => auth()->user()->getId(),
'contract_id' => $contractId,
])->update([
'bid_amount' => $bidAmount,
]);
if($type == 'public') {
return redirect('/contracts/display/public')->with('success', 'Bid modified.');
} else {
return redirect('/contracts/display/private')->with('success', 'Bid modified');
}
} }
} }

View File

@@ -1,10 +1,13 @@
@extends('layouts.b4') @extends('layouts.b4')
@section('content') @section('content')
<div class="container"> <div class="container">
<h2>Contract Dashboard</h2> <div class="row justify-content-center">
<h2>Contract Dashboard</h2>
</div>
</div> </div>
<br> <br>
<button href="{{ route('/contracts/admin/new') }}" type="button" class="btn btn-primary">Create New Contract</button>
<br>
@if(count($contracts)) @if(count($contracts))
@foreach($contracts as $contract) @foreach($contracts as $contract)
<div class="container"> <div class="container">