Files
workout/templates/program_view.html
2026-02-03 15:10:59 +11:00

118 lines
6.4 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ program.name }} - Program Details{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-8 max-w-4xl">
{# Back Link #}
<div class="mb-4">
<a href="{{ url_for('programs.list_programs') }}" hx-get="{{ url_for('programs.list_programs') }}"
hx-target="#container" hx-push-url="true" hx-swap="innerHTML"
class="text-indigo-600 hover:text-indigo-800 text-sm">
&larr; Back to Programs List
</a>
</div>
{# Program Header #}
<div class="bg-white shadow overflow-hidden sm:rounded-lg mb-8">
<div class="px-4 py-5 sm:px-6">
<h1 class="text-2xl leading-6 font-bold text-gray-900">
{{ program.name }}
</h1>
{% if program.description %}
<p class="mt-1 max-w-2xl text-sm text-gray-500">
{{ program.description }}
</p>
{% endif %}
<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>
{# Sessions Section #}
<h2 class="text-xl font-semibold mb-4 text-gray-700">Sessions</h2>
<div class="space-y-6">
{% if sessions %}
{% for session in sessions %}
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-4 sm:px-6 bg-gray-50 border-b border-gray-200">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Day {{ session.session_order }}{% if session.session_name %}: {{ session.session_name }}{% endif %}
</h3>
</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:px-6">
<dt class="text-sm font-medium text-gray-500 mb-2">
Exercises
</dt>
<dd class="mt-1 text-sm text-gray-900">
{% if session.exercises %}
<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.</p>
{% endif %}
</dd>
</div>
{# Add more session details here if needed #}
</dl>
</div>
</div>
{% endfor %}
{% else %}
<p class="text-gray-500 italic">This program currently has no sessions defined.</p>
{% endif %}
</div>
</div>
{% endblock %}