fixing PR

This commit is contained in:
akemidx 2022-12-13 16:00:59 -05:00
parent 07ae91b00f
commit f3e57d7dc0
3 changed files with 12 additions and 8 deletions

View file

@ -345,15 +345,15 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
* @since [v6.1] * @since [v6.1]
* @return \Illuminate\Database\Eloquent\Relations\Relation * @return \Illuminate\Database\Eloquent\Relations\Relation
*/ */
Public function allassignedcount() { Public function allAssignedCount() {
$assetsCount = $this->assets()->count(); $assetsCount = $this->assets()->count();
$licensesCount = $this->licenses()->count(); $licensesCount = $this->licenses()->count();
$accessoriesCount = $this->accessories()->count(); $accessoriesCount = $this->accessories()->count();
$consumablesCount = $this->consumables()->count(); $consumablesCount = $this->consumables()->count();
$totalcount = $assetsCount + $licensesCount + $accessoriesCount + $consumablesCount; $totalCount = $assetsCount + $licensesCount + $accessoriesCount + $consumablesCount;
return (int) $totalcount; return (int) $totalCount;
} }
/** /**

View file

@ -15,6 +15,7 @@ return array(
'password_resets_sent' => 'The selected users who are activated and have a valid email addresses have been sent a password reset link.', 'password_resets_sent' => 'The selected users who are activated and have a valid email addresses have been sent a password reset link.',
'password_reset_sent' => 'A password reset link has been sent to :email!', 'password_reset_sent' => 'A password reset link has been sent to :email!',
'user_has_no_email' => 'This user does not have an email address in their profile.', 'user_has_no_email' => 'This user does not have an email address in their profile.',
'user_has_no_assets_assigned' => 'This user does not have any assets assigned',
'success' => array( 'success' => array(

View file

@ -179,19 +179,22 @@
@can('view', $user) @can('view', $user)
<div class="col-md-12" style="padding-top: 5px;"> <div class="col-md-12" style="padding-top: 5px;">
@if($user->allassignedcount() != '0') @if($user->allAssignedCount() != '0')
<a href="{{ route('users.print', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print" target="_blank" rel="noopener">{{ trans('admin/users/general.print_assigned') }}</a> <a href="{{ route('users.print', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print" target="_blank" rel="noopener">{{ trans('admin/users/general.print_assigned') }}</a>
@else
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener" disabled title="{{ trans('admin/users/message.user_has_no_assets_assigned') }}">{{ trans('admin/users/general.print_assigned') }}</button>
@endif
</div> </div>
@endcan @endcan
@can('view', $user) @can('view', $user)
<div class="col-md-12" style="padding-top: 5px;"> <div class="col-md-12" style="padding-top: 5px;">
@if(!empty($user->email) && ($user->allassignedcount() != '0')) @if(!empty($user->email) && ($user->allAssignedCount() != '0'))
<form action="{{ route('users.email',['userId'=> $user->id]) }}" method="POST"> <form action="{{ route('users.email',['userId'=> $user->id]) }}" 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 hidden-print" rel="noopener">{{ trans('admin/users/general.email_assigned') }}</button>
</form> </form>
@elseif(!empty($user->email) && ($user->allassignedcount() == '0')) @elseif(!empty($user->email) && ($user->allAssignedCount() == '0'))
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener" disabled title="{{ trans('admin/users/message.user_has_no_assets_assigned') }}">{{ 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_assets_assigned') }}">{{ trans('admin/users/general.email_assigned') }}</button>
@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>