Merge branch 'master' of https://github.com/allerta-vvf/allerta-vvf into master

This commit is contained in:
Matteo Gheza 2020-11-21 21:54:13 +01:00
commit 4ca794a87a
10 changed files with 44 additions and 33 deletions

View File

@ -617,9 +617,9 @@ class user
public function logout()
{
try {
$this->log("Logout", $this->auth->getUserId(), $this->auth->getUserId(), date("d/m/Y"), date("H:i.s"));
$this->auth->logOut();
$this->auth->destroySession();
$this->log("Logout", $this->auth->getUserId(), $this->auth->getUserId(), date("d/m/Y"), date("H:i.s"));
setcookie("authenticated", false, time() - 3600);
}
catch (\Delight\Auth\NotLoggedInException $e) {

View File

@ -35,7 +35,8 @@ foreach($risultato as $row){
$name = $user->nameById($row["id"]);
$name_encoded = urlencode($name);
$functionName = $row["available"] ? "deactivate" : "activate";
$firstCell = $row["chief"] ? "<a onclick='$functionName(".$row["id"].");'><img alt='chief' src='./resources/images/red_helmet.png' width='20px'>$name</a>" : "<a onclick='$functionName(".$row["id"].");'><img alt='normal user' src='./resources/images/black_helmet.png' width='20px'>$name</a>";
$helmet_colour = $row["chief"] ? "red" : "black";
$firstCell = "<a id='username-{$row['id']}' style='text-align: left;' onclick='$functionName(".$row["id"].");'><img alt='{$helmet_colour} helmet' src='./resources/images/{$helmet_colour}_helmet.png' width='20px'>$name</a>";
$secondCell = $row["available"] ? "<a onclick='$functionName(".$row["id"].");'><i class='fa fa-check' style='color:green'></i></a>" : "<a onclick='$functionName(".$row["id"].");'><i class='fa fa-times' style='color:red'></i></a>";
$response[] = [
(time()-$row["online_time"])<=30 ? "<u>".$firstCell."</u>" : $firstCell,

View File

@ -121,13 +121,7 @@ div.img {
background: #0095cd;
}
form {
border: 3px solid #f1f1f1;
}
input[type=text],
input[type=password],
input[type=email] {
.form_input {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
@ -193,16 +187,16 @@ textarea {
background: #0095cd;
}
th,td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
table {
margin: auto;
max-width: 95%;
text-align:center;
overflow-x:auto;
}
table {
box-shadow: 2px 2px 25px rgba(0, 0, 0, 0.5);
border-radius: 15px;
margin: auto;
th, td {
text-align: center;
vertical-align: middle !important;
}
.fa{

View File

@ -89,6 +89,7 @@ function fillTable(data, replaceLatLngWithMap=false){
$("#table_body").empty();
$.each(data, function(row_num, item) {
let row = document.createElement("tr");
row.id = "row-"+row_num;
$.each(item, function(cell_num, i) {
if(i !== null){
if(replaceLatLngWithMap && i.match(/[+-]?\d+([.]\d+)?[;][+-]?\d+([.]\d+)?/gm)){

View File

@ -11,6 +11,15 @@
<br>
<br>
<script>
function generate_alert_string(id){
if(id == '{{ user.id }}'){
return '{{ "your availability"|t }}';
} else {
username = document.querySelector("#username-"+id).innerText;
return `{{ "%s\'s availability"|t|format('${username}') }}`;
}
}
function activate(id) {
$.ajax({
url: "resources/ajax/ajax_change_availability.php",
@ -21,8 +30,9 @@
token_list: "{{ token_list }}"
},
success: function (data) {
alert("{{ 'Thanks, %s, you have given your availability in case of alert.'|t|format(user.name) }}");
location.reload();
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");
}
});
}
@ -37,8 +47,9 @@
token_list: "{{ token_list }}"
},
success: function (data) {
alert("{{ 'Thanks, %s, you have removed your availability in case of alert.'|t|format(user.name) }}");
location.reload();
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");
}
});
}
@ -47,8 +58,8 @@
style="display: block; margin-left: auto; margin-right: auto;">
<br>
<br>
<div id="list" style="overflow-x:auto;">
<table style="width: 90%; text-align:center;">
<div id="list" class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{{ 'Name'|t }}</th>

View File

@ -5,8 +5,8 @@
<img alt="VVF" src="./resources/images/owner.png" width="150"
style="display: block; margin-left: auto; margin-right: auto;">
<br>
<div id="list" style="overflow-x:auto;">
<table style="width: 90%; text-align:center;">
<div id="list" class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{{ 'Action'|t }}</th>

View File

@ -10,8 +10,8 @@
<a id='add' class="pjax_disable" href="edit_service.php?add">{{ 'Add service'|t }}</a>
</p>
<br>
<div id="list" style="overflow-x:auto;">
<table style="width: 90%; text-align:center;">
<div id="list" class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{{ 'Date'|t }}</th>

View File

@ -10,8 +10,8 @@
<a id='add' class="pjax_disable" href="edit_training.php?add">{{ 'Add training'|t }}</a>
</p>
<br>
<div id="list" style="overflow-x:auto;">
<table style="width: 90%; text-align:center;">
<div id="list" class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{{ 'Date'|t }}</th>

View File

@ -69,8 +69,10 @@ return [
"Are you available in case of alert?" => "Are you available in case of alert?",
"Activate" => "Activate",
"Deactivate" => "Deactivate",
"Thanks, %s, you have given your availability in case of alert." => "Thanks, %s, you have given your availability in case of alert.",
"Thanks, %s, you have removed your availability in case of alert." => "Thanks, %s, you have removed your availability in case of alert.",
"your availability" => "your availability",
"%s's availability" => "%s's availability",
"Thanks, %s, you have given %s in case of alert." => "Thanks, %s, you have given %s in case of alert.",
"Thanks, %s, you have removed %s in case of alert." => "Thanks, %s, you have removed %s in case of alert.",
"Add service" => "Add service",
"Add training" => "Add training",
"You are offline" => "You are offline",

View File

@ -69,8 +69,10 @@ return [
"Are you available in case of alert?" => "Sei disponibile in caso di allerta?",
"Activate" => "Attiva",
"Deactivate" => "Disattiva",
"Thanks, %s, you have given your availability in case of alert." => "Grazie, %s, hai dato la tua disponibilità in caso di allerta.",
"Thanks, %s, you have removed your availability in case of alert." => "Grazie, %s, hai rimosso la tua disponibilità in caso di allerta.",
"your availability" => "la tua disponibilità",
"%s's availability" => "la disponibilità di %s",
"Thanks, %s, you have given %s in case of alert." => "Grazie, %s, hai dato %s in caso di allerta.",
"Thanks, %s, you have removed %s in case of alert." => "Grazie, %s, hai rimosso %s in caso di allerta.",
"Add service" => "Aggiungi intervento",
"Add training" => "Aggiungi esercitazione",
"You are offline" => "Sei offline",