2020-04-27 23:27:39 +02:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block content %}
|
2020-11-14 23:00:36 +01:00
|
|
|
<br>
|
|
|
|
<div class="text-center">
|
|
|
|
<p>{{ 'Are you available in case of alert?'|t }}</p>
|
|
|
|
<button class="btn btn-lg btn-success " onclick="activate('{{ user.id }}')">{{ 'Activate'|t }}</button>
|
|
|
|
<button class="btn btn-lg btn-danger" style="background-color: red"
|
|
|
|
onclick="deactivate('{{ user.id }}')">{{ 'Deactivate'|t }}</button>
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<script>
|
2020-11-21 21:41:37 +01:00
|
|
|
function generate_alert_string(id){
|
|
|
|
if(id == '{{ user.id }}'){
|
|
|
|
return '{{ "your availability"|t }}';
|
|
|
|
} else {
|
|
|
|
username = document.querySelector("#username-"+id).innerText;
|
2020-11-22 01:26:18 +01:00
|
|
|
return `{{ "%s availability"|t|format('${username}') }}`;
|
2020-11-21 21:41:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-14 23:00:36 +01:00
|
|
|
function activate(id) {
|
|
|
|
$.ajax({
|
|
|
|
url: "resources/ajax/ajax_change_availability.php",
|
|
|
|
method: "POST",
|
|
|
|
data: {
|
|
|
|
change_id: id,
|
|
|
|
dispo: 1,
|
|
|
|
token_list: "{{ token_list }}"
|
|
|
|
},
|
|
|
|
success: function (data) {
|
2020-11-21 21:41:37 +01:00
|
|
|
alert(`{{ 'Thanks, %s, you have given %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
|
|
|
|
clearInterval(window.loadTable_interval); //stop reloading
|
|
|
|
loadTable("list");
|
2020-11-14 23:00:36 +01:00
|
|
|
}
|
|
|
|
});
|
2020-10-18 00:22:11 +02:00
|
|
|
}
|
|
|
|
|
2020-11-14 23:00:36 +01:00
|
|
|
function deactivate(id) {
|
|
|
|
$.ajax({
|
|
|
|
url: "resources/ajax/ajax_change_availability.php",
|
|
|
|
method: "POST",
|
|
|
|
data: {
|
|
|
|
change_id: id,
|
|
|
|
dispo: 0,
|
|
|
|
token_list: "{{ token_list }}"
|
|
|
|
},
|
|
|
|
success: function (data) {
|
2020-11-21 21:41:37 +01:00
|
|
|
alert(`{{ 'Thanks, %s, you have removed %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
|
|
|
|
clearInterval(window.loadTable_interval); //stop reloading
|
|
|
|
loadTable("list");
|
2020-11-14 23:00:36 +01:00
|
|
|
}
|
|
|
|
});
|
2020-10-18 00:22:11 +02:00
|
|
|
}
|
2020-11-14 23:00:36 +01:00
|
|
|
</script>
|
|
|
|
<img alt="VVF" src="./resources/images/owner.png" width="150"
|
|
|
|
style="display: block; margin-left: auto; margin-right: auto;">
|
|
|
|
<br>
|
|
|
|
<br>
|
2020-11-21 21:41:37 +01:00
|
|
|
<div id="list" class="table-responsive">
|
|
|
|
<table class="table table-striped table-bordered">
|
2020-10-18 00:22:11 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{{ 'Name'|t }}</th>
|
|
|
|
<th>{{ 'Available'|t }}</th>
|
|
|
|
{% if user.full_viewer %}
|
|
|
|
<th>{{ 'Driver'|t }}</th>
|
|
|
|
<th>{{ 'Call'|t }}</th>
|
|
|
|
<th>{{ 'Write'|t }}</th>
|
|
|
|
<th>{{ 'Services'|t }}</th>
|
|
|
|
<th>{{ 'Availability Minutes'|t }}</th>
|
|
|
|
<th>{{ 'Other'|t }}</th>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="table_body">
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<script>
|
2020-11-14 23:00:36 +01:00
|
|
|
loadTable("list");
|
2020-10-18 00:22:11 +02:00
|
|
|
</script>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
<p style="text-align: center;">
|
|
|
|
<a id='add' href="edit_user.php?add">{{ 'Add user'|t }}</a>
|
|
|
|
</p>
|
|
|
|
<br>
|
|
|
|
<br>
|
2020-04-27 23:27:39 +02:00
|
|
|
{% endblock %}
|