A free open source IT asset/license management system
tape labels preview in editor
Godfrey Mf42bbadb5db6
diff --git a/app/Http/Controllers/Api/LabelsController.php b/app/Http/Controllers/Api/LabelsController.phpindex d725213046..a769e19394 100644--- a/app/Http/Controllers/Api/LabelsController.php+++ b/app/Http/Controllers/Api/LabelsController.php@@ -5,7 +5,7 @@ namespace App\Http\Controllers\Api;use App\Helpers\Helper;use App\Http\Controllers\Controller;use App\Http\Transformers\LabelsTransformer;-use App\Models\Labels\CustomLabels\PreviewLabel;+use App\Models\Labels\CustomLabels\PreviewSheetLabel;use App\Models\Labels\CustomUserLabel;use App\Models\Labels\Label;use Illuminate\Http\JsonResponse;@@ -24,7 +24,7 @@ class LabelsController extends Controller$this->authorize('view', Label::class);$baseLabels = Label::find()- ->reject(fn (Label $label) => $label instanceof PreviewLabel)+ ->reject(fn(Label $label) => $label instanceof PreviewSheetLabel)->map(function (Label $label) {return ['source' => 'base',diff --git a/app/Http/Controllers/LabelsController.php b/app/Http/Controllers/LabelsController.phpindex e30e85abaf..e535b0bf82 100755--- a/app/Http/Controllers/LabelsController.php+++ b/app/Http/Controllers/LabelsController.php@@ -7,7 +7,8 @@ use App\Models\AssetModel;use App\Models\Category;use App\Models\Company;use App\Models\CustomField;-use App\Models\Labels\CustomLabels\PreviewLabel;+use App\Models\Labels\CustomLabels\PreviewSheetLabel;+use App\Models\Labels\CustomLabels\PreviewTapeLabel;use App\Models\Labels\CustomUserLabel;use App\Models\Labels\DefaultLabel;use App\Models\Labels\Label;@@ -43,7 +44,7 @@ class LabelsController extends Controllerdata_get($customLabel->config_snapshot, 'template', $customLabel->base_label));- $template = new PreviewLabel;+ $template = new PreviewSheetLabel;if ($baseLabel) {$template->seedFromTemplate($baseLabel);@@ -107,12 +108,18 @@ class LabelsController extends Controllerpublic function update(Request $request, CustomUserLabel $label){+ $type = $request->input('type', $label->type ?? 'sheet');+ $isTape = $type === 'tape';+$validated = $request->validate(['name' => ['required', 'string', 'max:255'],'type' => ['nullable', 'string'],- 'page' => ['required', 'array'],- 'grid' => ['required', 'array'],- 'label' => ['required', 'array'],++ 'page' => [$isTape ? 'nullable' : 'required', 'array'],+ 'grid' => [$isTape ? 'nullable' : 'required', 'array'],+ 'label' => [$isTape ? 'nullable' : 'required', 'array'],+ 'tape' => [$isTape ? 'required' : 'nullable', 'array'],+'content' => ['required', 'array'],'supports' => ['required', 'array'],]);@@ -134,35 +141,48 @@ class LabelsController extends Controllerreturn is_numeric($value) ? (float)$value : $value;})->toArray();};-- $page = $castNumeric($validated['page']);- $grid = $castNumeric($validated['grid']);- $labelConfig = $castNumeric($validated['label']);- $content = $castNumeric($validated['content']);-$baseLabel = CustomUserLabel::makeBaseLabel($label->base_label);if (!$baseLabel) {return redirect()->back()->with('error', trans('admin/labels/labels.base_label_missing'));}- $baseWorkingLabel = new PreviewLabel;+ $chosenLabelType = function () use ($isTape) {+ return $isTape ? new PreviewTapeLabel : new PreviewSheetLabel;+ };+ $baseWorkingLabel = $chosenLabelType();$baseWorkingLabel->seedFromTemplate($baseLabel);$baseEditorConfig = $baseWorkingLabel->toEditorConfig();$baseConfig = $baseWorkingLabel->getEditorConfigSections();- $submittedConfig = [- 'page' => $page,- 'grid' => $grid,- 'label' => $labelConfig,- 'content' => $content,- 'supports' => $supports,- ];+ $content = $castNumeric($validated['content']);++ if ($isTape) {+ $tape = $castNumeric($validated['tape'] ?? []);++ $submittedConfig = [+ 'tape' => $tape,+ 'content' => $content,+ 'supports' => $supports,+ ];+ } else {+ $page = $castNumeric($validated['page']);+ $grid = $castNumeric($validated['grid']);+ $labelConfig = $castNumeric($validated['label']);++ $submittedConfig = [+ 'page' => $page,+ 'grid' => $grid,+ 'label' => $labelConfig,+ 'content' => $content,+ 'supports' => $supports,+ ];+ }$mergedConfig = array_replace_recursive($baseConfig, $submittedConfig);- $workingLabel = new PreviewLabel;+ $workingLabel = $chosenLabelType();$workingLabel->seedFromTemplate($baseLabel);$workingLabel->applyEditorConfig($mergedConfig);@@ -171,7 +191,7 @@ class LabelsController extends Controller$configSnapshot = ['unit' => $baseEditorConfig['unit'] ?? 'mm','template' => $label->base_label,- 'type' => $label->type ?? 'sheet',+ 'type' => $type,'name' => $validated['name'],];@@ -247,7 +267,7 @@ class LabelsController extends Controller}// Loading both base and working label in the preview to ensure millimeter-based comparisons for overrides.- $baseWorkingLabel = new PreviewLabel;+ $baseWorkingLabel = new PreviewSheetLabel;$baseWorkingLabel->seedFromTemplate($baseLabel);$baseConfig = $baseWorkingLabel->getEditorConfigSections();@@ -261,7 +281,7 @@ class LabelsController extends Controller$mergedConfig = array_replace_recursive($baseConfig, $submittedConfig);- $workingLabel = new PreviewLabel;+ $workingLabel = new PreviewSheetLabel;$workingLabel->seedFromTemplate($baseLabel);$workingLabel->applyEditorConfig($mergedConfig);@@ -304,6 +324,7 @@ class LabelsController extends Controllerreturn view('settings.label-edit', ['config' => $config,'selectedLabel' => $customLabel->base_label,+ 'selectedType' => $customLabel->type,'importedConfig' => null,'customLabel' => null,'formMethod' => 'POST',@@ -329,12 +350,14 @@ class LabelsController extends Controller$selectedLabel = 'DefaultLabel';}- $label = (new PreviewLabel)->seedFromTemplate($template);+ $label = $this->previewLabelForTemplate($template);$config = $importedConfig ?: $label->toEditorConfig();+ $type = str_starts_with($template->getName(), 'Tapes\\') ? 'tape' : 'sheet';return view('settings.label-edit', ['config' => $config,'selectedLabel' => $selectedLabel,+ 'selectedType' => $type,'importedConfig' => $importedConfig,'customLabel' => null,'formMethod' => 'POST',@@ -375,7 +398,7 @@ class LabelsController extends Controller'supports' => $request->input('supports', []),];- $template = new PreviewLabel;+ $template = new PreviewSheetLabel;if (method_exists($template, 'seedFromTemplate')) {$template->seedFromTemplate($baseTemplate);@@ -638,4 +661,15 @@ class LabelsController extends Controller->route('settings.labels.create')->with('imported_label_config', $config);}++ protected function previewLabelForTemplate($template)+ {+ $name = $template->getName();++ if (str_starts_with($name, 'Tapes\\')) {+ return (new PreviewTapeLabel)->seedFromTemplate($template);+ }++ return (new PreviewSheetLabel)->seedFromTemplate($template);+ }}diff --git a/app/Models/Labels/CustomLabels/CustomLabel.php b/app/Models/Labels/CustomLabels/CustomLabel.phpdeleted file mode 100644index 839f884040..0000000000--- a/app/Models/Labels/CustomLabels/CustomLabel.php+++ /dev/null@@ -1,65 +0,0 @@-<?php--namespace App\Models\Labels\CustomLabels;--use App\Models\Labels\RectangleSheet;--abstract class CustomLabel extends RectangleSheet-{- protected array $editorConfig = [];-- protected ?float $pageWidth = null;-- protected ?float $pageHeight = null;-- protected ?float $pageMarginTop = null;-- protected ?float $pageMarginRight = null;-- protected ?float $pageMarginBottom = null;-- protected ?float $pageMarginLeft = null;-- protected ?float $labelWidth = null;-- protected ?float $labelHeight = null;-- protected ?float $columnSpacing = null;-- protected ?float $rowSpacing = null;-- protected ?int $gridColumns = null;-- protected ?int $gridRows = null;-- public function applyEditorConfig(array $config): static- {- $this->editorConfig = $config;- $this->hydrateFromEditorConfig($config);-- return $this;- }-- protected function hydrateFromEditorConfig(array $config): void- {- $page = $config['page'] ?? [];- $label = $config['label'] ?? [];- $grid = $config['grid'] ?? [];-- $this->pageWidth = $page['width'] ?? $this->pageWidth;- $this->pageHeight = $page['height'] ?? $this->pageHeight;-- $this->pageMarginTop = $page['margin_top'] ?? $this->pageMarginTop;- $this->pageMarginRight = $page['margin_right'] ?? $this->pageMarginRight;- $this->pageMarginBottom = $page['margin_bottom'] ?? $this->pageMarginBottom;- $this->pageMarginLeft = $page['margin_left'] ?? $this->pageMarginLeft;-- $this->labelWidth = $label['width'] ?? $this->labelWidth;- $this->labelHeight = $label['height'] ?? $this->labelHeight;-- $this->gridColumns = $grid['columns'] ?? $this->gridColumns;- $this->gridRows = $grid['rows'] ?? $this->gridRows;- $this->columnSpacing = $grid['column_spacing'] ?? $this->columnSpacing;- $this->rowSpacing = $grid['row_spacing'] ?? $this->rowSpacing;- }-}diff --git a/app/Models/Labels/CustomLabels/CustomSheetLabel.php b/app/Models/Labels/CustomLabels/CustomSheetLabel.phpindex 708b647d5c..c5a1c2c5da 100644--- a/app/Models/Labels/CustomLabels/CustomSheetLabel.php+++ b/app/Models/Labels/CustomLabels/CustomSheetLabel.php@@ -3,9 +3,12 @@namespace App\Models\Labels\CustomLabels;use App\Helpers\Helper;+use App\Models\Labels\RectangleSheet;-abstract class CustomSheetLabel extends CustomLabel+abstract class CustomSheetLabel extends RectangleSheet{+ protected array $editorConfig = [];+protected string $unit = 'mm';protected ?float $pageWidth = 210.0;diff --git a/app/Models/Labels/CustomLabels/CustomTapeLabel.php b/app/Models/Labels/CustomLabels/CustomTapeLabel.phpnew file mode 100644index 0000000000..9bebea98b8--- /dev/null+++ b/app/Models/Labels/CustomLabels/CustomTapeLabel.php@@ -0,0 +1,350 @@+<?php++namespace App\Models\Labels\CustomLabels;++use App\Models\Labels\Label;++abstract class CustomTapeLabel extends Label+{+ protected array $editorConfig = [];++ protected string $unit = 'mm';++ protected float $width = 50.0;+ protected float $height = 12.0;++ protected float $marginTop = 3.2;+ protected float $marginRight = 3.2;+ protected float $marginBottom = 3.2;+ protected float $marginLeft = 3.2;++ protected bool $supportAssetTag = true;+ protected bool $support1DBarcode = true;+ protected bool $support2DBarcode = false;+ protected int $supportFields = 1;+ protected bool $supportLogo = false;+ protected bool $supportTitle = false;++ protected float $barcodeSize = 3.2;+ protected float $barcodeMargin = 0.3;+ protected float $textSizeMod = 1.0;+ protected float $tagSize = 5.5;+ protected float $fieldSize = 5.5;+ protected string $tagAlignment = 'L';+ protected string $fieldAlignment = 'R';++ public function getUnit()+ {+ return $this->unit;+ }++ public function getWidth()+ {+ return $this->width;+ }++ public function getHeight()+ {+ return $this->height;+ }++ public function getMarginTop()+ {+ return $this->marginTop;+ }++ public function getMarginRight()+ {+ return $this->marginRight;+ }++ public function getMarginBottom()+ {+ return $this->marginBottom;+ }++ public function getMarginLeft()+ {+ return $this->marginLeft;+ }++ public function getSupportAssetTag()+ {+ return $this->supportAssetTag;+ }++ public function getSupport1DBarcode()+ {+ return $this->support1DBarcode;+ }++ public function getSupport2DBarcode()+ {+ return $this->support2DBarcode;+ }++ public function getSupportFields()+ {+ return $this->supportFields;+ }++ public function getSupportLogo()+ {+ return $this->supportLogo;+ }++ public function getSupportTitle()+ {+ return $this->supportTitle;+ }++ public function getBarcodeSize(): float+ {+ return $this->barcodeSize;+ }++ public function getBarcodeMargin(): float+ {+ return $this->barcodeMargin;+ }++ public function getTextSizeMod(): float+ {+ return $this->textSizeMod;+ }++ public function getTagSize(): float+ {+ return $this->tagSize;+ }++ public function getFieldSize(): float+ {+ return $this->fieldSize;+ }++ public function getTagAlignment(): string+ {+ return $this->tagAlignment;+ }++ public function getFieldAlignment(): string+ {+ return $this->fieldAlignment;+ }++ public function preparePDF($pdf)+ {+ $pdf->SetMargins(0, 0, 0);+ $pdf->SetAutoPageBreak(false, 0);+ }++ protected function getDimensionsEditorConfig(): array+ {+ return [+ 'width' => $this->getWidth(),+ 'height' => $this->getHeight(),+ 'margin_top' => $this->getMarginTop(),+ 'margin_right' => $this->getMarginRight(),+ 'margin_bottom' => $this->getMarginBottom(),+ 'margin_left' => $this->getMarginLeft(),+ ];+ }++ protected function getContentEditorConfig(): array+ {+ return [+ 'barcode_size' => $this->getBarcodeSize(),+ 'barcode_margin' => $this->getBarcodeMargin(),+ 'text_size_mod' => $this->getTextSizeMod(),+ 'tag_font_size' => $this->getTagSize(),+ 'field_value_font_size' => $this->getFieldSize(),+ 'tag_alignment' => $this->getTagAlignment(),+ 'field_alignment' => $this->getFieldAlignment(),+ ];+ }++ public function getEditorConfigSections(): array+ {+ return [+ 'unit' => 'mm',+ 'tape' => $this->getDimensionsEditorConfig(),+ 'printable_area' => $this->getPrintableAreaEditorConfig(),+ 'content' => $this->getContentEditorConfig(),+ 'supports' => $this->getSupportsEditorConfig(),+ 'meta' => $this->getMetaEditorConfig(),+ ];+ }++ public function seedFromTemplate($template): static+ {+ $sourceUnit = $template->getUnit();++ $convert = function ($value) use ($sourceUnit) {+ if ($value === null || $value === '') {+ return $value;+ }++ return $sourceUnit === 'in' && is_numeric($value)+ ? (float)$value * 25.4+ : $value;+ };++ $this->unit = 'mm';++ $map = [+ 'width' => 'getWidth',+ 'height' => 'getHeight',+ 'marginTop' => 'getMarginTop',+ 'marginRight' => 'getMarginRight',+ 'marginBottom' => 'getMarginBottom',+ 'marginLeft' => 'getMarginLeft',+ ];++ foreach ($map as $property => $method) {+ if (method_exists($template, $method)) {+ $this->{$property} = (float)$convert($template->{$method}());+ }+ }++ $supportMap = [+ 'supportAssetTag' => 'getSupportAssetTag',+ 'support1DBarcode' => 'getSupport1DBarcode',+ 'support2DBarcode' => 'getSupport2DBarcode',+ 'supportFields' => 'getSupportFields',+ 'supportLogo' => 'getSupportLogo',+ 'supportTitle' => 'getSupportTitle',+ ];++ foreach ($supportMap as $property => $method) {+ if (method_exists($template, $method)) {+ $this->{$property} = $template->{$method}();+ }+ }++ $content = method_exists($template, 'getEditorConfigSections')+ ? ($template->getEditorConfigSections()['content'] ?? [])+ : [];++ $contentMap = [+ 'barcode_size' => 'barcodeSize',+ 'barcode_margin' => 'barcodeMargin',+ 'tag_font_size' => 'tagSize',+ 'field_value_font_size' => 'fieldSize',+ 'tag_alignment' => 'tagAlignment',+ 'field_alignment' => 'fieldAlignment',+ ];++ foreach ($contentMap as $key => $property) {+ if (array_key_exists($key, $content)) {+ $this->{$property} = is_numeric($content[$key])+ ? (float)$convert($content[$key])+ : (string)$content[$key];+ }+ }++ return $this;+ }++ public function applyEditorConfig(array $config): static+ {+ $this->editorConfig = $config;+ $this->hydrateFromEditorConfig($config);++ return $this;+ }++ protected function hydrateFromEditorConfig(array $config): void+ {+ $tape = $config['tape'] ?? [];+ $content = $config['content'] ?? [];+ $supports = $config['supports'] ?? [];++ $this->width = isset($tape['width']) ? (float)$tape['width'] : $this->width;+ $this->height = isset($tape['height']) ? (float)$tape['height'] : $this->height;++ $this->marginTop = isset($tape['margin_top']) ? (float)$tape['margin_top'] : $this->marginTop;+ $this->marginRight = isset($tape['margin_right']) ? (float)$tape['margin_right'] : $this->marginRight;+ $this->marginBottom = isset($tape['margin_bottom']) ? (float)$tape['margin_bottom'] : $this->marginBottom;+ $this->marginLeft = isset($tape['margin_left']) ? (float)$tape['margin_left'] : $this->marginLeft;++ $this->supportFields = isset($supports['fields']) ? (int)$supports['fields'] : $this->supportFields;+ $this->supportAssetTag = (bool)($supports['asset_tag'] ?? $this->supportAssetTag);+ $this->support1DBarcode = (bool)($supports['barcode_1d'] ?? $this->support1DBarcode);+ $this->support2DBarcode = (bool)($supports['barcode_2d'] ?? $this->support2DBarcode);+ $this->supportLogo = (bool)($supports['logo'] ?? $this->supportLogo);+ $this->supportTitle = (bool)($supports['title'] ?? $this->supportTitle);++ $this->barcodeSize = isset($content['barcode_size']) ? (float)$content['barcode_size'] : $this->barcodeSize;+ $this->barcodeMargin = isset($content['barcode_margin']) ? (float)$content['barcode_margin'] : $this->barcodeMargin;+ $this->textSizeMod = isset($content['text_size_mod']) ? (float)$content['text_size_mod'] : $this->textSizeMod;+ $this->tagSize = isset($content['tag_font_size']) ? (float)$content['tag_font_size'] : $this->tagSize;+ $this->fieldSize = isset($content['field_value_font_size']) ? (float)$content['field_value_font_size'] : $this->fieldSize;+ $this->tagAlignment = isset($content['tag_alignment']) ? (string)$content['tag_alignment'] : $this->tagAlignment;+ $this->fieldAlignment = isset($content['field_alignment']) ? (string)$content['field_alignment'] : $this->fieldAlignment;+ }++ public function write($pdf, $record)+ {+ $pa = $this->getPrintableArea();++ if ($record->has('barcode1d') && $this->getSupport1DBarcode()) {+ static::write1DBarcode(+ $pdf,+ $record->get('barcode1d')->content,+ $record->get('barcode1d')->type,+ $pa->x1,+ $pa->y1,+ $pa->w,+ $this->getBarcodeSize()+ );+ }++ $currentY = $pa->y1 + $this->getBarcodeSize() + $this->getBarcodeMargin();+ $usableHeight = max(0, $pa->h - $this->getBarcodeSize() - $this->getBarcodeMargin());+ $fontSize = $usableHeight + $this->getTextSizeMod();++ $tagWidth = $pa->w / 3;+ $fieldWidth = $pa->w - $tagWidth;++ if ($record->has('tag') && $this->getSupportAssetTag()) {+ static::writeText(+ $pdf,+ $record->get('tag'),+ $pa->x1,+ $currentY,+ 'freemono',+ 'B',+ $fontSize,+ $this->getTagAlignment(),+ $tagWidth,+ $usableHeight,+ true,+ 0,+ 0+ );+ }++ if (+ $record->has('fields') &&+ $this->getSupportFields() >= 1 &&+ $record->get('fields')->count() >= 1+ ) {+ static::writeText(+ $pdf,+ $record->get('fields')->values()->get(0)['value'],+ $pa->x1 + $tagWidth,+ $currentY,+ 'freemono',+ 'B',+ $fontSize,+ $this->getFieldAlignment(),+ $fieldWidth,+ $usableHeight,+ true,+ 0,+ 0+ );+ }+ }+}\ No newline at end of filediff --git a/app/Models/Labels/CustomLabels/PreviewLabel.php b/app/Models/Labels/CustomLabels/PreviewLabel.phpdeleted file mode 100644index 8bbe811a10..0000000000--- a/app/Models/Labels/CustomLabels/PreviewLabel.php+++ /dev/null@@ -1,5 +0,0 @@-<?php--namespace App\Models\Labels\CustomLabels;--class PreviewLabel extends CustomSheetLabel {}diff --git a/app/Models/Labels/CustomLabels/PreviewSheetLabel.php b/app/Models/Labels/CustomLabels/PreviewSheetLabel.phpnew file mode 100644index 0000000000..7627ce290d--- /dev/null+++ b/app/Models/Labels/CustomLabels/PreviewSheetLabel.php@@ -0,0 +1,7 @@+<?php++namespace App\Models\Labels\CustomLabels;++class PreviewSheetLabel extends CustomSheetLabel+{+}diff --git a/app/Models/Labels/CustomLabels/PreviewTapeLabel.php b/app/Models/Labels/CustomLabels/PreviewTapeLabel.phpnew file mode 100644index 0000000000..734ee7bed1--- /dev/null+++ b/app/Models/Labels/CustomLabels/PreviewTapeLabel.php@@ -0,0 +1,8 @@+<?php++namespace App\Models\Labels\CustomLabels;++class PreviewTapeLabel extends CustomTapeLabel+{++}\ No newline at end of filediff --git a/app/Models/Labels/Label.php b/app/Models/Labels/Label.phpindex a6a8bb6be4..90e60c3807 100644--- a/app/Models/Labels/Label.php+++ b/app/Models/Labels/Label.php@@ -806,13 +806,12 @@ abstract class Labelpublic function getEditorConfigSections(): array{return [- 'unit' => 'mm',- 'page' => $this->getPageEditorConfig(),- 'grid' => $this->getGridEditorConfig(),+ 'unit' => $this->getUnit(),+ 'dimensions' => $this->getDimensionsEditorConfig(),'printable_area' => $this->getPrintableAreaEditorConfig(),- 'label' => $this->getLabelEditorConfig(),'content' => $this->getContentEditorConfig(),'supports' => $this->getSupportsEditorConfig(),+ 'meta' => $this->getMetaEditorConfig(),];}}diff --git a/app/Models/Labels/RectangleSheet.php b/app/Models/Labels/RectangleSheet.phpindex 73c52e5adf..32d80ba872 100644--- a/app/Models/Labels/RectangleSheet.php+++ b/app/Models/Labels/RectangleSheet.php@@ -64,4 +64,17 @@ abstract class RectangleSheet extends Sheet'row_spacing' => $this->getLabelRowSpacing(),];}++ public function getEditorConfigSections(): array+ {+ return [+ 'unit' => 'mm',+ 'page' => $this->getPageEditorConfig(),+ 'grid' => $this->getGridEditorConfig(),+ 'printable_area' => $this->getPrintableAreaEditorConfig(),+ 'label' => $this->getLabelEditorConfig(),+ 'content' => $this->getContentEditorConfig(),+ 'supports' => $this->getSupportsEditorConfig(),+ ];+ }}diff --git a/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php b/app/Models/Labels/Tapes/Brother/TZe_12mm_A.phpindex e8459cf824..615a814a48 100644--- a/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php+++ b/app/Models/Labels/Tapes/Brother/TZe_12mm_A.php@@ -20,6 +20,22 @@ class TZe_12mm_A extends TZe_12mmreturn 50.0;}+ public function getBarcodeSize(): float+ {+ return self::BARCODE_SIZE;+ }++ public function getBarcodeMargin(): float+ {+ return self::BARCODE_MARGIN;+ }++ public function getTextSizeMod(): float+ {+ return self::TEXT_SIZE_MOD;+ }++public function getSupportAssetTag(){return true;@@ -50,6 +66,15 @@ class TZe_12mm_A extends TZe_12mmreturn false;}+ protected function getContentEditorConfig(): array+ {+ return [+ 'barcode_size' => $this->getBarcodeSize(),+ 'barcode_margin' => $this->getBarcodeMargin(),+ 'text_size_mod' => $this->getTextSizeMod(),+ ];+ }+public function preparePDF($pdf) {}public function write($pdf, $record)diff --git a/app/View/Label.php b/app/View/Label.phpindex 7c25b00607..a55023071d 100644--- a/app/View/Label.php+++ b/app/View/Label.php@@ -2,7 +2,7 @@namespace App\View;-use App\Models\Labels\CustomLabels\PreviewLabel;+use App\Models\Labels\CustomLabels\PreviewSheetLabel;use App\Models\Labels\CustomUserLabel;use App\Models\Labels\Field;use App\Models\Labels\Label as LabelModel;@@ -59,7 +59,7 @@ class Label implements Viewdata_get($customLabel->config_snapshot, 'template', $customLabel->base_label));- $template = new PreviewLabel;+ $template = new PreviewSheetLabel;if ($baseLabel) {$template->seedFromTemplate($baseLabel);diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex d0b72e03f5..0069d8f1e9 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -1899,7 +1899,7 @@const createUrl = '{{ route('settings.labels.create') }}';// Clone Buttonlet cloneHref;-+ console.log(row.name);if (row.source === 'custom') {cloneHref = createUrl + '?custom_label_id=' + row.custom_label_id;} else {diff --git a/resources/views/settings/label-edit.blade.php b/resources/views/settings/label-edit.blade.phpindex 25ca7e8265..c118e8f6ab 100644--- a/resources/views/settings/label-edit.blade.php+++ b/resources/views/settings/label-edit.blade.php@@ -104,6 +104,11 @@$printable = $config['label_printable_area'] ?? $config['printable_area'] ?? null;@endphp<input type="hidden" name="template" value="{{ $selectedLabel ?: 'DefaultLabel' }}">+ <input+ type="hidden"+ name="type"+ value="{{ $selectedType ?? data_get($config, 'type', 'sheet') }}"+ ><div class="label-config-grid"><div class="label-form-header">@php@@ -154,7 +159,24 @@</div></div>@endif-+ @if(!empty($config['tape']))+ <div class="panel box box-default label-config-panel">+ <div class="box-header with-border">+ <h3 class="box-title">Tape</h3>+ </div>+ <div id="tape-config" class="box-body collapse in">+ @foreach($config['tape'] as $key => $value)+ <div class="form-group">+ <label class="col-md-5 control-label">{{ $key }}</label>+ <div class="col-md-7">+ <input type="number" step="0.001" name="tape[{{ $key }}]"+ value="{{ $value }}" class="form-control">+ </div>+ </div>+ @endforeach+ </div>+ </div>+ @endif@if(!empty($config['grid']))<div class="panel box box-default label-config-panel"><div class="box-header with-border">