mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
this is good, just needs translations done in view
This commit is contained in:
parent
162b70d5a9
commit
e4c76f454c
|
@ -49,6 +49,7 @@ class BulkAssetsController extends Controller
|
|||
->with('settings', Setting::getSettings())
|
||||
->with('bulkedit', true)
|
||||
->with('count', 0);
|
||||
|
||||
case 'delete':
|
||||
$assets = Asset::with('assignedTo', 'location')->find($asset_ids);
|
||||
$assets->each(function ($asset) {
|
||||
|
@ -58,12 +59,13 @@ class BulkAssetsController extends Controller
|
|||
return view('hardware/bulk-delete')->with('assets', $assets);
|
||||
|
||||
case 'restore':
|
||||
$assets = Asset::with('assignedTo', 'location')->find($asset_ids);
|
||||
$assets = Asset::withTrashed()->find($asset_ids);
|
||||
$assets->each(function ($asset) {
|
||||
$this->authorize('restore', $asset);
|
||||
$this->authorize('delete', $asset);
|
||||
});
|
||||
|
||||
return view('hardware/bulk-restore')->with('assets', $assets);
|
||||
|
||||
case 'edit':
|
||||
return view('hardware/bulk')
|
||||
->with('assets', $asset_ids)
|
||||
|
@ -336,5 +338,6 @@ class BulkAssetsController extends Controller
|
|||
$asset = Asset::withTrashed()->find($assetId);
|
||||
$asset->restore();
|
||||
}
|
||||
return redirect()->route('hardware.index')->with('success', 'Assets Restored');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
return [
|
||||
'bulk_delete' => 'Confirm Bulk Delete Assets',
|
||||
'bulk_restore' => 'Confirm Bulk Restore Assets',
|
||||
'bulk_delete_help' => 'Review the assets for bulk deletion below. Once deleted, these assets can be restored, but they will no longer be associated with any users they are currently assigned to.',
|
||||
'bulk_restore_help' => 'Review the assets for bulk deletion below. Once deleted, these assets can be restored, but they will no longer be associated with any users they are currently assigned to.',
|
||||
'bulk_delete_warn' => 'You are about to delete :asset_count assets.',
|
||||
'bulk_restore_warn' => 'You are about to restore :asset_count assets.',
|
||||
'bulk_update' => 'Bulk Update Assets',
|
||||
'bulk_update_help' => 'This form allows you to update multiple assets at once. Only fill in the fields you need to change. Any fields left blank will remain unchanged. ',
|
||||
'bulk_update_warn' => 'You are about to edit the properties of a single asset.|You are about to edit the properties of :asset_count assets.',
|
||||
|
|
62
resources/views/hardware/bulk-restore.blade.php
Normal file
62
resources/views/hardware/bulk-restore.blade.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('admin/hardware/form.bulk_delete') }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ URL::previous() }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<!-- left column -->
|
||||
<div class="col-md-12">
|
||||
<p>{{ trans('admin/hardware/form.bulk_delete_help') }}</p>
|
||||
<form class="form-horizontal" method="post" action="{{ route('hardware/bulkrestore') }}" autocomplete="off" role="form">
|
||||
{{csrf_field()}}
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title" style="color: red">{{ trans('admin/hardware/form.bulk_restore_warn', ['asset_count' => count($assets)]) }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{{ trans('admin/hardware/table.id') }}</td>
|
||||
<td>{{ trans('admin/hardware/table.name') }}</td>
|
||||
<td>{{ trans('admin/hardware/table.location')}}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($assets as $asset)
|
||||
<tr>
|
||||
<td><input type="checkbox" name="ids[]" value="{{ $asset->id }}" checked="checked"></td>
|
||||
<td>{{ $asset->id }}</td>
|
||||
<td>{{ $asset->present()->name() }}</td>
|
||||
<td>
|
||||
@if ($asset->location)
|
||||
{{ $asset->location->name }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- /.box-body -->
|
||||
|
||||
<div class="box-footer text-right">
|
||||
<a class="btn btn-link" href="{{ URL::previous() }}" method="post" enctype="multipart/form-data">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-success" id="submit-button"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('button.delete') }}</button>
|
||||
</div><!-- /.box-footer -->
|
||||
</div><!-- /.box -->
|
||||
</form>
|
||||
</div> <!-- .col-md-12-->
|
||||
</div><!--.row-->
|
||||
@stop
|
|
@ -160,6 +160,11 @@ Route::group(
|
|||
[BulkAssetsController::class, 'destroy']
|
||||
)->name('hardware/bulkdelete');
|
||||
|
||||
Route::post(
|
||||
'bulkrestore',
|
||||
[BulkAssetsController::class, 'restore']
|
||||
)->name('hardware/bulkrestore');
|
||||
|
||||
Route::post(
|
||||
'bulksave',
|
||||
[BulkAssetsController::class, 'update']
|
||||
|
@ -181,4 +186,4 @@ Route::resource('hardware',
|
|||
'middleware' => ['auth'],
|
||||
'parameters' => ['asset' => 'asset_id'
|
||||
],
|
||||
]);
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue