mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Merge branch 'feature-label2' into develop
This commit is contained in:
commit
d0eb3cfc9b
19
app/Models/Labels/Tapes/Brother/TZe_24mm.php
Normal file
19
app/Models/Labels/Tapes/Brother/TZe_24mm.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\Labels\Tapes\Brother;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\Label;
|
||||
|
||||
abstract class TZe_24mm extends Label
|
||||
{
|
||||
private const HEIGHT = 24.00;
|
||||
private const MARGIN_SIDES = 3.20;
|
||||
private const MARGIN_ENDS = 3.20;
|
||||
|
||||
public function getHeight() { return Helper::convertUnit(self::HEIGHT, 'mm', $this->getUnit()); }
|
||||
public function getMarginTop() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit()); }
|
||||
public function getMarginBottom() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit());}
|
||||
public function getMarginLeft() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); }
|
||||
public function getMarginRight() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); }
|
||||
}
|
69
app/Models/Labels/Tapes/Brother/TZe_24mm_A.php
Normal file
69
app/Models/Labels/Tapes/Brother/TZe_24mm_A.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\Labels\Tapes\Brother;
|
||||
|
||||
class TZe_24mm_A extends TZe_24mm
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.40;
|
||||
private const TITLE_SIZE = 2.80;
|
||||
private const TITLE_MARGIN = 0.60;
|
||||
private const LABEL_SIZE = 1.90;
|
||||
private const LABEL_MARGIN = - 0.30;
|
||||
private const FIELD_SIZE = 3.20;
|
||||
private const FIELD_MARGIN = 0.30;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
public function getWidth() { return 65.0; }
|
||||
public function getSupport1DBarcode() { return false; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 3; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getPrintableArea();
|
||||
|
||||
$x = $pa->x1;
|
||||
$y = $pa->y1;
|
||||
$w = $pa->w;
|
||||
|
||||
if ($record->has('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$x, $y, $pa->h, $pa->h
|
||||
);
|
||||
$x += $pa->h + self::BARCODE_MARGIN;
|
||||
$w -= $pa->h + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$x, $y,
|
||||
'freesans', '', self::TITLE_SIZE, 'L',
|
||||
$w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$y += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $label => $value) {
|
||||
static::writeText(
|
||||
$pdf, $label,
|
||||
$x, $y,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$w, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$y += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $value,
|
||||
$x, $y,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$w, self::FIELD_SIZE, true, 0, 0.3
|
||||
);
|
||||
$y += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue