mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
wireframed, needs a view and should work
This commit is contained in:
parent
c9d1274edc
commit
162b70d5a9
|
@ -56,6 +56,14 @@ class BulkAssetsController extends Controller
|
|||
});
|
||||
|
||||
return view('hardware/bulk-delete')->with('assets', $assets);
|
||||
|
||||
case 'restore':
|
||||
$assets = Asset::with('assignedTo', 'location')->find($asset_ids);
|
||||
$assets->each(function ($asset) {
|
||||
$this->authorize('restore', $asset);
|
||||
});
|
||||
|
||||
return view('hardware/bulk-restore')->with('assets', $assets);
|
||||
case 'edit':
|
||||
return view('hardware/bulk')
|
||||
->with('assets', $asset_ids)
|
||||
|
@ -320,5 +328,13 @@ class BulkAssetsController extends Controller
|
|||
} catch (ModelNotFoundException $e) {
|
||||
return redirect()->route('hardware.bulkcheckout.show')->with('error', $e->getErrors());
|
||||
}
|
||||
|
||||
}
|
||||
public function restore(Request $request) {
|
||||
$assetIds = $request->get('ids');
|
||||
foreach ($assetIds as $key => $assetId) {
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
$asset->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,13 +63,15 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if (Request::get('status')!='Deleted')
|
||||
|
||||
|
||||
{{-- @if (Request::get('status')!='Deleted') --}}
|
||||
|
||||
|
||||
|
||||
@include('partials.asset-bulk-actions')
|
||||
@include('partials.asset-bulk-actions', ['status' => Request::get('status')])
|
||||
|
||||
@endif
|
||||
{{-- @endif --}}
|
||||
|
||||
<table
|
||||
data-advanced-search="true"
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
</span>
|
||||
</label>
|
||||
<select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="min-width: 350px;">
|
||||
@if($status == 'Deleted')
|
||||
<option value="restore">{{trans('button.restore')}}</option>
|
||||
@else
|
||||
@can('update', \App\Models\Asset::class)
|
||||
<option value="edit">{{ trans('button.edit') }}</option>
|
||||
@endcan
|
||||
|
@ -20,6 +23,7 @@
|
|||
<option value="delete">{{ trans('button.delete') }}</option>
|
||||
@endcan
|
||||
<option value="labels" accesskey="l">{{ trans_choice('button.generate_labels', 2) }}</option>
|
||||
@endif
|
||||
</select>
|
||||
|
||||
<button class="btn btn-primary" id="{{ (isset($id_button)) ? $id_button : 'bulkAssetEditButton' }}" disabled>{{ trans('button.go') }}</button>
|
||||
|
|
Loading…
Reference in a new issue