Skip to content

Commit 7941a88

Browse files
authored
Merge pull request #10817 from dampfklon/fix-10810-unaccepted-assets
Fix #10810 unaccepted assets
2 parents 80dff41 + 9818d16 commit 7941a88

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

app/Http/Controllers/ReportsController.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,12 +933,17 @@ public function getAssetAcceptanceReport($deleted = false)
933933
/**
934934
* Get all assets with pending checkout acceptances
935935
*/
936-
937-
$acceptances = CheckoutAcceptance::pending()->with('assignedTo')->get();
936+
if($showDeleted) {
937+
$acceptances = CheckoutAcceptance::pending()->withTrashed()->with(['assignedTo' , 'checkoutable.assignedTo', 'checkoutable.model'])->get();
938+
} else {
939+
$acceptances = CheckoutAcceptance::pending()->with(['assignedTo' => function ($query) {
940+
$query->withTrashed();
941+
}, 'checkoutable.assignedTo', 'checkoutable.model'])->get();
942+
}
938943

939944
$assetsForReport = $acceptances
940-
->filter(function($acceptance) {
941-
return $acceptance->checkoutable_type == 'App\Models\Asset' && !is_null($acceptance->assignedTo);
945+
->filter(function ($acceptance) {
946+
return $acceptance->checkoutable_type == 'App\Models\Asset';
942947
})
943948
->map(function($acceptance) {
944949
return ['assetItem' => $acceptance->checkoutable, 'acceptance' => $acceptance];

resources/views/reports/unaccepted_assets.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class="table table-striped snipe-table"
7171
@if ($item['assetItem'])
7272
<tr @if($item['acceptance']->trashed()) style="text-decoration: line-through" @endif>
7373
<td>{{ $item['acceptance']->created_at }}</td>
74-
<td>{{ ($item['assetItem']->company) ? $assetItem->company->name : '' }}</td>
74+
<td>{{ ($item['assetItem']->company) ? $item['assetItem']->company->name : '' }}</td>
7575
<td>{!! $item['assetItem']->model->category->present()->nameUrl() !!}</td>
7676
<td>{!! $item['assetItem']->present()->modelUrl() !!}</td>
7777
<td>{!! $item['assetItem']->present()->nameUrl() !!}</td>

0 commit comments

Comments
 (0)