Skip to content
Snippets Groups Projects
Commit 2e1ae85d authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Hints in teacher plans and in substitutions (HTML)

parent d6624c9b
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -158,23 +158,23 @@ span.badge .material-icons {
width: 100%;
}
.timetable-mobile-title-card{
.timetable-mobile-title-card {
margin-top: 50px;
margin-bottom: .60rem;
}
.timetable-mobile-title-card:first-child{
.timetable-mobile-title-card:first-child {
margin-top: -10px;
margin-bottom: .60rem;
}
.timetable-mobile-title-card .card-content{
.timetable-mobile-title-card .card-content {
padding: 10px;
text-align: center;
width: 100%;
}
.timetable-mobile-title-card .card-content .card-title{
.timetable-mobile-title-card .card-content .card-title {
font-weight: bold;
}
......@@ -331,6 +331,7 @@ main .alert p:first-child, main .alert div:first-child {
margin-left: -10px;
margin-right: -10px;
}
.btn, .btn-large, .btn-small {
background-color: #282E3F;
}
......@@ -354,12 +355,13 @@ FEEDBACK
}
@media only screen and (max-width: 992px) {
.rating{
.rating {
margin-top: 12px;
min-height: 40px;
justify-content: space-around;
}
´
´
}
.rating label {
......@@ -400,11 +402,27 @@ FEEDBACK
}
.support-input-mobile label {
line-height: 1rem;
line-height: 1rem;
}
.span-info {
width: 24px;
vertical-align: middle;
}
.span-info{
width: 24px;
vertical-align: middle;
i.collapsible-trigger {
margin-right: -10px;
}
.collapsible .collapsible-trigger::before {
content: 'arrow_downward';
}
.collapsible .collapsible-trigger.v2::before {
content: 'more_vert';
}
.collapsible .active .collapsible-trigger::before {
content: 'arrow_upward';
}
......@@ -17,9 +17,29 @@ def get_all_hints_by_class_and_time_period(_class, from_date, to_date):
return hints_match
def get_all_hints_for_teachers_by_time_period(from_date, to_date):
hints_tmp = get_all_hints_by_time_period(from_date, to_date)
hints_match = []
for hint in hints_tmp:
if hint.teachers:
hints_match.append(hint)
return hints_match
def get_all_hints_not_for_teachers_by_time_period(from_date, to_date):
hints_tmp = get_all_hints_by_time_period(from_date, to_date)
hints_match = []
for hint in hints_tmp:
if not hint.teachers:
hints_match.append(hint)
return hints_match
def get_all_hints_by_time_period(from_date, to_date):
print(from_date, to_date)
week_days = [from_date + datetime.timedelta(days=i) for i in range(5)]
delta = to_date - from_date
print(delta.days + 1)
week_days = [from_date + datetime.timedelta(days=i) for i in range(delta.days + 1)]
hints = []
for week_day in week_days:
......
......@@ -36,7 +36,6 @@
{% for hint in f.qs %}
<li>
<div class="collapsible-header row no-margin">
<i class="material-icons">keyboard_arrow_down</i>
<div class="col s10">
<strong>{{ hint.from_date }} &mdash; {{ hint.to_date }}</strong> für
......@@ -52,9 +51,8 @@
{% endif %}
</div>
<div class="col s2">
<div class="right">
<i class="material-icons center">more_vert</i>
</div>
<i class="material-icons right collapsible-trigger v2"></i>
</div>
</div>
......@@ -81,8 +79,10 @@
{% endfor %}
</ul>
<p>
<span class="badge new green no-float no-margin">Lehrkräfte</span> Lehrkräfte sehen den Hinweis &nbsp;&nbsp;
<span class="badge new red no-float no-margin">Lehrkräfte</span> Lehrkräfte sehen den Hinweis
<span class="badge new green no-float no-margin">Lehrkräfte</span>
Lehrkräfte sehen den Hinweis &nbsp;&nbsp;
<span class="badge new red no-float no-margin">Lehrkräfte</span>
Lehrkräfte sehen den Hinweis
<strong>nicht</strong>
</p>
</main>
......
......@@ -20,4 +20,47 @@
</div>
</div>
{% endfor %}
{% endif %}
{% if hints_b %}
<ul class="collapsible">
<li>
<div class="collapsible-header " style="font-size: 16px;">
<div class="col s12">
<i class="material-icons left">add</i>
Es gibt
{% if hints_b_mode == "week" %}
diese Woche
{% else %}
heute
{% endif %}
{% if hints %}
noch
{% endif %}
{{ hints_b|length }}
{% if hints %}
weitere(n)
{% endif %}
Hinweis(e).
<i class="material-icons right collapsible-trigger"></i>
</div>
</div>
<div class="collapsible-body">
{% for hint in hints_b %}
{% if not hint.teachers %}
<div>
<strong>
{{ hint.classes.all|join:", " }},
</strong>
{{ hint.from_date|date:"D, d.m." }},
{% if hint.from_date != hint.to_date %}
bis {{ hint.to_date|date:"D, d.m." }}
{% endif %}:
{{ hint.text|safe_markdown }}
</div>
{% endif %}
{% endfor %}
</div>
</li>
</ul>
{% endif %}
\ No newline at end of file
......@@ -2,11 +2,23 @@
{% if hints %}
<ul class="collapsible">
<li>
<div class="collapsible-header"><i class="material-icons">announcement</i>Es gibt Hinweise für diesen Tag.
<div class="collapsible-header " style="font-size: 16px;">
<div class="col s12">
<i class="material-icons left">announcement</i>Es gibt {{ hints|length }} Hinweis(e) für diesen Tag.
<i class="material-icons right collapsible-trigger"></i>
</div>
</div>
<div class="collapsible-body">
{% for hint in hints %}
{{ hint.text|safe_markdown }}
<div>
<strong>
{{ hint.classes.all|join:", " }}{% if hint.teachers and hint.classes.all %},{% endif %}
</strong>
{% if hint.teachers %}
<span class="badge new green no-float no-margin">Lehrkräfte</span>
{% endif %}:
{{ hint.text|safe_markdown }}
</div>
{% endfor %}
</div>
</li>
......
......@@ -11,7 +11,8 @@ from material import Fieldset, Row
from schoolapps.settings import SHORT_WEEK_DAYS, LONG_WEEK_DAYS
from timetable.filters import HintFilter
from timetable.forms import HintForm
from timetable.hints import get_all_hints_by_date, get_all_hints_by_time_period, get_all_hints_by_class_and_time_period
from timetable.hints import get_all_hints_by_date, get_all_hints_by_time_period, get_all_hints_by_class_and_time_period, \
get_all_hints_for_teachers_by_time_period, get_all_hints_not_for_teachers_by_time_period
from timetable.pdf import generate_class_tex, generate_pdf
from untisconnect.plan import get_plan, TYPE_TEACHER, TYPE_CLASS, TYPE_ROOM, parse_lesson_times
......@@ -98,10 +99,17 @@ def plan(request, plan_type, plan_id, regular="", year=timezone.datetime.now().y
# print(monday_of_week)
hints = None
hints_b = None
if plan_type == 'teacher':
_type = TYPE_TEACHER
el = get_teacher_by_id(plan_id)
# Get hints
if smart:
hints = list(get_all_hints_for_teachers_by_time_period(monday_of_week, friday))
hints_b = list(get_all_hints_not_for_teachers_by_time_period(monday_of_week, friday))
print(hints)
elif plan_type == 'class':
_type = TYPE_CLASS
el = get_class_by_id(plan_id)
......@@ -133,7 +141,9 @@ def plan(request, plan_type, plan_id, regular="", year=timezone.datetime.now().y
"selected_year": year,
"short_week_days": SHORT_WEEK_DAYS,
"long_week_days": LONG_WEEK_DAYS,
"hints": hints
"hints": hints,
"hints_b": hints_b,
"hints_b_mode": "week",
}
return render(request, 'timetable/plan.html', context)
......@@ -162,25 +172,26 @@ def my_plan(request, year=None, month=None, day=None):
el = get_teacher_by_shortcode(shortcode)
plan_id = el.id
raw_type = "teacher"
# print(el)
hints = []
# Get hints
hints = list(get_all_hints_for_teachers_by_time_period(date, date))
hints_b = list(get_all_hints_not_for_teachers_by_time_period(date, date))
elif _type == UserInformation.STUDENT:
_type = TYPE_CLASS
_name = UserInformation.user_classes(request.user)[0]
# print(_name)
el = get_class_by_name(_name)
plan_id = el.id
raw_type = "class"
# Get hints
hints = list(get_all_hints_by_class_and_time_period(el, date, date))
print(hints)
hints_b = None
else:
return redirect("timetable_admin_all")
# print(monday_of_week)
plan = get_plan(_type, plan_id, smart=True, monday_of_week=monday_of_week)
# print(parse_lesson_times())
context = {
"type": _type,
......@@ -193,9 +204,10 @@ def my_plan(request, year=None, month=None, day=None):
"date": date,
"date_js": int(date.timestamp()) * 1000,
"display_date_only": True,
"hints": hints
"hints": hints,
"hints_b": hints_b,
"hints_b_mode": "day",
}
# print(context["week_day"])
return render(request, 'timetable/myplan.html', context)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment