Add page to confirm deletion and add cancel button on edit page
This commit is contained in:
@@ -168,14 +168,14 @@
|
||||
<!-- Readings Table -->
|
||||
<div class="bg-white rounded-lg shadow-md overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left bg-white border-collapse">
|
||||
<table class="w-full text-left border-collapse">
|
||||
<!-- Table Header -->
|
||||
<thead class="bg-gray-50 border-b">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-sm font-semibold text-gray-700 uppercase">Timestamp</th>
|
||||
<th class="px-6 py-3 text-sm font-semibold text-gray-700 uppercase">Blood Pressure (mmHg)</th>
|
||||
<th class="px-6 py-3 text-sm font-semibold text-gray-700 uppercase">Heart Rate</th>
|
||||
<th class="px-6 py-3 text-sm font-semibold text-gray-700 uppercase">Actions</th>
|
||||
<th class="px-6 py-3 text-sm font-semibold text-gray-700 uppercase text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -183,28 +183,47 @@
|
||||
<tbody>
|
||||
{% for reading in readings %}
|
||||
<tr class="border-b hover:bg-gray-50">
|
||||
<td class="px-6 py-4 text-sm text-gray-600"> {{ reading.timestamp.strftime('%d %b %Y, %I:%M %p')
|
||||
}}
|
||||
<!-- Timestamp -->
|
||||
<td class="px-6 py-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{{ reading.timestamp.strftime('%d %b %Y, %I:%M %p') }}
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-600">
|
||||
<!-- Blood Pressure -->
|
||||
<td class="px-6 py-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{{ reading.systolic }}/{{ reading.diastolic }}
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-600">{{ reading.heart_rate }}</td>
|
||||
<td class="px-6 py-4 text-sm text-gray-600">
|
||||
<!-- Heart Rate -->
|
||||
<td class="px-6 py-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{{ reading.heart_rate }} bpm
|
||||
</td>
|
||||
<!-- Actions -->
|
||||
<td class="px-6 py-4 text-center">
|
||||
<!-- Edit Button -->
|
||||
<a rel="prefetch" href="{{ url_for('main.edit_reading', reading_id=reading.id) }}"
|
||||
class="text-blue-600 hover:underline">Edit</a>
|
||||
<form method="POST" action="{{ url_for('main.delete_reading', reading_id=reading.id) }}"
|
||||
class="inline">
|
||||
{{ delete_form.hidden_tag() }}
|
||||
<button type="submit" class="text-red-600 hover:underline ml-2">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
class="inline-flex items-center px-2 py-1 text-sm font-medium text-blue-600 hover:text-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-1" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="M15.232 5.232l3.536 3.536M9 11l6.232-6.232a2 2 0 112.828 2.828L11 13.828V17H8v-3l6.232-6.232z" />
|
||||
</svg>
|
||||
Edit
|
||||
</a>
|
||||
|
||||
<!-- Delete Button -->
|
||||
<a href="{{ url_for('main.confirm_delete', reading_id=reading.id) }}"
|
||||
class="inline-flex items-center px-2 py-1 text-sm font-medium text-red-600 hover:text-red-800 focus:outline-none focus:ring-2 focus:ring-red-500">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-1" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="px-6 py-4 text-center text-sm text-gray-500">No readings found.</td>
|
||||
<td colspan="4" class="px-6 py-4 text-center text-sm text-gray-500">
|
||||
No readings found.
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -212,5 +231,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user