Add more styles to student page
This commit is contained in:
parent
c97613e486
commit
f02439c65c
@ -1,19 +1,20 @@
|
|||||||
{% extends 'application.html' %}
|
{% extends 'application.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<section class="panel test">
|
||||||
<h1>Update User</h1>
|
<h1>Update User</h1>
|
||||||
|
|
||||||
<section>
|
|
||||||
<h3>{{ user.first_name }} {{ user.last_name }}</h3>
|
<h3>{{ user.first_name }} {{ user.last_name }}</h3>
|
||||||
{% if user.student %}
|
{% if user.student %}
|
||||||
<p>Student ID: {{user.student.student_number}}</p>
|
<p>Student ID: {{user.student.student_number}}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<p><a href="{% url 'password_change' %}">Change password</a></p>
|
||||||
<form method="post" action="{% url 'account-update' user.id %}">
|
<form method="post" action="{% url 'account-update' user.id %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
|
|
||||||
<input type="submit" value="Save changes" />
|
<input type="submit" value="Save changes"> or
|
||||||
|
<a href="{% url 'account-detail' user.id %}">Cancel</a>
|
||||||
</form>
|
</form>
|
||||||
<p><a href="{% url 'password_change' %}">Change password</a></p>
|
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
21
attendance/templates/attendance/_student_code.html
Normal file
21
attendance/templates/attendance/_student_code.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{% if user.student.code_set.last %}
|
||||||
|
<p class="student__code code">
|
||||||
|
<a class="code__button action-button" href="{% url 'code-update' user.student.code_set.last.id %}">
|
||||||
|
{% if clocked_in %}
|
||||||
|
Clock out →
|
||||||
|
{% else %}
|
||||||
|
Clock in →
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="student__code code">
|
||||||
|
<a class="action-button" href="{% url 'code-create' %}">
|
||||||
|
{% if clocked_in %}
|
||||||
|
Clock out →
|
||||||
|
{% else %}
|
||||||
|
Clock in →
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
29
attendance/templates/attendance/_student_periods.html
Normal file
29
attendance/templates/attendance/_student_periods.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<table class="attendance__log">
|
||||||
|
<caption class="attendance__month">{% now "F Y" %}</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Station</th>
|
||||||
|
<th>Clocked in</th>
|
||||||
|
<th>Clocked out</th>
|
||||||
|
<th>Duration</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for period in period_list %}
|
||||||
|
{% if period.clocked_out %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ period.station_number }}</td>
|
||||||
|
<td>{{ period.clocked_in }}</td>
|
||||||
|
{% if period.clocked_out %}
|
||||||
|
<td>{{ period.clocked_out }}</td>
|
||||||
|
<td>{{ period.clocked_in|timesince:period.clocked_out }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td colspan="2">Current sesson: {{ period.clocked_in|timesince }}</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% empty %}
|
||||||
|
<tr><td colspan="2">No periods yet.</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
@ -1,62 +1,22 @@
|
|||||||
<section class="student panel">
|
<section class="student panel">
|
||||||
<h1 class="student__department">{{ user.student.department.name }}</h1>
|
<h1 class="student__department">{{ user.student.department.name }}</h1>
|
||||||
{% if user.student.is_clocked_in and user.student.code_set.last %}
|
{% if user.student.is_clocked_in %}
|
||||||
<p><span class="student__clocked-in">You are currently clocked in.</span><br>
|
<div class="student__statusbar status">
|
||||||
|
<p><span class="status__clocked--clocked-in">You are currently clocked in.</span></p>
|
||||||
|
<p>
|
||||||
Clocked in at: <strong>{{ current_period.clocked_in|date:"P" }}</strong><br>
|
Clocked in at: <strong>{{ current_period.clocked_in|date:"P" }}</strong><br>
|
||||||
Current sesson: <strong>{{ current_period.clocked_in|timesince }}</strong></p>
|
Current sesson: <strong>{{ current_period.clocked_in|timesince }}</strong>
|
||||||
<p>
|
|
||||||
<a class="action-button" href="{% url 'code-update' user.student.code_set.last.id %}">Clock out →</a>
|
|
||||||
</p>
|
|
||||||
{% elif user.student.is_clocked_in and not user.student.code_set.last %}
|
|
||||||
<p><span class="student__clocked-in">You are currently clocked in.</span><br>
|
|
||||||
Clocked in at: {{ current_period.clocked_in }}<br>
|
|
||||||
Current sesson: <strong>{{ current_period.clocked_in|timesince }}</strong></p>
|
|
||||||
<p>
|
|
||||||
<a class="action-button" href="{% url 'code-create' %}">Clock out →</a>
|
|
||||||
</p>
|
|
||||||
{% elif user.student.code_set.last %}
|
|
||||||
<p>You are not clocked in.</p>
|
|
||||||
<p>
|
|
||||||
<a class="action-button" href="{% url 'code-update' user.student.code_set.last.id %}">Clock in →</a>
|
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
{% include 'attendance/_student_code.html' with clocked_in=True %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>You are not clocked in.</p>
|
<div class="status__clocked"></div>You are not clocked in.</p>
|
||||||
<p>
|
{% include 'attendance/_student_code.html' with clocked_in=False %}
|
||||||
<a class="action-button" href="{% url 'code-create' %}">Clock in →</a>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
<section class="attendance">
|
<section class="attendance">
|
||||||
<h2 class="attendance__title">Attendance log</h2>
|
<h2 class="attendance__title">Attendance log</h2>
|
||||||
<p class="attendance__total">Total hours for the month: <strong>{{period_total}}</strong><br>
|
<p class="attendance__total">Total hours for the month: <strong>{{period_total}}</strong><br>
|
||||||
<small>(Does not include current session.)</small></p>
|
<small>(Does not include current session.)</small></p>
|
||||||
<table class="attendance__log">
|
{% include 'attendance/_student_periods.html' %}
|
||||||
<caption class="attendance__month">{% now "F Y" %}</caption>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Station</th>
|
|
||||||
<th>Clocked in</th>
|
|
||||||
<th>Clocked out</th>
|
|
||||||
<th>Duration</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for period in period_list %}
|
|
||||||
{% if period.clocked_out %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ period.station_number }}</td>
|
|
||||||
<td>{{ period.clocked_in }}</td>
|
|
||||||
{% if period.clocked_out %}
|
|
||||||
<td>{{ period.clocked_out }}</td>
|
|
||||||
<td>{{ period.clocked_in|timesince:period.clocked_out }}</td>
|
|
||||||
{% else %}
|
|
||||||
<td colspan="2">Current sesson: {{ period.clocked_in|timesince }}</td>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% empty %}
|
|
||||||
<tr><td colspan="2">No periods yet.</td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -44,8 +44,6 @@ class AttendanceOverview(LoginRequiredMixin, TemplateView):
|
|||||||
clocked_in__month=timezone.now().month
|
clocked_in__month=timezone.now().month
|
||||||
).aggregate(total_duration=Sum('duration'))
|
).aggregate(total_duration=Sum('duration'))
|
||||||
|
|
||||||
print(periods_duration_sum)
|
|
||||||
print(timezone.now().month)
|
|
||||||
hours = 0
|
hours = 0
|
||||||
# Convert to hours floating point
|
# Convert to hours floating point
|
||||||
if periods_duration_sum['total_duration'] != None:
|
if periods_duration_sum['total_duration'] != None:
|
||||||
|
|||||||
@ -14,6 +14,8 @@ input {
|
|||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
label {
|
label {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@ -32,6 +34,7 @@ input[type=number],
|
|||||||
input[type=password],
|
input[type=password],
|
||||||
select[multiple=multiple],
|
select[multiple=multiple],
|
||||||
textarea {
|
textarea {
|
||||||
|
display: block;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: $primary-color;
|
color: $primary-color;
|
||||||
border: 4px solid $grey;
|
border: 4px solid $grey;
|
||||||
|
|||||||
@ -9,8 +9,14 @@
|
|||||||
&__department {
|
&__department {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&__clocked-in {
|
.status {
|
||||||
|
&__clocked {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
&__clocked--clocked-in {
|
||||||
background-color: $green;
|
background-color: $green;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
|
<h1>Change password</h1>
|
||||||
<form method="post" action="{% url 'password_change' %}">
|
<form method="post" action="{% url 'password_change' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
|
|
||||||
<input type="submit" value="Change my password">
|
<input type="submit" value="Change my password"> or
|
||||||
|
<a href="{{request.META.HTTP_REFERER}}">Cancel</a>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user