Add confirm button stuff

This commit is contained in:
2022-01-03 14:38:43 +00:00
parent 99e05d91bb
commit 5160eb7f78
6 changed files with 29 additions and 18 deletions

View File

@@ -44,6 +44,7 @@
{% endblock %}
{% block content %}
{% if u %}<h3>for {{ u }}</h3>{% endif %}
{% if request.user.is_supervisor or perms.training.change_traininglevel %}
<div class="col-sm-12 text-right pr-0">
<a type="button" class="btn btn-success mb-3" href="{% url 'add_requirement' pk=object.pk %}" id="requirement_button">

View File

@@ -2,6 +2,7 @@
{% load static %}
{% load percentage_complete from tags %}
{% load confirm_button from tags %}
{% load markdown_tags %}
{% block css %}
@@ -54,15 +55,7 @@
<li class="list-group-item">
{{ qual.level.get_icon }}
<a href="{% url 'level_detail' qual.level.pk %}">{{ qual.level }}</a>
{% if qual.confirmed_on is None %}
{% if request.user.pk != object.pk and request.user.is_supervisor %}
<span class="badge badge-warning">Awaiting Confirmation</span> <a class="btn btn-info" href="{% url 'confirm_level' object.pk qual.level.pk %}">Confirm</a>
{% else %}
<button class="btn btn-warning" disabled>Awaiting Confirmation</button>
{% endif %}
{% else %}
Confirmed by <a href="{{ qual.confirmed_by.get_absolute_url }}">{{ qual.confirmed_by|default:'System' }}</a> on {{ qual.confirmed_on|date }}
{% endif %}
</li>
{% empty %}
<div class="alert alert-warning mx-auto">No qualifications in any levels yet...did someone forget to fill out the paperwork?</div>
@@ -72,14 +65,22 @@
{% for level in started_levels %}
{% percentage_complete level object as completion %}
<div class="card my-3 border-warning">
<h3 class="card-header"><a href="{{ level.get_absolute_url }}">{{ level }}</a></h3>
<h3 class="card-header"><a href="{% url 'level_detail' level.pk object.pk %}">{{ level }}</a></h3>
<div class="card-body">
{{ level.description|markdown }}
</div>
<div class="card-footer">
<div class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" style="width: {{completion}}%" aria-valuenow="{{completion}}" aria-valuemin="0" aria-valuemax="100">{{completion}}% complete</div>
</div>
</div>
{% if completion == 100 %}
{% confirm_button request.user object level as cb %}
{% if cb %}
{{ cb }}
{% else %}
<p class="font-italic pt-2 pb-0">Missing prequisite level(s)</p>
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}