Working version of test tables

This commit is contained in:
Vivek Santayana 2021-11-25 10:34:01 +00:00
parent f771c19d99
commit 1d9d7853bd

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,41 +81,46 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% block custom_data_script %}
<script>
$(document).ready(function() {
$('#test-table').DataTable({
'columnDefs': [
{'sortable': false, 'targets': [1,3,5]},
{'searchable': false, 'targets': [3,5]}
],
'order': [[0, 'desc'], [2, 'asc']],
'buttons': [
'copy', 'excel', 'pdf'
],
'responsive': 'true',
'colReorder': 'true',
'fixedHeader': 'true'
});
} );
$('#test-table').show();
$(window).trigger('resize');
</script>
{% endblock %}
{% else %} {% else %}
<div class="alert alert-primary alert-db-empty"> <div class="alert alert-primary alert-db-empty">
<i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i> <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. There are no active exams. Use the form below to create an exam.
</div> </div>
{% endif %} {% endif %}
{% block custom_data_script %}
<script>
$(document).ready(function() {
$('#active-test-table').DataTable({
'columnDefs': [
{'sortable': false, 'targets': [1,3,5]},
{'searchable': false, 'targets': [3,5]}
],
'order': [[0, 'desc'], [2, 'asc']],
'buttons': [
'copy', 'excel', 'pdf'
],
'responsive': 'true',
'colReorder': 'true',
'fixedHeader': 'true'
});
} );
$('#test-table').show();
$(window).trigger('resize');
</script>
{% endblock %}
<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") }}