This commit is contained in:
@@ -10,6 +10,9 @@ $editing = isset($editEvent) && $editEvent !== null;
|
||||
$actionEvent = $editing ? 'event_update' : 'event_add';
|
||||
$startVal = $editEvent ? date('Y-m-d\TH:i', strtotime((string)$editEvent['starts_at'])) : '';
|
||||
$allowNoKidsChecked = $editEvent ? ((int)$editEvent['allow_kids'] === 0) : false;
|
||||
$editingChild = isset($editChild) && $editChild !== null;
|
||||
$childAction = $editingChild ? 'child_update' : 'child_add';
|
||||
$childModalTitle = $editingChild ? 'Kind bearbeiten' : 'Kind hinzufügen';
|
||||
$sectionLinks = [
|
||||
'profile' => 'Profil',
|
||||
'children' => 'Kinder',
|
||||
@@ -104,12 +107,37 @@ $sectionLinks = [
|
||||
<?php else: ?>
|
||||
<ul class="dash-list">
|
||||
<?php foreach ($children as $c): ?>
|
||||
<li><?= htmlspecialchars($c['first_name'], ENT_QUOTES) ?>, <?= htmlspecialchars($c['gender'], ENT_QUOTES) ?> <?= $c['age_years'] ? '(' . (int)$c['age_years'] . ' Jahre)' : '' ?></li>
|
||||
<li>
|
||||
<div style="display:flex; justify-content:space-between; gap:12px; align-items:flex-start; flex-wrap:wrap;">
|
||||
<div>
|
||||
<strong><?= htmlspecialchars($c['first_name'], ENT_QUOTES) ?></strong>,
|
||||
<?= htmlspecialchars($c['gender'], ENT_QUOTES) ?>
|
||||
<?= $c['age_years'] ? '(' . (int)$c['age_years'] . ' Jahre)' : '' ?>
|
||||
<?php if (!empty($c['birthdate'])): ?>
|
||||
<span class="muted small">· geboren am <?= htmlspecialchars(date('d.m.Y', strtotime((string)$c['birthdate'])), ENT_QUOTES) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($c['note'])): ?>
|
||||
<div class="muted small" style="margin-top:4px;"><?= htmlspecialchars($c['note'], ENT_QUOTES) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="flex gap-12" style="flex-wrap:wrap;">
|
||||
<a class="btn ghost" href="/dashboard?section=children&edit_child=<?= (int)$c['id'] ?>">Bearbeiten</a>
|
||||
<form method="post" action="/dashboard?section=children" onsubmit="return confirm('Kind wirklich löschen?');">
|
||||
<input type="hidden" name="action" value="child_delete">
|
||||
<input type="hidden" name="child_id" value="<?= (int)$c['id'] ?>">
|
||||
<button class="btn ghost" type="submit">Löschen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<div class="flex gap-12" style="margin-top:18px;">
|
||||
<button class="btn" type="button" data-modal-open="modalChild">Kind hinzufügen</button>
|
||||
<?php if ($editingChild): ?>
|
||||
<a class="btn ghost" href="/dashboard?section=children">Bearbeitung abbrechen</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -524,43 +552,46 @@ $sectionLinks = [
|
||||
<div class="modal" id="modalChild">
|
||||
<div class="panel">
|
||||
<div class="head flex between center-y">
|
||||
<h3>Kind hinzufügen</h3>
|
||||
<h3><?= htmlspecialchars($childModalTitle, ENT_QUOTES) ?></h3>
|
||||
<button class="btn ghost" type="button" data-modal-close>✕</button>
|
||||
</div>
|
||||
<form method="post" class="stack gap-12">
|
||||
<input type="hidden" name="action" value="child_add">
|
||||
<input type="hidden" name="action" value="<?= htmlspecialchars($childAction, ENT_QUOTES) ?>">
|
||||
<?php if ($editingChild): ?>
|
||||
<input type="hidden" name="child_id" value="<?= (int)$editChild['id'] ?>">
|
||||
<?php endif; ?>
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="cName">Vorname</label>
|
||||
<input id="cName" name="first_name" class="input" required>
|
||||
<input id="cName" name="first_name" class="input" value="<?= htmlspecialchars((string)($editChild['first_name'] ?? ''), ENT_QUOTES) ?>" required>
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="cGender">Geschlecht</label>
|
||||
<select id="cGender" name="gender" class="select">
|
||||
<option value="male">Männlich</option>
|
||||
<option value="female">Weiblich</option>
|
||||
<option value="diverse">Divers</option>
|
||||
<option value="unknown">Unbekannt</option>
|
||||
<option value="male" <?= (($editChild['gender'] ?? 'unknown') === 'male') ? 'selected' : '' ?>>Männlich</option>
|
||||
<option value="female" <?= (($editChild['gender'] ?? 'unknown') === 'female') ? 'selected' : '' ?>>Weiblich</option>
|
||||
<option value="diverse" <?= (($editChild['gender'] ?? 'unknown') === 'diverse') ? 'selected' : '' ?>>Divers</option>
|
||||
<option value="unknown" <?= (($editChild['gender'] ?? 'unknown') === 'unknown') ? 'selected' : '' ?>>Unbekannt</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="cBirth">Geburtsdatum</label>
|
||||
<input id="cBirth" name="birthdate" class="input" type="date">
|
||||
<input id="cBirth" name="birthdate" class="input" type="date" value="<?= htmlspecialchars((string)($editChild['birthdate'] ?? ''), ENT_QUOTES) ?>">
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="cAge">Alter (Jahre)</label>
|
||||
<input id="cAge" name="age_years" class="input" type="number" min="0" max="18">
|
||||
<input id="cAge" name="age_years" class="input" type="number" min="0" max="18" value="<?= htmlspecialchars((string)($editChild['age_years'] ?? ''), ENT_QUOTES) ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="cNote">Notiz</label>
|
||||
<input id="cNote" name="note" class="input">
|
||||
<input id="cNote" name="note" class="input" value="<?= htmlspecialchars((string)($editChild['note'] ?? ''), ENT_QUOTES) ?>">
|
||||
</div>
|
||||
<div class="flex gap-12">
|
||||
<button class="btn ghost" type="button" data-modal-close>Abbrechen</button>
|
||||
<button class="btn" type="submit">Speichern</button>
|
||||
<button class="btn" type="submit"><?= $editingChild ? 'Änderungen speichern' : 'Speichern' ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -840,6 +871,15 @@ $sectionLinks = [
|
||||
})();
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($editingChild): ?>
|
||||
(function(){
|
||||
const modal = document.getElementById('modalChild');
|
||||
if (modal) {
|
||||
modal.classList.add('open');
|
||||
}
|
||||
})();
|
||||
<?php endif; ?>
|
||||
|
||||
(function(){
|
||||
const statusText = document.getElementById('locationBrowserStatusText');
|
||||
const hintText = document.getElementById('locationBrowserStatusHint');
|
||||
|
||||
Reference in New Issue
Block a user