82 lines
4 KiB
PHP
82 lines
4 KiB
PHP
|
|
<?php
|
|||
|
|
/** @var string|null $signatureTime */
|
|||
|
|
/** @var bool $hasSignature */
|
|||
|
|
/** @var array<string, string> $errors */
|
|||
|
|
/** @var array<string, mixed> $legal */
|
|||
|
|
/** @var int $depositDueDays */
|
|||
|
|
$error = static fn (string $key): string => (string) ($errors[$key] ?? '');
|
|||
|
|
$place = trim((string) ($legal['city'] ?? ''));
|
|||
|
|
$owner = trim((string) ($legal['owner'] ?? '')) !== '' ? (string) $legal['owner'] : (string) ($legal['business_name'] ?? '');
|
|||
|
|
?>
|
|||
|
|
<div class="page-head page-head--compact">
|
|||
|
|
<div>
|
|||
|
|
<p class="eyebrow">Verwaltung</p>
|
|||
|
|
<h1>Einstellungen</h1>
|
|||
|
|
<p class="page-head__lede">Unterschrift des Vermieters für die Auftragsbestätigung. Sie wird einmal
|
|||
|
|
hinterlegt und in jede neu erzeugte Auftragsbestätigung eingesetzt – zusammen mit Ort und Datum.</p>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<?php require __DIR__ . '/_admin_nav.php'; ?>
|
|||
|
|
|
|||
|
|
<?php if ($error('general') !== ''): ?>
|
|||
|
|
<div class="alert alert--error" role="alert">
|
|||
|
|
<svg class="ico" aria-hidden="true"><use href="#i-alert"/></svg>
|
|||
|
|
<div><strong>Das hat nicht geklappt.</strong><p><?= e($error('general')) ?></p></div>
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
|
|||
|
|
<section class="panel">
|
|||
|
|
<div class="panel__head">
|
|||
|
|
<div>
|
|||
|
|
<h2>Unterschrift des Vermieters</h2>
|
|||
|
|
<p><?= $hasSignature
|
|||
|
|
? 'Hinterlegt' . ($signatureTime !== null ? ' seit ' . e(fmt_datetime($signatureTime)) : '') . '. Neue Auftragsbestätigungen enthalten sie im Feld „Unterschrift Vermieter“.'
|
|||
|
|
: 'Noch keine Unterschrift hinterlegt – die Auftragsbestätigung bleibt im Unterschriftenfeld leer.' ?></p>
|
|||
|
|
</div>
|
|||
|
|
<?php if ($hasSignature): ?>
|
|||
|
|
<div class="panel__actions">
|
|||
|
|
<form method="post" action="<?= e(url('/admin/settings')) ?>" data-confirm="Hinterlegte Unterschrift entfernen?">
|
|||
|
|
<?= csrf_field() ?>
|
|||
|
|
<input type="hidden" name="action" value="delete_signature">
|
|||
|
|
<button class="btn small danger-ghost" type="submit">
|
|||
|
|
<svg class="ico" aria-hidden="true"><use href="#i-trash"/></svg> Unterschrift entfernen
|
|||
|
|
</button>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-grid">
|
|||
|
|
<div class="field">
|
|||
|
|
<span>Aktuell hinterlegt</span>
|
|||
|
|
<?php if ($hasSignature): ?>
|
|||
|
|
<img class="signature-preview" src="<?= e(url('/admin/settings/signature')) ?>" alt="Hinterlegte Unterschrift von <?= e($owner) ?>">
|
|||
|
|
<?php else: ?>
|
|||
|
|
<p class="muted small">– keine –</p>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
<em class="muted small">Ort und Datum setzt die Auftragsbestätigung automatisch:
|
|||
|
|
<strong><?= e(trim($place . ', ' . fmt_date(today_iso()), ', ')) ?></strong>.</em>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="field">
|
|||
|
|
<span>Neue Unterschrift zeichnen</span>
|
|||
|
|
<form method="post" action="<?= e(url('/admin/settings')) ?>" data-signature-form>
|
|||
|
|
<?= csrf_field() ?>
|
|||
|
|
<input type="hidden" name="action" value="save_signature">
|
|||
|
|
<input type="hidden" name="signature" value="" data-signature-input>
|
|||
|
|
<div class="sign-pad" data-signature-pad>
|
|||
|
|
<canvas width="900" height="300" data-signature-canvas aria-label="Unterschriftfläche"></canvas>
|
|||
|
|
<p class="sign-pad__hint">Hier mit Maus oder Finger unterschreiben</p>
|
|||
|
|
</div>
|
|||
|
|
<div class="sign-actions">
|
|||
|
|
<button type="button" class="btn" data-signature-clear>Leeren</button>
|
|||
|
|
<button type="submit" class="btn primary" data-signature-submit disabled>Unterschrift speichern</button>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
<em class="muted small">Gilt ab sofort für alle <strong>neu</strong> erzeugten Auftragsbestätigungen;
|
|||
|
|
bereits erzeugte PDFs bleiben unverändert.</em>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</section>
|