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,8 +6,8 @@
<div class="mb-4 flex items-center justify-between">
<div>
<h3 class="text-xl font-bold text-gray-900 mb-2">Gabe</h3>
<span class="text-base font-normal text-gray-500">Apr 23 ,2021</span>
<h3 class="text-xl font-bold text-gray-900 mb-2">{{ workout_info['Name'] }}</h3>
<span class="text-base font-normal text-gray-500">{{ workout_info['StartDate'] }}</span>
</div>
<a href="#" class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
Delete workout
@@ -37,55 +37,25 @@
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
{% for t in top_sets %}
<tr class="text-gray-500">
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">Squats
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">
{{ t['Name'] }}
</th>
<td class="border-t-0 px-4 align-middle text-l font-medium text-gray-900 whitespace-nowrap p-4">
5 x 60kg</td>
{{ t['TopSet'] }}</td>
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
<a href="{{ url_for('show_topset_from_workout_for_person' ,person_id=person_id, workout_id=workout_id, topset_id=1) }}"
<a href="{{ url_for('show_topset_from_workout_for_person', person_id=person_id, workout_id=workout_id, topset_id=t['TopSetId']) }}"
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 class="text-gray-500">
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">Bench
</th>
<td class="border-t-0 px-4 align-middle text-l font-medium text-gray-900 whitespace-nowrap p-4">
5 x 60kg</td>
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
<a href="{{ url_for('show_topset_from_workout_for_person' ,person_id=person_id, workout_id=workout_id, topset_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 class="text-gray-500">
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">Lat
Pulldowns
</th>
<td class="border-t-0 px-4 align-middle text-l font-medium text-gray-900 whitespace-nowrap p-4">
5 x 60kg</td>
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
<a href="{{ url_for('show_topset_from_workout_for_person' ,person_id=person_id, workout_id=workout_id, topset_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_topset_from_workout_for_person', person_id=person_id, workout_id=workout_id, topset_id=t['TopSetId'])}}"
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>
</div>
@@ -93,7 +63,9 @@
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 2xl:col-span-2 mt-4">
<div class=" ">
<form class="w-full max-w-lg" action="" method="post">
<form class="w-full max-w-lg"
action="{{ url_for('add_topset_to_workout_for_person', person_id=person_id, workout_id=workout_id) }}"
method="post">
<div class="flex flex-wrap -mx-3 mb-2">
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
@@ -103,10 +75,11 @@
<div class="relative">
<select
class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-state">
<option value="1">Squats</option>
<option value="2">Bench</option>
<option value="3">Deadlift</option>
id="grid-state" name="exercise_id">
{% for e in exercises %}
<option value="{{ e['ExcerciseId'] }}">{{
e['Name']}}</option>
{% endfor %}
</select>
<div
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
@@ -123,7 +96,7 @@
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-city" type="number">
id="grid-city" type="number" name="repetitions">
</div>
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
@@ -132,7 +105,7 @@
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="grid-zip" type="number">
id="grid-zip" type="number" name="weight">
</div>
</div>
<button