109 lines
6.0 KiB
HTML
109 lines
6.0 KiB
HTML
<div class="space-y-6">
|
|
<!-- Table Date Filter -->
|
|
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-4 mb-2">
|
|
<form hx-get="{{ url_for('main.dashboard_table') }}" hx-target="#dashboard-content"
|
|
class="flex flex-col sm:flex-row gap-4">
|
|
<!-- Start Date -->
|
|
<div class="flex-1">
|
|
<label for="start_date" class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
|
|
<input type="date" name="start_date" id="start_date" value="{{ start_date or '' }}"
|
|
class="w-full p-2.5 border border-gray-300 rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-primary-500 text-gray-700">
|
|
</div>
|
|
|
|
<!-- End Date -->
|
|
<div class="flex-1">
|
|
<label for="end_date" class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
|
|
<input type="date" name="end_date" id="end_date" value="{{ end_date or '' }}"
|
|
class="w-full p-2.5 border border-gray-300 rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-primary-500 text-gray-700">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Data Table -->
|
|
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th scope="col"
|
|
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
Date</th>
|
|
<th scope="col"
|
|
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
Time</th>
|
|
<th scope="col"
|
|
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
Systolic</th>
|
|
<th scope="col"
|
|
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
Diastolic</th>
|
|
<th scope="col"
|
|
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
Heart Rate</th>
|
|
<th scope="col"
|
|
class="px-6 py-3 text-right text-xs font-semibold text-gray-500 uppercase tracking-wider">
|
|
Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
{% for reading in readings %}
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{
|
|
reading.local_timestamp.strftime('%Y-%m-%d') }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{
|
|
reading.local_timestamp.strftime('%I:%M %p') }}</td>
|
|
<td
|
|
class="px-6 py-4 whitespace-nowrap text-sm font-semibold {{ 'text-red-500' if reading.systolic >= 130 else 'text-gray-900' }}">
|
|
{{ reading.systolic }}</td>
|
|
<td
|
|
class="px-6 py-4 whitespace-nowrap text-sm font-semibold {{ 'text-red-500' if reading.diastolic >= 80 else 'text-gray-900' }}">
|
|
{{ reading.diastolic }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ reading.heart_rate }} bpm</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
|
<a href="{{ url_for('reading.edit_reading', reading_id=reading.id) }}"
|
|
class="text-primary-600 hover:text-primary-900">Edit</a>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="6" class="px-6 py-12 text-center text-sm text-gray-500">
|
|
No readings found for this date range.
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination Controls -->
|
|
{% if pagination.pages > 1 %}
|
|
<div class="flex justify-center items-center gap-2 mt-6">
|
|
{% if pagination.has_prev %}
|
|
<button
|
|
hx-get="{{ url_for('main.dashboard_table', page=pagination.prev_num, start_date=start_date, end_date=end_date) }}"
|
|
hx-target="#dashboard-content" class="px-3 py-1 rounded bg-gray-200 hover:bg-gray-300 text-sm">«
|
|
Prev</button>
|
|
{% endif %}
|
|
|
|
{% for page_num in pagination.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
|
{% if page_num %}
|
|
<button hx-get="{{ url_for('main.dashboard_table', page=page_num, start_date=start_date, end_date=end_date) }}"
|
|
hx-target="#dashboard-content"
|
|
class="px-3 py-1 rounded text-sm {% if page_num == pagination.page %}bg-primary-600 text-white{% else %}bg-gray-200 hover:bg-gray-300{% endif %}">
|
|
{{ page_num }}
|
|
</button>
|
|
{% else %}
|
|
<span class="text-gray-400">…</span>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if pagination.has_next %}
|
|
<button
|
|
hx-get="{{ url_for('main.dashboard_table', page=pagination.next_num, start_date=start_date, end_date=end_date) }}"
|
|
hx-target="#dashboard-content" class="px-3 py-1 rounded bg-gray-200 hover:bg-gray-300 text-sm">Next
|
|
»</button>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div> |