From 5948a0b235817e1415fd1769f5fd11007edcc8a9 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 16 Apr 2018 20:10:38 -0700 Subject: [PATCH] Added department to custom asset export --- app/Http/Controllers/ReportsController.php | 13 ++++++ resources/views/reports/custom.blade.php | 52 ++++++++++++++-------- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 03d9499575..507498afc4 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -529,6 +529,10 @@ class ReportsController extends Controller $header[] = 'Employee No.'; } + if ($request->has('department')) { + $header[] = trans('general.department'); + } + if ($request->has('status')) { $header[] = trans('general.status'); } @@ -729,6 +733,15 @@ class ReportsController extends Controller } } + + if ($request->has('department')) { + if ($asset->checkedOutToUser()) { + $row[] = (($asset->assignedto) && ($asset->assignedto->department)) ? $asset->assignedto->department->name : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + if ($request->has('status')) { $row[] = ($asset->assetstatus) ? $asset->assetstatus->name.' ('.$asset->present()->statusMeta.')' : ''; } diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index 6e556a204d..b523c716c9 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -135,25 +135,7 @@ -
- -
-
- -
-
- -
+ +
+

Checked Out To Fields:

+
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ + + + @if ($customfields->count() > 0)

Custom Fields: