mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Merge pull request #11427 from Godmartinz/email_users_list
[feature] adds button to email user list of assets from profile
This commit is contained in:
commit
2262ef818e
|
@ -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
|
||||
|
@ -615,6 +616,28 @@ class UsersController extends Controller
|
|||
->with('settings', Setting::getSettings());
|
||||
}
|
||||
|
||||
/**
|
||||
* Emails user a list of assigned assets
|
||||
*
|
||||
* @author [G. Martinez] [<godmartinz@gmail.com>]
|
||||
* @since [v6.0.5]
|
||||
* @param \App\Http\Controllers\Users\UsersController $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
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',
|
||||
|
|
|
@ -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