Add basic workout tracking functionality, create/edit/delete workouts and there topsets

This commit is contained in:
Peter Stockings
2022-07-18 21:30:12 +10:00
parent 93ae1fa04b
commit 07f19b38c6
7 changed files with 403 additions and 367 deletions

View File

@@ -6,7 +6,7 @@
<div class="mb-4 flex items-center justify-between">
<div>
<h3 class="text-xl font-bold text-gray-900 mb-2">Gabe</h3>
<h3 class="text-xl font-bold text-gray-900 mb-2">{{ person['Name'] }}</h3>
<span class="text-base font-normal text-gray-500">List of workouts</span>
</div>
</div>
@@ -22,222 +22,50 @@
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Date
</th>
{% for e in exercises %}
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Squats
</th>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Bench
</th>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Deadlift
</th>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Lat Pulldown
{{ e['Name'] }}
</th>
{% endfor %}
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-8">
</th>
</tr>
</thead>
<tbody class="bg-white">
{% for w in workouts %}
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
{{ w['start_date'] }}
</td>
{% for e in exercises %}
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
{% if e['ExcerciseId'] in w['topset_exercises'] %}
{{ w['topset_exercises'][e['ExcerciseId']] }}
{% endif %}
</td>
{% endfor %}
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=w['workout_id']) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
Apr 23 ,2021
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
5 x 60kg
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('show_workout_for_person' ,person_id=person_id, workout_id=1) }}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Edit
</a>
<a href="#"
<a href="{{ url_for('delete_workout_from_person', person_id=person_id, workout_id=w['workout_id'])}}"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href=" {{ url_for('new_workout_for_person', person_id=person_id) }}"
class="sm:inline-flex text-white bg-cyan-600 hover:bg-cyan-700 focus:ring-4 focus:ring-cyan-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center">
class="sm:inline-flex text-white bg-cyan-600 hover:bg-cyan-700 focus:ring-4 focus:ring-cyan-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mt-6">
New workout
</a>
</div>