Mitarbeiter ohne Buchungen löschbar machen
This commit is contained in:
parent
e3d328f55a
commit
672df3d0a7
7 changed files with 58 additions and 4 deletions
|
|
@ -86,7 +86,21 @@ $fieldError = static fn (string $key): string => (string) ($errors[$key] ?? '');
|
|||
<td><?= e($row['first_name'] ? $row['first_name'] . ' ' . $row['last_name'] : '–') ?></td>
|
||||
<td><?= (int) $row['future_bookings'] ?></td>
|
||||
<td><span class="pill <?= (int) $row['active'] === 1 ? 'pill--green' : 'pill--grey' ?>"><?= (int) $row['active'] === 1 ? 'aktiv' : 'inaktiv' ?></span></td>
|
||||
<td class="ta-right"><a class="btn small" href="<?= e(url('/admin/employees?edit=' . (int) $row['id'])) ?>">Bearbeiten</a></td>
|
||||
<td class="ta-right">
|
||||
<div class="table-actions">
|
||||
<a class="btn small" href="<?= e(url('/admin/employees?edit=' . (int) $row['id'])) ?>">Bearbeiten</a>
|
||||
<?php if ((int) $row['booking_count'] === 0): ?>
|
||||
<form method="post" action="<?= e(url('/admin/employees')) ?>" data-confirm="Mitarbeiter <?= e($row['name']) ?> endgültig löschen?">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?= (int) $row['id'] ?>">
|
||||
<button class="link-button small" type="submit"><svg class="ico" aria-hidden="true"><use href="#i-trash"/></svg> Löschen</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<span class="muted small" title="<?= (int) $row['booking_count'] ?> Buchung(en) verweisen auf diesen Mitarbeiter"><?= (int) $row['booking_count'] ?> Buchung<?= (int) $row['booking_count'] === 1 ? '' : 'en' ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue