Private
Public Access
1
0

plannedsessionteamedit

This commit is contained in:
Sander Roosendaal
2018-10-12 17:06:37 +02:00
parent a2c1777c74
commit ab1cba4ccb
3 changed files with 97 additions and 134 deletions

View File

@@ -7,7 +7,7 @@
{% block main %} {% block main %}
<h1>Create Team Session</h1> <h1>Create Team Session</h1>
<form enctype="multipart/form-data" action="{{ formloc }}" method="post"> <form enctype="multipart/form-data" action="" method="post">
{% if form.errors %} {% if form.errors %}
<p style="color: red;"> <p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below. Please correct the error{{ form.errors|pluralize }} below.

View File

@@ -1,151 +1,106 @@
{% extends "base.html" %} {% extends "newbase.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load rowerfilters %} {% load rowerfilters %}
{% block title %}New Planned Session{% endblock %} {% block title %}New Planned Session{% endblock %}
{% block content %} {% block main %}
<div class="grid_12 alpha"> <h1>Edit Team Session</h1>
{% include "planningbuttons.html" %} <form enctype="multipart/form-data" action="" method="post">
</div> {% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
{% csrf_token %}
<div class="grid_12 alpha"> <ul class="main-content">
<div id="left" class="grid_6 alpha"> <li class="grid_2">
<h1>Edit Team Session</h1> <h1>Select Team</h1>
</div> <p>
<div id="timeperiod" class="grid_2 dropdown"> Selecting a team assigns this session to all members of the team.
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button> Unselecting a team does not remove rowers
<div class="dropdown-content"> who are already assigned to this session. Use the Rowers selection for that.
<a class="button gray small alpha"
href="/rowers/sessions/create/today/rower/{{ rower.id }}">
Today
</a>
<a class="button gray small alpha"
href="/rowers/sessions/create/thisweek/rower/{{ rower.id }}">
This Week
</a>
<a class="button gray small alpha"
href="/rowers/sessions/create/thismonth/rower/{{ rower.id }}">
This Month
</a>
<a class="button gray small alpha"
href="/rowers/sessions/create/lastweek/rower/{{ rower.id }}">
Last Week
</a>
<a class="button gray small alpha"
href="/rowers/sessions/create/lastmonth/rower/{{ rower.id }}">
Last Month
</a>
<a class="button gray small alpha"
href="/rowers/sessions/create/nextweek/rower/{{ rower.id }}">
Next Week
</a>
<a class="button gray small alpha"
href="/rowers/sessions/create/nextmonth/rower/{{ rower.id }}">
Next Month
</a>
</div>
</div>
</div>
<div class="grid_12 alpha">
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
{% csrf_token %}
<div id="right" class="grid_6 alpha">
<h1>Select Team</h1>
<p>
Selecting a team assigns this session to all members of the team.
Unselecting a team does not remove rowers
who are already assigned to this session. Use the Rowers selection for that.
</p><p> </p><p>
<table> <table>
{{ teamform.as_table }} {{ teamform.as_table }}
</table></p> </table></p>
<h1>Select Rowers</h1> <h1>Select Rowers</h1>
<p> <p>
<table> <table>
{{ rowersform.as_table }} {{ rowersform.as_table }}
</table> </table>
</p> </p>
{% if plannedsessions %} {% if plannedsessions %}
<h1>Team Plan Sessions</h1> <h1>Team Plan Sessions</h1>
<p> <p>
<table class="listtable shortpadded" width="80%"> <table class="listtable shortpadded" width="80%">
<thead> <thead>
<tr> <tr>
<th>After</th> <th>After</th>
<th>Before</th> <th>Before</th>
<th>Name</th> <th>Name</th>
<th>Value</th> <th>Value</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>Edit</th> <th>Edit</th>
<th>Clone</th> <th>Clone</th>
<th>Delete</th> <th>Delete</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for ps in plannedsessions %} {% for ps in plannedsessions %}
<tr> <tr>
<td> {{ ps.startdate|date:"Y-m-d" }} </td> <td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td> <td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td> <td>
{% if ps.name != '' %} {% if ps.name != '' %}
<a class="small" <a class="small"
href="/rowers/sessions/{{ ps.id }}">{{ ps.name }}</a> href="/rowers/sessions/{{ ps.id }}">{{ ps.name }}</a>
{% else %} {% else %}
<a class="small" <a class="small"
href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a> href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a>
{% endif %} {% endif %}
</td> </td>
<td> {{ ps.sessionvalue }} </td> <td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td> <td> {{ ps.sessionunit }} </td>
<td> <td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/edit">Edit</a> <a class="small" href="/rowers/sessions/{{ ps.id }}/edit">Edit</a>
</td> </td>
<td> <td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/clone">Clone</a> <a class="small" href="/rowers/sessions/{{ ps.id }}/clone">Clone</a>
</td> </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
</li>
<li class="grid_2">
<td> <h1>Session {{ plannedsession.name }}</h1>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
</div>
<div class="grid_6 omega">
<h1>Session {{ plannedsession.name }}</h1>
<table> <table>
{{ form.as_table }} {{ form.as_table }}
</table> </table>
<div class="grid_1 prefix_2 alpha"> <p>
<a class="red button small" href="/rowers/sessions/{{ plannedsession.id }}/deleteconfirm">Delete</a> <a href="/rowers/sessions/{{ plannedsession.id }}/deleteconfirm">Delete</a>
</div> </p>
<div class="grid_1"> <p>
<a class="gray button small" href="/rowers/sessions/{{ plannedsession.id }}/clone">Clone</a> <a href="/rowers/sessions/{{ plannedsession.id }}/clone">Clone</a>
</div> </p>
<div id="formbutton" class="grid_1 suffix_1 omega"> <p>
<input class="button green" type="submit" value="Save"> <input class="button green" type="submit" value="Save">
</div> </p>
</form> <div id="id_guidance" class="padded">
<div class="grid_6" id="id_guidance">
</div> </div>
</div> </li>
</ul>
</div> </form>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
@@ -258,3 +213,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block sidebar %}
{% include 'menu_plan.html' %}
{% endblock %}

View File

@@ -13989,6 +13989,8 @@ def plannedsession_teamcreate_view(request,timeperiod='thisweek',
def plannedsession_teamedit_view(request,timeperiod='thisweek', def plannedsession_teamedit_view(request,timeperiod='thisweek',
sessionid=0): sessionid=0):
r = getrequestrower(request)
try: try:
ps = PlannedSession.objects.get(id=sessionid) ps = PlannedSession.objects.get(id=sessionid)
except PlannedSession.DoesNotExist: except PlannedSession.DoesNotExist:
@@ -14098,6 +14100,8 @@ def plannedsession_teamedit_view(request,timeperiod='thisweek',
{ {
'plannedsession':ps, 'plannedsession':ps,
'plan':trainingplan, 'plan':trainingplan,
'rower':r,
'active':'nav-plan',
'teams':get_my_teams(request.user), 'teams':get_my_teams(request.user),
'form':sessioncreateform, 'form':sessioncreateform,
'teamform':sessionteamselectform, 'teamform':sessionteamselectform,