Merge pull request 'feat: improve Kontaktformular error handling and enhance UI feedback' (#18) from develop into main

Reviewed-on: https://git.feigel.it/SFBadSteben/schachfreunde-badsteben/pulls/18
This commit is contained in:
2025-07-13 17:59:59 +02:00
2 changed files with 22 additions and 14 deletions
+1 -1
View File
@@ -49,7 +49,7 @@
} catch (Exception $error) { } catch (Exception $error) {
if (option('debug')): if (option('debug')):
$alert['error'] = 'Beim Versenden ist ein Fehler aufgetreten: <strong>' . $error->getMessage() . '</strong>'; $alert['error'] = 'Beim Versenden ist ein Fehler aufgetreten:<br /> <strong>' . $error->getMessage() . '</strong>';
else: else:
$alert['error'] = 'Beim Versenden ist ein Fehler aufgetreten!'; $alert['error'] = 'Beim Versenden ist ein Fehler aufgetreten!';
endif; endif;
+17 -9
View File
@@ -82,30 +82,38 @@
</div> </div>
</div> </div>
<div class="sm:col-span-2"> <div class="sm:col-span-2">
<label for="message" class="block text-sm/6 font-semibold text-gray-900">Nachricht</label> <label for="text" class="block text-sm/6 font-semibold text-gray-900">Nachricht</label>
<div class="mt-2.5"> <div class="mt-2.5">
<textarea name="message" id="message" rows="4" class="block w-full rounded-md bg-white px-3.5 py-2 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600" required><?= esc($data['text'] ?? '') ?></textarea> <textarea name="text" id="text" rows="4" class="block w-full rounded-md bg-white px-3.5 py-2 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600" required><?= esc($data['text'] ?? '') ?></textarea>
<?= isset($alert['text']) ? '<span class="alert error">' . esc($alert['text']) . '</span>' : '' ?> <?= isset($alert['text']) ? '<span class="alert error">' . esc($alert['text']) . '</span>' : '' ?>
</div> </div>
</div> </div>
</div> </div>
<div class="mt-8 flex justify-end"> <div class="mt-8 flex justify-end">
<button type="submit" class="rounded-md bg-sf_blau-500 px-3.5 py-2.5 text-center text-sm font-semibold text-white shadow-xs hover:bg-sf_gelb-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Absenden</button> <button type="submit" class="rounded-md bg-sf_blau-500 px-3.5 py-2.5 text-center text-sm font-semibold text-white shadow-xs hover:bg-sf_gelb-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" name="submit" value="Submit">Absenden</button>
</div> </div>
<div class="py-8">
</div>
</form>
<?php if ($success): ?> <?php if ($success): ?>
<div class="alert success"> <div class="rounded-md bg-green-500 p-4">
<p><?= $success ?></p> <div class="mt-2 text-sm text-white">
<?= $success ?>
</div>
</div> </div>
<?php else: ?> <?php else: ?>
<?php if (isset($alert['error'])): ?> <?php if (isset($alert['error'])): ?>
<div><?= $alert['error'] ?></div> <div class="rounded-md bg-red-500 p-4">
<div class="mt-2 text-sm text-white">
<?= $alert['error'] ?>
</div>
</div>
<?php endif ?> <?php endif ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
</form>
</div>
</div>
</div> </div>
</div> </div>