diff --git a/aleksis/apps/alsijil/templates/alsijil/class_register/lesson.html b/aleksis/apps/alsijil/templates/alsijil/class_register/lesson.html index 169939512ab656561c6b878db3d85f55e1d5a821..2e7308ab04bcfb0e09b4e318067a4105406bd813 100644 --- a/aleksis/apps/alsijil/templates/alsijil/class_register/lesson.html +++ b/aleksis/apps/alsijil/templates/alsijil/class_register/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/class_register/week_view.html b/aleksis/apps/alsijil/templates/alsijil/class_register/week_view.html index f5d5e4f7430ae8361fa1e36063e248cc82a8dd89..e42575fd07fc5ad520575643a1db2effa61ba66a 100644 --- a/aleksis/apps/alsijil/templates/alsijil/class_register/week_view.html +++ b/aleksis/apps/alsijil/templates/alsijil/class_register/week_view.html @@ -46,6 +46,7 @@ <table class="striped datatable"> <thead> <tr> + <th></th> <th>{% blocktrans %}Period{% endblocktrans %}</th> <th>{% blocktrans %}Subject{% endblocktrans %}</th> <th>{% blocktrans %}Teachers{% endblocktrans %}</th> @@ -53,24 +54,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 class="tr-link"> <a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}"> {{ period.period.period }}. 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 %}