diff --git a/schoolapps/static/common/style.css b/schoolapps/static/common/style.css index fb8e74a20e1b541f1ee9779e923a547a856d7ee2..4087548ac25f77ce78dc13b3fca2d01981c7291a 100755 --- a/schoolapps/static/common/style.css +++ b/schoolapps/static/common/style.css @@ -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'; +} diff --git a/schoolapps/timetable/hints.py b/schoolapps/timetable/hints.py index d8748bd1e074b6bd6f5fef755e67ad4eaed8a060..89340aa9f11e0b9b836b77459d01e42a77d2336d 100644 --- a/schoolapps/timetable/hints.py +++ b/schoolapps/timetable/hints.py @@ -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: diff --git a/schoolapps/timetable/templates/timetable/hints.html b/schoolapps/timetable/templates/timetable/hints.html index a140f6de0ea7f099fc692636acb2484c755fbe33..2a4e11ff2a661bc2908a05f8130f78643f06dc82 100755 --- a/schoolapps/timetable/templates/timetable/hints.html +++ b/schoolapps/timetable/templates/timetable/hints.html @@ -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 }} — {{ 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 - <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 + <span class="badge new red no-float no-margin">Lehrkräfte</span> + Lehrkräfte sehen den Hinweis <strong>nicht</strong> </p> </main> diff --git a/schoolapps/timetable/templates/timetable/hintsinplan.html b/schoolapps/timetable/templates/timetable/hintsinplan.html index 9c0c098b600d9eb4794dd90c34b71b242602df9c..a6c4c4461d3ea4ef90544a1c9a74a64afcf84340 100644 --- a/schoolapps/timetable/templates/timetable/hintsinplan.html +++ b/schoolapps/timetable/templates/timetable/hintsinplan.html @@ -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 diff --git a/schoolapps/timetable/templates/timetable/hintsinsub.html b/schoolapps/timetable/templates/timetable/hintsinsub.html index 0d7d0d34bc7f844cfda8ddfbe635632bbdc3c117..32a022549dd4853c94f175e680b013f7fc502bd7 100644 --- a/schoolapps/timetable/templates/timetable/hintsinsub.html +++ b/schoolapps/timetable/templates/timetable/hintsinsub.html @@ -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> diff --git a/schoolapps/timetable/views.py b/schoolapps/timetable/views.py index e754a3538a3da82658e6d6718791ca0be621f68b..e6dad0ca8ae41d809250b17f7bd7064ce80adfcc 100755 --- a/schoolapps/timetable/views.py +++ b/schoolapps/timetable/views.py @@ -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)