Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/lang/en-US/admin/users/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'superadmin_permission_warning' => 'Only superadmins may grant a user superadmin access.',
'admin_permission_warning' => 'Only users with admins rights or greater may grant a user admin access.',
'remove_group_memberships' => 'Remove Group Memberships',
'warning_deletion_information' => 'You are about to checkin ALL items from the :count user(s) listed below. Super admin names are highlighted in red.',
'warning_deletion_information' => 'You are about to checkin ALL items from the :count user(s) listed below.',
'update_user_assets_status' => 'Update all assets for these users to this status',
'checkin_user_properties' => 'Check in all properties associated with these users',
'remote_label' => 'This is a remote user',
Expand Down
3 changes: 2 additions & 1 deletion resources/lang/en-US/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
'backup_delete_not_allowed' => 'Deleting backups has been disabled in the .env file. Contact support or your systems administrator.',
'additional_files' => 'Additional Files',
'shitty_browser' => 'No signature detected. If you are using an older browser, please use a more modern browser to complete your asset acceptance.',
'bulk_soft_delete' =>'Also soft-delete these users. Their asset history will remain intact unless/until you purge deleted records in the Admin Settings.',
'bulk_soft_delete' =>'Also soft-delete these users. Their item history will remain intact unless/until you purge deleted records in the Admin Settings.',
'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.',
'bulk_checkin_success' => 'The items for the selected users have been checked in.',
'set_to_null' => 'Delete values for this selection|Delete values for all :selection_count selections ',
Expand Down Expand Up @@ -649,6 +649,7 @@
'upload_deleted' => 'Upload Deleted',
'child_locations' => 'Child Locations',
'append' => 'Append',
'optional' => 'OPTIONAL',

