mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
adds custom field select to default label view
This commit is contained in:
parent
54552fc95c
commit
c62758c5b5
|
@ -27,7 +27,7 @@ class LabelsController extends Controller
|
||||||
public function show(string $labelName)
|
public function show(string $labelName)
|
||||||
{
|
{
|
||||||
$labelName = str_replace('/', '\\', $labelName);
|
$labelName = str_replace('/', '\\', $labelName);
|
||||||
$template = Label::find($labelName);
|
$template = Label::find($labelName);//
|
||||||
|
|
||||||
$exampleAsset = new Asset();
|
$exampleAsset = new Asset();
|
||||||
|
|
||||||
|
|
|
@ -162,62 +162,12 @@ class DefaultLabel extends RectangleSheet
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
$fieldsDone = 0;
|
$fieldsDone = 0;
|
||||||
|
|
||||||
if ($settings->labels_display_name && $fieldsDone < $this->getSupportFields()) {
|
if ($settings->labels_display_name && $fieldsDone < $this->getSupportFields()) {
|
||||||
|
foreach($record->get('fields') as $field)
|
||||||
if ($asset->name) {
|
if ($asset->name) {
|
||||||
static::writeText(
|
static::writeText(
|
||||||
$pdf, 'N: '.$asset->name,
|
$pdf, $field['label'][0].': '.$field['value'],
|
||||||
$textX1, $textY,
|
|
||||||
'freesans', '', $this->textSize, 'L',
|
|
||||||
$textW, $this->textSize,
|
|
||||||
true, 0
|
|
||||||
);
|
|
||||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
|
||||||
$fieldsDone++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($settings->labels_display_company_name && $fieldsDone < $this->getSupportFields()) {
|
|
||||||
if ($asset->company) {
|
|
||||||
static::writeText(
|
|
||||||
$pdf, 'C: '.$asset->company->name,
|
|
||||||
$textX1, $textY,
|
|
||||||
'freesans', '', $this->textSize, 'L',
|
|
||||||
$textW, $this->textSize,
|
|
||||||
true, 0
|
|
||||||
);
|
|
||||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
|
||||||
$fieldsDone++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($settings->labels_display_tag && $fieldsDone < $this->getSupportFields()) {
|
|
||||||
if ($asset->asset_tag) {
|
|
||||||
static::writeText(
|
|
||||||
$pdf, 'T: '.$asset->asset_tag,
|
|
||||||
$textX1, $textY,
|
|
||||||
'freesans', '', $this->textSize, 'L',
|
|
||||||
$textW, $this->textSize,
|
|
||||||
true, 0
|
|
||||||
);
|
|
||||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
|
||||||
$fieldsDone++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($settings->labels_display_serial && $fieldsDone < $this->getSupportFields()) {
|
|
||||||
if ($asset->serial) {
|
|
||||||
static::writeText(
|
|
||||||
$pdf, 'S: '.$asset->serial,
|
|
||||||
$textX1, $textY,
|
|
||||||
'freesans', '', $this->textSize, 'L',
|
|
||||||
$textW, $this->textSize,
|
|
||||||
true, 0
|
|
||||||
);
|
|
||||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
|
||||||
$fieldsDone++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($settings->labels_display_model && $fieldsDone < $this->getSupportFields()) {
|
|
||||||
if ($asset->model) {
|
|
||||||
static::writeText(
|
|
||||||
$pdf, 'M: '.$asset->model->name,
|
|
||||||
$textX1, $textY,
|
$textX1, $textY,
|
||||||
'freesans', '', $this->textSize, 'L',
|
'freesans', '', $this->textSize, 'L',
|
||||||
$textW, $this->textSize,
|
$textW, $this->textSize,
|
||||||
|
@ -227,8 +177,61 @@ class DefaultLabel extends RectangleSheet
|
||||||
$fieldsDone++;
|
$fieldsDone++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if ($settings->labels_display_company_name && $fieldsDone < $this->getSupportFields()) {
|
||||||
|
// if ($asset->company) {
|
||||||
|
// static::writeText(
|
||||||
|
// $pdf, 'C: '.$asset->company->name,
|
||||||
|
// $textX1, $textY,
|
||||||
|
// 'freesans', '', $this->textSize, 'L',
|
||||||
|
// $textW, $this->textSize,
|
||||||
|
// true, 0
|
||||||
|
// );
|
||||||
|
// $textY += $this->textSize + self::TEXT_MARGIN;
|
||||||
|
// $fieldsDone++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if ($settings->labels_display_tag && $fieldsDone < $this->getSupportFields()) {
|
||||||
|
// if ($asset->asset_tag) {
|
||||||
|
// static::writeText(
|
||||||
|
// $pdf, 'T: '.$asset->asset_tag,
|
||||||
|
// $textX1, $textY,
|
||||||
|
// 'freesans', '', $this->textSize, 'L',
|
||||||
|
// $textW, $this->textSize,
|
||||||
|
// true, 0
|
||||||
|
// );
|
||||||
|
// $textY += $this->textSize + self::TEXT_MARGIN;
|
||||||
|
// $fieldsDone++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if ($settings->labels_display_serial && $fieldsDone < $this->getSupportFields()) {
|
||||||
|
// if ($asset->serial) {
|
||||||
|
// static::writeText(
|
||||||
|
// $pdf, 'S: '.$asset->serial,
|
||||||
|
// $textX1, $textY,
|
||||||
|
// 'freesans', '', $this->textSize, 'L',
|
||||||
|
// $textW, $this->textSize,
|
||||||
|
// true, 0
|
||||||
|
// );
|
||||||
|
// $textY += $this->textSize + self::TEXT_MARGIN;
|
||||||
|
// $fieldsDone++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if ($settings->labels_display_model && $fieldsDone < $this->getSupportFields()) {
|
||||||
|
// if ($asset->model) {
|
||||||
|
// static::writeText(
|
||||||
|
// $pdf, 'M: '.$asset->model->name,
|
||||||
|
// $textX1, $textY,
|
||||||
|
// 'freesans', '', $this->textSize, 'L',
|
||||||
|
// $textW, $this->textSize,
|
||||||
|
// true, 0
|
||||||
|
// );
|
||||||
|
// $textY += $this->textSize + self::TEXT_MARGIN;
|
||||||
|
// $fieldsDone++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -37,6 +37,7 @@ class Label implements View
|
||||||
{
|
{
|
||||||
$settings = $this->data->get('settings');
|
$settings = $this->data->get('settings');
|
||||||
$assets = $this->data->get('assets');
|
$assets = $this->data->get('assets');
|
||||||
|
dd($this->data);
|
||||||
$offset = $this->data->get('offset');
|
$offset = $this->data->get('offset');
|
||||||
$template = $this->data->get('template');
|
$template = $this->data->get('template');
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@
|
||||||
{{ Form::hidden('label2_fields', old('label2_fields', $setting->label2_fields)) }}
|
{{ Form::hidden('label2_fields', old('label2_fields', $setting->label2_fields)) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($setting->label2_enable && ($setting->label2_template != 'DefaultLabel'))
|
@if ($setting->label2_enable)
|
||||||
<!-- Hidden version of legacy settings -->
|
<!-- Hidden version of legacy settings -->
|
||||||
{{ Form::hidden('labels_per_page', old('labels_per_page', $setting->labels_per_page)) }}
|
{{ Form::hidden('labels_per_page', old('labels_per_page', $setting->labels_per_page)) }}
|
||||||
{{ Form::hidden('labels_fontsize', old('labels_fontsize', $setting->labels_fontsize)) }}
|
{{ Form::hidden('labels_fontsize', old('labels_fontsize', $setting->labels_fontsize)) }}
|
||||||
|
|
Loading…
Reference in a new issue