From 7b4006ae2ca252e2f5246154ed63fcb17dd48882 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 15 Oct 2018 17:34:21 +0200 Subject: [PATCH] coach view --- rowers/templates/plannedsessionscoach.html | 299 ++++++++------------- rowers/views.py | 20 +- static/css/rowsandall2.css | 26 +- 3 files changed, 137 insertions(+), 208 deletions(-) diff --git a/rowers/templates/plannedsessionscoach.html b/rowers/templates/plannedsessionscoach.html index 170de818..5f7310b5 100644 --- a/rowers/templates/plannedsessionscoach.html +++ b/rowers/templates/plannedsessionscoach.html @@ -1,197 +1,136 @@ -{% extends "base.html" %} +{% extends "newbase.html" %} {% load staticfiles %} {% load rowerfilters %} {% block title %}Planned Sessions{% endblock %} -{% block content %} -
- {% include "planningbuttons.html" %} -
-
- {% if theteam %} -

Coach Overview. Team {{ theteam.name }}

- {% else %} -

Coach Overview

- {% endif %} -
- -{% if user.is_authenticated and user|is_manager %} - - +{% block main %} +{% if theteam %} +

Coach Overview. Team {{ theteam.name }}

+{% else %} +

Coach Overview

{% endif %} -
- - - - - - - - {% for r in rowers %} -
On or afterOn or beforePreferred dateName
- {{ r.user.first_name }} {{ r.user.last_name }} + + + + + + + + + {% for r in rowers %} + - {% endfor %} - - - - {% for thedict in statusdict %} - - - - - - {% for r in rowers %} - - {% endfor %} - - {% endfor %} - -
On or afterOn or beforePreferred dateName
+ {{ r.user.first_name }} {{ r.user.last_name }}
- {{ thedict|lookup:'startdate'|date:"Y-m-d" }} - - {{ thedict|lookup:'enddate'|date:"Y-m-d" }} - - {{ thedict|lookup:'preferreddate'|date:"Y-m-d" }} - - - {% if thedict|lookup:'name' %} - {{ thedict|lookup:'name' }} - {% else %} - Unnamed Session - {% endif %} - - - {% if thedict|lookup:'results'|lookup:r.id == 'completed' %} -   - {% elif thedict|lookup:'results'|lookup:r.id == 'partial' %} -   - {% elif thedict|lookup:'results'|lookup:r.id == 'not done' %} -   - {% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %} -   - {% else %} -   - {% endif %} -
- - {% if unmatchedworkouts %} -

Workouts that are not linked to any session

- - - - - - - - - - - - - - - - {% for workout in unmatchedworkouts %} - - - - - {% if workout.user.user == user or user == team.manager %} - {% if workout.name != '' %} - - {% else %} - - {% endif %} - {% else %} - {% if workout.name != '' %} - - {% else %} - - {% endif %} - {% endif %} - - - - - - {% endfor %} - + + + + {% for thedict in statusdict %} + + + + + + {% for r in rowers %} + + {% endfor %} + + {% endfor %} + +
Rower Date Time Name Type Distance Duration Avg HR Max HR
{{ workout.user.user.first_name }} {{ workout.user.user.last_name }} {{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }} - - {{ workout.name }} - - - No Name - {{ workout.name }}No Name {{ workout.workouttype }} {{ workout.distance }}m {{ workout.duration |durationprint:"%H:%M:%S.%f" }} {{ workout.averagehr }} {{ workout.maxhr }}
+ {{ thedict|lookup:'startdate'|date:"Y-m-d" }} + + {{ thedict|lookup:'enddate'|date:"Y-m-d" }} + + {{ thedict|lookup:'preferreddate'|date:"Y-m-d" }} + + + {% if thedict|lookup:'name' %} + {{ thedict|lookup:'name' }} + {% else %} + Unnamed Session + {% endif %} + + + {% if thedict|lookup:'results'|lookup:r.id == 'completed' %} +   + {% elif thedict|lookup:'results'|lookup:r.id == 'partial' %} +   + {% elif thedict|lookup:'results'|lookup:r.id == 'not done' %} +   + {% elif thedict|lookup:'results'|lookup:r.id == 'not assigned' %} +   + {% else %} +   + {% endif %} +
+ +{% if unmatchedworkouts %} +

Workouts that are not linked to any session

+ + + + + + + + + + + + + + + + {% for workout in unmatchedworkouts %} + + + + + {% if workout.user.user == user or user == team.manager %} + {% if workout.name != '' %} + + {% else %} + + {% endif %} + {% else %} + {% if workout.name != '' %} + + {% else %} + + {% endif %} + {% endif %} + + + + + + + {% endfor %} +
Rower Date Time Name Type Distance Duration Avg HR Max HR
{{ workout.user.user.first_name }} {{ workout.user.user.last_name }} {{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }} + + {{ workout.name }} + + + No Name + {{ workout.name }}No Name {{ workout.workouttype }} {{ workout.distance }}m {{ workout.duration |durationprint:"%H:%M:%S.%f" }} {{ workout.averagehr }} {{ workout.maxhr }}
- - {% endif %} -
+{% endif %} + {% endblock %} + +{% block sidebar %} +{% include 'menu_plan.html' %} +{% endblock %} diff --git a/rowers/views.py b/rowers/views.py index f4f326c6..fbc93fb8 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -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) diff --git a/static/css/rowsandall2.css b/static/css/rowsandall2.css index 60a14cc3..c9b87d10 100644 --- a/static/css/rowsandall2.css +++ b/static/css/rowsandall2.css @@ -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; -} -