Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-10-03 16:29:14 +01:00
commit 2de3bc92eb
3 changed files with 28 additions and 14 deletions

View file

@ -194,14 +194,14 @@ class ProfileController extends Controller
*/ */
public function printInventory() : View public function printInventory() : View
{ {
$show_user = auth()->user(); $show_users = User::where('id',auth()->user()->id)->get();
return view('users/print') return view('users/print')
->with('assets', auth()->user()->assets) ->with('assets', auth()->user()->assets())
->with('licenses', $show_user->licenses()->get()) ->with('licenses', auth()->user()->licenses()->get())
->with('accessories', $show_user->accessories()->get()) ->with('accessories', auth()->user()->accessories()->get())
->with('consumables', $show_user->consumables()->get()) ->with('consumables', auth()->user()->consumables()->get())
->with('show_user', $show_user) ->with('users', $show_users)
->with('settings', Setting::getSettings()); ->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')); 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')); return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
} }
} }

View file

@ -103,20 +103,23 @@
</div> </div>
@can('self.profile') @can('self.profile')
<div class="col-md-12"> <div class="col-md-12">
<a href="{{ route('profile') }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print"> <a href="{{ route('profile') }}" style="width: 100%;" class="btn btn-sm btn-warning btn-social btn-block hidden-print">
<x-icon type="edit" />
{{ trans('general.editprofile') }} {{ trans('general.editprofile') }}
</a> </a>
</div> </div>
@endcan @endcan
<div class="col-md-12" style="padding-top: 5px;"> <div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('account.password.index') }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print" target="_blank" rel="noopener"> <a href="{{ route('account.password.index') }}" style="width: 100%;" class="btn btn-sm btn-primary btn-social btn-block hidden-print" target="_blank" rel="noopener">
<x-icon type="password" class="fa-fw" />
{{ trans('general.changepassword') }} {{ trans('general.changepassword') }}
</a> </a>
</div> </div>
@can('self.api') @can('self.api')
<div class="col-md-12" style="padding-top: 5px;"> <div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('user.api') }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print" target="_blank" rel="noopener"> <a href="{{ route('user.api') }}" style="width: 100%;" class="btn btn-sm btn-primary btn-social btn-block hidden-print" target="_blank" rel="noopener">
<x-icon type="api-key" class="fa-fw" />
{{ trans('general.manage_api_keys') }} {{ trans('general.manage_api_keys') }}
</a> </a>
</div> </div>
@ -124,7 +127,8 @@
<div class="col-md-12" style="padding-top: 5px;"> <div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('profile.print') }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print" target="_blank" rel="noopener"> <a href="{{ route('profile.print') }}" style="width: 100%;" class="btn btn-sm btn-primary btn-social btn-block hidden-print" target="_blank" rel="noopener">
<x-icon type="print" class="fa-fw" />
{{ trans('admin/users/general.print_assigned') }} {{ trans('admin/users/general.print_assigned') }}
</a> </a>
</div> </div>
@ -134,10 +138,15 @@
@if (!empty($user->email)) @if (!empty($user->email))
<form action="{{ route('profile.email_assets') }}" method="POST"> <form action="{{ route('profile.email_assets') }}" method="POST">
{{ csrf_field() }} {{ csrf_field() }}
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener">{{ trans('admin/users/general.email_assigned') }}</button> <button style="width: 100%;" class="btn btn-sm btn-primary btn-social btn-block hidden-print" rel="noopener">
<x-icon type="email" class="fa-fw" />
{{ trans('admin/users/general.email_assigned') }}
</button>
</form> </form>
@else @else
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener" disabled title="{{ trans('admin/users/message.user_has_no_email') }}">{{ trans('admin/users/general.email_assigned') }}</button> <button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener" disabled title="{{ trans('admin/users/message.user_has_no_email') }}">
{{ trans('admin/users/general.email_assigned') }}
</button>
@endif @endif
</div> </div>

View file

@ -2,7 +2,7 @@
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@if (count($users) === 1) @if ((isset($users) && count($users) === 1))
<title>{{ trans('general.assigned_to', ['name' => $users[0]->present()->fullName()]) }} - {{ date('Y-m-d H:i', time()) }}</title> <title>{{ trans('general.assigned_to', ['name' => $users[0]->present()->fullName()]) }} - {{ date('Y-m-d H:i', time()) }}</title>
@else @else
<title>{{ trans('admin/users/general.print_assigned') }} - {{ date('Y-m-d H:i', time()) }}</title> <title>{{ trans('admin/users/general.print_assigned') }} - {{ date('Y-m-d H:i', time()) }}</title>