kategorie
All checks were successful
Deploy / deploy (push) Successful in 55s

This commit is contained in:
2026-08-19 20:51:09 +02:00
parent adb41791d9
commit b0d80e209c

View File

@@ -965,16 +965,15 @@ if (!empty($canManageSystemSettings)) {
<?php endforeach; ?> <?php endforeach; ?>
</datalist> </datalist>
<div class="card" style="margin-bottom:18px;"> <div class="card" style="margin-bottom:22px; padding:18px 20px;">
<form method="get" class="stack gap-12"> <form method="get" class="stack gap-12">
<input type="hidden" name="section" value="categories"> <input type="hidden" name="section" value="categories">
<div class="form-grid"> <div style="display:grid; grid-template-columns:minmax(0, 1fr) minmax(160px, 220px); gap:14px; align-items:end;">
<div class="stack gap-6"> <div class="stack gap-6">
<label class="label" for="categoryQuery">Kategorie suchen</label> <label class="label" for="categoryQuery">Kategorie suchen</label>
<input id="categoryQuery" name="category_query" class="input" value="<?= htmlspecialchars((string)($categorySearchQuery ?? ''), ENT_QUOTES) ?>" list="categoryMergeSuggestions"> <input id="categoryQuery" name="category_query" class="input" value="<?= htmlspecialchars((string)($categorySearchQuery ?? ''), ENT_QUOTES) ?>" list="categoryMergeSuggestions">
</div> </div>
<div class="stack gap-6" style="justify-content:end;"> <div>
<span class="label" aria-hidden="true">&nbsp;</span>
<button class="btn" type="submit">Suchen</button> <button class="btn" type="submit">Suchen</button>
</div> </div>
</div> </div>
@@ -982,12 +981,12 @@ if (!empty($canManageSystemSettings)) {
</div> </div>
<?php if (($categorySearchQuery ?? '') !== ''): ?> <?php if (($categorySearchQuery ?? '') !== ''): ?>
<div class="card" style="margin-bottom:18px;"> <div class="card" style="margin-bottom:22px; padding:18px 20px;">
<strong>Suchergebnisse</strong> <strong>Suchergebnisse</strong>
<?php if (!empty($categorySearchResults)): ?> <?php if (!empty($categorySearchResults)): ?>
<div class="stack gap-10" style="margin-top:12px;"> <div class="stack gap-12" style="margin-top:16px;">
<?php foreach ($categorySearchResults as $categoryItem): ?> <?php foreach ($categorySearchResults as $categoryItem): ?>
<div class="card" style="padding:12px;"> <div class="card" style="padding:16px 18px;">
<div> <div>
<strong><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></strong> <strong><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></strong>
<?php if (!empty($categoryItem['needs_review'])): ?> <?php if (!empty($categoryItem['needs_review'])): ?>
@@ -997,7 +996,7 @@ if (!empty($canManageSystemSettings)) {
Slug: <?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?> · Einträge: <?= (int)($categoryItem['listing_count'] ?? 0) ?> · Orte: <?= (int)($categoryItem['place_count'] ?? 0) ?> · Eigene Events: <?= (int)($categoryItem['event_count'] ?? 0) ?> Slug: <?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?> · Einträge: <?= (int)($categoryItem['listing_count'] ?? 0) ?> · Orte: <?= (int)($categoryItem['place_count'] ?? 0) ?> · Eigene Events: <?= (int)($categoryItem['event_count'] ?? 0) ?>
</div> </div>
</div> </div>
<form method="post" class="stack gap-8" style="margin-top:12px;"> <form method="post" class="stack gap-12" style="margin-top:16px;">
<input type="hidden" name="action" value="category_merge"> <input type="hidden" name="action" value="category_merge">
<input type="hidden" name="current_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>"> <input type="hidden" name="current_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>">
<div class="stack gap-6"> <div class="stack gap-6">
@@ -1008,6 +1007,7 @@ if (!empty($canManageSystemSettings)) {
class="input" class="input"
list="categoryMergeSuggestions" list="categoryMergeSuggestions"
placeholder="Kategorie suchen" placeholder="Kategorie suchen"
data-category-keep-input="#keepCategorySearchChoice<?= (int)($categoryItem['id'] ?? 0) ?> option[value='other']"
required required
> >
</div> </div>
@@ -1015,15 +1015,15 @@ if (!empty($canManageSystemSettings)) {
<label class="label" for="keepCategorySearchChoice<?= (int)($categoryItem['id'] ?? 0) ?>">Behalten</label> <label class="label" for="keepCategorySearchChoice<?= (int)($categoryItem['id'] ?? 0) ?>">Behalten</label>
<select id="keepCategorySearchChoice<?= (int)($categoryItem['id'] ?? 0) ?>" name="keep_category_choice" class="select"> <select id="keepCategorySearchChoice<?= (int)($categoryItem['id'] ?? 0) ?>" name="keep_category_choice" class="select">
<option value="current"><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></option> <option value="current"><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></option>
<option value="other">Ausgewählte zweite Kategorie</option> <option value="other">Zweite Kategorie</option>
</select> </select>
</div> </div>
<div class="flex gap-8" style="flex-wrap:wrap;"> <div class="flex gap-10" style="flex-wrap:wrap; padding-top:4px;">
<button class="btn ghost" type="submit">Zusammenführen</button> <button class="btn ghost" type="submit">Zusammenführen</button>
</div> </div>
</form> </form>
<?php if (!empty($categoryItem['needs_review'])): ?> <?php if (!empty($categoryItem['needs_review'])): ?>
<form method="post" style="margin-top:12px;"> <form method="post" style="margin-top:16px;">
<input type="hidden" name="action" value="category_confirm"> <input type="hidden" name="action" value="category_confirm">
<input type="hidden" name="source_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>"> <input type="hidden" name="source_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>">
<button class="btn" type="submit">Bestätigen</button> <button class="btn" type="submit">Bestätigen</button>
@@ -1039,9 +1039,9 @@ if (!empty($canManageSystemSettings)) {
<?php endif; ?> <?php endif; ?>
<?php if (!empty($categoryReviewItems)): ?> <?php if (!empty($categoryReviewItems)): ?>
<div class="stack gap-10"> <div class="stack gap-12">
<?php foreach ($categoryReviewItems as $categoryItem): ?> <?php foreach ($categoryReviewItems as $categoryItem): ?>
<div class="card" style="padding:12px;"> <div class="card" style="padding:16px 18px;">
<div> <div>
<strong><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></strong> <strong><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></strong>
<span class="badge" style="margin-left:8px;">Neu</span> <span class="badge" style="margin-left:8px;">Neu</span>
@@ -1049,7 +1049,7 @@ if (!empty($canManageSystemSettings)) {
Slug: <?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?> · Einträge: <?= (int)($categoryItem['listing_count'] ?? 0) ?> · Orte: <?= (int)($categoryItem['place_count'] ?? 0) ?> · Eigene Events: <?= (int)($categoryItem['event_count'] ?? 0) ?> Slug: <?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?> · Einträge: <?= (int)($categoryItem['listing_count'] ?? 0) ?> · Orte: <?= (int)($categoryItem['place_count'] ?? 0) ?> · Eigene Events: <?= (int)($categoryItem['event_count'] ?? 0) ?>
</div> </div>
</div> </div>
<form method="post" class="stack gap-8" style="margin-top:12px;"> <form method="post" class="stack gap-12" style="margin-top:16px;">
<input type="hidden" name="action" value="category_merge"> <input type="hidden" name="action" value="category_merge">
<input type="hidden" name="current_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>"> <input type="hidden" name="current_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>">
<div class="stack gap-6"> <div class="stack gap-6">
@@ -1060,6 +1060,7 @@ if (!empty($canManageSystemSettings)) {
class="input" class="input"
list="categoryMergeSuggestions" list="categoryMergeSuggestions"
placeholder="Kategorie suchen" placeholder="Kategorie suchen"
data-category-keep-input="#keepCategoryChoice<?= (int)($categoryItem['id'] ?? 0) ?> option[value='other']"
required required
> >
</div> </div>
@@ -1067,14 +1068,14 @@ if (!empty($canManageSystemSettings)) {
<label class="label" for="keepCategoryChoice<?= (int)($categoryItem['id'] ?? 0) ?>">Behalten</label> <label class="label" for="keepCategoryChoice<?= (int)($categoryItem['id'] ?? 0) ?>">Behalten</label>
<select id="keepCategoryChoice<?= (int)($categoryItem['id'] ?? 0) ?>" name="keep_category_choice" class="select"> <select id="keepCategoryChoice<?= (int)($categoryItem['id'] ?? 0) ?>" name="keep_category_choice" class="select">
<option value="current"><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></option> <option value="current"><?= htmlspecialchars((string)$categoryItem['title'], ENT_QUOTES) ?></option>
<option value="other">Ausgewählte zweite Kategorie</option> <option value="other">Zweite Kategorie</option>
</select> </select>
</div> </div>
<div class="flex gap-8" style="flex-wrap:wrap;"> <div class="flex gap-10" style="flex-wrap:wrap; padding-top:4px;">
<button class="btn ghost" type="submit">Zusammenführen</button> <button class="btn ghost" type="submit">Zusammenführen</button>
</div> </div>
</form> </form>
<form method="post" style="margin-top:12px;"> <form method="post" style="margin-top:16px;">
<input type="hidden" name="action" value="category_confirm"> <input type="hidden" name="action" value="category_confirm">
<input type="hidden" name="source_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>"> <input type="hidden" name="source_category_slug" value="<?= htmlspecialchars((string)$categoryItem['slug'], ENT_QUOTES) ?>">
<button class="btn" type="submit">Bestätigen</button> <button class="btn" type="submit">Bestätigen</button>
@@ -1881,6 +1882,22 @@ if (!empty($canManageSystemSettings)) {
const allEventLocationOptions = <?= json_encode($eventLocationOptions ?? [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>; const allEventLocationOptions = <?= json_encode($eventLocationOptions ?? [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>;
function syncCategoryKeepLabels() {
document.querySelectorAll('[data-category-keep-input]').forEach((input) => {
const optionSelector = input.getAttribute('data-category-keep-input');
const option = optionSelector ? document.querySelector(optionSelector) : null;
if (!option) return;
const currentValue = (input.value || '').trim();
option.textContent = currentValue !== '' ? currentValue : 'Zweite Kategorie';
});
}
document.querySelectorAll('[data-category-keep-input]').forEach((input) => {
input.addEventListener('input', syncCategoryKeepLabels);
input.addEventListener('change', syncCategoryKeepLabels);
});
syncCategoryKeepLabels();
function buildEventLocationLabel(option) { function buildEventLocationLabel(option) {
if (!option) return ''; if (!option) return '';
const addressLabel = [String(option.street || ''), `${String(option.zip || '')} ${String(option.city || '')}`.trim()] const addressLabel = [String(option.street || ''), `${String(option.zip || '')} ${String(option.city || '')}`.trim()]