2021-11-24 17:17:56 +00:00
|
|
|
{% extends "admin/components/datatable.html" %}
|
2021-11-23 13:00:03 +00:00
|
|
|
{% 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>
|
|
|
|
<th>
|
|
|
|
|
|
|
|
</th>
|
|
|
|
<th data-priority="1">
|
|
|
|
Username
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
Email Address
|
|
|
|
</th>
|
|
|
|
<th data-priority="1">
|
|
|
|
Actions
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for user in users %}
|
2021-11-28 17:28:14 +00:00
|
|
|
<tr class="table-row">
|
2021-11-23 13:00:03 +00:00
|
|
|
<td>
|
|
|
|
{% if user._id == get_id_from_cookie() %}
|
|
|
|
<div class="text-success" title="Current User">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi success bi-caret-right-fill" viewBox="0 0 16 16">
|
|
|
|
<path d="m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"/>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{ user.username }}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{ user.email }}
|
|
|
|
</td>
|
2021-11-28 17:28:14 +00:00
|
|
|
<td class="row-actions">
|
2021-11-23 13:00:03 +00:00
|
|
|
<a
|
|
|
|
href="
|
|
|
|
{% if not user._id == get_id_from_cookie() %}
|
|
|
|
{{ url_for('admin_views.update_user', _id = user._id ) }}
|
|
|
|
{% else %}
|
|
|
|
{{ url_for('admin_auth.account') }}
|
|
|
|
{% endif %}
|
|
|
|
"
|
|
|
|
class="btn btn-primary"
|
|
|
|
title="Update User"
|
|
|
|
>
|
2021-11-25 20:12:50 +00:00
|
|
|
<i class="bi bi-person-lines-fill button-icon"></i>
|
2021-11-23 13:00:03 +00:00
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
href="
|
|
|
|
{% if not user._id == get_id_from_cookie() %}
|
|
|
|
{{ url_for('admin_views.delete_user', _id = user._id ) }}
|
|
|
|
{% else %}
|
|
|
|
#
|
|
|
|
{% endif %}
|
|
|
|
"
|
|
|
|
class="btn btn-danger {% if user._id == get_id_from_cookie() %} disabled {% endif %}"
|
|
|
|
title="Delete User"
|
|
|
|
{% if user._id == get_id_from_cookie() %} onclick="return false" {% endif %}
|
|
|
|
>
|
2021-11-25 20:12:50 +00:00
|
|
|
<i class="bi bi-person-x-fill button-icon"></i>
|
2021-11-23 13:00:03 +00:00
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class="form-container">
|
2021-12-01 08:26:08 +00:00
|
|
|
<form name="form-create-user" class="form-display form-post" action="{{ url_for(request.endpoint, **request.view_args) }}" data-rel-success="">
|
|
|
|
<h2 class="form-heading">Create User</h2>
|
2021-11-23 13:00:03 +00:00
|
|
|
{{ form.hidden_tag() }}
|
|
|
|
<div class="form-label-group">
|
|
|
|
{{ form.username(class_="form-control", placeholder="Enter Username") }}
|
|
|
|
{{ form.username.label }}
|
|
|
|
</div>
|
|
|
|
<div class="form-label-group">
|
|
|
|
{{ form.email(class_="form-control", placeholder="Enter Email") }}
|
|
|
|
{{ form.email.label }}
|
|
|
|
</div>
|
|
|
|
<div class="form-label-group">
|
|
|
|
If you do not enter a password, a random one will be generated.
|
|
|
|
</div>
|
|
|
|
<div class="form-label-group">
|
|
|
|
{{ form.password(class_="form-control", placeholder="Enter Password") }}
|
|
|
|
{{ form.password.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 User" class="btn btn-md btn-success btn-block" type="submit">
|
2021-11-25 20:12:50 +00:00
|
|
|
<i class="bi bi-person-plus-fill button-icon"></i>
|
2021-11-23 13:00:03 +00:00
|
|
|
Create User
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
2021-11-24 17:17:56 +00:00
|
|
|
{% block custom_data_script %}
|
2021-11-23 13:00:03 +00:00
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#user-table').DataTable({
|
|
|
|
'columnDefs': [
|
|
|
|
{'sortable': false, 'targets': [0,3]}
|
|
|
|
],
|
|
|
|
'order': [[1, 'asc'], [2, 'asc']],
|
|
|
|
'buttons': [
|
|
|
|
'copy', 'excel', 'pdf'
|
|
|
|
],
|
|
|
|
'responsive': 'true',
|
|
|
|
'colReorder': 'true',
|
|
|
|
'fixedHeader': 'true'
|
|
|
|
});
|
|
|
|
} );
|
|
|
|
$('#user-table').show();
|
|
|
|
$(window).trigger('resize');
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|