rpg-westreiche/westreiche_website/views/admin_skills.php

65 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/** @var array $skills */
/** @var string $error */
?>
<div class="page-head">
<div>
<h1>Fertigkeiten-Katalog</h1>
<p class="lede">Der Katalog entspricht dem Charakterbogen (Körper, Wildnis, Sozial, Wissen). Eigene Fertigkeiten lassen sich zusätzlich im Bogen eintragen.</p>
</div>
<a class="btn btn-ghost" href="<?= e(url('/admin/users')) ?>">Zurück</a>
</div>
<?php if ($error !== ''): ?>
<p class="alert alert-error"><?= e($error) ?></p>
<?php endif; ?>
<section class="panel">
<h2>Neue Fertigkeit</h2>
<form method="post" action="<?= e(url('/admin/skills')) ?>" class="inline-form">
<?= csrf_field() ?>
<label class="field grow">
<span>Name</span>
<input type="text" name="name" required maxlength="80">
</label>
<label class="field" style="max-width:9rem">
<span>Attribut</span>
<select name="attribute">
<option value="">–</option>
<?php foreach (['STR', 'DEX', 'CON', 'INT', 'WIS', 'CHA'] as $attribute): ?>
<option value="<?= e($attribute) ?>"><?= e($attribute) ?></option>
<?php endforeach; ?>
</select>
</label>
<label class="field" style="max-width:12rem">
<span>Kategorie</span>
<select name="category">
<?php foreach (WS_SKILL_CATEGORIES as $category): ?>
<option value="<?= e($category) ?>"><?= e($category) ?></option>
<?php endforeach; ?>
</select>
</label>
<button class="btn" type="submit">Hinzufügen</button>
</form>
</section>
<section class="panel">
<table class="data">
<thead><tr><th>Fertigkeit</th><th>Attribut</th><th>Kategorie</th><th></th></tr></thead>
<tbody>
<?php foreach ($skills as $skill): ?>
<tr>
<td><?= e((string) $skill['name']) ?></td>
<td class="muted"><?= e((string) $skill['attribute']) ?></td>
<td class="muted"><?= e((string) $skill['category']) ?></td>
<td class="num">
<form method="post" action="<?= e(url('/admin/skills/' . (int) $skill['id'] . '/delete')) ?>">
<?= csrf_field() ?>
<button class="btn btn-small btn-danger" type="submit" data-confirm="Katalog-Eintrag entfernen? Bereits eingetragene Bögen behalten den Namen.">×</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>