Added: Habits dashboard
This commit is contained in:
parent
d98c208df9
commit
d13c490efb
@ -3,33 +3,22 @@
|
|||||||
<?php if (empty($this->get('habits'))): ?>
|
<?php if (empty($this->get('habits'))): ?>
|
||||||
<p>No habits yet. <a href="/habits/create">Create your first habit</a>.</p>
|
<p>No habits yet. <a href="/habits/create">Create your first habit</a>.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<table>
|
<div class="habits-wrapper">
|
||||||
<thead>
|
<?php foreach ($this->get('habits') as $habit): ?>
|
||||||
<tr>
|
<div class="habit bordered">
|
||||||
<th>Title</th>
|
<b><?= htmlspecialchars($habit['title']) ?></b>
|
||||||
<th>Frequency</th>
|
<p>Frequency: <?= htmlspecialchars($habit['frequency']) ?></p>
|
||||||
<th>Custom Schedule</th>
|
<?php if (isset($habit['custom_frequency'])): ?>
|
||||||
<th>Points</th>
|
<p><?= htmlspecialchars($habit['custom_frequency'] ?? 'N/A') ?></p>
|
||||||
<th>Created At</th>
|
<?php endif; ?>
|
||||||
<th>Actions</th>
|
<p><?= htmlspecialchars($habit['reward_points']) ?></p>
|
||||||
</tr>
|
<p><?= htmlspecialchars($habit['created_at']) ?></p>
|
||||||
</thead>
|
<a href="/habits/done">Mark as done</a> |
|
||||||
<tbody>
|
<a href="/habits/edit?id=<?= $habit['id'] ?>">Edit</a> |
|
||||||
<?php foreach ($this->get('habits') as $habit): ?>
|
<a href="/habits/delete?id=<?= $habit['id'] ?>" onclick="return confirm('Are you sure you want to delete this habit?')">Delete</a>
|
||||||
<tr>
|
</div>
|
||||||
<td><?= htmlspecialchars($habit['title']) ?></td>
|
<?php endforeach; ?>
|
||||||
<td><?= htmlspecialchars($habit['frequency']) ?></td>
|
</div>
|
||||||
<td><?= htmlspecialchars($habit['custom_frequency'] ?? 'N/A') ?></td>
|
<a href="/habits/create" class="btn-green">Create new habit!</a>
|
||||||
<td><?= htmlspecialchars($habit['reward_points']) ?></td>
|
|
||||||
<td><?= htmlspecialchars($habit['created_at']) ?></td>
|
|
||||||
<td>
|
|
||||||
<a href="/habits/edit?id=<?= $habit['id'] ?>">Edit</a> |
|
|
||||||
<a href="/habits/delete?id=<?= $habit['id'] ?>" onclick="return confirm('Are you sure you want to delete this habit?')">Delete</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<a href="/habits/create">Create new habit!</a>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
|
@ -1,26 +1,15 @@
|
|||||||
.habits h1 {
|
.habits-wrapper {
|
||||||
font-size: 2rem;
|
display: flex;
|
||||||
margin-bottom: 1rem;
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.habits table {
|
.habits .bordered {
|
||||||
width: 100%;
|
border-radius: var(--border-radious);
|
||||||
border-collapse: collapse;
|
border: var(--borderWidth-thin) solid var(--clr-border);
|
||||||
|
width: 17rem;
|
||||||
|
padding: 1rem;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
text-align: center;
|
||||||
|
|
||||||
.habits table th,
|
|
||||||
.habits table td {
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 8px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.habits a {
|
|
||||||
color: #007bff;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.habits a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user