145 lines
6.7 KiB
HTML
145 lines
6.7 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block content %}
|
|
|
|
<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 %}
|
|
<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 href="{{ url_for('get_person' ,person_id=p['PersonId']) }}"
|
|
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg p-2">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>
|
|
<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>
|
|
<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>
|
|
|
|
<div class="mt-4 w-full grid grid-cols-1 md:grid-cols-3 2xl:grid-cols-4 xl:grid-cols-5 gap-4">
|
|
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<span class="text-2xl sm:text-3xl leading-none font-bold text-gray-900">{{ stats['TotalWorkouts']
|
|
}}</span>
|
|
<h3 class="text-base font-normal text-gray-500">Total workouts tracked</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<span class="text-2xl sm:text-3xl leading-none font-bold text-gray-900">{{
|
|
stats['AverageWorkoutsPerWeek']
|
|
}}</span>
|
|
<h3 class="text-base font-normal text-gray-500">Avg. weekly workouts</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<span class="text-2xl sm:text-3xl leading-none font-bold text-gray-900">{{ stats['NumberOfPeople']
|
|
}}</span>
|
|
<h3 class="text-base font-normal text-gray-500">People tracked</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% if stats['TotalWorkouts'] > 0 %}
|
|
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<span class="text-2xl sm:text-3xl leading-none font-bold text-gray-900">{{
|
|
stats['DaysSinceFirstWorkout']
|
|
}}</span>
|
|
<h3 class="text-base font-normal text-gray-500">Days since first workout</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<span class="text-2xl sm:text-3xl leading-none font-bold text-gray-900">{{ stats['DaysSinceLastWorkout']
|
|
}}</span>
|
|
<h3 class="text-base font-normal text-gray-500">Days since last workout</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% endblock %} |