When you select an exercise for a new topset autofill the reps/weight feilds with the most recent topset values if possible (I beleive I have introduced a minor defect where adding a new set no longer clears reps/weight feild, but for some reason still clears exercise)
This commit is contained in:
43
templates/partials/new_set_form.html
Normal file
43
templates/partials/new_set_form.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-state">
|
||||
Exercise
|
||||
</label>
|
||||
<div class="relative">
|
||||
|
||||
|
||||
<div class="w-full">
|
||||
<select data-te-select-init data-te-select-filter="true" data-te-select-size="lg" name="exercise_id"
|
||||
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"
|
||||
hx-get="{{ url_for('get_most_recent_topset_for_exercise', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-target="#new-set-workout-{{ workout_id }}" hx-swap="innerHTML" {% if has_value==True %} _="init js(me)
|
||||
te.Select.getOrCreateInstance(me).setValue('{{ exercise_id | safe }}')
|
||||
end" {% else %} _="init js(me)
|
||||
te.Select.getOrCreateInstance(me)
|
||||
end" {% endif %}>
|
||||
{% for e in exercises %}
|
||||
<option value="{{ e.exercise_id}}">{{
|
||||
e.name
|
||||
}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
|
||||
Reps
|
||||
</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" name="repetitions" {% if has_value==True %} value="{{ repetitions }}" {% endif %}>
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-zip">
|
||||
Weight
|
||||
</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" name="weight" step="any" {% if has_value==True %} value="{{ weight }}" {% endif %}>
|
||||
</div>
|
||||
@@ -103,51 +103,11 @@
|
||||
then call _hyperscript.processNode(#notifications-container)
|
||||
then reset() me">
|
||||
|
||||
<div class="flex flex-wrap -mx-3 mb-2">
|
||||
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
|
||||
for="grid-state">
|
||||
Exercise
|
||||
</label>
|
||||
<div class="relative">
|
||||
|
||||
|
||||
<div class="w-full">
|
||||
<select data-te-select-init data-te-select-filter="true" data-te-select-size="lg"
|
||||
name="exercise_id"
|
||||
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"
|
||||
_="init js(me)
|
||||
te.Select.getOrCreateInstance(me)
|
||||
end">
|
||||
{% for e in workout['Exercises'] %}
|
||||
<option value="{{ e['ExerciseId'] }}">{{
|
||||
e['Name']
|
||||
}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
|
||||
for="grid-city">
|
||||
Reps
|
||||
</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" name="repetitions">
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
|
||||
for="grid-zip">
|
||||
Weight
|
||||
</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" name="weight" step="any">
|
||||
</div>
|
||||
<div class="flex flex-wrap -mx-3 mb-2" id="new-set-workout-{{ workout['WorkoutId'] }}">
|
||||
{{ render_partial('partials/new_set_form.html', person_id=workout['PersonId'],
|
||||
workout_id=workout['WorkoutId'],
|
||||
exercises=exercises,
|
||||
has_value=False) }}
|
||||
</div>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 pt-2 px-0 sm:px-2">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user