From 732af53fda7dfe679ba53dd556fddc6aaa785bf9 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Sat, 21 Aug 2021 00:09:00 +0100 Subject: [PATCH] Groundwork stuff for common competencies + other fixes --- assets/templates/asset_audit.html | 10 ++++---- assets/templates/asset_audit_list.html | 4 +--- training/templates/edit_training_record.html | 6 ++--- training/templates/level_detail.html | 22 ++++++++++++++--- training/templates/trainee_detail.html | 25 +------------------- training/views.py | 7 ++++-- 6 files changed, 33 insertions(+), 41 deletions(-) diff --git a/assets/templates/asset_audit.html b/assets/templates/asset_audit.html index e2f2d001..3d0190ba 100644 --- a/assets/templates/asset_audit.html +++ b/assets/templates/asset_audit.html @@ -64,16 +64,16 @@
{% include 'partials/form_field.html' with field=form.length append=form.length.help_text col="col-6" %}
- - - + + +
{% include 'partials/form_field.html' with field=form.csa append=form.csa.help_text title='CSA' col="col-6" %}
- - + +
diff --git a/assets/templates/asset_audit_list.html b/assets/templates/asset_audit_list.html index e90eb337..ae669c4a 100644 --- a/assets/templates/asset_audit_list.html +++ b/assets/templates/asset_audit_list.html @@ -12,9 +12,7 @@ }); $('#searchButton').click(function (e) { e.preventDefault(); - var url = "{% url 'asset_audit' None %}"; - var id = $("#{{form.q.id_for_label}}").val(); - url = url.replace('None', id); + var url = "{% url 'asset_audit' None %}".replace('None', $("#{{form.q.id_for_label}}").val(); $.ajax({ url: url, success: function(){ diff --git a/training/templates/edit_training_record.html b/training/templates/edit_training_record.html index 77cc4987..e10132f5 100644 --- a/training/templates/edit_training_record.html +++ b/training/templates/edit_training_record.html @@ -21,9 +21,6 @@ {% endblock %} {% block content %} -{% if form.errors %} - {% include 'form_errors.html' %} -{% endif %}
{% include 'form_errors.html' %} {% csrf_token %} @@ -44,9 +41,10 @@
-
+
{% render_field form.date|add_class:'form-control'|attr:'type="date"' value=form.date.initial %}
+
diff --git a/training/templates/level_detail.html b/training/templates/level_detail.html index 171007ba..2a1b711a 100644 --- a/training/templates/level_detail.html +++ b/training/templates/level_detail.html @@ -1,5 +1,8 @@ {% extends 'base_training.html' %} +{% load user_has_qualification from tags %} +{% load user_level_if_present from tags %} + {% block content %} {% if edit or True %}
@@ -27,6 +30,8 @@
+ {% empty %} + Nobody here but us chickens... {% endfor %}
@@ -43,12 +48,23 @@ - - - + + + +

Prerequisite Levels:

+
+
    + {% for level in object.prerequisite_levels.all %} + {% user_level_if_present request.user level as level_qualification %} +
  • {{ level }}
  • + {% empty %} + None + {% endfor %} +
+
{% include 'partials/last_edited.html' with target="traininglevel_history" %} {% endblock %} diff --git a/training/templates/trainee_detail.html b/training/templates/trainee_detail.html index 8534e343..ed4f9b6a 100644 --- a/training/templates/trainee_detail.html +++ b/training/templates/trainee_detail.html @@ -47,7 +47,7 @@ {% block content %}
@@ -70,31 +70,8 @@

{{ level.description|truncatewords:30 }}

{% percentage_complete level object as completion %} -
{{completion}}% complete
- - -
- - - - - - - - - - - - - - - -
Training StartedTraining CompletePassed Out
    {% for req in level.started_requirements %}
  • {{ req.item }} {% user_has_qualification object req.item 0 %}
  • {% endfor %}
    {% for req in level.complete_requirements %}
  • {{ req.item }} {% user_has_qualification object req.item 1 %}
  • {% endfor %}
    {% for req in level.passed_out_requirements %}
  • {{ req.item }} {% user_has_qualification object req.item 2 %}
  • {% endfor %}
-