Working version of test tables

This commit is contained in:
Vivek Santayana 2021-11-25 10:34:01 +00:00
parent 2f45e58369
commit f68571900e

View File

@ -2,25 +2,27 @@
{% block title %} SKA Referee Test | Manage Exams {% endblock %} {% block title %} SKA Referee Test | Manage Exams {% endblock %}
{% block content %} {% block content %}
<h1>Manage Exams</h1> <h1>Manage Exams</h1>
{% if active_tests %}
{% if tests %} <table id="active-test-table" class="table table-striped" style="width:100%">
<table id="test-table" class="table table-striped" style="width:100%">
<thead> <thead>
<caption>
Active Tests
</caption>
<tr> <tr>
<th data-proority="1"> <th data-priority="1">
Date Created Start Date
</th>
<th data-priority="2">
Exam Code
</th> </th>
<th data-priority="1"> <th data-priority="1">
Exam Code
</th>
<th data-priority="2">
Expiry Date Expiry Date
</th> </th>
<th data-proority="4"> <th data-priority="3">
Time Limit Time Limit
</th> </th>
<th data-priority="3"> <th data-priority="4">
Created By Results
</th> </th>
<th data-priority="1"> <th data-priority="1">
Actions Actions
@ -28,10 +30,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for test in tests %} {% for test in active_tests %}
<tr class="user-table-row"> <tr class="user-table-row">
<td> <td>
{{ test.date.date() }} {{ test.date.strftime('%d %b %Y') }}
</td> </td>
<td> <td>
{{ '—'.join([test.test_code[:4], test.test_code[4:8], test.test_code[8:]]) }} {{ '—'.join([test.test_code[:4], test.test_code[4:8], test.test_code[8:]]) }}
@ -79,10 +81,17 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% else %}
<div class="alert alert-primary alert-db-empty">
<i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i>
There are no active exams. Use the form below to create an exam.
</div>
{% endif %}
{% block custom_data_script %} {% block custom_data_script %}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#test-table').DataTable({ $('#active-test-table').DataTable({
'columnDefs': [ 'columnDefs': [
{'sortable': false, 'targets': [1,3,5]}, {'sortable': false, 'targets': [1,3,5]},
{'searchable': false, 'targets': [3,5]} {'searchable': false, 'targets': [3,5]}
@ -100,20 +109,18 @@
$(window).trigger('resize'); $(window).trigger('resize');
</script> </script>
{% endblock %} {% endblock %}
{% else %}
<div class="alert alert-primary alert-db-empty">
<i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i>
No exams have been created. Use the form below to create an exam.
</div>
{% endif %}
<div class="form-container"> <div class="form-container">
<form name="form-create-test" class="form-signin"> <form name="form-create-test" class="form-signin">
<h2 class="form-signin-heading">Create Exam</h2> <h2 class="form-signin-heading">Create Exam</h2>
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
<div class="form-date-input"> <div class="form-date-input">
{{ form.expiry(placeholder="Enter Expiry Date", class_ = "datepicker") }} {{ form.start_date(placeholder="Enter Start Date", class_ = "datepicker") }}
{{ form.expiry.label }} {{ form.start_date.label }}
</div>
<div class="form-date-input">
{{ form.expiry_date(placeholder="Enter Expiry Date", class_ = "datepicker") }}
{{ form.expiry_date.label }}
</div> </div>
<div class="form-select-input"> <div class="form-select-input">
{{ form.time_limit(placeholder="Select Time Limit") }} {{ form.time_limit(placeholder="Select Time Limit") }}