From 40135f58616a772f28efa0169a91bed730442acd Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Fri, 7 Aug 2020 14:11:20 -0500 Subject: [PATCH] supply chain controller --- .../Contracts/SupplyChainController.php | 17 ++++++++--------- .../views/supplychain/dashboard/bids.blade.php | 11 ++++++++--- routes/web.php | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Contracts/SupplyChainController.php b/app/Http/Controllers/Contracts/SupplyChainController.php index 47eb26af3..740b07671 100644 --- a/app/Http/Controllers/Contracts/SupplyChainController.php +++ b/app/Http/Controllers/Contracts/SupplyChainController.php @@ -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.'); diff --git a/resources/views/supplychain/dashboard/bids.blade.php b/resources/views/supplychain/dashboard/bids.blade.php index 44cf6eee0..63e25f5dd 100644 --- a/resources/views/supplychain/dashboard/bids.blade.php +++ b/resources/views/supplychain/dashboard/bids.blade.php @@ -12,9 +12,14 @@ @foreach($bids as $bid)
- Contract Id: {{ $bid['contract_id'] }}
- Contract Title: {{ $bid['title'] }}
- Issuer: {{ $bid['issuer_name'] }}
+
+ Contract Id: {{ $bid['contract_id'] }}
+ Contract Title: {{ $bid['title'] }}
+ Issuer: {{ $bid['issuer_name'] }}
+
+
Bid Id: {{ $bid['bid_id'] }}
diff --git a/routes/web.php b/routes/web.php index f97a0c6d9..73e952cc2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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');