Skip to content
31 changes: 22 additions & 9 deletions app/View/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,30 @@ public function render(callable $callback = null)
? route('locations.show', $asset->location_id)
: null;
break;
case 'hardware_id':
default:
$barcode2DTarget = route('hardware.show', $asset);
case 'mailto':
$companyEmail = $asset->company->email ?? env('MAIL_FROM_ADDR');
if (empty($companyEmail)) {
$barcode2DTarget = null;
break;
}
$subjectText = trans('admin/settings/general.mailto_subject', [
'asset_tag' => $asset->asset_tag,
]);

$subject = rawurlencode($subjectText);
$barcode2DTarget = "mailto:{$companyEmail}?subject={$subject}";
break;
case 'hardware_id':
default:
$barcode2DTarget = route('hardware.show', $asset);
break;
}
$assetData->put('barcode2d', (object)[
'type' => $barcode2DType,
'content' => $barcode2DTarget,
]);
}
}
$assetData->put('barcode2d', (object)[
'type' => $barcode2DType,
'content' => $barcode2DTarget,
]);
}
}

$fields = $fieldDefinitions
->map(fn($field) => $field->toArray($asset))
Expand Down
1 change: 1 addition & 0 deletions resources/views/settings/labels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ class="form-control"
:options="[
'hardware_id'=> config('app.url').'/hardware/{id} ('.trans('admin/settings/general.default').')',
'ht_tag'=> config('app.url').'/ht/{asset_tag}',
'mailto' => trans('admin/settings/general.mailto_option'),
'location' => config('app.url').'/locations/{location_id}',
'plain_asset_id'=> trans('admin/settings/general.asset_id'),
'plain_asset_tag'=> trans('general.asset_tag'),
Expand Down
Loading