Skip to content

Commit

Permalink
Merge pull request #11453 from mikeroq/fixes/asset_restore_not_working
Browse files Browse the repository at this point in the history
Fixes #11452 - Asset Restore routes/buttons also asset models/users restore as well
  • Loading branch information
snipe committed Jul 2, 2022
2 parents b44f27d + 0a5ca6e commit af14ee0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 54 deletions.
4 changes: 2 additions & 2 deletions resources/views/partials/bootstrap-table.blade.php
Expand Up @@ -282,7 +282,7 @@ function genericActionsFormatter(owner_name, element_name) {
if ((row.available_actions) && (row.available_actions.restore === true)) {
actions += '<form style="display: inline;" method="POST" action="{{ url('/') }}/' + dest + '/' + row.id + '/restore"> ';
actions += '@csrf';
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/restore" class="btn btn-sm btn-warning" data-toggle="tooltip" title="{{ trans('general.restore') }}"><i class="far fa-clone"></i></a>&nbsp;';
actions += '<button class="btn btn-sm btn-warning" data-toggle="tooltip" title="{{ trans('general.restore') }}"><i class="far fa-clone"></i></button>&nbsp;';
actions += '<i class="fa fa-retweet" aria-hidden="true"></i><span class="sr-only">{{ trans('general.restore') }}</span></button></form>&nbsp;';
}
Expand Down Expand Up @@ -780,4 +780,4 @@ function numberWithCommas(value) {
</script>

@endpush
@endpush
12 changes: 5 additions & 7 deletions resources/views/users/view.blade.php
Expand Up @@ -141,11 +141,6 @@
<div class="callout callout-warning">
<i class="icon fas fa-exclamation-triangle"></i>
{{ trans('admin/users/message.user_deleted_warning') }}
@can('update', $user)
<a href="{{ route('restore/user', $user->id) }}">
{{ trans('admin/users/general.restore_user') }}
</a>
@endcan
</div>
</div>
@endif
Expand Down Expand Up @@ -229,7 +224,10 @@
</div>
@else
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('restore/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</a>
<form method="POST" action="{{ route('restore/user', $user->id) }}">
@csrf
<button style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</button>
</form>
</div>
@endif
@endcan
Expand Down Expand Up @@ -1037,4 +1035,4 @@ class="table table-striped snipe-table"
</script>


@stop
@stop
4 changes: 2 additions & 2 deletions routes/web/hardware.php
Expand Up @@ -134,7 +134,7 @@ function () {
[AssetsController::class, 'getBarCode']
)->name('barcode/hardware');

Route::get('{assetId}/restore',
Route::post('{assetId}/restore',
[AssetsController::class, 'getRestore']
)->name('restore/hardware');

Expand Down Expand Up @@ -181,4 +181,4 @@ function () {
'middleware' => ['auth'],
'parameters' => ['asset' => 'asset_id'
],
]);
]);
46 changes: 3 additions & 43 deletions routes/web/users.php
Expand Up @@ -4,47 +4,7 @@
use App\Http\Controllers\Users\UserFilesController;
use Illuminate\Support\Facades\Route;

// User Management
Route::post(
'{userId}/clone',
[
Users\UsersController::class,
'postCreate'
]
);

Route::post(
'{userId}/restore',
[
Users\UsersController::class,
'getRestore'
]
)->name('restore/user');

Route::get(
'{userId}/unsuspend',
[
Users\UsersController::class,
'getUnsuspend'
]
)->name('unsuspend/user');

Route::post(
'{userId}/upload',
[
Users\UserFilesController::class,
'store'
]
)->name('upload/user');

Route::delete(
'{userId}/deletefile/{fileId}',
[
Users\UserFilesController::class,
'destroy'
]
)->name('userfile.destroy');

// User Management

Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {

Expand Down Expand Up @@ -88,7 +48,7 @@
]
)->name('clone/user');

Route::get(
Route::post(
'{userId}/restore',
[
Users\UsersController::class,
Expand Down Expand Up @@ -183,4 +143,4 @@
Route::resource('users', Users\UsersController::class, [
'middleware' => ['auth'],
'parameters' => ['user' => 'user_id'],
]);
]);

0 comments on commit af14ee0

Please sign in to comment.