mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Merge pull request #15747 from NebelKreis/feature/custom-data-options-for-2d-barcode
This commit is contained in:
commit
e03ed7567a
|
@ -115,18 +115,30 @@ class Label implements View
|
|||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($template->getSupport2DBarcode()) {
|
||||
$barcode2DType = $settings->label2_2d_type;
|
||||
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
|
||||
switch ($settings->label2_2d_target) {
|
||||
case 'ht_tag':
|
||||
$barcode2DTarget = route('ht/assetTag', $asset->asset_tag);
|
||||
break;
|
||||
case 'hardware_id':
|
||||
default:
|
||||
$barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]);
|
||||
break;
|
||||
|
||||
if ($template->getSupport2DBarcode()) {
|
||||
$barcode2DType = $settings->label2_2d_type;
|
||||
$barcode2DType = ($barcode2DType == 'default') ?
|
||||
$settings->barcode_type :
|
||||
$barcode2DType;
|
||||
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
|
||||
switch ($settings->label2_2d_target) {
|
||||
case 'ht_tag':
|
||||
$barcode2DTarget = route('ht/assetTag', $asset->asset_tag);
|
||||
break;
|
||||
case 'plain_asset_id':
|
||||
$barcode2DTarget = (string) $asset->id;
|
||||
break;
|
||||
case 'plain_asset_tag':
|
||||
$barcode2DTarget = $asset->asset_tag;
|
||||
break;
|
||||
case 'plain_serial_number':
|
||||
$barcode2DTarget = $asset->serial;
|
||||
break;
|
||||
case 'hardware_id':
|
||||
default:
|
||||
$barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]);
|
||||
break;
|
||||
}
|
||||
$assetData->put('barcode2d', (object)[
|
||||
'type' => $barcode2DType,
|
||||
|
|
|
@ -362,12 +362,14 @@ return [
|
|||
'label2_2d_type' => '2D Barcode Type',
|
||||
'label2_2d_type_help' => 'Format for 2D barcodes',
|
||||
'label2_2d_target' => '2D Barcode Target',
|
||||
'label2_2d_target_help' => 'The URL the 2D barcode points to when scanned',
|
||||
'label2_2d_target_help' => 'The data that will be contained in the 2D barcode',
|
||||
'label2_fields' => 'Field Definitions',
|
||||
'label2_fields_help' => 'Fields can be added, removed, and reordered in the left column. For each field, multiple options for Label and DataSource can be added, removed, and reordered in the right column.',
|
||||
'help_asterisk_bold' => 'Text entered as <code>**text**</code> will be displayed as bold',
|
||||
'help_blank_to_use' => 'Leave blank to use the value from <code>:setting_name</code>',
|
||||
'help_default_will_use' => '<br>Note that the value of the barcodes must comply with the respective barcode spec in order to be successfully generated. Please see <a href="https://snipe-it.readme.io/docs/barcodes">the documentation <i class="fa fa-external-link"></i></a> for more details. ',
|
||||
'help_default_will_use' => '<code>:default</code> will use the value from <code>:setting_name</code>. <br>Note that the value of the barcodes must comply with the respective barcode spec in order to be successfully generated. Please see <a href="https://snipe-it.readme.io/docs/barcodes">the documentation <i class="fa fa-external-link"></i></a> for more details. ',
|
||||
'asset_id' => 'Asset ID',
|
||||
'data' => 'Data',
|
||||
'default' => 'Default',
|
||||
'none' => 'None',
|
||||
'google_callback_help' => 'This should be entered as the callback URL in your Google OAuth app settings in your organization's <strong><a href="https://console.cloud.google.com/" target="_blank">Google developer console <i class="fa fa-external-link" aria-hidden="true"></i></a></strong>.',
|
||||
|
|
|
@ -143,7 +143,6 @@
|
|||
@if ($is_gd_installed)
|
||||
<!-- barcode -->
|
||||
<div class="form-group">
|
||||
|
||||
<div class="col-md-9 col-md-offset-3">
|
||||
<label class="form-control">
|
||||
{{ Form::checkbox('alt_barcode_enabled', '1', old('alt_barcode_enabled', $setting->alt_barcode_enabled),array( 'aria-label'=>'alt_barcode_enabled')) }}
|
||||
|
@ -153,33 +152,38 @@
|
|||
</div>
|
||||
@endif
|
||||
@endif
|
||||
<!-- 1D Barcode Type -->
|
||||
<div class="form-group{{ $errors->has('label2_1d_type') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('label2_1d_type', trans('admin/settings/general.label2_1d_type'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@php
|
||||
$select1DValues = [
|
||||
'C128' => 'C128',
|
||||
'C39' => 'C39',
|
||||
'EAN5' => 'EAN5',
|
||||
'EAN13' => 'EAN13',
|
||||
'UPCA' => 'UPCA',
|
||||
'UPCE' => 'UPCE',
|
||||
'none' => trans('admin/settings/general.none'),
|
||||
];
|
||||
@endphp
|
||||
{{ Form::select('label2_1d_type', $select1DValues, old('label2_1d_type', $setting->label2_1d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_1d_type' ]) }}
|
||||
{!! $errors->first('label2_1d_type', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">
|
||||
{{ trans('admin/settings/general.label2_1d_type_help') }}.
|
||||
{!!
|
||||
trans('admin/settings/general.help_default_will_use')
|
||||
!!}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 1D Barcode Type -->
|
||||
<div class="form-group{{ $errors->has('label2_1d_type') ? ' has-error' : '' }}">
|
||||
<div class="col-md-3 text-right">
|
||||
{{ Form::label('label2_1d_type', trans('admin/settings/general.label2_1d_type'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@php
|
||||
$select1DValues = [
|
||||
'C128' => 'C128',
|
||||
'C39' => 'C39',
|
||||
'EAN5' => 'EAN5',
|
||||
'EAN13' => 'EAN13',
|
||||
'UPCA' => 'UPCA',
|
||||
'UPCE' => 'UPCE',
|
||||
'none' => trans('admin/settings/general.none'),
|
||||
];
|
||||
@endphp
|
||||
{{ Form::select('label2_1d_type', $select1DValues, old('label2_1d_type', $setting->label2_1d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_1d_type' ]) }}
|
||||
{!! $errors->first('label2_1d_type', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">
|
||||
{{ trans('admin/settings/general.label2_1d_type_help') }}.
|
||||
{!!
|
||||
trans('admin/settings/general.help_default_will_use', [
|
||||
'default' => trans('admin/settings/general.default'),
|
||||
'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.alt_barcode_type'),
|
||||
])
|
||||
!!}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($setting->label2_enable == 0)
|
||||
|
||||
<!-- qr code -->
|
||||
|
@ -273,7 +277,13 @@
|
|||
{{ Form::label('label2_2d_target', trans('admin/settings/general.label2_2d_target'), ['class'=>'control-label']) }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{{ Form::select('label2_2d_target', ['hardware_id'=>'/hardware/{id} ('.trans('admin/settings/general.default').')', 'ht_tag'=>'/ht/{asset_tag}'], old('label2_2d_target', $setting->label2_2d_target), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_target' ]) }}
|
||||
{{ Form::select('label2_2d_target', [
|
||||
'hardware_id' => trans('general.url') .': /hardware/{id} ('.trans('admin/settings/general.default').')',
|
||||
'ht_tag' => trans('general.url') .': /ht/{asset_tag}',
|
||||
'plain_asset_id' => trans('admin/settings/general.data') .': '. trans('admin/settings/general.asset_id') .' {id}',
|
||||
'plain_asset_tag' => trans('admin/settings/general.data') .': '. trans('general.asset_tag') .' {asset_tag}',
|
||||
'plain_serial_number' => trans('admin/settings/general.data') .': '. trans('general.serial_number') .' {serial}',
|
||||
], old('label2_2d_target', $setting->label2_2d_target), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_target' ]) }}
|
||||
{!! $errors->first('label2_2d_target', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p class="help-block">{{ trans('admin/settings/general.label2_2d_target_help') }}</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue