148 lines
7.1 KiB
PHP
148 lines
7.1 KiB
PHP
<?php include('../include/headscript.php'); ?>
|
|
<?php include("../class/company.php"); ?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
|
|
<?php include('../include/seo.php'); ?>
|
|
|
|
<link rel="shortcut icon" href="../assets/images/favicon.ico">
|
|
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
|
<link href="../assets/css/icons.css" rel="stylesheet" type="text/css">
|
|
<link href="../assets/css/style.css" rel="stylesheet" type="text/css">
|
|
<link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.js"></script>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.css">
|
|
<script src="../assets/js/jquery.min.js"></script>
|
|
<style>
|
|
/* Custom styles here */
|
|
</style>
|
|
</head>
|
|
|
|
<body class="fixed-left">
|
|
|
|
<div id="wrapper">
|
|
<?php include('../include/navigationbar.php'); ?>
|
|
|
|
<div class="content-page">
|
|
<div class="content">
|
|
|
|
<?php include('../include/topbar.php'); ?>
|
|
|
|
<div class="page-content-wrapper ">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="page-title-box">
|
|
<h4 class="page-title">Intervention necessary</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="header-title pb-3 mt-0">Records</h5>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-custom">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>UUID</th>
|
|
<th>Lab ID</th>
|
|
<th>Received At</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
// Database connection
|
|
$conn = new mysqli($servername, $username, $password, $database);
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
// Query for rows with processed = 2
|
|
$sql = "SELECT * FROM temp_json_queue WHERE processed = 2";
|
|
$result = $conn->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
echo "<tr>";
|
|
echo "<td>" . $row['id'] . "</td>";
|
|
echo "<td>" . $row['uuid'] . "</td>";
|
|
echo "<td>" . $row['lab_id'] . "</td>";
|
|
echo "<td>" . $row['received_at'] . "</td>";
|
|
echo "<td>
|
|
<a href='importjson.php?id=" . $row['id'] . "' class='btn btn-success btn-sm'>Import</a>
|
|
<button class='btn btn-danger btn-sm' onclick='deleteRow(" . $row['id'] . ")'><i class='bx bx-trash'></i></button>
|
|
</td>";
|
|
echo "</tr>";
|
|
}
|
|
} else {
|
|
echo "<tr><td colspan='5'>No records found</td></tr>";
|
|
}
|
|
|
|
$conn->close();
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div> <!-- container -->
|
|
</div> <!-- Page content Wrapper -->
|
|
</div> <!-- content -->
|
|
|
|
<?php include('../include/footer.php'); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function deleteRow(id) {
|
|
Swal.fire({
|
|
title: 'Are you sure?',
|
|
text: "This action cannot be undone!",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: 'Yes, delete it!',
|
|
cancelButtonText: 'No, cancel!',
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
$.ajax({
|
|
url: 'delete_json.php',
|
|
type: 'POST',
|
|
data: {
|
|
id: id
|
|
},
|
|
success: function(response) {
|
|
console.log(response); // Controlla cosa viene restituito
|
|
if (response.trim() == "success") {
|
|
Swal.fire('Deleted!', 'The record has been deleted.', 'success').then(() => {
|
|
window.location.reload();
|
|
});
|
|
} else {
|
|
Swal.fire('Error!', 'There was a problem deleting the record.', 'error');
|
|
}
|
|
},
|
|
|
|
error: function() {
|
|
Swal.fire('Error!', 'Could not reach the server.', 'error');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|