diff --git a/aleksis/apps/alsijil/templates/alsijil/lesson.html b/aleksis/apps/alsijil/templates/alsijil/lesson.html index 7614a51c13db64e484a17d0c39e037f745b41d47..16b2579c768b8d07dad41a8d2646c745fa7e34f4 100644 --- a/aleksis/apps/alsijil/templates/alsijil/lesson.html +++ b/aleksis/apps/alsijil/templates/alsijil/lesson.html @@ -21,6 +21,10 @@ {% for teacher in lesson_period.get_teachers.all %} {{ teacher.short_name }} {% endfor %} + + <span class="right"> + {% include "alsijil/partials/lesson_status_icon.html" with period=lesson_period css_class="medium" %} + </span> {% endblock %} {% block content %} diff --git a/aleksis/apps/alsijil/templates/alsijil/partials/lesson_status_icon.html b/aleksis/apps/alsijil/templates/alsijil/partials/lesson_status_icon.html new file mode 100644 index 0000000000000000000000000000000000000000..08746b5c9791b1b3f118387b3835dd4cbc4eec03 --- /dev/null +++ b/aleksis/apps/alsijil/templates/alsijil/partials/lesson_status_icon.html @@ -0,0 +1,24 @@ +{% load i18n week_helpers %} + +{% now_datetime as now_dt %} + +{% if period.has_documentation %} + <i class="material-icons green-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Data complete" %}" title="{% trans "Data complete" %}">check_circle</i> +{% else %} + {% period_to_time_start week period.period as time_start %} + {% period_to_time_end week period.period as time_end %} + + {% if now_dt > time_end %} + <i class="material-icons red-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Missing data" %}" title="{% trans "Missing data" %}">history</i> + {% elif now_dt > time_start and now_dt < time_end %} + <i class="material-icons orange-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Pending" %}" title="{% trans "Pending" %}">more_horiz</i> + {% else %} + {% if period.get_substitution %} + {% if period.get_substitution.cancelled %} + <i class="material-icons red-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Lesson cancelled" %}" title="{% trans "Lesson cancelled" %}">cancel</i> + {% else %} + <i class="material-icons orange-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Substitution" %}" title="{% trans "Substitution" %}">update</i> + {% endif %} + {% endif %} + {% endif %} +{% endif %} diff --git a/aleksis/apps/alsijil/templates/alsijil/week_view.html b/aleksis/apps/alsijil/templates/alsijil/week_view.html index 0e160ef17f5a125200e4e2df2c826974c4a65e9e..e709d4871d9907156ef15c28c8565cadcf94820d 100644 --- a/aleksis/apps/alsijil/templates/alsijil/week_view.html +++ b/aleksis/apps/alsijil/templates/alsijil/week_view.html @@ -45,6 +45,7 @@ <table class="striped responsive-table datatable"> <thead> <tr> + <th></th> <th>{% blocktrans %}Period{% endblocktrans %}</th> <th>{% blocktrans %}Subject{% endblocktrans %}</th> <th>{% blocktrans %}Teachers{% endblocktrans %}</th> @@ -52,24 +53,10 @@ </thead> <tbody> {% for period in periods %} - <tr class=" - {% if period.has_documentation %} - success - {% else %} - {% weekday_to_date week period.period.weekday as current_date %} - {% today as today %} - {% if current_date < today %} - error - {% else %} - {% if period.get_substitution %} - warning - {% if period.get_substitution.cancelled %} - alsijil-lesson-cancelled - {% endif %} - {% endif %} - {% endif %} - {% endif %} - "> + <tr> + <td class="center-align"> + {% include "alsijil/partials/lesson_status_icon.html" with period=period %} + </td> <td>{{ period.period.period }}</td> <td> <a href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">