Add weekly progress and validation

This commit is contained in:
2026-07-10 16:23:50 +02:00
parent 23416ee382
commit 1cdef43a87
6 changed files with 39 additions and 11 deletions
+9 -3
View File
@@ -14,6 +14,7 @@
id="title"
name="title"
type="text"
maxlength="120"
class="<?= !empty($errors['title']) ? 'input-error' : '' ?>"
value="<?= e($habit['title'] ?? '') ?>"
required
@@ -24,10 +25,13 @@
<?php endif; ?>
<label for="description">Beschreibung <span>optional</span></label>
<textarea id="description" name="description" rows="4"><?= e($habit['description'] ?? '') ?></textarea>
<textarea id="description" name="description" rows="4" maxlength="1000"><?= e($habit['description'] ?? '') ?></textarea>
<?php if (!empty($errors['description'])): ?>
<small class="field-error"><?= e($errors['description']) ?></small>
<?php endif; ?>
<label for="category_id">Kategorie</label>
<select id="category_id" name="category_id">
<select id="category_id" name="category_id" class="<?= !empty($errors['category_id']) ? 'input-error' : '' ?>">
<option value="">Keine Kategorie</option>
<?php foreach ($categories as $category): ?>
<option value="<?= (int) $category['id'] ?>" <?= (string) ($habit['category_id'] ?? '') === (string) $category['id'] ? 'selected' : '' ?>>
@@ -35,6 +39,9 @@
</option>
<?php endforeach; ?>
</select>
<?php if (!empty($errors['category_id'])): ?>
<small class="field-error"><?= e($errors['category_id']) ?></small>
<?php endif; ?>
<label for="target_per_week">Ziel pro Woche</label>
<input
@@ -55,4 +62,3 @@
<button type="submit"><?= $isEdit ? 'Speichern' : 'Erstellen' ?></button>
</form>
</section>