E-Mails und Druckvorlage im neuen Design
E-Mail:
- Nachrichten werden in ein markentreues HTML-Gerüst gelegt (Tabellen +
Inline-Styles, damit Outlook & Co. es zuverlässig darstellen); die
Kopfleiste nutzt den eingestellten Markenverlauf
- neuer Platzhalter {VOUCHER_CARD} rendert den Code als hervorgehobene
Karte; bestehende Vorlagen mit {VOUCHER_CODE} funktionieren unverändert
weiter, sie werden lediglich eingerahmt
- Zeilenumbrüche der Vorlage werden vor dem Einsetzen der Platzhalter
umgewandelt, Markup aus dem WYSIWYG-Editor bleibt unangetastet
Druck:
- neue Standardvorlage als Ticket mit QR-Code, Code, Gültigkeit und
Anleitung; zentral in Ui::defaultPrintTemplate()
- neuer Platzhalter {QR_CODE}; der QR-Code wird lokal im Browser erzeugt
(qrcodejs aus assets/vendor), auch bei Bulk-Erstellung für jede Karte
- die Druckvorlage ist am Bildschirm ausgeblendet und erscheint nur im
Ausdruck
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
7f1d93debd
commit
e28527ed91
8 changed files with 401 additions and 290 deletions
28
index.php
28
index.php
|
|
@ -75,7 +75,7 @@ $instructionHeader = $db->getSetting('instruction_header', '');
|
|||
$instructionText = $db->getSetting('instruction_text', '');
|
||||
$publicAccess = $db->getSetting('public_access', 0);
|
||||
$smtpEnabled = $db->getSetting('smtp_enabled', '0') === '1';
|
||||
$printTemplate = $db->getSetting('print_template', '<div style="text-align:center;padding:40px;font-family:sans-serif;"><h1>{APP_TITLE}</h1><h2>WLAN Zugangscode</h2><div style="font-size:48px;font-weight:bold;margin:30px 0;font-family:monospace;letter-spacing:4px;">{VOUCHER_CODE}</div><p><strong>Gültig bis:</strong> {EXPIRY_DATE} {EXPIRY_TIME}</p><p><strong>Standort:</strong> {SITE_NAME}</p><p><strong>Maximale Geräte:</strong> {MAX_USES}</p><hr style="margin:30px 0;"><div style="font-size:14px;text-align:left;">{INSTRUCTIONS}</div></div>');
|
||||
$printTemplate = $db->getSetting('print_template', Ui::defaultPrintTemplate());
|
||||
$defaultExpire = max(1, (int)$db->getSetting('default_expire_minutes', 480));
|
||||
$defaultMaxUses = max(1, (int)$db->getSetting('default_max_uses', 1));
|
||||
$maxUsesLimit = max(1, (int)$db->getSetting('max_uses_limit', 10));
|
||||
|
|
@ -272,9 +272,12 @@ function buildPrintCard($template, $data, $instructionHeader, $instructionText,
|
|||
$instructions = $instructionHeader || $instructionText
|
||||
? htmlspecialchars($instructionHeader) . "\n" . $instructionText
|
||||
: '';
|
||||
// {QR_CODE} wird erst im Browser gefuellt (siehe renderPrintQr()).
|
||||
$qr = '<div class="print-qr" data-code="' . htmlspecialchars(str_replace('-', '', (string)$data['code']), ENT_QUOTES) . '"></div>';
|
||||
|
||||
return str_replace(
|
||||
['{VOUCHER_CODE}', '{SITE_NAME}', '{MAX_USES}', '{APP_TITLE}', '{INSTRUCTIONS}', '{EXPIRY_DATE}', '{EXPIRY_TIME}'],
|
||||
[$data['code'], htmlspecialchars($data['site_name']), $data['max_uses'], htmlspecialchars($appTitle), $instructions, $data['expiry_date'], $data['expiry_time']],
|
||||
['{QR_CODE}', '{VOUCHER_CODE}', '{SITE_NAME}', '{MAX_USES}', '{APP_TITLE}', '{INSTRUCTIONS}', '{EXPIRY_DATE}', '{EXPIRY_TIME}'],
|
||||
[$qr, $data['code'], htmlspecialchars($data['site_name']), $data['max_uses'], htmlspecialchars($appTitle), $instructions, $data['expiry_date'], $data['expiry_time']],
|
||||
$template
|
||||
);
|
||||
}
|
||||
|
|
@ -289,7 +292,7 @@ function buildPrintCard($template, $data, $instructionHeader, $instructionText,
|
|||
<?php if ($captchaMode === 'hcaptcha' && $hcaptchaSiteKey !== ''): ?>
|
||||
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
||||
<?php endif; ?>
|
||||
<?php if ($voucherCreated): ?>
|
||||
<?php if ($voucherCreated || $bulkCreated): ?>
|
||||
<?= Ui::script('assets/vendor/qrcodejs/qrcode.min.js') ?>
|
||||
<?php endif; ?>
|
||||
<style>
|
||||
|
|
@ -635,6 +638,23 @@ function buildPrintCard($template, $data, $instructionHeader, $instructionText,
|
|||
<div id="toast-container" role="status" aria-live="polite"></div>
|
||||
<script src="assets/global.js"></script>
|
||||
<script>
|
||||
<?php if ($voucherCreated || $bulkCreated): ?>
|
||||
// QR-Codes der Druckkarten erzeugen (im Browser, ohne externen Dienst)
|
||||
function renderPrintQr() {
|
||||
document.querySelectorAll('.print-qr').forEach(function (el) {
|
||||
if (el.dataset.done) return;
|
||||
el.dataset.done = '1';
|
||||
new QRCode(el, {
|
||||
text: el.dataset.code || '',
|
||||
width: 132, height: 132,
|
||||
colorDark: '#101625', colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.M
|
||||
});
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', renderPrintQr);
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($voucherCreated): ?>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
new QRCode(document.getElementById('qrcode'), {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue