62 lines
3.2 KiB
PHP
62 lines
3.2 KiB
PHP
<?php
|
||
/** @var array $rows */
|
||
/** @var array $errors */
|
||
$fieldError = static fn (int $id): string => (string) ($errors['trailer_' . $id] ?? '');
|
||
?>
|
||
<div class="page-head page-head--compact">
|
||
<div>
|
||
<p class="eyebrow">Verwaltung</p>
|
||
<h1>Kühlanhänger</h1>
|
||
<p class="page-head__lede">Acht Anhänger, acht Farben. Bezeichnung und Farbe lassen sich anpassen – die Farbe steuert die Balken im Kalender.</p>
|
||
</div>
|
||
</div>
|
||
|
||
<?php require __DIR__ . '/_admin_nav.php'; ?>
|
||
|
||
<?php if ($errors): ?>
|
||
<div class="alert alert--error" role="alert">
|
||
<svg class="ico" aria-hidden="true"><use href="#i-alert"/></svg>
|
||
<div><strong>Bitte die markierten Anhänger prüfen.</strong>
|
||
<?php foreach ($errors as $message): ?><p><?= e($message) ?></p><?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<form method="post" action="<?= e(url('/admin/trailers')) ?>" class="panel">
|
||
<?= csrf_field() ?>
|
||
<div class="panel__head">
|
||
<div>
|
||
<h2>Anhänger & Farben</h2>
|
||
<p>Alle acht Anhänger bleiben gleichzeitig im Kalender sichtbar.</p>
|
||
</div>
|
||
<button class="btn primary" type="submit"><svg class="ico" aria-hidden="true"><use href="#i-check"/></svg> Speichern</button>
|
||
</div>
|
||
|
||
<div class="trailer-admin">
|
||
<div class="trailer-admin__head" aria-hidden="true">
|
||
<span>Farbe</span>
|
||
<span>Bezeichnung</span>
|
||
<span>Farbname</span>
|
||
<span>Sortierung</span>
|
||
<span>Vorschau</span>
|
||
</div>
|
||
<?php foreach ($rows as $row): ?>
|
||
<?php $id = (int) $row['id']; ?>
|
||
<div class="trailer-admin__row<?= $fieldError($id) !== '' ? ' has-error' : '' ?>">
|
||
<span class="trailer-admin__color">
|
||
<input type="color" value="<?= e($row['color_hex']) ?>" data-color-sync aria-label="Farbe für <?= e($row['label']) ?>">
|
||
<input type="text" name="color_hex[<?= $id ?>]" value="<?= e($row['color_hex']) ?>" maxlength="7" pattern="#[0-9a-fA-F]{6}" class="color-hex" data-color-text aria-label="Farbe als Hex-Wert">
|
||
</span>
|
||
<input type="text" name="label[<?= $id ?>]" value="<?= e($row['label']) ?>" maxlength="40" required aria-label="Bezeichnung">
|
||
<input type="text" name="color_name[<?= $id ?>]" value="<?= e($row['color_name']) ?>" maxlength="40" required aria-label="Farbname">
|
||
<input type="number" name="sort_order[<?= $id ?>]" value="<?= (int) $row['sort_order'] ?>" step="10" aria-label="Sortierung">
|
||
<span class="trailer-admin__preview" data-color-preview style="--trailer: <?= e($row['color_hex']) ?>; --trailer-text: <?= e(contrast_color($row['color_hex'])) ?>">
|
||
<span class="trailer-dot" style="--trailer: <?= e($row['color_hex']) ?>"></span>
|
||
<?= e($row['label']) ?>
|
||
</span>
|
||
<?php if ($fieldError($id)): ?><em class="field-error"><?= e($fieldError($id)) ?></em><?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<p class="muted small">Hinweis: Die Farbe wird bei allen Buchungen dieses Anhängers sofort übernommen. Der Buchungstext selbst bleibt unverändert.</p>
|
||
</form>
|