@php $fmt = in_array(($format ?? '11354'), ['11354','99014'], true) ? $format : '11354'; $dymoFix = isset($dymoFix) ? (bool) $dymoFix : false; $dymoRot = isset($dymoRot) ? (int) $dymoRot : 0; $dymoDx = isset($dymoDx) ? (float) $dymoDx : 0.0; $dymoDy = isset($dymoDy) ? (float) $dymoDy : 0.0; $autoPrint = request()->has('autoprint') && filter_var(request()->query('autoprint'), FILTER_VALIDATE_BOOL); $labelPrinterMode = isset($labelPrinterMode) ? (bool) $labelPrinterMode : false; $pageWidth = $fmt === '99014' ? '54mm' : '57mm'; $pageHeight = $fmt === '99014' ? '101mm' : '32mm'; $template = is_array(data_get($item->metadati, 'generic_label_template')) ? data_get($item->metadati, 'generic_label_template') : []; $templateName = (string) ($template['template_name'] ?? 'classic-right'); $qrPosition = (string) ($template['qr_position'] ?? ($fmt === '99014' ? 'bottom-right' : 'right-center')); $qrScale = (string) ($template['qr_scale'] ?? ($fmt === '99014' ? 'lg' : 'md')); $isArchive99014 = $fmt === '99014' && $templateName === 'archive-99014'; $payload = [ 'mnemonic_code' => (string) ($template['mnemonic_code'] ?? ''), 'titolo' => (string) $item->titolo, 'linea_secondaria' => (string) data_get($item->metadati, 'linea_secondaria', ''), 'tipo_label' => (string) $item->tipo_label, 'supporto_fisico' => (string) ($item->supporto_fisico ?? ''), 'percorso_compatto' => (string) ($item->percorso_fisico ?? ''), 'ubicazione' => trim(implode(' · ', array_filter([$item->magazzino, $item->scaffale, $item->ripiano, $item->ubicazione_dettaglio]))), 'note' => (string) ($item->note ?? ''), 'stabile' => (string) ($item->stabile->denominazione ?? ''), 'stabile_code' => (string) ($item->stabile->codice_stabile ?? ''), 'stabile_address' => (string) ($item->stabile->indirizzo_completo ?? ''), 'stabile_summary' => trim(implode(' · ', array_filter([ (string) ($item->stabile->denominazione ?? ''), (string) ($item->stabile->codice_stabile ?? ''), (string) ($item->stabile->indirizzo_completo ?? ''), ]))), 'codice_univoco' => (string) $item->codice_univoco, 'amazon_url' => (string) data_get($item->metadati, 'amazon_url', ''), ]; $slotValue = static function (string $key, array $payload): string { if ($key === 'none') { return ''; } return trim((string) ($payload[$key] ?? '')); }; $titleText = $slotValue((string) ($template['title_source'] ?? 'titolo'), $payload); $subtitleText = $slotValue((string) ($template['subtitle_source'] ?? 'linea_secondaria'), $payload); $metaText = $slotValue((string) ($template['meta_source'] ?? 'percorso_compatto'), $payload); $noteText = $slotValue((string) ($template['note_source'] ?? 'note'), $payload); $stableLineValue = static function (string $key, array $payload): string { if ($key === 'none') { return ''; } if ($key === 'blank_line') { return '__BLANK_LINE__'; } return trim((string) ($payload[$key] ?? '')); }; $stableLines = [ $stableLineValue((string) ($template['stable_line_one_source'] ?? 'stabile_summary'), $payload), $stableLineValue((string) ($template['stable_line_two_source'] ?? 'blank_line'), $payload), ]; $blankLinesCount = max(0, min(4, (int) ($template['blank_lines_count'] ?? 2))); @endphp @if($autoPrint) @endif
@if($isArchive99014)
{{ $payload['mnemonic_code'] !== '' ? $payload['mnemonic_code'] : $item->codice_univoco }}
{{ $titleText !== '' ? $titleText : $item->titolo }}
@if($subtitleText !== '')
{{ $subtitleText }}
@endif
@foreach($stableLines as $stableLine) @if($stableLine === '__BLANK_LINE__')
@elseif($stableLine !== '')
{{ $stableLine }}
@endif @endforeach
@if($blankLinesCount > 0)
@for($line = 0; $line < $blankLinesCount; $line++)
@endfor
@endif @if($noteText !== '')
{{ $noteText }}
@endif
$qrScale === 'sm', 'qr-md' => $qrScale === 'md', 'qr-lg' => $qrScale === 'lg'])> {!! $item->qr_code_image !!}
QR
@else
$fmt === '99014', 'qr-right-top' => $qrPosition === 'right-top', 'qr-right-center' => $qrPosition === 'right-center', 'qr-bottom-right' => $qrPosition === 'bottom-right', 'qr-bottom-center' => $qrPosition === 'bottom-center', ])>
{{ $item->codice_univoco }}
{{ $titleText !== '' ? $titleText : $item->titolo }}
@if($subtitleText !== '')
Linea: {{ $subtitleText }}
@endif @if($metaText !== '')
Info: {{ $metaText }}
@endif
Tipo: {{ $item->tipo_label }}
@if($item->voce_numero || $item->voce_titolo)
Voce: {{ $item->voce_numero ? 'Voce ' . $item->voce_numero : '' }} {{ $item->voce_titolo }}
@endif @if($item->data_archiviazione)
Data: {{ $item->data_archiviazione->format('d-m-Y') }}
@endif @if($item->parent)
Dentro: {{ $item->parent->codice_univoco }}
@endif @if($item->documento)
Digitale: {{ $item->documento->nome_file ?: $item->documento->nome }}
@endif @if($noteText !== '')
Nota: {{ $noteText }}
@endif @if(data_get($item->metadati, 'amazon_url'))
Acquisto: {{ data_get($item->metadati, 'amazon_url') }}
@endif
{{ $item->percorso_fisico }}
$qrScale === 'sm', 'qr-md' => $qrScale === 'md', 'qr-lg' => $qrScale === 'lg'])> {!! $item->qr_code_image !!}
@endif