Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-03-07 10:34:30 +00:00
commit 21ad7f549d
3 changed files with 8 additions and 63 deletions

View file

@ -162,10 +162,11 @@ class DefaultLabel extends RectangleSheet
// Fields // Fields
$fieldsDone = 0; $fieldsDone = 0;
if ($settings->labels_display_name && $fieldsDone < $this->getSupportFields()) { if ($fieldsDone < $this->getSupportFields()) {
if ($asset->name) { // dd($record->get('fields'));
foreach ($record->get('fields') as $field) {
static::writeText( static::writeText(
$pdf, 'N: '.$asset->name, $pdf, $field['label'][0]. ': ' . $field['value'],
$textX1, $textY, $textX1, $textY,
'freesans', '', $this->textSize, 'L', 'freesans', '', $this->textSize, 'L',
$textW, $this->textSize, $textW, $this->textSize,
@ -175,60 +176,8 @@ 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++;
}
}
} }
} }
?> ?>

View file

@ -146,7 +146,7 @@ class Label implements View
return $toAdd ? $myFields->push($toAdd) : $myFields; return $toAdd ? $myFields->push($toAdd) : $myFields;
}, new Collection()); }, new Collection());
$assetData->put('fields', $fields->take($template->getSupportFields())); $assetData->put('fields', $fields->take($template->getSupportFields()));
return $assetData; return $assetData;

View file

@ -255,7 +255,6 @@
{{ Form::hidden('labels_display_model', old('labels_display_model', $setting->labels_display_model)) }} {{ Form::hidden('labels_display_model', old('labels_display_model', $setting->labels_display_model)) }}
{{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }} {{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }}
@else @else
<!-- Legacy settings --> <!-- Legacy settings -->
<div class="form-group{{ $errors->has('labels_per_page') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('labels_per_page') ? ' has-error' : '' }}">
<div class="col-md-3 text-right"> <div class="col-md-3 text-right">
@ -378,7 +377,8 @@
{!! $errors->first('labels_pageheight', '<span class="alert-msg" aria-hidden="true">:message</span>') !!} {!! $errors->first('labels_pageheight', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div> </div>
</div> </div>
@endif
@if(!$setting->label2_enable)
<div class="form-group"> <div class="form-group">
<div class="col-md-3 text-right"> <div class="col-md-3 text-right">
{{ Form::label('labels_display', trans('admin/settings/general.label_fields'), ['class' => 'control-label']) }} {{ Form::label('labels_display', trans('admin/settings/general.label_fields'), ['class' => 'control-label']) }}
@ -404,13 +404,9 @@
{{ Form::checkbox('labels_display_company_name', '1', old('labels_display_company_name', $setting->labels_display_company_name),['class' => 'minimal', 'aria-label'=>'labels_display_company_name']) }} {{ Form::checkbox('labels_display_company_name', '1', old('labels_display_company_name', $setting->labels_display_company_name),['class' => 'minimal', 'aria-label'=>'labels_display_company_name']) }}
{{ trans('admin/companies/table.name') }} {{ trans('admin/companies/table.name') }}
</label> </label>
</div> <!--/.col-md-9--> </div> <!--/.col-md-9-->
</div> <!--/.form-group--> </div> <!--/.form-group-->
@endif @endif
</div> </div>
</div> <!--/.box-body--> </div> <!--/.box-body-->