From 3c0f4181ae994e6e33c4c15adbb6704be921c99f Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 3 Oct 2024 16:19:06 +0100 Subject: [PATCH 1/3] Use the newer button style Signed-off-by: snipe --- resources/views/account/view-assets.blade.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php index 96b95484a6..e4cb6d33f2 100755 --- a/resources/views/account/view-assets.blade.php +++ b/resources/views/account/view-assets.blade.php @@ -103,20 +103,23 @@ @can('self.profile') @endcan @can('self.api') @@ -124,7 +127,8 @@ @@ -134,10 +138,15 @@ @if (!empty($user->email))
{{ csrf_field() }} - +
@else - + @endif From 7461c3e0ca2af18ed989a5905c84c5710213f1fb Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 3 Oct 2024 16:19:27 +0100 Subject: [PATCH 2/3] Change controller to assume a collection. (This is dumb, but whatever) Signed-off-by: snipe --- app/Http/Controllers/ProfileController.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index abe09e8afa..896c253463 100755 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -194,14 +194,14 @@ class ProfileController extends Controller */ public function printInventory() : View { - $show_user = auth()->user(); + $show_users = User::where('id',auth()->user()->id)->get(); return view('users/print') - ->with('assets', auth()->user()->assets) - ->with('licenses', $show_user->licenses()->get()) - ->with('accessories', $show_user->accessories()->get()) - ->with('consumables', $show_user->consumables()->get()) - ->with('show_user', $show_user) + ->with('assets', auth()->user()->assets()) + ->with('licenses', auth()->user()->licenses()->get()) + ->with('accessories', auth()->user()->accessories()->get()) + ->with('consumables', auth()->user()->consumables()->get()) + ->with('users', $show_users) ->with('settings', Setting::getSettings()); } @@ -222,7 +222,12 @@ class ProfileController extends Controller return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email')); } - $user->notify((new CurrentInventory($user))); + try { + $user->notify((new CurrentInventory($user))); + } catch (\Exception $e) { + \Log::error($e); + } + return redirect()->back()->with('success', trans('admin/users/general.user_notified')); } } From 722d5a58e719886282f908a11420fa88f9fed4fc Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 3 Oct 2024 16:19:38 +0100 Subject: [PATCH 3/3] Added isset on users Signed-off-by: snipe --- resources/views/users/print.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 7fe92303b3..2211b987bf 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -2,7 +2,7 @@ - @if (count($users) === 1) + @if ((isset($users) && count($users) === 1)) {{ trans('general.assigned_to', ['name' => $users[0]->present()->fullName()]) }} - {{ date('Y-m-d H:i', time()) }} @else {{ trans('admin/users/general.print_assigned') }} - {{ date('Y-m-d H:i', time()) }}