ug2024finals/templates/unauthorized.html

100 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mashinka Control</title>
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">
<!-- MDB -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="/">Seal Team</a>
<span class="navbar-text">
Недостаточно прав
</span>
</div>
</nav>
<div class=alertContainer id="alertcontainer"></div>
<center><h1>Вы не авторизированы</h1></center>
<div class="d-flex justify-content-center mt-5">
<button class="btn btn-primary btn-lg mr-3" class="update_form" type="button" onclick="document.location.href = '/login'">Авторизация</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-primary btn-lg ml-3" class="update_form" type="button" onclick="document.location.href = '/register'">Регистрация</button>
</div>
</div>
<!-- MDB -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<!--Script-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
function callSOSCheckEndpoint() {
setInterval(function() {
$.ajax({
url: '/sos_check',
method: 'POST',
success: function(data) {
if (data) {
data = JSON.parse(data);
console.log(data);
var alertHTML = '<div class="alert alert-success alert-dismissible fade show" role="alert">'
var alertMessages = [];
// Iterate over the returned data
data.forEach(function(alertt) {
var statname = alertt["stationName"];
var sosAlertType = alertt["alertType"];
var alertMessage = 'SOS ALERT ON THIS STATIONS: ' + statname + ':' + sosAlertType;
alertMessages.push(alertMessage);
});
alertMessages.forEach(function(alertMessage) {
alertHTML += '<div class="alert alert-warning">' + alertMessage + '</div>';
});
alertHTML += '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'
var x = document.getElementById("alertcontainer");
x.innerHTML = alertHTML;
}
}
});
}, 10000);
}
callSOSCheckEndpoint();
</script>
<script>
// this is the id of the submit button
$(".update_form").click(function() {
var myform = $(this).closest("form"); //parent form
$.ajax({
type: "POST",
url: "approve_test.php",
data: myform.serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
return false; // avoid to execute the actual submit of the form.
});
</script>
</body>
</html>