Files
workout/templates/partials/page/dashboard.html

93 lines
4.5 KiB
HTML

<script>
let layout = {
margin: { t: 0 }, xaxis: { type: 'date', showgrid: false }, yaxis: {
title: 'Estimated 1RM (kg)',
showgrid: false
}
};
let config = { responsive: true, displayModeBar: false };
let hovertemplate = '<i>Estimated 1RM</i>: <b>%{y}kg</b><br><i>Topset</i>:<b>%{text}</b><br><i>Date</i>: <b>%{x}</b>';
</script>
<div class="w-full grid grid-cols-1 xl:grid-cols-3 2xl:grid-cols-3 gap-4">
{% for p in model['People'] %}
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
<div class="mb-4 flex items-center justify-between">
<div>
<h3 class="text-xl font-bold text-gray-900 mb-2">{{ p['PersonName'] }}</h3>
<span class="text-base font-normal text-gray-500">Current rep maxes</span>
</div>
<div class="flex-shrink-0">
<a hx-get="{{ url_for('get_calendar' ,person_id=p['PersonId']) }}" hx-push-url="true"
hx-target="#container"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg p-2 cursor-pointer">View
workouts</a>
</div>
</div>
{% if p['NumberOfWorkouts'] == 0 %}
<div class="bg-purple-100 rounded-lg py-5 px-6 mb-4 text-base text-purple-700 mb-3" role="alert">
No workouts completed.
</div>
{% endif %}
{% for e in p['Exercises'] %}
<div class="flex flex-col mt-8">
<div class="overflow-x-auto rounded-lg">
<div class="align-middle inline-block min-w-full">
<div class="shadow overflow-hidden sm:rounded-lg">
<h4 class="text-l font-semibold text-blue-400 mb-2 text-center">{{ e['ExerciseName'] }}</h4>
{% if e['RepMaxes']|length > 1 %}
<div id="person-{{ p['PersonId'] }}-exercise-{{ e['ExerciseId'] }}"
class="w-full mt-2 aspect-video"></div>
<script>
Plotly.newPlot(document.getElementById("person-{{ p['PersonId'] }}-exercise-{{ e['ExerciseId'] }}"), [{
x: {{ e['EstimatedOneRepMaxProgressions']['StartDates'] | replace('"', "'") | safe }},
y: {{ e['EstimatedOneRepMaxProgressions']['Estimated1RMs'] | replace('"', "'") | safe }},
text: {{ e['EstimatedOneRepMaxProgressions']['TopSets'] | replace('"', "'") | safe }},
name: "{{ p['PersonName'] }} - {{ e['ExerciseName'] }}",
hovertemplate
}], layout, config);
</script>
{% endif %}
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Date
</th>
<th scope="col"
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Rep Max
</th>
</tr>
</thead>
<tbody class="bg-white">
{% for rm in e['RepMaxes'] %}
<tr>
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
{{ rm['StartDate'] }}
</td>
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
{{ rm['Repetitions'] }} x {{ rm['Weight'] }}kg
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{{ render_partial('partials/stats.html', stats=model['Stats']) }}