diff --git a/app/Http/Controllers/Contracts/ContractAdminController.php b/app/Http/Controllers/Contracts/ContractAdminController.php index bc68b886a..c8718f378 100644 --- a/app/Http/Controllers/Contracts/ContractAdminController.php +++ b/app/Http/Controllers/Contracts/ContractAdminController.php @@ -38,7 +38,17 @@ class ContractAdminController extends Controller } public function displayPastContracts() { - $contracts = Contract::where(['finished' => true])->get(); + $contracts = Contract::where(['finished' => true])->get()->toArray(); + + //Get the accepted bid for the contract and load it into the array + foreach($contracts as $contract) { + //Get the accepted bid for the contract and add it to the array + $accepted = AcceptedBid::where([ + 'contract_id' => $contract['id'], + ])->get()->toArray(); + + $contract['accepted'] = $accepted; + } return view('contracs.admin.past')->with('contracts', $contracts); } diff --git a/resources/views/contracts/admin/past.blade.php b/resources/views/contracts/admin/past.blade.php new file mode 100644 index 000000000..3054a071d --- /dev/null +++ b/resources/views/contracts/admin/past.blade.php @@ -0,0 +1,62 @@ +@extends('layouts.admin.b4') +@section('content') +
+
+

Past Contracts Dashboard

+
+
+
+@if(count($contracts)) +@foreach($contracts as $contract) +
+
+
+
+
+
+
+ {{ $contract['title'] }} +
+
+ Type: {{ $contract['type'] }} +
+
+
+
+
+ End Date: {{ $contract['end_date'] }} +
+
+ Accepted Bid Amount: {{ $contract['accepted']['bid_amount'] }}
+
+
+ Accepted Bid Notes: {{ $contract['accepted']['notes'] }} +
+ +
+ {!! $contract['body'] !!} +
+
+
+
+
+
+
+
+@endforeach +@else +
+
+
+
+
+ No Contracts Issued +
+
+
+
+
+
+
+@endif +@endsection \ No newline at end of file