Skip to content

Commit

Permalink
untangled code visibility from each label engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Godmartinz committed Jan 7, 2025
1 parent 94f44d1 commit 83ee0e0
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions app/View/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function render(callable $callback = null)
}
}

if ($settings->alt_barcode_enabled) {

if ($template->getSupport1DBarcode()) {
$barcode1DType = $settings->label2_1d_type;
if ($barcode1DType != 'none') {
Expand All @@ -115,21 +115,25 @@ public function render(callable $callback = null)
]);
}
}
}

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':
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;
}
$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

0 comments on commit 83ee0e0

Please sign in to comment.