allerta-vvf/server/templates/lista.html

95 lines
2.5 KiB
HTML
Raw Normal View History

2020-04-27 23:27:39 +02:00
{% extends "base.html" %}
{% block content %}
<br>
<div class="text-center">
2020-07-03 11:38:41 +02:00
<p>{{ 'Are you available in case of alert?'|t }}</p>
2020-07-02 21:45:45 +02:00
<button class="btn btn-lg btn-success " onclick="Attivo('{{ user.id }}')">{{ 'Active'|t }}</button>
2020-04-27 23:27:39 +02:00
2020-07-02 21:45:45 +02:00
<button class="btn btn-lg btn-danger" style="background-color: red" onclick="NonAttivo('{{ user.id }}')">{{ 'Not Active'|t }}</button>
2020-04-27 23:27:39 +02:00
</div>
<script defer>
function Attivo(id){
2020-04-27 23:27:39 +02:00
$.ajax({
url: "risorse/ajax/ajax_aggiornadispo.php",
method: "POST",
data: {
change_id: id,
dispo: 1
2020-04-27 23:27:39 +02:00
},
success: function(data) {
2020-07-02 23:49:41 +02:00
alert("{{ 'Thanks, %s, you have given your availability in case of alert.'|t|format(user.name) }}");
2020-04-27 23:27:39 +02:00
location.reload();
}
});
}
2020-04-27 23:27:39 +02:00
function NonAttivo(id){
2020-04-27 23:27:39 +02:00
$.ajax({
url: "risorse/ajax/ajax_aggiornadispo.php",
method: "POST",
data: {
change_id: id,
dispo: 0
2020-04-27 23:27:39 +02:00
},
success: function(data) {
2020-07-02 23:49:41 +02:00
alert("{{ 'Thanks, %s, you have removed your availability in case of alert.'|t|format(user.name) }}");
2020-04-27 23:27:39 +02:00
location.reload();
}
});
}
2020-04-27 23:27:39 +02:00
</script>
<br>
<br>
2020-05-20 22:49:36 +02:00
<img alt="VVF" src="./risorse/images/owner.png" width="150" style="display: block; margin-left: auto; margin-right: auto;">
2020-04-27 23:27:39 +02:00
<br>
<br>
<div id="lista"></div>
{% if user.full_viewer == false %}
2020-04-27 23:27:39 +02:00
<script>
$( "#lista" ).load("risorse/ajax/ajax_lista.php");
$(document).ready(function() {
setInterval(function() {
$( "#lista" ).load("risorse/ajax/ajax_lista.php");
}, 10000);
});
</script>
{% elseif user.full_viewer == true %}
2020-04-27 23:27:39 +02:00
<script>
$( "#lista" ).load("risorse/ajax/ajax_lista_admin.php");
$(document).ready(function() {
setInterval(function() {
$( "#lista" ).load("risorse/ajax/ajax_lista_admin.php");
}, 10000);
});
</script>
2020-06-17 22:48:10 +02:00
<style>
#add {
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: bold 12px Arial, Helvetica, sans-serif;
color: #fff;
padding: 10px 20px;
border: solid 1px #0076a3;
background: #0095cd;
}
#href {
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: bold 12px Arial, Helvetica, sans-serif;
color: #fff;
padding: 10px 20px;
border: solid 1px #0076a3;
background: #0095cd;
}
</style>
2020-04-27 23:27:39 +02:00
{% endif %}
<script defer type="text/javascript" src="risorse/js/cache.js"></script>
<br>
<br>
{% endblock %}