Create the training database (#463)

Co-authored-by: josephjboyden <josephjboyden@gmail.com>
This commit is contained in:
2022-01-18 15:47:53 +00:00
committed by GitHub
parent eaf891daf7
commit d25381b2de
85 changed files with 12550 additions and 841 deletions

View File

@@ -0,0 +1,54 @@
{% extends request.is_ajax|yesno:'base_ajax.html,base_training.html' %}
{% load static %}
{% load widget_tweaks %}
{% block css %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
{% endblock %}
{% block preload_js %}
{{ block.super }}
<script src="{% static 'js/selects.js' %}"></script>
{% endblock %}
{% block js %}
{{ block.super }}
<script src="{% static 'js/autocompleter.js' %}"></script>
<script src="{% static 'js/tooltip.js' %}"></script>
{% endblock %}
{% block content %}
{% if form.errors %}
{% include 'form_errors.html' %}
<script src="{% static 'js/autocompleter.js' %}"></script>
<script>
//Has to be done here or the pickers disappear on modal error
$('document').ready(function(){
$(document).find(".selectpicker").selectpicker().each(function(){initPicker($(this))});
});
</script>
{% endif %}
<form id="requirement-form" action="{{ form.action|default:request.path }}" method="post">{% csrf_token %}
{% render_field form.level|attr:'hidden' value=form.level.initial %}
<div class="form-group form-row">
<label for="item_id" class="col-sm-2 col-form-label">Item</label>
<select name="item" id="item_id" class="form-control selectpicker custom-select col-sm-10" data-live-search="true" data-sourceurl="{% url 'api_secure' model='training_item' %}" required>
</select>
</div>
<div class="form-group form-row">
<label for="depth" class="col-sm-2 col-form-label">Depth</label>
{% render_field form.depth|add_class:'form-control col-sm'|attr:'required' %}
</div>
{% if not request.is_ajax %}
<button type="submit" class="btn btn-primary">Save</button>
{% endif %}
</form>
{% endblock %}
{% block footer %}
<div class="col-sm-12 text-right pr-0">
<button type="submit" class="btn btn-primary" title="Save" form="requirement-form"><span class="fas fa-save align-middle"></span> <span class="d-none d-sm-inline align-middle">Save</span></button>
</div>
{% endblock %}

View File

@@ -0,0 +1,40 @@
{% extends 'base.html' %}
{% load static %}
{% block titleheader %}
<a class="navbar-brand" href="{% url 'trainee_list' %}">Training</a>
{% endblock %}
{% block titleelements %}
{% if user.is_authenticated %}
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-info" href="#" id="navbarDropdownMy" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
My Record
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMy">
<a class="dropdown-item" href="{% url 'trainee_detail' request.user.pk %}"><span class="fas fa-eye"></span>
Overview</a>
<a class="dropdown-item" href="{% url 'trainee_item_detail' request.user.pk %}"><span class="fas fa-list"></span>
Item Detail</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownLists" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Lists
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownLists">
<a class="dropdown-item" href="{% url 'trainee_list' %}"><span class="fas fa-users"></span> Trainee List</a>
<a class="dropdown-item" href="{% url 'level_list' %}"><span class="fas fa-layer-group"></span> Level List</a>
<a class="dropdown-item" href="{% url 'item_list' %}"><span class="fas fa-sitemap"></span> Item List</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="{% url 'training_activity_table' %}"><span class="fas fa-random"></span> Recent Changes</a></li>
{% endif %}
{% endblock %}
{% block titleelements_right %}
{% include 'partials/search.html' %}
{% include 'partials/navbar_user.html' %}
{% endblock %}

View File

@@ -0,0 +1,78 @@
{% extends request.is_ajax|yesno:'base_ajax.html,base_training.html' %}
{% load static %}
{% load widget_tweaks %}
{% load button from filters %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
{% endblock %}
{% block preload_js %}
<script src="{% static 'js/selects.js' %}"></script>
{% endblock %}
{% block js %}
<script src="{% static 'js/tooltip.js' %}"></script>
{% endblock %}
{% block content %}
<script src="{% static 'js/autocompleter.js' %}"></script>
<script>
//Has to be done here or the pickers disappear on modal error
$('document').ready(function(){
$(document).find(".selectpicker").selectpicker().each(function(){initPicker($(this))});
});
</script>
<form role="form" action="{{ form.action|default:request.path }}" method="POST" id="add_record_form">
{% include 'form_errors.html' %}
{% csrf_token %}
{% render_field form.trainee|attr:'hidden' value=form.trainee.initial %}
<div class="form-group form-row">
<label for="item_id" class="col-sm-2 col-form-label">Item</label>
<select name="item" id="item_id" class="form-control selectpicker custom-select col-sm-4" data-live-search="true" data-sourceurl="{% url 'api_secure' model='training_item' %}?fields=reference_number,name&filters=active" required>
{% if object.item %}
<option value="{{object.item.pk}}" selected>{{object.item}}</option>
{% endif %}
</select>
</div>
<div class="form-group form-row">
<label for="depth" class="col-sm-2 col-form-label">Depth</label>
{% render_field form.depth|add_class:'form-control custom-select col-sm-4' %}
</div>
<div class="form-group form-row">
<label for="supervisor" class="col-sm-2 col-form-label">Supervisor</label>
<select name="supervisor" id="supervisor_id" class="form-control selectpicker custom-select col-sm-10" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials&filters=is_supervisor" required>
{% if object.supervisor %}
<option value="{{object.supervisor.pk}}" selected>{{object.supervisor}}</option>
{% endif %}
</select>
</div>
<div class="form-group form-row">
<label for="date" class="col-sm-2 col-form-label">Training Date</label>
<div class="col-sm-8">
{% with training_date=object.date|date:"Y-m-d" %}
{% render_field form.date|add_class:'form-control'|attr:'type="date"' value=training_date %}
{% endwith %}
</div>
<button class="btn btn-info col-sm-2" onclick="var date = new Date(); $('#id_date').val([date.getFullYear(), ('0' + (date.getMonth()+1)).slice(-2), ('0' + date.getDate()).slice(-2)].join('-'))" tabindex="-1" type="button">Today</button>
</div>
<div class="form-group form-row">
<label for="id_notes" class="col-sm-2 col-form-label">Notes</label>
<div class="col-sm-8">
{% render_field form.notes|add_class:'form-control' rows=3 %}
</div>
</div>
{% if not request.is_ajax %}
<div class="col-sm-12 text-right pr-0">
{% button 'submit' %}
</div>
{% endif %}
</form>
{% endblock %}
{% block footer %}
<div class="col-sm-12 text-right pr-0">
<button type="submit" class="btn btn-primary" title="Save" form="add_record_form"><span class="fas fa-save align-middle"></span> <span class="d-none d-sm-inline align-middle">Save</span></button>
</div>
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends 'base_training.html' %}
{% block content %}
<div id="accordion">
{% for category in categories %}
<div class="card">
<div class="card-header" id="heading{{forloop.counter}}">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapse{{forloop.counter}}" aria-expanded="true" aria-controls="collapse{{forloop.counter}}">
{{ category }}
</button>
</div>
<div id="collapse{{forloop.counter}}" class="collapse" aria-labelledby="heading{{forloop.counter}}" data-parent="#accordion">
<div class="card-body">
<div class="list-group list-group-flush">
{% for item in category.items.all %}
{% if item.active %}
<li class="list-group-item">{{ item }}</li>
{% elif request.user.is_superuser %}
<li class="list-group-item text-warning">{{ item }}</li>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@@ -0,0 +1,142 @@
{% extends 'base_training.html' %}
{% load user_has_qualification from tags %}
{% load user_level_if_present from tags %}
{% load markdown_tags %}
{% load static %}
{% block css %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
{% endblock %}
{% block preload_js %}
{{ block.super }}
<script src="{% static 'js/selects.js' %}"></script>
{% endblock %}
{% block js %}
<script src="{% static 'js/autocompleter.js' %}"></script>
<script src="{% static 'js/tooltip.js' %}"></script>
<script>
$('document').ready(function(){
$('#requirement_button').click(function (e) {
e.preventDefault();
var url = $(this).attr("href");
$.ajax({
url: url,
success: function(){
$link = $(this);
// Anti modal inception
if ($link.parents('#modal').length === 0) {
modaltarget = $link.data('target');
modalobject = "";
$('#modal').load(url, function (e) {
$('#modal').modal();
$(".selectpicker").selectpicker().each(function(){initPicker($(this))});
});
}
}
});
});
});
</script>
{% endblock %}
{% block content %}
{% if request.user.is_supervisor or perms.training.add_traininglevelrequirement %}
<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">
<span class="fas fa-plus"></span> Add New Requirement
</a>
</div>
{% endif %}
<div class="card mb-3">
<h4 class="card-header">Description</h4>
<div class="card-body">
<p>{{ object.description|markdown }}</p>
</div>
</div>
<div class="card">
<div class="card-header"><h4 class="card-title">Level Requirements</h4> {% if u.pk != request.user.pk %}<h5 class="card-subtitle font-italic">for {{ u }}</h5>{% endif %}</div>
<div class="table-responsive card-body">
<table class="table">
<thead>
<tr>
<th scope="col" class="table-warning" style="width: 33%">Training Started</th>
<th scope="col" class="table-success" style="width: 33%">Training Complete</th>
<th scope="col" class="table-info" style="width: 33%">Passed Out</th>
</tr>
</thead>
<tbody class="table-body">
{% for level in object.prerequisite_levels.all %}
<tr data-toggle="collapse" data-target="#{{level.pk}}" style="cursor: pointer;"><th colspan="3" class="text-center font-italic" data-toggle="collapse" data-target="#level_{{level.pk}}">{{level}} (prerequisite)</th></tr>
<tr id="level_{{level.pk}}" class="collapse">
<td><ul class="list-unstyled">{% for req in level.started_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 0 %}</li>{% endfor %}</ul></td>
<td><ul class="list-unstyled">{% for req in level.complete_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 1 %}</li>{% endfor %}</ul></td>
<td><ul class="list-unstyled">{% for req in level.passed_out_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 2 %}</li>{% endfor %}</ul></td>
</tr>
{% endfor %}
<tr><th colspan="3" class="text-center">{{object}}</th></tr>
<tr>
<td><ul class="list-unstyled">{% for req in object.started_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 0 %} {% if request.user.is_supervisor or perms.training.delete_traininglevelrequirement %}<a type="button" class="btn btn-link tn-sm p-0 align-baseline" href="{% url 'remove_requirement' pk=req.pk %}"><span class="fas fa-trash-alt text-danger"></span></a>{%endif%}</li>{% endfor %}</ul></td>
<td><ul class="list-unstyled">{% for req in object.complete_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 1 %} {% if request.user.is_supervisor or perms.training.delete_traininglevelrequirement %}<a type="button" class="btn btn-link tn-sm p-0 align-baseline" href="{% url 'remove_requirement' pk=req.pk %}"><span class="fas fa-trash-alt text-danger"></span></a>{%endif%}</li>{% endfor %}</ul></td>
<td><ul class="list-unstyled">{% for req in object.passed_out_requirements %}<li>{{ req.item }} {% user_has_qualification u req.item 2 %} {% if request.user.is_supervisor or perms.training.delete_traininglevelrequirement %}<a type="button" class="btn btn-link tn-sm p-0 align-baseline"" href="{% url 'remove_requirement' pk=req.pk %}" title="Delete requirement"><span class="fas fa-trash-alt text-danger"></span></a>{%endif%}</li>{% endfor %}</ul></td>
</tr>
</tbody>
</table>
</div>
<h4 class="card-header">Prerequisite Levels:</h4>
<div class="card-body">
<ul>
{% for level in object.prerequisite_levels.all %}
{% user_level_if_present u level as level_qualification %}
<li><a href="{% url 'level_detail' level.pk u.pk %}">{{ level }}</a> <span class="fas {% if level_qualification %}text-success fa-check{% if level_qualification.confirmed_by is not None %}-double{% endif %}{% else %}fa-hourglass-start text-warning{%endif%}"></span></li>
{% for nested_level in level.prerequisite_levels.all %}
{% user_level_if_present u nested_level as nested_level_qualification %}
<ul>
<li><a href="{% url 'level_detail' nested_level.pk u.pk %}">{{ nested_level }}</a> <span class="fas {% if nested_level_qualification %}text-success fa-check{% if nested_level_qualification.confirmed_by is not None %}-double{% endif %}{% else %}fa-hourglass-start text-warning{%endif%}"></span></li>
</ul>
{% endfor %}
{% empty %}
None
{% endfor %}
</ul>
</div>
</div>
<div class="card mb-3 mt-2">
<h4 class="card-header">Users with this level</h4>
<div class="card-body">
{% for user in users_with %}
{% user_level_if_present user object as level_qualification %}
{% if forloop.first %}
<table class="table table-sm">
<thead>
<tr>
<th scope="col">Person</th>
<th scope="col">Confirmed?</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% endif %}
<tr {% if not level_qualification.confirmed_on %}style="border-style: dashed; opacity: 80%"{%endif%}>
<td><a href="{{user.get_absolute_url}}"><img src="{{user.profile_picture}}" style="width: 50px" class="img-thumbnail"/> {{user}}</a></td>
<td>{% if level_qualification.confirmed_on %}<p class="card-text"><small>Qualified on {{ level_qualification.confirmed_on }}</small></p>{%else%}Unconfirmed{%endif%}</td>
<td><a href="{% url 'profile_detail' user.pk %}" class="btn btn-primary btn-sm"><span class="fas fa-user"></span> View Profile</a></div></td>
</tr>
{% if forloop.last %}
</tbody>
</table>
{% endif %}
{% empty %}
Nobody here but us chickens... <span class="fas fa-egg text-warning"></span>
{% endfor %}
</div>
</div>
<div class="row">
<div class="col text-right">
{% include 'partials/last_edited.html' with target="traininglevel_history" %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,29 @@
{% extends 'base_training.html' %}
{% load markdown_tags %}
{% block content %}
{% if request.user.is_staff %}
<div class="alert alert-info" role="alert">
<p>Please Note:</p>
<ul>
<li>Technical Assistant status is automatically valid when the item requirements are met.</li>
<li>Technician status is also automatic, but notification of status should be made at the next general meeting, at which point 'approval' should be granted on the system.</li>
<li>Supervisor status is <em>not automatically valid</em> and until signed off at a general meeting, does not count.</li>
</ul>
<sup>Correct as of 3rd September 2021, check the Training Policy.</sup>
</div>
{% endif %}
{% for level in object_list %}
{% ifchanged level.department %}
{% if not forloop.first %}</div>{% endif %}
<div class="card-group">
{% endifchanged %}
<div class="card mb-2 border-{{level.department_colour}}">
<div class="card-body">
<h3 class="card-title"><a href="{{level.get_absolute_url}}">{{level}}</a></h2>
{{level.description|markdown}}
</div>
</div>
{% endfor %}
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% if request.user.is_supervisor or perms.training.add_trainingitemqualification %}
<a type="button" class="btn btn-success" href="{% url 'add_qualification' object.pk %}" id="add_record">
<span class="fas fa-plus"></span> Add New Training Record
</a>
{% endif %}

View File

@@ -0,0 +1,54 @@
{% extends 'base_rigs.html' %}
{% load static %}
{% load button from filters %}
{% block css %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
{% endblock %}
{% block preload_js %}
{{ block.super }}
<script src="{% static 'js/selects.js' %}"></script>
{% endblock %}
{% block js %}
{{ block.super }}
<script src="{% static 'js/autocompleter.js' %}"></script>
<script src="{% static 'js/interaction.js' %}"></script>
<script src="{% static 'js/tooltip.js' %}"></script>
{% endblock %}
{% block content %}
<div class="row">
<div class="col">
<form class="form">
<h3>People</h3>
<div class="form-group">
<label for="selectpicker">Select Supervisor</label>
<select name="supervisor" id="supervisor_id" class="form-control selectpicker custom-select" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials">
</select>
</div>
<div class="form-group">
<label for="selectpicker">Select Attendees</label>
<select multiple name="attendees" id="attendees_id" class="form-control selectpicker custom-select" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials">
</select>
</div>
<h3>Training Items</h3>
<div class="row">
{% for depth in depths %}
<div class="col">
<h4>{{ depth.1 }}</h4>
<select multiple name="{{ depth.0 }}" id="{{ depth.0 }}_id" class="form-control selectpicker custom-select" data-live-search="true" data-sourceurl="{% url 'api_secure' model='training_item' %}">
</select>
</div>
{% endfor %}
</div>
<div class="col-sm-12 text-right my-3">
{% button 'submit' %}
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,97 @@
{% extends 'base_training.html' %}
{% load static %}
{% load percentage_complete from tags %}
{% load confirm_button from tags %}
{% load markdown_tags %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
{% endblock %}
{% block preload_js %}
<script src="{% static 'js/selects.js' %}"></script>
{% endblock %}
{% block js %}
<script src="{% static 'js/tooltip.js' %}"></script>
<script>
$('document').ready(function(){
$('#add_record').click(function (e) {
e.preventDefault();
var url = $(this).attr("href");
$.ajax({
url: url,
success: function(){
$link = $(this);
// Anti modal inception
if ($link.parents('#modal').length === 0) {
modaltarget = $link.data('target');
modalobject = "";
$('#modal').load(url, function (e) {
$('#modal').modal();
//$(".selectpicker").selectpicker().each(function(){initPicker($(this))});
});
}
}
});
});
});
</script>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-12 text-right">
<div class="btn-group">
{% include 'partials/add_qualification.html' %}
<a href="{% url 'trainee_item_detail' object.pk %}" class="btn btn-info"><span class="fas fa-info-circle"></span> View Detailed Record</a>
<a href="{% url 'profile_detail' object.pk %}" class="btn btn-primary"><span class="fas fa-eye"></span> View User Profile</a>
</div>
</div>
</div>
<div class="row mb-3">
<h2 class="col-12">Training Levels</h2>
<ul class="list-group col-12">
{% for qual in completed_levels %}
<li class="list-group-item">
{{ qual.level.get_icon }}
<a href="{% url 'level_detail' qual.level.pk %}">{{ qual.level }}</a>
Confirmed by <a href="{{ qual.confirmed_by.get_absolute_url }}">{{ qual.confirmed_by|default:'System' }}</a> on {{ qual.confirmed_on|date }}
</li>
{% empty %}
<div class="alert alert-warning mx-auto">No qualifications in any levels yet...did someone forget to fill out the paperwork?</div>
{% endfor %}
</ul>
<div class="card-columns">
{% for level in started_levels %}
{% percentage_complete level object as completion %}
<div class="card my-3 border-warning">
<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>
{% if completion == 100 %}
<br>
{% confirm_button request.user object level as cb %}
{% if cb %}
<div class="d-flex justify-content-between">{{ cb }}</div>
{% else %}
<p class="font-italic pt-2 pb-0">Missing prerequisite level(s)</p>
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
<div class="row">
<div class="col text-right">
{% include 'partials/last_edited.html' with target="trainee_history" %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,54 @@
{% extends 'base_training.html' %}
{% load url_replace from filters %}
{% load paginator from filters %}
{% load linkornone from filters %}
{% load button from filters %}
{% load colour_from_depth from tags %}
{% block content %}
<p class="text-muted text-right">Search by supervisor name, item name or item ID</p>{% include 'partials/list_search.html' %}
<div class="row pt-2">
<div class="col">
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Training Item</th>
<th>Depth</th>
<th>Date</th>
<th>Supervisor</th>
<th>Notes</th>
{% if request.user.is_supervisor or perms.training.change_trainingitemqualification %}
<th></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for object in object_list %}
<tr id="row_item" {% if request.user.is_superuser and not object.item.active %}class="text-warning"{%endif%}>
<th scope="row" class="align-middle" id="cell_name">{{ object.item }}</th>
<td class="table-{% colour_from_depth object.depth %}">{{ object.get_depth_display }}</td>
<td>{{ object.date }}</td>
<td><a href="{{ object.supervisor.get_absolute_url}}">{{ object.supervisor }}</a></td>
<td>{{ object.notes }}</td>
{% if request.user.is_supervisor or perms.training.change_trainingitemqualification %}
<td>{% button 'edit' 'edit_qualification' trainee.pk %}</td>
{% endif %}
</tr>
{% empty %}
<tr class="table-warning">
<td colspan="6" class="text-center">Nothing found</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col text-right">
{% include 'partials/last_edited.html' with target="trainee_history" object=trainee %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,58 @@
{% extends 'base_training.html' %}
{% load url_replace from filters %}
{% load orderby from filters %}
{% load paginator from filters %}
{% load linkornone from filters %}
{% load button from filters %}
{% load get_levels_of_depth from tags %}
{% block js %}
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
{% endblock %}
{% block content %}
{% include 'partials/list_search.html' %}
<div class="row pt-2">
<div class="col">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th>Van Driver?</th>
<th>Technician?</th>
<th>Supervisor?</th>
<th>Qualification Count</th>
<th></th>
</tr>
</thead>
<tbody>
{% for object in object_list %}
<tr id="row_item">
<th scope="row" class="align-middle" id="cell_name"><a href="{% url 'trainee_detail' object.pk %}">{{ object.name }} {% if request.user.pk == object.pk %}<span class="fas fa-user text-success"></span>{%endif%}</a></th>
<td>{{ object.is_driver|yesno|title }}</td>
<td>{% for level in object|get_levels_of_depth:1 %}{% if forloop.first %}Yes {%endif%}{{ level.get_icon }}{%empty%}No{%endfor%}</td>
<td>{% for level in object|get_levels_of_depth:2 %}{% if forloop.first %}Yes {%endif%}{{ level.get_icon }}{%empty%}No{%endfor%}</td>
<td>{{ object.num_qualifications }} {% if forloop.first and page_obj.number is 1 %} <span class="fas fa-crown text-warning"></span>{% endif %}</td>
<td style="white-space: nowrap">
<a class="btn btn-info" href="{% url 'trainee_detail' pk=object.pk %}"><span class="fas fa-eye"></span> View Training Record</a>
<a href="{% url 'trainee_item_detail' pk=object.pk %}" class="btn btn-info"><span class="fas fa-info-circle"></span> View Detailed Record</a>
</td>
</tr>
{% empty %}
<tr class="table-warning">
<td colspan="6" class="text-center">Nothing found</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% paginator %}
{% endblock %}

View File

@@ -0,0 +1,16 @@
{% extends 'base_training.html' %}
{% block content %}
<div class="alert alert-danger" role="alert">
<p>Are you sure you wish to delete {{ page_title }}</p>
<div class="text-right">
<form action="{{ action_link }}" method="post">
{% csrf_token %}
<input type="hidden" name="next" value="{% url 'level_detail' object.level.pk %}"/>
<input type="submit" value="Yes" class="btn btn-danger col-sm-1"/>
<a href="{% url 'level_detail' object.level.pk %}" class="btn btn-success col-sm-1">No</a>
</form>
</div>
</div>
{% endblock %}