Update programs functionality

This commit is contained in:
Peter Stockings
2026-02-03 15:10:59 +11:00
parent b26ae1e319
commit ac093ec2e0
7 changed files with 849 additions and 210 deletions

View File

@@ -25,7 +25,19 @@
{{ program.description }}
</p>
{% endif %}
{# Add Edit/Assign buttons here later #}
<div class="mt-4 flex space-x-3">
<a href="{{ url_for('programs.edit_program', program_id=program.program_id) }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
hx-get="{{ url_for('programs.edit_program', program_id=program.program_id) }}"
hx-target="#container" hx-push-url="true" hx-swap="innerHTML">
<svg xmlns="http://www.w3.org/2000/svg" class="-ml-1 mr-2 h-5 w-5 text-gray-400" viewBox="0 0 20 20"
fill="currentColor">
<path
d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z" />
</svg>
Edit Program
</a>
</div>
</div>
</div>
@@ -39,32 +51,56 @@
<h3 class="text-lg leading-6 font-medium text-gray-900">
Day {{ session.session_order }}{% if session.session_name %}: {{ session.session_name }}{% endif %}
</h3>
<p class="mt-1 text-sm text-gray-500">Tag: {{ session.tag_name }} (ID: {{ session.tag_id }})</p>
</div>
<div class="border-t border-gray-200 px-4 py-5 sm:p-0">
<dl class="sm:divide-y sm:divide-gray-200">
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">
<div class="py-4 sm:py-5 sm:px-6">
<dt class="text-sm font-medium text-gray-500 mb-2">
Exercises
</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
<dd class="mt-1 text-sm text-gray-900">
{% if session.exercises %}
<ul role="list" class="border border-gray-200 rounded-md divide-y divide-gray-200">
{% for exercise in session.exercises %}
<li class="pl-3 pr-4 py-3 flex items-center justify-between text-sm">
<div class="w-0 flex-1 flex items-center">
<!-- Heroicon name: solid/paper-clip -->
{# Could add an icon here #}
<span class="ml-2 flex-1 w-0 truncate">
{{ exercise.name }} (ID: {{ exercise.exercise_id }})
</span>
</div>
{# Add links/actions per exercise later if needed #}
</li>
{% endfor %}
</ul>
<div class="overflow-x-auto border border-gray-200 rounded-md">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col"
class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Order</th>
<th scope="col"
class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Exercise</th>
<th scope="col"
class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Sets</th>
<th scope="col"
class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Rep Range</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
{% for exercise in session.exercises %}
<tr>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-500">
{{ loop.index if not exercise.exercise_order else
exercise.exercise_order }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm font-medium text-gray-900">
{{ exercise.name }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-500">
{{ exercise.sets if exercise.sets else '-' }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-500">
{{ exercise.rep_range if exercise.rep_range else '-' }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-gray-500 italic">No exercises found for this session's tag filter.</p>
<p class="text-gray-500 italic">No exercises found for this session.</p>
{% endif %}
</dd>
</div>