Skip to content

A free open source IT asset/license management system

Added consumables tio printable output

snipedeba4d2b81cd
diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index 5feddf2798..2252a154d0 100755
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -1162,7 +1162,8 @@ class UsersController extends Controller
$assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model', 'model.category')->get();
$licenses = $user->licenses()->get();
$accessories = $user->accessories()->get();
- return view('users/print')->with('assets', $assets)->with('licenses',$licenses)->with('accessories', $accessories);
+ $consumables = $user->consumables()->get();
+ return view('users/print')->with('assets', $assets)->with('licenses',$licenses)->with('accessories', $accessories)->with('consumables', $consumables);
}
diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php
index 89b359fb54..ce5415b36f 100644
--- a/resources/views/users/print.blade.php
+++ b/resources/views/users/print.blade.php
@@ -138,6 +138,42 @@
@endforeach
</table>
@endif
+
+@if ($consumables->count() > 0)
+ <br><br>
+ <table class="inventory">
+ <thead>
+ <tr>
+ <th colspan="4">{{ trans('general.consumables') }}</th>
+ </tr>
+ </thead>
+ <thead>
+ <tr>
+ <th style="width: 20px;"></th>
+ <th style="width: 40%;">Name</th>
+ <th style="width: 50%;">Category</th>
+ <th style="width: 10%;">Checked Out</th>
+ </tr>
+ </thead>
+ @php
+ $ccounter = 1;
+ @endphp
+
+ @foreach ($consumables as $consumable)
+
+ <tr>
+ <td>{{ $ccounter }}</td>
+ <td>{{ $consumable->manufacturer->name }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
+ <td>{{ $consumable->category->name }}</td>
+ <td>{{ $consumable->assetlog->first()->created_at }}</td>
+ </tr>
+ @php
+ $ccounter++
+ @endphp
+ @endforeach
+ </table>
+@endif
+
<br>
<br>
<br>