Files
plugi/extensions/plugi-ext-form/admin/Views/ListForms.php
T
deepDiverPaul 9d192c2141 refresh admin interface layouts
Redesign authentication and website manager views with responsive layouts, clearer navigation, and accessibility improvements. Refresh page, menu, file, system information, settings, overview, welcome, page settings, and block thumbnail screens. Add the shared Admin stylesheet and Plugi theme, update the build configuration, and regenerate the admin CSS.
2026-11-25 12:02:54 +01:00

74 lines
4.0 KiB
PHP

<?php
use Plugi\Extensions\Form\DefinitionsRepository;
$formsRepository = new DefinitionsRepository();
$forms = $formsRepository->getAll();
?>
<section class="space-y-5">
<header class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
<div class="space-y-1">
<p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary">Form extension</p>
<h2 class="text-xl font-bold tracking-tight text-base-content">Forms</h2>
<p class="text-sm text-base-content/60"><?= count($forms) ?> form<?= count($forms) !== 1 ? 's' : '' ?> available</p>
</div>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary">
<i class="ph-duotone ph-plus" aria-hidden="true"></i>
New form
</a>
</header>
<?php if (empty($forms)): ?>
<div class="card border border-dashed border-base-300 bg-base-100 shadow-sm" role="status">
<div class="card-body items-center gap-3 px-5 py-12 text-center sm:py-16">
<span class="grid size-14 place-items-center rounded-2xl bg-primary/10 text-primary">
<i class="text-3xl ph-duotone ph-notebook" aria-hidden="true"></i>
</span>
<h3 class="card-title mt-1 text-lg">No forms yet</h3>
<p class="max-w-md text-sm leading-relaxed text-base-content/60">Create your first form to collect submissions from your website.</p>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary mt-2">
<i class="ph-duotone ph-plus" aria-hidden="true"></i>
Create your first form
</a>
</div>
</div>
<?php else: ?>
<div class="overflow-x-auto rounded-box border border-base-300 bg-base-100">
<table class="table table-zebra w-full min-w-[36rem]">
<thead>
<tr>
<th class="w-16">ID</th>
<th><?= phpb_trans('website-manager.name') ?></th>
<th class="w-40 text-right"><?= phpb_trans('website-manager.actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($forms as $form): ?>
<tr>
<td><span class="badge badge-ghost font-mono"><?= phpb_e($form['id']) ?></span></td>
<td>
<div class="font-medium"><?= phpb_e($form['name']) ?></div>
</td>
<td>
<div class="flex items-center justify-end gap-1">
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'listEntries', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-square btn-sm" title="View entries" aria-label="View entries for <?= phpb_e($form['name']) ?>">
<i class="ph-duotone ph-eye text-lg" aria-hidden="true"></i>
</a>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-square btn-sm" title="<?= phpb_trans('website-manager.edit') ?>" aria-label="<?= phpb_trans('website-manager.edit') ?> <?= phpb_e($form['name']) ?>">
<i class="ph-duotone ph-pencil-line text-lg" aria-hidden="true"></i>
</a>
<a href="/ext--form/delete-form?id=<?= $form['id'] ?>" class="btn btn-ghost btn-square btn-sm text-error" title="<?= phpb_trans('website-manager.remove') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> <?= phpb_e($form['name']) ?>">
<i class="ph-duotone ph-trash text-lg" aria-hidden="true"></i>
</a>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</section>