// Add form placeholders here
'placeholders' => [
Expand Down
24 changes: 24 additions & 0 deletions resources/lang/en-US/tooltips.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

return array(

'disabled_assoc' => [
'accessory' => 'This accessory cannot be deleted because it still has items, users, or locations associated with it',
'asset' => 'This asset cannot be deleted because it still has items associated with it',
'category' => 'This category cannot be deleted because it still has items associated with it',
'company' => 'This company cannot be deleted because it still has items or users associated with it',
'component' => 'This component cannot be deleted because it still has items associated with it',
'custom_field' => 'This custom field cannot be deleted because it is still associated with at least one fieldset',
'department' => 'This department cannot be deleted because it still has users associated with it',
'location' => 'This location cannot be deleted because it still has items or users associated with it',
'manufacturer' => 'This manufacturer cannot be deleted because it still has items associated with it',
'supplier' => 'This supplier cannot be deleted because it still has items associated with it',
'user' => 'This user cannot be deleted because it still has items associated with it',
'user_self' => 'You cannot delete yourself',
],

'checkin_all' => [
'user' => 'Checkin all items for this user and optionally delete them. You will be able to confirm this on the next page.'
],

);
81 changes: 50 additions & 31 deletions resources/views/users/confirm-bulk-delete.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@extends('layouts/default')
{{-- Page title --}}
@section('title')
{!! trans('general.bulk_checkin_delete') !!}
{{ trans('general.bulk_checkin_delete') }}
@parent
@stop

Expand Down Expand Up @@ -33,8 +33,32 @@

<div class="col-md-12">
<div class="table-responsive">
<table class="display table table-hover">
<table class="display table table-striped">
<thead>
<tr>
<td colspan="8">
<x-input.select
name="status_id"
id="status_id"
:options="$statuslabel_list"
:selected="old('status_id')"
required
style="width:350px"
aria-label="status_id"
/>
<label>
{{ trans('admin/users/general.update_user_assets_status') }}
</label>
</td>
</tr>
<tr>
<td colspan="8">
<label class="form-control">
<input type="checkbox" name="delete_user" value="1">
<span class="text-warning"><i class="fa fa-warning"></i> <strong>{{ trans('general.optional') }}: {{ trans('general.bulk_soft_delete') }}</strong></span>
</label>
</td>
</tr>
<tr>
<th class="col-md-1">
<!-- <input type="checkbox" id="checkAll"> -->
Expand Down Expand Up @@ -65,7 +89,7 @@
</thead>
<tbody>
@foreach ($users as $user)
<tr {!! ($user->isSuperUser() ? ' class="danger"':'') !!}>
<tr>
<td>
@if (Auth::id()!=$user->id)
<input type="checkbox" name="ids[]" value="{{ $user->id }}" checked="checked">
Expand All @@ -75,10 +99,29 @@
</td>

<td>
<span {!! (Auth::user()->id==$user->id ? ' style="text-decoration: line-through"' : '') !!}>
{{ $user->display_name }} ({{ $user->username }})
</span>
{{ (Auth::id()==$user->id ? ' (cannot delete yourself)' : '') }}

@if (auth()->user()->id == $user->id)

<span {!! (Auth::user()->id==$user->id ? ' style="text-decoration: line-through" class="text-danger"' : '') !!}>
{{ $user->display_name }} ({{ $user->username }})
</span>
@elseif ($user->isSuperUser())
<span class="text-danger">
<i class="fas fa-crown text-danger"></i> {{ $user->display_name }} ({{ $user->username }})
</span>
@elseif ($user->isAdmin())
<span class="text-warning">
<i class="fas fa-crown text-warning"></i> {{ $user->display_name }} ({{ $user->username }})
</span>
@else
{{ $user->display_name }} ({{ $user->username }})
@endif


@if (auth()->user()->id == $user->id)
<i class="fas fa-x text-danger"></i> {{ trans('tooltips.disabled_assoc.user_self') }}
@endif

</td>
<td>
@foreach ($user->groups as $group)
Expand All @@ -105,31 +148,7 @@
</tr>
@endforeach
</tbody>
<tfoot>

<tr>
<td colspan="8">
<x-input.select
name="status_id"
id="status_id"
:options="$statuslabel_list"
:selected="old('status_id')"
required
style="width:250px"
aria-label="status_id"
/>
<label>{{ trans('admin/users/general.update_user_assets_status') }}</label>
</td>
</tr>
<tr>
<td colspan="8" class="col-md-12 alert-danger">
<label class="form-control">
<input type="checkbox" name="delete_user" value="1">
<span><i class="fa fa-warning fa-2x"></i> {{ trans('general.bulk_soft_delete') }}</span>
</label>
</td>
</tr>
</tfoot>
</table>
</div> <!--/table-responsive-->
</div><!--/col-md-12-->
Expand Down
14 changes: 10 additions & 4 deletions resources/views/users/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,26 +276,32 @@
@can('update', $user)
@if ($user->deleted_at=='')
<div class="col-md-12" style="padding-top: 30px;">
@if ($user->isDeletable())
@if (($user->isDeletable()) && ($user->id!=auth()->user()->id))
<a href="" class="delete-asset btn-block btn btn-sm btn-danger btn-social hidden-print" data-toggle="modal" data-title="{{ trans('general.delete') }}" data-content="{{ trans('general.sure_to_delete_var', ['item' => $user->display_name]) }}" data-icon="fa-trash" data-target="#dataConfirmModal" onClick="return false;" >
<x-icon type="delete" />
{{ trans('button.delete')}}
</a>
@else
<button class="btn-block btn btn-sm btn-danger btn-social hidden-print disabled">
@elseif ($user->id == auth()->user()->id)
<button class="btn-block btn btn-sm btn-danger btn-social hidden-print disabled" data-tooltip="true" data-title="{{ trans('tooltips.disabled_assoc.user_self') }}">
<x-icon type="delete" />
{{ trans('button.delete')}}
</button>
@else
<button class="btn-block btn btn-sm btn-danger btn-social hidden-print disabled" data-tooltip="true" data-title="{{ trans('tooltips.disabled_assoc.user') }}">
<x-icon type="delete" />
{{ trans('button.delete')}}
</button>
@endif
</div>
<div class="col-md-12" style="padding-top: 5px;">

<form action="{{ route('users/bulkedit') }}" method="POST">
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="bulk_actions" value="delete" />

<input type="hidden" name="ids[{{ $user->id }}]" value="{{ $user->id }}" />
<button class="btn btn-block btn-sm btn-danger btn-social hidden-print">
<button class="btn btn-block btn-sm btn-danger btn-social hidden-print" data-tooltip="true" data-title="{{ trans('tooltips.checkin_all.user') }}">
<x-icon type="checkin-and-delete" />
{{ trans('button.checkin_and_delete') }}
</button>
Expand Down
7 changes: 5 additions & 2 deletions routes/web/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)->name('ldap/user')
->breadcrumbs(fn (Trail $trail) =>
$trail->parent('users.index')
->push(trans('general.ldap_user_sync'), route('ldap/user')));;
->push(trans('general.ldap_user_sync'), route('ldap/user')));

Route::post(
'ldap',
Expand Down Expand Up @@ -97,7 +97,10 @@
Users\BulkUsersController::class,
'edit'
]
)->name('users/bulkedit');
)->name('users/bulkedit')
->breadcrumbs(fn (Trail $trail) =>
$trail->parent('users.index')
->push(trans('general.bulk_checkin_delete'), route('users.index')));

Route::post(
'merge',
Expand Down
Loading