fix: align generic label print and settings storage
This commit is contained in:
parent
9e6c3958d6
commit
59db92713a
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if (! Schema::hasTable('impostazioni')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$driver = DB::getDriverName();
|
||||||
|
|
||||||
|
if ($driver === 'mysql') {
|
||||||
|
DB::statement('ALTER TABLE `impostazioni` MODIFY `valore` LONGTEXT NULL');
|
||||||
|
DB::statement('ALTER TABLE `impostazioni` MODIFY `descrizione` TEXT NULL');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($driver === 'sqlite') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
if (! Schema::hasTable('impostazioni')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$driver = DB::getDriverName();
|
||||||
|
|
||||||
|
if ($driver === 'mysql') {
|
||||||
|
DB::statement('ALTER TABLE `impostazioni` MODIFY `valore` VARCHAR(255) NULL');
|
||||||
|
DB::statement('ALTER TABLE `impostazioni` MODIFY `descrizione` VARCHAR(255) NULL');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($driver === 'sqlite') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
$subtitleText = $slotValue((string) ($template['subtitle_source'] ?? 'linea_secondaria'), $payload);
|
$subtitleText = $slotValue((string) ($template['subtitle_source'] ?? 'linea_secondaria'), $payload);
|
||||||
$metaText = $slotValue((string) ($template['meta_source'] ?? 'percorso_compatto'), $payload);
|
$metaText = $slotValue((string) ($template['meta_source'] ?? 'percorso_compatto'), $payload);
|
||||||
$noteText = $slotValue((string) ($template['note_source'] ?? 'note'), $payload);
|
$noteText = $slotValue((string) ($template['note_source'] ?? 'note'), $payload);
|
||||||
|
$templateCode = trim((string) ($template['mnemonic_code'] ?? ''));
|
||||||
$stableLineValue = static function (string $key, array $payload): string {
|
$stableLineValue = static function (string $key, array $payload): string {
|
||||||
if ($key === 'none') {
|
if ($key === 'none') {
|
||||||
return '';
|
return '';
|
||||||
|
|
@ -61,10 +62,51 @@
|
||||||
|
|
||||||
return trim((string) ($payload[$key] ?? ''));
|
return trim((string) ($payload[$key] ?? ''));
|
||||||
};
|
};
|
||||||
$stableLines = [
|
$templateLineRows = is_array($template['line_rows'] ?? null) && count($template['line_rows']) > 0
|
||||||
$stableLineValue((string) ($template['stable_line_one_source'] ?? 'stabile_summary'), $payload),
|
? $template['line_rows']
|
||||||
$stableLineValue((string) ($template['stable_line_two_source'] ?? 'blank_line'), $payload),
|
: [
|
||||||
|
[
|
||||||
|
'mode' => 'source',
|
||||||
|
'source' => (string) ($template['stable_line_one_source'] ?? 'stabile_summary'),
|
||||||
|
'text' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'mode' => ((string) ($template['stable_line_two_source'] ?? 'blank_line')) === 'blank_line' ? 'blank_line' : 'source',
|
||||||
|
'source' => (string) ($template['stable_line_two_source'] ?? 'blank_line'),
|
||||||
|
'text' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'mode' => ((int) ($template['blank_lines_count'] ?? 0)) >= 1 ? 'blank_line' : 'none',
|
||||||
|
'source' => 'none',
|
||||||
|
'text' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'mode' => ((int) ($template['blank_lines_count'] ?? 0)) >= 2 ? 'blank_line' : 'none',
|
||||||
|
'source' => 'none',
|
||||||
|
'text' => '',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
$stableLines = [];
|
||||||
|
foreach ($templateLineRows as $lineRow) {
|
||||||
|
if (! is_array($lineRow)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mode = (string) ($lineRow['mode'] ?? 'none');
|
||||||
|
if ($mode === 'blank_line') {
|
||||||
|
$stableLines[] = '__BLANK_LINE__';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode === 'text') {
|
||||||
|
$stableLines[] = trim((string) ($lineRow['text'] ?? ''));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode === 'source') {
|
||||||
|
$stableLines[] = $stableLineValue((string) ($lineRow['source'] ?? 'none'), $payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
$blankLinesCount = max(0, min(4, (int) ($template['blank_lines_count'] ?? 2)));
|
$blankLinesCount = max(0, min(4, (int) ($template['blank_lines_count'] ?? 2)));
|
||||||
@endphp
|
@endphp
|
||||||
<style>
|
<style>
|
||||||
|
|
@ -352,7 +394,7 @@
|
||||||
@if($isArchive99014)
|
@if($isArchive99014)
|
||||||
<div class="panel panel-99014 archive-99014">
|
<div class="panel panel-99014 archive-99014">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="archive-99014-code">{{ $payload['mnemonic_code'] !== '' ? $payload['mnemonic_code'] : $item->codice_univoco }}</div>
|
<div class="archive-99014-code">{{ $templateCode !== '' ? $templateCode : $item->codice_univoco }}</div>
|
||||||
<div class="archive-99014-title">{{ $titleText !== '' ? $titleText : $item->titolo }}</div>
|
<div class="archive-99014-title">{{ $titleText !== '' ? $titleText : $item->titolo }}</div>
|
||||||
@if($subtitleText !== '')
|
@if($subtitleText !== '')
|
||||||
<div class="archive-99014-subtitle">{{ $subtitleText }}</div>
|
<div class="archive-99014-subtitle">{{ $subtitleText }}</div>
|
||||||
|
|
@ -398,36 +440,28 @@
|
||||||
'qr-bottom-center' => $qrPosition === 'bottom-center',
|
'qr-bottom-center' => $qrPosition === 'bottom-center',
|
||||||
])>
|
])>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="code">{{ $item->codice_univoco }}</div>
|
<div class="code">{{ $templateCode !== '' ? $templateCode : $item->codice_univoco }}</div>
|
||||||
<div class="title">{{ $titleText !== '' ? $titleText : $item->titolo }}</div>
|
<div class="title">{{ $titleText !== '' ? $titleText : $item->titolo }}</div>
|
||||||
<div class="meta">
|
|
||||||
@if($subtitleText !== '')
|
@if($subtitleText !== '')
|
||||||
<div><strong>Linea:</strong> {{ $subtitleText }}</div>
|
<div class="meta">{{ $subtitleText }}</div>
|
||||||
@endif
|
@endif
|
||||||
@if($metaText !== '')
|
@if($metaText !== '')
|
||||||
<div><strong>Info:</strong> {{ $metaText }}</div>
|
<div class="meta">{{ $metaText }}</div>
|
||||||
@endif
|
@endif
|
||||||
<div><strong>Tipo:</strong> {{ $item->tipo_label }}</div>
|
@if($stableLines !== [])
|
||||||
@if($item->voce_numero || $item->voce_titolo)
|
<div class="path">
|
||||||
<div><strong>Voce:</strong> {{ $item->voce_numero ? 'Voce ' . $item->voce_numero : '' }} {{ $item->voce_titolo }}</div>
|
@foreach($stableLines as $stableLine)
|
||||||
|
@if($stableLine === '__BLANK_LINE__')
|
||||||
|
<div style="height: 4.5mm; border-bottom: 0.25mm solid #999;"></div>
|
||||||
|
@elseif($stableLine !== '')
|
||||||
|
<div>{{ $stableLine }}</div>
|
||||||
@endif
|
@endif
|
||||||
@if($item->data_archiviazione)
|
@endforeach
|
||||||
<div><strong>Data:</strong> {{ $item->data_archiviazione->format('d-m-Y') }}</div>
|
</div>
|
||||||
@endif
|
|
||||||
@if($item->parent)
|
|
||||||
<div><strong>Dentro:</strong> {{ $item->parent->codice_univoco }}</div>
|
|
||||||
@endif
|
|
||||||
@if($item->documento)
|
|
||||||
<div><strong>Digitale:</strong> {{ $item->documento->nome_file ?: $item->documento->nome }}</div>
|
|
||||||
@endif
|
@endif
|
||||||
@if($noteText !== '')
|
@if($noteText !== '')
|
||||||
<div><strong>Nota:</strong> {{ $noteText }}</div>
|
<div class="meta">{{ $noteText }}</div>
|
||||||
@endif
|
@endif
|
||||||
@if(data_get($item->metadati, 'amazon_url'))
|
|
||||||
<div><strong>Acquisto:</strong> {{ data_get($item->metadati, 'amazon_url') }}</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
<div class="path">{{ $item->percorso_fisico }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div @class(['qr', 'qr-sm' => $qrScale === 'sm', 'qr-md' => $qrScale === 'md', 'qr-lg' => $qrScale === 'lg'])>
|
<div @class(['qr', 'qr-sm' => $qrScale === 'sm', 'qr-md' => $qrScale === 'md', 'qr-lg' => $qrScale === 'lg'])>
|
||||||
{!! $item->qr_code_image !!}
|
{!! $item->qr_code_image !!}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user