coach view
This commit is contained in:
@@ -1,197 +1,136 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "newbase.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}Planned Sessions{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="grid_12 alpha">
|
||||
{% include "planningbuttons.html" %}
|
||||
</div>
|
||||
<div class="grid_4 alpha">
|
||||
{% if theteam %}
|
||||
<h1>Coach Overview. Team {{ theteam.name }}</h1>
|
||||
{% else %}
|
||||
<h1>Coach Overview</h1>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div id="timeperiod" class="grid_2 dropdown">
|
||||
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button>
|
||||
<div class="dropdown-content">
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/today">
|
||||
Today
|
||||
</a>
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/thisweek">
|
||||
This Week
|
||||
</a>
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/thismonth">
|
||||
This Month
|
||||
</a>
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/lastweek">
|
||||
Last Week
|
||||
</a>
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/lastmonth">
|
||||
Last Month
|
||||
</a>
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/nextweek">
|
||||
Next Week
|
||||
</a>
|
||||
<a class="button gray small alpha"
|
||||
href="/rowers/sessions/coach/nextmonth">
|
||||
Next Month
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
<div class="grid_2 dropdown">
|
||||
<button class="grid_2 alpha button green small dropbtn">
|
||||
Select Rower Individual Plan
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
{% for member in user|team_rowers %}
|
||||
<a class="button green small" href="/rowers/sessions/{{ timeperiod }}/rower/{{ member.id }}">{{ member.user.first_name }} {{ member.user.last_name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_2 dropdown">
|
||||
<button class="grid_2 alpha button green small dropbtn">
|
||||
Select Team
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
<a class="button green small" href="/rowers/sessions/coach/{{ timeperiod }}">
|
||||
All Teams
|
||||
</a>
|
||||
|
||||
{% for team in myteams %}
|
||||
<a class="button green small" href="/rowers/sessions/coach/{{ timeperiod }}/team/{{ team.id }}">{{ team.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% block main %}
|
||||
{% if theteam %}
|
||||
<h1>Coach Overview. Team {{ theteam.name }}</h1>
|
||||
{% else %}
|
||||
<h1>Coach Overview</h1>
|
||||
{% endif %}
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
<table width="90%" class="listtable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>On or after</th>
|
||||
<th>On or before</th>
|
||||
<th>Preferred date</th>
|
||||
<th>Name</th>
|
||||
{% for r in rowers %}
|
||||
<th class="rotate"><div><span>
|
||||
{{ r.user.first_name }} {{ r.user.last_name }}
|
||||
|
||||
<table width="90%" class="listtable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">On or after</th>
|
||||
<th align="left">On or before</th>
|
||||
<th align="left">Preferred date</th>
|
||||
<th align="left">Name</th>
|
||||
{% for r in rowers %}
|
||||
<th class="rotate"><div><span>
|
||||
{{ r.user.first_name }} {{ r.user.last_name }}
|
||||
</span></div></th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for thedict in statusdict %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ thedict|lookup:'startdate'|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
{{ thedict|lookup:'enddate'|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
{{ thedict|lookup:'preferreddate'|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="/rowers/sessions/{{ thedict|lookup:"id" }}">
|
||||
{% if thedict|lookup:'name' %}
|
||||
{{ thedict|lookup:'name' }}
|
||||
{% else %}
|
||||
Unnamed Session
|
||||
{% endif %}
|
||||
</a>
|
||||
</td>
|
||||
{% for r in rowers %}
|
||||
<td>
|
||||
{% if thedict|lookup:'results'|lookup:r.id == 'completed' %}
|
||||
<a class="green dot"
|
||||
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}"> </a>
|
||||
{% elif thedict|lookup:'results'|lookup:r.id == 'partial' %}
|
||||
<a class="orange dot"
|
||||
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}"> </a>
|
||||
{% elif thedict|lookup:'results'|lookup:r.id == 'not done' %}
|
||||
<a class="white dot"
|
||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}"> </a>
|
||||
{% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %}
|
||||
|
||||
{% else %}
|
||||
<a class="red dot"
|
||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}"> </a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if unmatchedworkouts %}
|
||||
<h1>Workouts that are not linked to any session</h1>
|
||||
<table width="90%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> Rower</th>
|
||||
<th style="width:80"> Date</th>
|
||||
<th> Time</th>
|
||||
<th> Name</th>
|
||||
<th> Type</th>
|
||||
<th> Distance </th>
|
||||
<th> Duration </th>
|
||||
<th> Avg HR </th>
|
||||
<th> Max HR </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for workout in unmatchedworkouts %}
|
||||
<tr>
|
||||
<td> {{ workout.user.user.first_name }} {{ workout.user.user.last_name }} </td>
|
||||
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
||||
<td> {{ workout.starttime|date:"H:i" }} </td>
|
||||
{% if workout.user.user == user or user == team.manager %}
|
||||
{% if workout.name != '' %}
|
||||
<td>
|
||||
<a href={% url rower.defaultlandingpage id=workout.id %}>
|
||||
{{ workout.name }}
|
||||
</a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>
|
||||
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name
|
||||
</a></td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if workout.name != '' %}
|
||||
<td><a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a></td>
|
||||
{% else %}
|
||||
<td><a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<td> {{ workout.workouttype }} </td>
|
||||
<td> {{ workout.distance }}m</td>
|
||||
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
|
||||
<td> {{ workout.averagehr }} </td>
|
||||
<td> {{ workout.maxhr }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for thedict in statusdict %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ thedict|lookup:'startdate'|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
{{ thedict|lookup:'enddate'|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
{{ thedict|lookup:'preferreddate'|date:"Y-m-d" }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="/rowers/sessions/{{ thedict|lookup:"id" }}">
|
||||
{% if thedict|lookup:'name' %}
|
||||
{{ thedict|lookup:'name' }}
|
||||
{% else %}
|
||||
Unnamed Session
|
||||
{% endif %}
|
||||
</a>
|
||||
</td>
|
||||
{% for r in rowers %}
|
||||
<td>
|
||||
{% if thedict|lookup:'results'|lookup:r.id == 'completed' %}
|
||||
<a class="green dot"
|
||||
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}"> </a>
|
||||
{% elif thedict|lookup:'results'|lookup:r.id == 'partial' %}
|
||||
<a class="orange dot"
|
||||
href="{% url 'plannedsession_view' id=thedict|lookup:"id" rowerid=r.id %}"> </a>
|
||||
{% elif thedict|lookup:'results'|lookup:r.id == 'not done' %}
|
||||
<a class="white dot"
|
||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}"> </a>
|
||||
{% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %}
|
||||
|
||||
{% else %}
|
||||
<a class="red dot"
|
||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ thedict|lookup:"id" }}"> </a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if unmatchedworkouts %}
|
||||
<h1>Workouts that are not linked to any session</h1>
|
||||
<table width="90%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> Rower</th>
|
||||
<th style="width:80"> Date</th>
|
||||
<th> Time</th>
|
||||
<th> Name</th>
|
||||
<th> Type</th>
|
||||
<th> Distance </th>
|
||||
<th> Duration </th>
|
||||
<th> Avg HR </th>
|
||||
<th> Max HR </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for workout in unmatchedworkouts %}
|
||||
<tr>
|
||||
<td> {{ workout.user.user.first_name }} {{ workout.user.user.last_name }} </td>
|
||||
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
||||
<td> {{ workout.starttime|date:"H:i" }} </td>
|
||||
{% if workout.user.user == user or user == team.manager %}
|
||||
{% if workout.name != '' %}
|
||||
<td>
|
||||
<a href={% url rower.defaultlandingpage id=workout.id %}>
|
||||
{{ workout.name }}
|
||||
</a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>
|
||||
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name
|
||||
</a></td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if workout.name != '' %}
|
||||
<td><a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a></td>
|
||||
{% else %}
|
||||
<td><a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<td> {{ workout.workouttype }} </td>
|
||||
<td> {{ workout.distance }}m</td>
|
||||
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
|
||||
<td> {{ workout.averagehr }} </td>
|
||||
<td> {{ workout.maxhr }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_plan.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -7796,6 +7796,8 @@ def cumstats(request,theuser=0,
|
||||
s = enddate
|
||||
enddate = startdate
|
||||
startdate = s
|
||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
if modalityform.is_valid():
|
||||
modality = modalityform.cleaned_data['modality']
|
||||
waterboattype = modalityform.cleaned_data['waterboattype']
|
||||
@@ -7854,6 +7856,7 @@ def cumstats(request,theuser=0,
|
||||
'includereststrokes':includereststrokes,
|
||||
}
|
||||
|
||||
|
||||
request.session['options'] = options
|
||||
|
||||
|
||||
@@ -7938,7 +7941,6 @@ def cumstats(request,theuser=0,
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
'form':form,
|
||||
'deltaform':deltaform,
|
||||
'optionsform':modalityform,
|
||||
'cordict':cordict,
|
||||
})
|
||||
@@ -14151,11 +14153,21 @@ def plannedsession_teamedit_view(request,
|
||||
|
||||
@user_passes_test(iscoachmember,login_url="/rowers/planmembership/",
|
||||
redirect_field_name=None)
|
||||
def plannedsessions_coach_view(request,timeperiod='thisweek',
|
||||
teamid=0):
|
||||
def plannedsessions_coach_view(request,
|
||||
teamid=0,userid=0):
|
||||
|
||||
|
||||
therower = getrower(request.user)
|
||||
|
||||
when = request.GET.get('when')
|
||||
if when:
|
||||
timeperiod = when
|
||||
else:
|
||||
timeperiod = 'thisweek'
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(timeperiod)
|
||||
|
||||
|
||||
trainingplan = None
|
||||
|
||||
if teamid != 0:
|
||||
@@ -14211,6 +14223,8 @@ def plannedsessions_coach_view(request,timeperiod='thisweek',
|
||||
'statusdict':statusdict,
|
||||
'timeperiod':timeperiod,
|
||||
'rowers':rowers,
|
||||
'rower':therower,
|
||||
'active':'nav-plan',
|
||||
'theteam':theteam,
|
||||
'unmatchedworkouts':unmatchedworkouts,
|
||||
'rower':getrower(request.user)
|
||||
|
||||
@@ -690,7 +690,7 @@ th.rotate > div > span {
|
||||
color: #1c75bc;
|
||||
padding: 0.2em 0.0em 0.2em 0.0em;
|
||||
zoom: 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -928,27 +928,3 @@ a.wh:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.cd-accordion-menu input[type=checkbox] {
|
||||
/* hide native checkbox */
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
.cd-accordion-menu label, .cd-accordion-menu a {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 18px 18px 18px 64px;
|
||||
background: #4d5158;
|
||||
box-shadow: inset 0 -1px #555960;
|
||||
color: #ffffff;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
|
||||
.cd-accordion-menu input[type=checkbox]:checked + label + ul,
|
||||
.cd-accordion-menu input[type=checkbox]:checked + label:nth-of-type(n) + ul {
|
||||
/* use label:nth-of-type(n) to fix a bug on safari (<= 8.0.8) with multiple adjacent-sibling selectors*/
|
||||
/* show children when item is checked */
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user