Finished delete and data table fiew for tests
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
<div class="navbar navbar-expand-sm navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<div class="expand navbar-expand justify-content-center" id="navbar_secondary">
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('admin_views.tests', filter='active') }}">Active</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('admin_views.tests', filter='scheduled') }}">Scheduled</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('admin_views.tests', filter='expired') }}">Expired</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('admin_views.tests', filter='all') }}">All</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('admin_views.tests', filter='create') }}">Create</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -2,7 +2,6 @@
|
||||
{% block title %} SKA Referee Test | Manage Users {% endblock %}
|
||||
{% block content %}
|
||||
<h1>Manage Users</h1>
|
||||
|
||||
<table id="user-table" class="table table-striped" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -50,9 +49,7 @@
|
||||
class="btn btn-primary"
|
||||
title="Update User"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-lines-fill" viewBox="0 0 16 16">
|
||||
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-5 6s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zM11 3.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5zm.5 2.5a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4zm2 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2zm0 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2z"/>
|
||||
</svg>
|
||||
<i class="bi bi-person-lines-fill button-icon"></i>
|
||||
</a>
|
||||
<a
|
||||
href="
|
||||
@ -66,16 +63,13 @@
|
||||
title="Delete User"
|
||||
{% if user._id == get_id_from_cookie() %} onclick="return false" {% endif %}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-x-fill" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M1 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm6.146-2.854a.5.5 0 0 1 .708 0L14 6.293l1.146-1.147a.5.5 0 0 1 .708.708L14.707 7l1.147 1.146a.5.5 0 0 1-.708.708L14 7.707l-1.146 1.147a.5.5 0 0 1-.708-.708L13.293 7l-1.147-1.146a.5.5 0 0 1 0-.708z"></path>
|
||||
</svg>
|
||||
<i class="bi bi-person-x-fill button-icon"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="form-container">
|
||||
<form name="form-create-user" class="form-signin">
|
||||
<h2 class="form-signin-heading">Create User</h2>
|
||||
@ -100,10 +94,7 @@
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<button title="Create User" class="btn btn-md btn-success btn-block" type="submit">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-plus-fill" viewBox="0 0 20 20">
|
||||
<path d="M1 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
||||
<path fill-rule="evenodd" d="M13.5 5a.5.5 0 0 1 .5.5V7h1.5a.5.5 0 0 1 0 1H14v1.5a.5.5 0 0 1-1 0V8h-1.5a.5.5 0 0 1 0-1H13V5.5a.5.5 0 0 1 .5-.5z"/>
|
||||
</svg>
|
||||
<i class="bi bi-person-plus-fill button-icon"></i>
|
||||
Create User
|
||||
</button>
|
||||
</div>
|
||||
|
@ -2,12 +2,11 @@
|
||||
{% block title %} SKA Referee Test | Manage Exams {% endblock %}
|
||||
{% block content %}
|
||||
<h1>Manage Exams</h1>
|
||||
{% if active_tests %}
|
||||
{% include "admin/components/secondary-navs/tests.html" %}
|
||||
<h2>{{ display_title }}</h2>
|
||||
{% if tests %}
|
||||
<table id="active-test-table" class="table table-striped" style="width:100%">
|
||||
<thead>
|
||||
<caption>
|
||||
Active Tests
|
||||
</caption>
|
||||
<tr>
|
||||
<th data-priority="1">
|
||||
Start Date
|
||||
@ -22,7 +21,7 @@
|
||||
Time Limit
|
||||
</th>
|
||||
<th data-priority="4">
|
||||
Results
|
||||
Entries
|
||||
</th>
|
||||
<th data-priority="1">
|
||||
Actions
|
||||
@ -30,16 +29,16 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for test in active_tests %}
|
||||
{% for test in tests %}
|
||||
<tr class="user-table-row">
|
||||
<td>
|
||||
{{ test.date.strftime('%d %b %Y') }}
|
||||
{{ test.start_date.strftime('%d %b %Y') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ '—'.join([test.test_code[:4], test.test_code[4:8], test.test_code[8:]]) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ test.expiry }}
|
||||
{{ test.expiry_date.strftime('%d %b %Y') }}
|
||||
</td>
|
||||
<td>
|
||||
{% if test.time_limit == None -%}
|
||||
@ -55,91 +54,107 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ test.creator }}
|
||||
{{ test.attempts|length }}
|
||||
</td>
|
||||
<td class="test-row-actions">
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-primary"
|
||||
class="btn btn-primary edit-test"
|
||||
data-_id="{{test._id}}"
|
||||
title="Edit Exam"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-lines-fill" viewBox="0 0 16 16">
|
||||
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-5 6s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zM11 3.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5zm.5 2.5a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4zm2 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2zm0 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2z"/>
|
||||
</svg>
|
||||
<i class="bi bi-file-earmark-text-fill button-icon"></i>
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-danger"
|
||||
class="btn btn-danger delete-test"
|
||||
data-_id="{{test._id}}"
|
||||
title="Delete Exam"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-x-fill" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M1 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm6.146-2.854a.5.5 0 0 1 .708 0L14 6.293l1.146-1.147a.5.5 0 0 1 .708.708L14.707 7l1.147 1.146a.5.5 0 0 1-.708.708L14 7.707l-1.146 1.147a.5.5 0 0 1-.708-.708L13.293 7l-1.147-1.146a.5.5 0 0 1 0-.708z"></path>
|
||||
</svg>
|
||||
<i class="bi bi-file-earmark-excel-fill button-icon"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
{% elif not filter == 'create' %}
|
||||
<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.
|
||||
{{ error_none }}
|
||||
</div>
|
||||
{% 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">
|
||||
<form name="form-create-test" class="form-signin">
|
||||
<h2 class="form-signin-heading">Create Exam</h2>
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="form-date-input">
|
||||
{{ form.start_date(placeholder="Enter Start Date", class_ = "datepicker") }}
|
||||
{{ 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 class="form-select-input">
|
||||
{{ form.time_limit(placeholder="Select Time Limit") }}
|
||||
{{ form.time_limit.label }}
|
||||
</div>
|
||||
{% include "admin/components/client-alerts.html" %}
|
||||
<div class="container form-submission-button">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<button title="Create Exam" class="btn btn-md btn-success btn-block" type="submit">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-plus-fill" viewBox="0 0 20 20">
|
||||
<path d="M1 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
||||
<path fill-rule="evenodd" d="M13.5 5a.5.5 0 0 1 .5.5V7h1.5a.5.5 0 0 1 0 1H14v1.5a.5.5 0 0 1-1 0V8h-1.5a.5.5 0 0 1 0-1H13V5.5a.5.5 0 0 1 .5-.5z"/>
|
||||
</svg>
|
||||
Create Exam
|
||||
</button>
|
||||
{% if form %}
|
||||
<div class="form-container">
|
||||
<form name="form-create-test" class="form-signin">
|
||||
<h2 class="form-signin-heading">Create Exam</h2>
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="form-date-input">
|
||||
{{ form.start_date(placeholder="Enter Start Date", class_ = "datepicker") }}
|
||||
{{ 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 class="form-select-input">
|
||||
{{ form.time_limit(placeholder="Select Time Limit") }}
|
||||
{{ form.time_limit.label }}
|
||||
</div>
|
||||
{% include "admin/components/client-alerts.html" %}
|
||||
<div class="container form-submission-button">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<button title="Create Exam" class="btn btn-md btn-success btn-block" type="submit">
|
||||
<i class="bi bi-file-earmark-plus-fill button-icon"></i>
|
||||
Create Exam
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% if tests %}
|
||||
{% 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']],
|
||||
dom: 'lfBrtip',
|
||||
'buttons': [
|
||||
{
|
||||
extend: 'print',
|
||||
exportOptions: {
|
||||
columns: [0, 1, 2, 3]
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
exportOptions: {
|
||||
columns: [0, 1, 2, 3]
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
exportOptions: {
|
||||
columns: [0, 1, 2, 3]
|
||||
}
|
||||
},
|
||||
],
|
||||
'responsive': 'true',
|
||||
'colReorder': 'true',
|
||||
'fixedHeader': 'true',
|
||||
});
|
||||
// $('.buttons-pdf').html('<span class="glyphicon glyphicon-file" data-toggle="tooltip" title="Export To Excel"/>') -->
|
||||
} );
|
||||
$('#test-table').show();
|
||||
$(window).trigger('resize');
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endif %}
|
Reference in New Issue
Block a user