Added: favicon, Dashboard, Habits list, some styles, dashboard redirect
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<section class="habit-create">
|
||||
<h1><?= $this->get('title', 'Create Habit') ?></h1>
|
||||
<link rel="stylesheet" href="/css/form.css">
|
||||
<link rel="stylesheet" href="/css/habits_create.css">
|
||||
<section class="form habit-create">
|
||||
<h1 class="header-form"><?= $this->get('title', 'Create Habit') ?></h1>
|
||||
|
||||
<?php if ($this->get('error')): ?>
|
||||
<div class="error" style="color: red; margin-bottom: 1rem;">
|
||||
@@ -19,29 +21,50 @@
|
||||
</select>
|
||||
|
||||
<div id="custom-frequency" style="display: none;">
|
||||
<label>Days of the Week:</label>
|
||||
<input type="checkbox" name="days_of_week[]" value="1"> Monday
|
||||
<input type="checkbox" name="days_of_week[]" value="2"> Tuesday
|
||||
<input type="checkbox" name="days_of_week[]" value="3"> Wednesday
|
||||
<input type="checkbox" name="days_of_week[]" value="4"> Thursday
|
||||
<input type="checkbox" name="days_of_week[]" value="5"> Friday
|
||||
<input type="checkbox" name="days_of_week[]" value="6"> Saturday
|
||||
<input type="checkbox" name="days_of_week[]" value="7"> Sunday
|
||||
<label id="lbl_dow">Days of the Week:</label>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_mon">Monday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_mon" value="1">
|
||||
</div>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_tue">Tuesday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_tue" value="2">
|
||||
</div>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_wed">Wednesday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_wed" value="3">
|
||||
</div>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_thu">Thursday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_thu" value="4">
|
||||
</div>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_fri">Friday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_fri" value="5">
|
||||
</div>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_sat">Saturday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_sat" value="6">
|
||||
</div>
|
||||
<div class="dow_chb_wrapper">
|
||||
<label for="dow_sun">Sunday</label>
|
||||
<input type="checkbox" name="days_of_week[]" id="dow_sun" value="7">
|
||||
</div>
|
||||
|
||||
<label for="days_of_month">Days of the Month:</label>
|
||||
<label for="days_of_month" id="lbl_dom">Days of the Month:</label>
|
||||
<input type="text" name="days_of_month" id="days_of_month" placeholder="1,15 (comma-separated)">
|
||||
|
||||
<label for="months">Months:</label>
|
||||
<input type="text" name="months" id="months" placeholder="1,7,12 (comma-separated)">
|
||||
</div>
|
||||
|
||||
<button type="submit">Create Habit</button>
|
||||
<input type="submit" value="Create Habit">
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
function toggleCustomFrequency(value) {
|
||||
const customFrequencyDiv = document.getElementById('custom-frequency');
|
||||
customFrequencyDiv.style.display = value === 'Custom' ? 'block' : 'none';
|
||||
customFrequencyDiv.style.display = value === 'Custom' ? 'flex' : 'none';
|
||||
}
|
||||
</script>
|
||||
|
35
app/views/habits/index.php
Normal file
35
app/views/habits/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<link rel="stylesheet" href="/css/habits_dashboard.css">
|
||||
<section class="habits">
|
||||
<?php if (empty($this->get('habits'))): ?>
|
||||
<p>No habits yet. <a href="/habits/create">Create your first habit</a>.</p>
|
||||
<?php else: ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Frequency</th>
|
||||
<th>Custom Schedule</th>
|
||||
<th>Points</th>
|
||||
<th>Created At</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->get('habits') as $habit): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($habit['title']) ?></td>
|
||||
<td><?= htmlspecialchars($habit['frequency']) ?></td>
|
||||
<td><?= htmlspecialchars($habit['custom_frequency'] ?? 'N/A') ?></td>
|
||||
<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; ?>
|
||||
</section>
|
Reference in New Issue
Block a user