mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Use bulk actions menu
This commit is contained in:
parent
54044bfa5e
commit
a2d4dcf6e8
|
@ -13,6 +13,7 @@ use App\Models\Group;
|
||||||
use App\Models\LicenseSeat;
|
use App\Models\LicenseSeat;
|
||||||
use App\Models\ConsumableAssignment;
|
use App\Models\ConsumableAssignment;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
|
use App\Models\Setting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -76,6 +77,30 @@ class BulkUsersController extends Controller
|
||||||
}
|
}
|
||||||
return redirect()->back()->with('success', trans('admin/users/message.password_resets_sent'));
|
return redirect()->back()->with('success', trans('admin/users/message.password_resets_sent'));
|
||||||
|
|
||||||
|
} elseif ($request->input('bulk_actions') == 'print') {
|
||||||
|
$users = User::query()
|
||||||
|
->with([
|
||||||
|
'assets.assetlog',
|
||||||
|
'assets.assignedAssets.assetlog',
|
||||||
|
'assets.assignedAssets.defaultLoc',
|
||||||
|
'assets.assignedAssets.location',
|
||||||
|
'assets.assignedAssets.model.category',
|
||||||
|
'assets.defaultLoc',
|
||||||
|
'assets.location',
|
||||||
|
'assets.model.category',
|
||||||
|
'accessories.category',
|
||||||
|
'accessories.manufacturer',
|
||||||
|
'consumables.assetlog',
|
||||||
|
'consumables.category',
|
||||||
|
'consumables.manufacturer',
|
||||||
|
'licenses.category',
|
||||||
|
])
|
||||||
|
->withTrashed()
|
||||||
|
->findMany($request->input('ids'));
|
||||||
|
|
||||||
|
return view('users.print')
|
||||||
|
->with('users', $users)
|
||||||
|
->with('settings', Setting::getSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -619,37 +619,6 @@ class UsersController extends Controller
|
||||||
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id')));
|
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printAllThings()
|
|
||||||
{
|
|
||||||
$this->authorize('view', User::class);
|
|
||||||
|
|
||||||
$users = User::query()
|
|
||||||
->with([
|
|
||||||
'assets.assetlog',
|
|
||||||
'assets.assignedAssets.assetlog',
|
|
||||||
'assets.assignedAssets.defaultLoc',
|
|
||||||
'assets.assignedAssets.location',
|
|
||||||
'assets.assignedAssets.model.category',
|
|
||||||
'assets.defaultLoc',
|
|
||||||
'assets.location',
|
|
||||||
'assets.model.category',
|
|
||||||
'accessories.category',
|
|
||||||
'accessories.manufacturer',
|
|
||||||
'consumables.assetlog',
|
|
||||||
'consumables.category',
|
|
||||||
'consumables.manufacturer',
|
|
||||||
'licenses.category',
|
|
||||||
])
|
|
||||||
->withTrashed()
|
|
||||||
->get();
|
|
||||||
|
|
||||||
// @todo: more authorization
|
|
||||||
|
|
||||||
return view('users.print')
|
|
||||||
->with('users', $users)
|
|
||||||
->with('settings', Setting::getSettings());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emails user a list of assigned assets
|
* Emails user a list of assigned assets
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<option value="delete">{!! trans('general.bulk_checkin_delete') !!}</option>
|
<option value="delete">{!! trans('general.bulk_checkin_delete') !!}</option>
|
||||||
<option value="merge">{!! trans('general.merge_users') !!}</option>
|
<option value="merge">{!! trans('general.merge_users') !!}</option>
|
||||||
<option value="bulkpasswordreset">{{ trans('button.send_password_link') }}</option>
|
<option value="bulkpasswordreset">{{ trans('button.send_password_link') }}</option>
|
||||||
|
<option value="print">{{ trans('admin/users/general.print_assigned') }}</option>
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-primary" id="bulkUserEditButton" disabled>{{ trans('button.go') }}</button>
|
<button class="btn btn-primary" id="bulkUserEditButton" disabled>{{ trans('button.go') }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -105,10 +105,6 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {
|
||||||
]
|
]
|
||||||
)->name('users.print');
|
)->name('users.print');
|
||||||
|
|
||||||
Route::get('print-all-things', [Users\UsersController::class, 'printAllThings'])
|
|
||||||
->withoutMiddleware([AssetCountForSidebar::class])
|
|
||||||
->name('users.print-all-things');
|
|
||||||
|
|
||||||
Route::post(
|
Route::post(
|
||||||
'{userId}/email',
|
'{userId}/email',
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue