added nicer overview and delete function

This commit is contained in:
2023-10-26 17:50:54 +02:00
parent 0f13bdea27
commit ddf13b2413
8 changed files with 81 additions and 23 deletions

View File

@ -1,15 +1,23 @@
<h1">Meine Hunde</h1>
<h1>Meine Hunde</h1>
<figure>
<table>
<table class="table">
<thead>
<tr>
<?php foreach (array_keys($doggos[0]) as $key) : ?>
<th>
<?= $key ?>
Foto
</th>
<th>
Name
</th>
<th>
Geburstag
</th>
<th>
Aktiv
</th>
<?php endforeach; ?>
<th>
Bearbeiten
@ -23,17 +31,27 @@
<?php foreach ($doggos as $dog) : ?>
<tr>
<?php foreach (array_keys($dog) as $key) : ?>
<td>
<?= $dog[$key] ?>
<img src="<?= $dog['photo'] ?>/50x50/forcesize">
</td>
<td>
<?= escape($dog['name']); ?>
</td>
<td>
<?= escape($dog['birthday']); ?>
</td>
<td>
<?= escape($dog['active'])?'Ja':'Nein'; ?>
</td>
<?php endforeach; ?>
<td>
<button hx-get="/dogs/edit/<?= $dog['id'] ?>" hx-push-url="/dogs/edit/<?= $dog['id'] ?>" hx-target="#main" >Bearbeiten</button>
</td>
<td>
<button hx-get="/dogs/delete/<?= $dog['id'] ?>" hx-target="#main" >Löschen</button>
<button hx-get="/dogs/delete/<?= $dog['id'] ?>" hx-target="#main" hx-confirm="Bist du sicher, dass du <?= escape($dog['name']); ?> löschen willst">Löschen</button>
</td>
</tr>