Admin-Ausruestung: Filter-Formular nutzt url() statt undefiniertem $base (404 unter base_path)
This commit is contained in:
parent
a10272aa48
commit
4691f4413a
2 changed files with 26 additions and 6 deletions
|
|
@ -381,7 +381,12 @@ function page_handle(string $method, string $path): void
|
||||||
redirect('/admin/skills');
|
redirect('/admin/skills');
|
||||||
}
|
}
|
||||||
if ($path === '/admin/equipment') {
|
if ($path === '/admin/equipment') {
|
||||||
$catalogFilters = ['kind' => query_string('kind'), 'needle' => query_string('q'), 'limit' => 400];
|
$catalogFilters = [
|
||||||
|
'kind' => query_string('kind'),
|
||||||
|
'availability' => query_string('avail'),
|
||||||
|
'needle' => query_string('q'),
|
||||||
|
'limit' => 400,
|
||||||
|
];
|
||||||
render_page('admin_equipment', [
|
render_page('admin_equipment', [
|
||||||
'weapons' => weapons_catalog(),
|
'weapons' => weapons_catalog(),
|
||||||
'armors' => armors_catalog(),
|
'armors' => armors_catalog(),
|
||||||
|
|
|
||||||
|
|
@ -53,24 +53,27 @@
|
||||||
*
|
*
|
||||||
* @var list<array<string,mixed>> $itemCatalog
|
* @var list<array<string,mixed>> $itemCatalog
|
||||||
* @var int $itemCatalogCount
|
* @var int $itemCatalogCount
|
||||||
* @var array{kind:string,needle:string,limit:int} $itemFilters
|
* @var array{kind:string,availability:string,needle:string,limit:int} $itemFilters
|
||||||
*/
|
*/
|
||||||
$availabilityShort = ['methaven' => 'Methaven', 'garana' => 'Garana', 'selten' => 'selten'];
|
$availabilityShort = ['methaven' => 'Methaven', 'garana' => 'Garana', 'selten' => 'selten'];
|
||||||
|
// Basis-URL inkl. app.base_path – ohne sie zeigen die Formulare auf /admin/equipment statt
|
||||||
|
// auf /<base>/admin/equipment und der Filter landet im 404.
|
||||||
|
$base = url('/admin/equipment');
|
||||||
?>
|
?>
|
||||||
<section class="panel">
|
<section class="panel" id="katalog">
|
||||||
<h2>Ausrüstungskatalog</h2>
|
<h2>Ausrüstungskatalog</h2>
|
||||||
<p class="muted">
|
<p class="muted">
|
||||||
Quelle ist <code>data/item_catalog.csv</code> (dort kuratieren, dann
|
Quelle ist <code>data/item_catalog.csv</code> (dort kuratieren, dann
|
||||||
<code>python3 tools/build_item_catalog.py</code>). Preise in Silbertalern;
|
<code>python3 tools/build_item_catalog.py</code>). Preise in Silbertalern;
|
||||||
OSE-Goldmünzen sind 1:1 übernommen.
|
OSE-Goldmünzen sind 1:1 übernommen.
|
||||||
</p>
|
</p>
|
||||||
<form method="post" action="<?= e($base . '/admin/equipment/items/sync') ?>" class="inline-form" style="margin-bottom:.8rem">
|
<form method="post" action="<?= e($base . '/items/sync') ?>" class="inline-form" style="margin-bottom:.8rem">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<button class="btn btn-small" type="submit">Katalog aus der CSV neu einlesen</button>
|
<button class="btn btn-small" type="submit">Katalog aus der CSV neu einlesen</button>
|
||||||
<span class="muted"><?= (int) $itemCatalogCount ?> Gegenstände im Filter, <?= count($itemCatalog) ?> gelistet.</span>
|
<span class="muted"><?= (int) $itemCatalogCount ?> Gegenstände im Filter, <?= count($itemCatalog) ?> gelistet.</span>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form method="get" action="<?= e($base . '/admin/equipment') ?>" class="selector-filters">
|
<form method="get" action="<?= e($base . '#katalog') ?>" class="selector-filters">
|
||||||
<label class="field">
|
<label class="field">
|
||||||
<span>Suche</span>
|
<span>Suche</span>
|
||||||
<input type="search" name="q" value="<?= e($itemFilters['needle']) ?>" placeholder="Name oder Notiz …">
|
<input type="search" name="q" value="<?= e($itemFilters['needle']) ?>" placeholder="Name oder Notiz …">
|
||||||
|
|
@ -84,7 +87,19 @@ $availabilityShort = ['methaven' => 'Methaven', 'garana' => 'Garana', 'selten' =
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<button class="btn btn-small" type="submit">Filtern</button>
|
<label class="field">
|
||||||
|
<span>Verfügbarkeit</span>
|
||||||
|
<select name="avail">
|
||||||
|
<option value="">Alle (auch Seltenes)</option>
|
||||||
|
<?php foreach (WS_ITEM_AVAILABILITY as $availKey => $availLabel): ?>
|
||||||
|
<option value="<?= e($availKey) ?>"<?= $itemFilters['availability'] === $availKey ? ' selected' : '' ?>><?= e($availLabel) ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<div class="selector-filter-actions">
|
||||||
|
<button class="btn btn-small" type="submit">Filtern</button>
|
||||||
|
<a class="btn btn-small" href="<?= e($base . '#katalog') ?>">Zurücksetzen</a>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<table class="data">
|
<table class="data">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue