From 90eb3b86cf75486adcb784abbff9629357cdd5d9 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 26 Oct 2023 19:10:53 -0500 Subject: [PATCH] added user phone & address fields --- app/Http/Controllers/ReportsController.php | 72 ++++++++++++++++++++++ resources/views/reports/custom.blade.php | 32 ++++++++++ 2 files changed, 104 insertions(+) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index d449d3c444..ebd5bc3c4f 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -528,6 +528,30 @@ class ReportsController extends Controller $header[] = trans('admin/users/table.title'); } + if ($request->filled('phone')) { + $header[] = trans('admin/users/table.phone'); + } + + if ($request->filled('user_address')) { + $header[] = trans('general.user') .' '. trans('general.address'); + } + + if ($request->filled('user_city')) { + $header[] = trans('general.user') .' '. trans('general.city'); + } + + if ($request->filled('user_state')) { + $header[] = trans('general.user') .' '. trans('general.state'); + } + + if ($request->filled('user_country')) { + $header[] = trans('general.user') .' '. trans('general.country'); + } + + if ($request->filled('user_zip')) { + $header[] = trans('general.user') .' '. trans('general.zip'); + } + if ($request->filled('status')) { $header[] = trans('general.status'); } @@ -828,6 +852,54 @@ class ReportsController extends Controller } } + if ($request->filled('phone')) { + if ($asset->checkedOutToUser()) { + $row[] = ($asset->assignedto) ? $asset->assignedto->phone : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + + if ($request->filled('user_address')) { + if ($asset->checkedOutToUser()) { + $row[] = ($asset->assignedto) ? $asset->assignedto->address : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + + if ($request->filled('user_city')) { + if ($asset->checkedOutToUser()) { + $row[] = ($asset->assignedto) ? $asset->assignedto->city : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + + if ($request->filled('user_state')) { + if ($asset->checkedOutToUser()) { + $row[] = ($asset->assignedto) ? $asset->assignedto->state : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + + if ($request->filled('user_country')) { + if ($asset->checkedOutToUser()) { + $row[] = ($asset->assignedto) ? $asset->assignedto->country : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + + if ($request->filled('user_zip')) { + if ($asset->checkedOutToUser()) { + $row[] = ($asset->assignedto) ? $asset->assignedto->zip : ''; + } else { + $row[] = ''; // Empty string if unassigned + } + } + if ($request->filled('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 959be57c9c..cc0ec158af 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -221,6 +221,38 @@ {{ trans('admin/users/table.title') }} + + + + + + + + + + + + + + @if ($customfields->count() > 0)