Files
plugi/extensions/plugi-ext-form/admin/Views/ListForms.php
T
2026-11-22 16:09:43 +01:00

73 lines
3.6 KiB
PHP

<?php
use Plugi\Extensions\Form\DefinitionsRepository;
$formsRepository = new DefinitionsRepository();
$forms = $formsRepository->getAll();
?>
<div class="flex items-center justify-between mb-6">
<div>
<h2 class="text-xl font-bold">Formulare</h2>
<p class="text-sm text-base-content/60"><?= count($forms) ?> Formular<?= count($forms) !== 1 ? 'e' : '' ?> vorhanden</p>
</div>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary btn-sm">
<i class="ph-duotone ph-plus"></i>
Neues Formular
</a>
</div>
<?php if (empty($forms)): ?>
<div class="card bg-base-100 shadow">
<div class="card-body items-center text-center py-16">
<i class="ph-duotone ph-notebook text-6xl text-base-content/20"></i>
<h3 class="card-title text-lg mt-4">Noch keine Formulare</h3>
<p class="text-base-content/60 mt-1">Erstelle dein erstes Formular, um Einträge von deiner Website zu sammeln.</p>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary mt-4">
<i class="ph-duotone ph-plus"></i>
Erstes Formular erstellen
</a>
</div>
</div>
<?php else: ?>
<div class="card bg-base-100 shadow">
<div class="card-body p-0">
<div class="overflow-x-auto">
<table class="table w-full">
<thead>
<tr class="bg-base-200/50">
<th class="w-16">ID</th>
<th><?= phpb_trans('website-manager.name') ?></th>
<th class="w-16 text-center"><?= phpb_trans('website-manager.actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($forms as $form): ?>
<tr class="hover:bg-base-200/30">
<td class="font-mono text-sm text-base-content/60"><?= phpb_e($form['id']) ?></td>
<td>
<div class="font-medium"><?= phpb_e($form['name']) ?></div>
</td>
<td>
<div class="flex items-center justify-center gap-1">
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'listEntries', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="Einträge ansehen">
<i class="ph-duotone ph-eye text-lg"></i>
</a>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>">
<i class="ph-duotone ph-pencil-line text-lg"></i>
</a>
<a href="/ext--form/delete-form?id=<?= $form['id'] ?>" class="btn btn-ghost btn-sm btn-circle text-error" title="<?= phpb_trans('website-manager.remove') ?>">
<i class="ph-duotone ph-trash text-lg"></i>
</a>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<?php endif; ?>