supply chain controller
This commit is contained in:
@@ -334,25 +334,24 @@ class SupplyChainController extends Controller
|
||||
|
||||
/**
|
||||
* Delete a bid on a supply chain contract
|
||||
*
|
||||
* @var contractId
|
||||
* @var bidId
|
||||
*/
|
||||
public function deleteSupplyChainContractBid(Request $request) {
|
||||
$this->validate($request, [
|
||||
'contract_id' => 'required',
|
||||
'bid_id' => 'required',
|
||||
]);
|
||||
public function deleteSupplyChainContractBid($contractId, $bidId) {
|
||||
|
||||
//See if the user has put in a bid. If not, then redirect to failure.
|
||||
$count = SupplyChainBid::where([
|
||||
'contract_id' => $request->contract_id,
|
||||
'contract_id' => $contractId,
|
||||
'entity_id' => auth()->user()->getId(),
|
||||
'bid_id' => $request->bid_id,
|
||||
'bid_id' => $bidId,
|
||||
])->count();
|
||||
|
||||
if($count > 0) {
|
||||
SupplyChainBid::where([
|
||||
'contract_id' => $request->contract_id,
|
||||
'contract_id' => $contractId,
|
||||
'entity_id' => auth()->user()->getId(),
|
||||
'bid_id' => $request->bid_id,
|
||||
'bid_id' => $bidId,
|
||||
])->delete();
|
||||
|
||||
return redirect('/suppplychain/dashboard')->with('success', 'Deleted supply chain contract bid.');
|
||||
|
||||
@@ -12,9 +12,14 @@
|
||||
@foreach($bids as $bid)
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Contract Id: {{ $bid['contract_id'] }}<br>
|
||||
Contract Title: {{ $bid['title'] }}<br>
|
||||
Issuer: {{ $bid['issuer_name'] }}<br>
|
||||
<div class="col-md" align="left">
|
||||
Contract Id: {{ $bid['contract_id'] }}<br>
|
||||
Contract Title: {{ $bid['title'] }}<br>
|
||||
Issuer: {{ $bid['issuer_name'] }}<br>
|
||||
</div>
|
||||
<div class="col-md" align="right">
|
||||
<a href="/supplychain/display/newbid/{{ $bid['contract_id'] }}/{{ $bid['bid_id'] }} "><button type="button" class="btn btn-danger">Delete Bid</button></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
Bid Id: {{ $bid['bid_id'] }}<br>
|
||||
|
||||
@@ -187,7 +187,7 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
Route::get('/supplychain/display/bids', 'Contracts\SupplyChainController@displaySupplyChainBids');
|
||||
Route::get('/supplychain/display/newbid/{contract}', 'Contracts\SupplyChainController@displaySupplyChainContractBid');
|
||||
Route::post('/supplychain/display/newbid', 'Contracts\SupplyChainController@storeSupplyChainContractBid');
|
||||
Route::post('/supplychain/delete/bid', 'Contracts\SupplyChainController@deleteSupplyChainContractBid');
|
||||
Route::get('/supplychain/delete/bid/{contractId}/{bidId}', 'Contracts\SupplyChainController@deleteSupplyChainContractBid');
|
||||
Route::get('/supplychain/modify/bid', 'Contracts\SupplyChainController@displayModifySupplyChainContractBid');
|
||||
Route::post('/supplychain/modify/bid', 'Contracts\SupplyChainController@modifySupplyChainContractBid');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user