mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Implement #3088: Add "Generate Label" option to "Actions" dropdown menu in individual Asset Details view. (#7388)
* Implement #3088: Add "Generate Label" option to "Actions" dropdown menu in individual Asset Details view. * Add conditional for including the asset number in the URL of the barcode image. * Change case of variables to pass Codacy PR review standards.
This commit is contained in:
parent
7b0b28aed0
commit
4c8b26f732
|
@ -481,6 +481,29 @@ class AssetsController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a label for an individual asset.
|
||||
*
|
||||
* @author [L. Swartzendruber] [<logan.swartzendruber@gmail.com>
|
||||
* @param int $assetId
|
||||
* @return View
|
||||
*/
|
||||
public function getLabel($assetId = null)
|
||||
{
|
||||
if (isset($assetId)) {
|
||||
$asset = Asset::find($assetId);
|
||||
$this->authorize('view', $asset);
|
||||
|
||||
return view('hardware/labels')
|
||||
->with('assets', Asset::find($asset))
|
||||
->with('settings', Setting::getSettings())
|
||||
->with('bulkedit', false)
|
||||
->with('count', 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a view that presents a form to clone an asset.
|
||||
*
|
||||
|
|
|
@ -40,6 +40,7 @@ class BulkAssetsController extends Controller
|
|||
return view('hardware/labels')
|
||||
->with('assets', Asset::find($asset_ids))
|
||||
->with('settings', Setting::getSettings())
|
||||
->with('bulkedit', true)
|
||||
->with('count', 0);
|
||||
case 'delete':
|
||||
$assets = Asset::with('assignedTo', 'location')->find($asset_ids);
|
||||
|
|
|
@ -13,4 +13,5 @@ return array(
|
|||
'upload' => 'Upload',
|
||||
'select_file' => 'Select File...',
|
||||
'select_files' => 'Select Files...',
|
||||
'generate_labels' => '{1} Generate Label|[2,*] Generate Labels',
|
||||
);
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
@if (Input::get('status')!='Deleted')
|
||||
<div id="toolbar">
|
||||
<select name="bulk_actions" class="form-control select2">
|
||||
<option value="edit">Edit</option>
|
||||
<option value="delete">Delete</option>
|
||||
<option value="labels">Generate Labels</option>
|
||||
<option value="edit">{{ trans('button.edit') }}</option>
|
||||
<option value="delete">{{ trans('button.delete') }}</option>
|
||||
<option value="labels">{{ trans_choice('button.generate_labels', 2) }}</option>
|
||||
</select>
|
||||
<button class="btn btn-primary" id="bulkEdit" disabled>Go</button>
|
||||
</div>
|
||||
|
|
|
@ -135,7 +135,11 @@
|
|||
|
||||
@if ($settings->qr_code=='1')
|
||||
<div class="label-qr_img qr_img">
|
||||
@if ($bulkedit==False)
|
||||
<img src="./qr_code" class="qr_img">
|
||||
@else
|
||||
<img src="./{{ $asset->id }}/qr_code" class="qr_img">
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
@ -182,7 +186,11 @@
|
|||
|
||||
@if ((($settings->alt_barcode_enabled=='1') && $settings->alt_barcode!=''))
|
||||
<div class="label-alt_barcode barcode_container">
|
||||
@if ($bulkedit==False)
|
||||
<img src="./barcode" class="barcode">
|
||||
@else
|
||||
<img src="./{{ $asset->id }}/barcode" class="barcode">
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
@can('audit', \App\Models\Asset::class)
|
||||
<li role="presentation"><a href="{{ route('asset.audit.create', $asset->id) }}">{{ trans('general.audit') }}</a></li>
|
||||
@endcan
|
||||
<li role="presentation"><a href="{{ route('label/hardware', $asset->id) }}">{{ trans_choice('button.generate_labels', 1) }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@endcan
|
||||
|
|
|
@ -80,6 +80,11 @@ Route::group(
|
|||
'uses' => 'Assets\AssetsController@getClone'
|
||||
]);
|
||||
|
||||
Route::get('{assetId}/label', [
|
||||
'as' => 'label/hardware',
|
||||
'uses' => 'Assets\AssetsController@getLabel'
|
||||
]);
|
||||
|
||||
Route::post('{assetId}/clone', 'Assets\AssetsController@postCreate');
|
||||
|
||||
Route::get('{assetId}/checkout', [
|
||||
|
|
Loading…
Reference in a new issue