|
|
@@ -87,6 +87,13 @@ show_alerts();
|
|
|
</form>
|
|
|
</div>
|
|
|
|
|
|
+<?php foreach ($activities as $a): ?>
|
|
|
+<form id="edit-form-<?= $a['activityID'] ?>" method="POST">
|
|
|
+ <input type="hidden" name="action" value="edit">
|
|
|
+ <input type="hidden" name="activityID" value="<?= $a['activityID'] ?>">
|
|
|
+</form>
|
|
|
+<?php endforeach; ?>
|
|
|
+
|
|
|
<table class="tbl">
|
|
|
<thead><tr><th>#</th><th>Name</th><th>Group</th><th>Sort</th><th></th></tr></thead>
|
|
|
<tbody>
|
|
|
@@ -108,33 +115,19 @@ show_alerts();
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr id="edit-<?= $id ?>" style="display:none;background:rgba(79,209,197,.04);">
|
|
|
- <td colspan="5">
|
|
|
- <form method="POST" style="display:flex;gap:.75rem;align-items:flex-end;flex-wrap:wrap;padding:.25rem 0;">
|
|
|
- <input type="hidden" name="action" value="edit">
|
|
|
- <input type="hidden" name="activityID" value="<?= $id ?>">
|
|
|
- <div>
|
|
|
- <label>Activity Name</label>
|
|
|
- <input type="text" name="activityName" value="<?= htmlspecialchars($a['activityName']) ?>" required style="margin-bottom:0;min-width:180px;">
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label>Group</label>
|
|
|
- <select name="groupID" required style="margin-bottom:0;min-width:140px;">
|
|
|
- <?php foreach ($groups as $g): ?>
|
|
|
- <option value="<?= $g['groupID'] ?>" <?= $a['groupID'] == $g['groupID'] ? 'selected' : '' ?>>
|
|
|
- <?= htmlspecialchars($g['groupName']) ?>
|
|
|
- </option>
|
|
|
- <?php endforeach; ?>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <label>Sort Order</label>
|
|
|
- <input type="number" name="sortOrder" value="<?= (int)$a['sortOrder'] ?>" min="0" style="margin-bottom:0;max-width:90px;">
|
|
|
- </div>
|
|
|
- <div style="display:flex;gap:.4rem;padding-bottom:1px;">
|
|
|
- <button type="submit" class="btn btn-sm btn-primary">💾 Save</button>
|
|
|
- <button type="button" onclick="cancelEdit(<?= $id ?>)" class="btn btn-sm btn-secondary">Cancel</button>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
+ <td style="color:var(--muted)"><?= $id ?></td>
|
|
|
+ <td><input type="text" name="activityName" form="edit-form-<?= $id ?>" value="<?= htmlspecialchars($a['activityName']) ?>" required style="margin:0;width:100%;"></td>
|
|
|
+ <td>
|
|
|
+ <select name="groupID" form="edit-form-<?= $id ?>" required style="margin:0;width:100%;">
|
|
|
+ <?php foreach ($groups as $g): ?>
|
|
|
+ <option value="<?= $g['groupID'] ?>" <?= $a['groupID'] == $g['groupID'] ? 'selected' : '' ?>><?= htmlspecialchars($g['groupName']) ?></option>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td><input type="number" name="sortOrder" form="edit-form-<?= $id ?>" value="<?= (int)$a['sortOrder'] ?>" min="0" style="margin:0;width:100%;max-width:80px;"></td>
|
|
|
+ <td style="display:flex;gap:.4rem;justify-content:flex-end;">
|
|
|
+ <button type="submit" form="edit-form-<?= $id ?>" class="btn btn-sm btn-primary">💾 Save</button>
|
|
|
+ <button type="button" onclick="cancelEdit(<?= $id ?>)" class="btn btn-sm btn-secondary">Cancel</button>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<?php endforeach; ?>
|