Add form to create user overview graphs
This commit is contained in:
88
templates/partials/user_workouts_graphs.html
Normal file
88
templates/partials/user_workouts_graphs.html
Normal file
@@ -0,0 +1,88 @@
|
||||
<div class="flex flex-wrap mb-1">
|
||||
<div class="w-full md:w-1/4 px-3 mb-6 md:mb-0">
|
||||
<div class="mb-1 w-full">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
|
||||
Attributes
|
||||
</label>
|
||||
<select data-te-select-init data-te-select-filter="true" data-te-select-size="lg" name="attributes"
|
||||
class="bg-gray-50 border border-gray-300 " multiple
|
||||
hx-get="{{ url_for('graph_user_workouts', user_id=user.id) }}"
|
||||
hx-include="[name='start_date'],[name='end_date'],[name='period']"
|
||||
hx-target="#user-workouts-overview-graphs-{{ user.id }}" hx-swap="innerHTML" _="init js(me)
|
||||
te.Select.getOrCreateInstance(me).setValue({{ ['workout_count'] }})
|
||||
end">
|
||||
{% for val,name in user.attributes %}
|
||||
<option value="{{ val }}">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full md:w-1/4 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">
|
||||
Start date
|
||||
</label>
|
||||
<div class="relative">
|
||||
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
|
||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor"
|
||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<input type="date"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 w-full"
|
||||
name="start_date" value="{{ user.first_workout_date }}"
|
||||
hx-get="{{ url_for('graph_user_workouts', user_id=user.id) }}"
|
||||
hx-include="[name='attributes'],[name='end_date'],[name='period']"
|
||||
hx-target="#user-workouts-overview-graphs-{{ user.id }}" hx-swap="innerHTML" hx-trigger="change">
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full md:w-1/4 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">
|
||||
End date
|
||||
</label>
|
||||
<div class="relative">
|
||||
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
|
||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor"
|
||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<input type="date"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 w-full"
|
||||
name="end_date" value="{{ user.last_workout_date }}"
|
||||
hx-get="{{ url_for('graph_user_workouts', user_id=user.id) }}"
|
||||
hx-include="[name='start_date'],[name='attributes'],[name='period']"
|
||||
hx-target="#user-workouts-overview-graphs-{{ user.id }}" hx-swap="innerHTML" hx-trigger="change">
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full md:w-1/4 px-3 mb-6 md:mb-0">
|
||||
<div class="mb-1 w-full">
|
||||
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
|
||||
Period
|
||||
</label>
|
||||
<select data-te-select-init data-te-select-filter="true" data-te-select-size="lg" name="period"
|
||||
class="bg-gray-50 border border-gray-300 "
|
||||
hx-get="{{ url_for('graph_user_workouts', user_id=user.id) }}"
|
||||
hx-include="[name='start_date'],[name='end_date'],[name='attributes']"
|
||||
hx-target="#user-workouts-overview-graphs-{{ user.id }}" hx-swap="innerHTML" _="init js(me)
|
||||
te.Select.getOrCreateInstance(me).setValue({{ ['week'] }})
|
||||
end">
|
||||
|
||||
{% for p in user.periods %}
|
||||
<option value="{{ p }}">{{ p }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="user-workouts-overview-graphs-{{ user.id }}">
|
||||
<img src="{{ url_for('graph_user_workouts', user_id=user.id, period='week', attributes=['workout_count']) }}"
|
||||
loading="lazy" alt="No image" class="mx-auto">
|
||||
<img src="{{ url_for('graph_user_workouts', user_id=user.id, period='month', attributes=['duration']) }}"
|
||||
loading="lazy" alt="No image" class="mx-auto">
|
||||
</div>
|
||||
Reference in New Issue
Block a user