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);
|
||||
$metaText = $slotValue((string) ($template['meta_source'] ?? 'percorso_compatto'), $payload);
|
||||
$noteText = $slotValue((string) ($template['note_source'] ?? 'note'), $payload);
|
||||
$templateCode = trim((string) ($template['mnemonic_code'] ?? ''));
|
||||
$stableLineValue = static function (string $key, array $payload): string {
|
||||
if ($key === 'none') {
|
||||
return '';
|
||||
|
|
@ -61,10 +62,51 @@
|
|||
|
||||
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),
|
||||
];
|
||||
$templateLineRows = is_array($template['line_rows'] ?? null) && count($template['line_rows']) > 0
|
||||
? $template['line_rows']
|
||||
: [
|
||||
[
|
||||
'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)));
|
||||
@endphp
|
||||
<style>
|
||||
|
|
@ -352,7 +394,7 @@
|
|||
@if($isArchive99014)
|
||||
<div class="panel panel-99014 archive-99014">
|
||||
<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>
|
||||
@if($subtitleText !== '')
|
||||
<div class="archive-99014-subtitle">{{ $subtitleText }}</div>
|
||||
|
|
@ -398,36 +440,28 @@
|
|||
'qr-bottom-center' => $qrPosition === 'bottom-center',
|
||||
])>
|
||||
<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="meta">
|
||||
@if($subtitleText !== '')
|
||||
<div><strong>Linea:</strong> {{ $subtitleText }}</div>
|
||||
@endif
|
||||
@if($metaText !== '')
|
||||
<div><strong>Info:</strong> {{ $metaText }}</div>
|
||||
@endif
|
||||
<div><strong>Tipo:</strong> {{ $item->tipo_label }}</div>
|
||||
@if($item->voce_numero || $item->voce_titolo)
|
||||
<div><strong>Voce:</strong> {{ $item->voce_numero ? 'Voce ' . $item->voce_numero : '' }} {{ $item->voce_titolo }}</div>
|
||||
@endif
|
||||
@if($item->data_archiviazione)
|
||||
<div><strong>Data:</strong> {{ $item->data_archiviazione->format('d-m-Y') }}</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
|
||||
@if($noteText !== '')
|
||||
<div><strong>Nota:</strong> {{ $noteText }}</div>
|
||||
@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>
|
||||
@if($subtitleText !== '')
|
||||
<div class="meta">{{ $subtitleText }}</div>
|
||||
@endif
|
||||
@if($metaText !== '')
|
||||
<div class="meta">{{ $metaText }}</div>
|
||||
@endif
|
||||
@if($stableLines !== [])
|
||||
<div class="path">
|
||||
@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
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@if($noteText !== '')
|
||||
<div class="meta">{{ $noteText }}</div>
|
||||
@endif
|
||||
</div>
|
||||
<div @class(['qr', 'qr-sm' => $qrScale === 'sm', 'qr-md' => $qrScale === 'md', 'qr-lg' => $qrScale === 'lg'])>
|
||||
{!! $item->qr_code_image !!}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user