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:
Logan Swartzendruber
2019-09-03 14:02:55 -04:00
committed by snipe
parent 7b0b28aed0
commit 4c8b26f732
7 changed files with 42 additions and 3 deletions
@@ -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);