Improve form editing, settings, submission lists, and navigation with responsive layouts and accessibility enhancements. Update the form wrapper block view and regenerate the extension stylesheet. Ignore .agents and skills-lock.json.
73 lines
3.8 KiB
PHP
73 lines
3.8 KiB
PHP
<?php
|
|
use Plugi\Extensions\Form\DefinitionsRepository;
|
|
|
|
$formsRepository = new DefinitionsRepository();
|
|
$forms = $formsRepository->getAll();
|
|
|
|
?>
|
|
|
|
<div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
|
<div>
|
|
<h2 class="text-xl font-bold">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 btn-sm">
|
|
<i class="ph-duotone ph-plus"></i>
|
|
New form
|
|
</a>
|
|
</div>
|
|
|
|
<?php if (empty($forms)): ?>
|
|
<div class="card border border-base-300/60 bg-base-100 shadow-sm">
|
|
<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">No forms yet</h3>
|
|
<p class="text-base-content/60 mt-1">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-4">
|
|
<i class="ph-duotone ph-plus"></i>
|
|
Create your first form
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="card border border-base-300/60 bg-base-100 shadow-sm">
|
|
<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-40 text-right"><?= 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-end 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="View entries" aria-label="View entries for <?= phpb_e($form['name']) ?>">
|
|
<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') ?>" aria-label="<?= phpb_trans('website-manager.edit') ?> <?= phpb_e($form['name']) ?>">
|
|
<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') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> <?= phpb_e($form['name']) ?>">
|
|
<i class="ph-duotone ph-trash text-lg"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|