Skip to content

A free open source IT asset/license management system

adds methods to DefaultLabel

Godfrey M17cf36b077a3
diff --git a/app/Models/Labels/DefaultLabel.php b/app/Models/Labels/DefaultLabel.php
index 21d0d97079..d73f3ada4d 100644
--- a/app/Models/Labels/DefaultLabel.php
+++ b/app/Models/Labels/DefaultLabel.php
@@ -82,6 +82,41 @@ class DefaultLabel extends RectangleSheet
}
+ public function getBarcode1DSize()
+ {
+ return self::BARCODE1D_SIZE;
+ }
+
+ public function getBarcode2DSize()
+ {
+ return self::BARCODE2D_SIZE;
+ }
+
+ public function getBarcode2DMargin()
+ {
+ return self::BARCODE2D_MARGIN;
+ }
+
+ public function getLogoSize()
+ {
+ return self::LOGO_SIZE;
+ }
+
+ public function getLogoMargin()
+ {
+ return self::LOGO_MARGIN;
+ }
+
+ public function getTextMargin()
+ {
+ return self::TEXT_MARGIN;
+ }
+
+ public function getTextSize()
+ {
+ return $this->textSize;
+ }
+
public function getUnit()
{
return 'in';
@@ -202,6 +237,32 @@ class DefaultLabel extends RectangleSheet
return true;
}
+ protected function getContentEditorConfig(): array
+ {
+ return [
+ 'text_font_size' => $this->getTextSize(),
+ 'text_margin' => $this->getTextMargin(),
+ 'barcode_1d_size' => $this->getBarcode1DSize(),
+ 'barcode_2d_size' => $this->getBarcode2DSize(),
+ 'barcode_2d_margin' => $this->getBarcode2DMargin(),
+ 'logo_width' => $this->getLogoSize()[0],
+ 'logo_height' => $this->getLogoSize()[1],
+ 'logo_margin' => $this->getLogoMargin(),
+ ];
+ }
+
+ protected function getSupportsEditorConfig(): array
+ {
+ return [
+ 'asset_tag' => $this->getSupportAssetTag(),
+ 'barcode_1d' => $this->getSupport1DBarcode(),
+ 'barcode_2d' => $this->getSupport2DBarcode(),
+ 'fields' => $this->getSupportFields(),
+ 'logo' => $this->getSupportLogo(),
+ 'title' => $this->getSupportTitle(),
+ ];
+ }
+
public function preparePDF($pdf) {}
public function write($pdf, $record)
diff --git a/routes/web.php b/routes/web.php
index fce14adec2..e0288accff 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -570,7 +570,7 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {
->name('report-templates.destroy');
});
Route::get('/debug/label', function () {
- $label = new \App\Models\Labels\Sheets\Avery\L7163_A();
+ $label = new \App\Models\Labels\DefaultLabel();
dd($label->toEditorConfig());
});