mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
adds button to email user list of assets from profile
This commit is contained in:
parent
f8fd87b896
commit
e471aa8639
|
@ -23,6 +23,7 @@ use Redirect;
|
|||
use Str;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use View;
|
||||
use App\Notifications\CurrentInventory;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Users for
|
||||
|
@ -614,6 +615,19 @@ class UsersController extends Controller
|
|||
->with('show_user', $show_user)
|
||||
->with('settings', Setting::getSettings());
|
||||
}
|
||||
public function emailAssetList($id)
|
||||
{
|
||||
$this->authorize('view', User::class);
|
||||
|
||||
if( User::where('id', $id)->first()->exists())
|
||||
{
|
||||
$user= User::where('id', $id)->first();
|
||||
$user->notify((new CurrentInventory($user)));
|
||||
return redirect()->back()->with('success', 'admin/users/general.user_notified');
|
||||
}
|
||||
|
||||
return redirect()->back()->with('error', 'admin/accessories/message.user_does_not_exist');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send individual password reset email
|
||||
|
|
|
@ -17,6 +17,8 @@ return [
|
|||
'last_login' => 'Last Login',
|
||||
'ldap_config_text' => 'LDAP configuration settings can be found Admin > Settings. The (optional) selected location will be set for all imported users.',
|
||||
'print_assigned' => 'Print All Assigned',
|
||||
'email_assigned' => 'Email List of All Assigned',
|
||||
'user_notified' => 'User has been emailed a list of their currently assigned items.',
|
||||
'software_user' => 'Software Checked out to :name',
|
||||
'send_email_help' => 'You must provide an email address for this user to send them credentials. Emailing credentials can only be done on user creation. Passwords are stored in a one-way hash and cannot be retrieved once saved.',
|
||||
'view_user' => 'View User :name',
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
<th style="width: 20%;">{{ trans('admin/hardware/table.asset_tag') }}</th>
|
||||
<th style="width: 20%;">{{ trans('general.name') }}</th>
|
||||
<th style="width: 10%;">{{ trans('general.category') }}</th>
|
||||
<th style="width: 20%;">{{ trans('admin/hardware/form.serial') }}</th>
|
||||
<th style="width: 20%;">{{ trans('admin/hardware/form.model') }}</th>
|
||||
<th style="width: 20%;">{{ trans('admin/hardware/form.serial') }}</th>
|
||||
<th style="width: 10%;">{{ trans('admin/hardware/table.checkout_date') }}</th>
|
||||
|
|
|
@ -188,6 +188,15 @@
|
|||
</div>
|
||||
@endcan
|
||||
|
||||
@can('view', $user)
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<form action="{{ route('users.email',['userId'=> $user->id]) }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener">{{ trans('admin/users/general.email_assigned') }}</button>
|
||||
</form>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('update', $user)
|
||||
@if (($user->activated == '1') && ($user->email != '') && ($user->ldap_import == '0'))
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
|
|
|
@ -144,6 +144,14 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {
|
|||
]
|
||||
)->name('users.print');
|
||||
|
||||
Route::post(
|
||||
'{userId}/email',
|
||||
[
|
||||
Users\UsersController::class,
|
||||
'emailAssetList'
|
||||
]
|
||||
)->name('users.email');
|
||||
|
||||
Route::post(
|
||||
'bulkedit',
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue