Anhänger anlegen standardmäßig einklappen
This commit is contained in:
parent
5ecbd29d21
commit
b05bda7c96
4 changed files with 90 additions and 59 deletions
|
|
@ -89,7 +89,7 @@ function url(string $path = '/'): string
|
|||
}
|
||||
|
||||
/** Cache-Buster: bei Änderungen an app.css/app.js erhöhen. */
|
||||
const DIC_ASSET_VERSION = '4';
|
||||
const DIC_ASSET_VERSION = '5';
|
||||
|
||||
function asset(string $path): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,69 +25,77 @@ $createError = static fn (string $key): string => (string) ($createErrors[$key]
|
|||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="card">
|
||||
<div class="card__head">
|
||||
<h2>Anhänger anlegen</h2>
|
||||
<p>Neue Anhänger stehen sofort im Kalender und in der Buchungsmaske zur Auswahl. Die Sortierung bestimmt die Reihenfolge der Zeilen.</p>
|
||||
</div>
|
||||
<details class="card create-trailer"<?= $createErrors ? ' open' : '' ?>>
|
||||
<summary class="create-trailer__summary">
|
||||
<span class="create-trailer__title">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg>
|
||||
Anhänger anlegen
|
||||
</span>
|
||||
<span class="create-trailer__hint">Nur bei Bedarf – z. B. für einen zusätzlichen Mietanhänger.</span>
|
||||
<svg class="ico create-trailer__chevron" aria-hidden="true"><use href="#i-right"/></svg>
|
||||
</summary>
|
||||
|
||||
<?php if ($createErrors): ?>
|
||||
<div class="alert alert--error" role="alert">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-alert"/></svg>
|
||||
<div><strong>Bitte die markierten Felder prüfen.</strong>
|
||||
<?php foreach ($createErrors as $message): ?><p><?= e($message) ?></p><?php endforeach; ?>
|
||||
<div class="create-trailer__body">
|
||||
<p class="muted small">Neue Anhänger stehen sofort im Kalender und in der Buchungsmaske zur Auswahl. Die Sortierung bestimmt die Reihenfolge der Zeilen.</p>
|
||||
|
||||
<?php if ($createErrors): ?>
|
||||
<div class="alert alert--error" role="alert" style="margin-top: 14px">
|
||||
<svg class="ico" aria-hidden="true"><use href="#i-alert"/></svg>
|
||||
<div><strong>Bitte die markierten Felder prüfen.</strong>
|
||||
<?php foreach ($createErrors as $message): ?><p><?= e($message) ?></p><?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="<?= e(url('/admin/trailers')) ?>" class="form-grid" data-color-row>
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="create">
|
||||
<form method="post" action="<?= e(url('/admin/trailers')) ?>" class="form-grid" data-color-row>
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="create">
|
||||
|
||||
<label class="field<?= $createError('label') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Bezeichnung</span>
|
||||
<input type="text" name="label" value="<?= e($createValues['label']) ?>" maxlength="40" required placeholder="z. B. Nr. 9">
|
||||
<?php if ($createError('label')): ?><em class="field-error"><?= e($createError('label')) ?></em><?php endif; ?>
|
||||
</label>
|
||||
|
||||
<label class="field<?= $createError('color_name') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Farbname</span>
|
||||
<input type="text" name="color_name" value="<?= e($createValues['color_name']) ?>" maxlength="40" required placeholder="z. B. Türkis">
|
||||
<?php if ($createError('color_name')): ?><em class="field-error"><?= e($createError('color_name')) ?></em><?php endif; ?>
|
||||
</label>
|
||||
|
||||
<div class="field<?= $createError('color_hex') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Farbe</span>
|
||||
<span class="trailer-admin__color">
|
||||
<input type="color" value="<?= e($createValues['color_hex']) ?>" data-color-sync aria-label="Farbe für den neuen Anhänger">
|
||||
<input type="text" name="color_hex" value="<?= e($createValues['color_hex']) ?>" maxlength="7" pattern="#[0-9a-fA-F]{6}" class="color-hex" data-color-text aria-label="Farbe als Hex-Wert">
|
||||
</span>
|
||||
<span class="trailer-admin__preview" data-color-preview style="--trailer: <?= e($createValues['color_hex']) ?>; --trailer-text: <?= e(contrast_color($createValues['color_hex'])) ?>">
|
||||
<span class="trailer-dot" style="--trailer: <?= e($createValues['color_hex']) ?>"></span>
|
||||
<span data-color-preview-label><?= e($createValues['label'] ?: 'Neuer Anhänger') ?></span>
|
||||
</span>
|
||||
<?php if ($createError('color_hex')): ?><em class="field-error"><?= e($createError('color_hex')) ?></em><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<label class="field">
|
||||
<span>Sortierung</span>
|
||||
<input type="number" name="sort_order" value="<?= (int) $createValues['sort_order'] ?>" step="10">
|
||||
</label>
|
||||
|
||||
<div class="field">
|
||||
<span>Status</span>
|
||||
<label class="check check--boxed">
|
||||
<input type="hidden" name="active" value="0">
|
||||
<input type="checkbox" name="active" value="1"<?= (int) $createValues['active'] === 1 ? ' checked' : '' ?>>
|
||||
<span>Anhänger ist aktiv</span>
|
||||
<label class="field<?= $createError('label') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Bezeichnung</span>
|
||||
<input type="text" name="label" value="<?= e($createValues['label']) ?>" maxlength="40" required placeholder="z. B. Nr. 9">
|
||||
<?php if ($createError('label')): ?><em class="field-error"><?= e($createError('label')) ?></em><?php endif; ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field field--wide">
|
||||
<button class="btn primary" type="submit"><svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Anhänger anlegen</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<label class="field<?= $createError('color_name') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Farbname</span>
|
||||
<input type="text" name="color_name" value="<?= e($createValues['color_name']) ?>" maxlength="40" required placeholder="z. B. Türkis">
|
||||
<?php if ($createError('color_name')): ?><em class="field-error"><?= e($createError('color_name')) ?></em><?php endif; ?>
|
||||
</label>
|
||||
|
||||
<div class="field<?= $createError('color_hex') !== '' ? ' has-error' : '' ?>">
|
||||
<span>Farbe</span>
|
||||
<span class="trailer-admin__color">
|
||||
<input type="color" value="<?= e($createValues['color_hex']) ?>" data-color-sync aria-label="Farbe für den neuen Anhänger">
|
||||
<input type="text" name="color_hex" value="<?= e($createValues['color_hex']) ?>" maxlength="7" pattern="#[0-9a-fA-F]{6}" class="color-hex" data-color-text aria-label="Farbe als Hex-Wert">
|
||||
</span>
|
||||
<span class="trailer-admin__preview" data-color-preview style="--trailer: <?= e($createValues['color_hex']) ?>; --trailer-text: <?= e(contrast_color($createValues['color_hex'])) ?>">
|
||||
<span class="trailer-dot" style="--trailer: <?= e($createValues['color_hex']) ?>"></span>
|
||||
<span data-color-preview-label><?= e($createValues['label'] ?: 'Neuer Anhänger') ?></span>
|
||||
</span>
|
||||
<?php if ($createError('color_hex')): ?><em class="field-error"><?= e($createError('color_hex')) ?></em><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<label class="field">
|
||||
<span>Sortierung</span>
|
||||
<input type="number" name="sort_order" value="<?= (int) $createValues['sort_order'] ?>" step="10">
|
||||
</label>
|
||||
|
||||
<div class="field">
|
||||
<span>Status</span>
|
||||
<label class="check check--boxed">
|
||||
<input type="hidden" name="active" value="0">
|
||||
<input type="checkbox" name="active" value="1"<?= (int) $createValues['active'] === 1 ? ' checked' : '' ?>>
|
||||
<span>Anhänger ist aktiv</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field field--wide">
|
||||
<button class="btn primary" type="submit"><svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Anhänger anlegen</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<form method="post" action="<?= e(url('/admin/trailers')) ?>" class="panel" style="margin-top: 16px">
|
||||
<?= csrf_field() ?>
|
||||
|
|
|
|||
|
|
@ -688,6 +688,26 @@ a .ico, button .ico { pointer-events: none; }
|
|||
.reminder-note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--ice-50); border: 1px solid var(--ice-200); color: var(--brand-800); font-size: .82rem; max-width: 900px; }
|
||||
|
||||
/* --------------------------------------------------------------- Admin */
|
||||
.create-trailer { padding: 0; overflow: hidden; }
|
||||
.create-trailer__summary {
|
||||
list-style: none; cursor: pointer;
|
||||
display: flex; align-items: center; gap: 11px;
|
||||
padding: 17px 22px;
|
||||
transition: background .15s;
|
||||
}
|
||||
.create-trailer__summary::-webkit-details-marker { display: none; }
|
||||
.create-trailer__summary:hover { background: var(--ice-50); }
|
||||
.create-trailer__title {
|
||||
display: inline-flex; align-items: center; gap: 8px;
|
||||
font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--ink);
|
||||
}
|
||||
.create-trailer__title .ico { color: var(--brand); }
|
||||
.create-trailer__hint { font-size: .8rem; color: var(--muted); }
|
||||
.create-trailer__chevron { margin-left: auto; color: var(--muted); transform: rotate(90deg); transition: transform .2s; }
|
||||
.create-trailer[open] .create-trailer__chevron { transform: rotate(-90deg); }
|
||||
.create-trailer__body { padding: 0 22px 22px; border-top: 1px solid var(--line-soft); }
|
||||
.create-trailer__body > .muted { padding-top: 14px; margin-bottom: 14px; }
|
||||
|
||||
.admin-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
|
||||
.admin-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; font-size: .84rem; font-weight: 600; color: var(--ink-2); }
|
||||
.admin-nav a:hover { background: var(--ice-50); color: var(--brand-700); }
|
||||
|
|
@ -881,6 +901,9 @@ a .ico, button .ico { pointer-events: none; }
|
|||
.trailer-admin__row > .link-button, .trailer-admin__row > .muted { grid-column: 1 / -1; }
|
||||
.trailer-admin__row input[type="number"] { width: 100%; }
|
||||
.admin-nav { overflow-x: auto; flex-wrap: nowrap; }
|
||||
.create-trailer__summary { padding: 14px 16px; }
|
||||
.create-trailer__hint { display: none; }
|
||||
.create-trailer__body { padding: 0 16px 16px; }
|
||||
.admin-nav a { flex: 0 0 auto; }
|
||||
.panel-head { padding: 16px 16px 12px; }
|
||||
.panel-head h2 { font-size: 1.15rem; }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* zwischengespeichert, damit niemand veraltete Buchungen sieht.
|
||||
*/
|
||||
|
||||
const VERSION = 'dic-v4';
|
||||
const VERSION = 'dic-v5';
|
||||
const CACHE = VERSION;
|
||||
const BASE = new URL(self.registration.scope).pathname.replace(/\/$/, '');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue