Update 18-09-2024 adding NAS
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
<?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'); ?>
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
||||
<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">
|
||||
<style>
|
||||
.table-custom tr {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.table-custom td,
|
||||
.table-custom th {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.table-custom .btn {
|
||||
padding: 2px 15px;
|
||||
line-height: 1.7;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* Questo allinea verticalmente gli elementi nella riga */
|
||||
gap: 10px;
|
||||
/* Questo crea una piccola distanza tra gli elementi nella riga */
|
||||
}
|
||||
|
||||
.table-custom .form-control,
|
||||
.table-custom .form-select {
|
||||
height: 25px;
|
||||
/* Puoi modificare questo valore per adattarlo al tuo design */
|
||||
padding: 2px 6px;
|
||||
/* riduce la dimensione del padding */
|
||||
font-size: 14px;
|
||||
/* riduce la dimensione del font */
|
||||
}
|
||||
|
||||
.table-custom .form-control-sm.analysis-input {
|
||||
height: 25px;
|
||||
/* Questo modifica la dimensione degli input con classe 'form-control-sm' e 'analysis-input' */
|
||||
padding: 2px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body class="fixed-left">
|
||||
|
||||
<!-- Loader -->
|
||||
<div id="preloader">
|
||||
<div id="status">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="wrapper">
|
||||
|
||||
<?php include('../include/navigationbar.php'); ?>
|
||||
|
||||
<!-- Start right Content here -->
|
||||
|
||||
<div class="content-page">
|
||||
<!-- Start content -->
|
||||
<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">
|
||||
<div class="btn-group float-right">
|
||||
<ol class="breadcrumb hide-phone p-0 m-0">
|
||||
<li class="breadcrumb-item"><a href="#">Reportify</a></li>
|
||||
<li class="breadcrumb-item active">Importify</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Reports</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title end breadcrumb -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="header-title pb-3 mt-0">Reports</h5>
|
||||
<a class="btn btn-primary" href="insert-importifytemplate.php" role="button">Reports Dahboard</a>
|
||||
<a class="btn btn-danger" href="../index.php" role="button">Dahboard</a>
|
||||
|
||||
<br><br>
|
||||
<div class="col-sm-12 mb-3">
|
||||
<input type="text" class="form-control" id="searchInput" placeholder="Search by Component or CAS">
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm sm-0">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><strong>Report N.</strong></th>
|
||||
<th><strong>Lab</strong></th>
|
||||
<th><strong>Ref. Number</strong></th>
|
||||
<th><strong>Description</strong></th>
|
||||
<th><strong>Test Out</strong></th>
|
||||
<th><strong>Rating</strong></th>
|
||||
<th><strong>Action</strong></th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $reportslist = new WA_MySQLi_RS("rsl", $repnew, 0);
|
||||
$reportslist->setQuery("SELECT * FROM reports LEFT JOIN products ON reports.idproducts=products.idproducts ORDER BY reports.reportsDateOut ");
|
||||
$reportslist->execute();
|
||||
|
||||
$wa_startindex = 0;
|
||||
while (!$reportslist->atEnd()) {
|
||||
$wa_startindex = $reportslist->Index;
|
||||
?> <tr>
|
||||
<td><?php echo ($reportslist->getColumnVal("reportsNumberLab")); ?></td>
|
||||
<td><?php echo ($reportslist->getColumnVal("lab")); ?></td>
|
||||
<td><?php echo ($reportslist->getColumnVal("products_refnumber")); ?></td>
|
||||
<td><?php echo substr($reportslist->getColumnVal("products_description"), 0, 50); ?></td>
|
||||
|
||||
<td><?php echo ($reportslist->getColumnVal("reportsDateOut")); ?></td>
|
||||
<td><?php echo ($reportslist->getColumnVal("reportsRating")); ?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<a class="btn btn-success" href="material-rsl.php?id=<?php echo ($reportslist->getColumnVal("idimporttemplates")); ?>" role="button" data-toggle="tooltip" title="Go"><i class="fas fa-angle-double-right font-size-16 align-middle"></i></a>
|
||||
<a class="btn btn-primary" href="material-rsl.php?id=<?php echo ($reportslist->getColumnVal("idimporttemplates")); ?>" role="button" data-toggle="tooltip" title="Expand"><i class="fas fa-angle-double-down font-size-16 align-middle"></i></a>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php $reportslist->moveNext();
|
||||
}
|
||||
$reportslist->moveFirst(); //return RS to first record
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
|
||||
?></tbody>
|
||||
</table>
|
||||
</div><!--end table-responsive-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
|
||||
</div><!-- container -->
|
||||
|
||||
</div> <!-- Page content Wrapper -->
|
||||
|
||||
</div> <!-- content -->
|
||||
|
||||
<?php include('../include/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
<!-- End Right content here -->
|
||||
|
||||
</div>
|
||||
<!-- END wrapper -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- plugin JS -->
|
||||
<script src="../assets/js/jquery.min.js"></script>
|
||||
<script src="../assets/js/popper.min.js"></script>
|
||||
<script src="../assets/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/js/modernizr.min.js"></script>
|
||||
<script src="../assets/js/detect.js"></script>
|
||||
<script src="../assets/js/fastclick.js"></script>
|
||||
<script src="../assets/js/jquery.slimscroll.js"></script>
|
||||
<script src="../assets/js/jquery.blockUI.js"></script>
|
||||
<script src="../assets/js/waves.js"></script>
|
||||
<script src="../assets/js/jquery.nicescroll.js"></script>
|
||||
<script src="../assets/js/jquery.scrollTo.min.js"></script>
|
||||
|
||||
<script src="../assets/plugins/chart.js/chart.min.js"></script>
|
||||
<script src="../assets/pages/dashboard.js"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="../assets/js/app.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
include('../include/headscript.php');
|
||||
include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Recupera il valore di reportId dal POST
|
||||
$reportId = isset($_POST['reportId']) ? $_POST['reportId'] : 0;
|
||||
|
||||
// Query per ottenere le analisi associate al report, comprese le parti
|
||||
$query = "
|
||||
SELECT a.nameanalysisvoc AS name, rp.result_Rating AS finalRating
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
||||
WHERE rp.idreports = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("i", $reportId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
// Array per raccogliere le analisi e le relative valutazioni (rating)
|
||||
$analysis = [];
|
||||
|
||||
// Raggruppa le analisi e seleziona il rating più restrittivo
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$name = $row['name'];
|
||||
$rating = strtoupper($row['finalRating']); // Normalizziamo tutto in maiuscolo per uniformità
|
||||
|
||||
if (!isset($analysis[$name])) {
|
||||
// Se l'analisi non è ancora presente, la aggiungiamo
|
||||
$analysis[$name] = $rating;
|
||||
} else {
|
||||
// Applica il rating più restrittivo: Fail > N/A > Pass
|
||||
if ($analysis[$name] != 'FAIL' && ($rating == 'FAIL' || $rating == "DOESN'T COMPLY")) {
|
||||
$analysis[$name] = 'FAIL';
|
||||
} elseif ($analysis[$name] != 'FAIL' && $analysis[$name] != 'N/A' && ($rating == 'N/A' || $rating == '//')) {
|
||||
$analysis[$name] = 'N/A';
|
||||
} elseif ($analysis[$name] == 'PASS' && ($rating == 'PASS' || $rating == 'COMPLIES')) {
|
||||
$analysis[$name] = 'PASS';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Trasforma i dati in un array
|
||||
$finalAnalysis = [];
|
||||
foreach ($analysis as $name => $finalRating) {
|
||||
$finalAnalysis[] = [
|
||||
'name' => $name,
|
||||
'finalRating' => $finalRating
|
||||
];
|
||||
}
|
||||
|
||||
// Restituisci i dati come JSON
|
||||
echo json_encode($finalAnalysis);
|
||||
+158
-158
@@ -1,6 +1,16 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Query per ottenere tutti i report e i prodotti associati
|
||||
$query = "
|
||||
SELECT r.*, p.products_refnumber, p.products_description
|
||||
FROM reports r
|
||||
LEFT JOIN products p ON r.idproducts = p.idproducts";
|
||||
$result = $conn->query($query);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@@ -8,221 +18,211 @@
|
||||
<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'); ?>
|
||||
<title>Reports</title>
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- Includi prima jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
||||
<link rel="shortcut icon" href="../assets/images/favicon.ico">
|
||||
<!-- Includi DataTables CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
|
||||
|
||||
<!-- Includi DataTables JS -->
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
|
||||
<!-- Altri riferimenti al CSS e JS -->
|
||||
<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">
|
||||
<style>
|
||||
.table-custom tr {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.table-custom td,
|
||||
.table-custom th {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.table-custom .btn {
|
||||
padding: 2px 15px;
|
||||
line-height: 1.7;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* Questo allinea verticalmente gli elementi nella riga */
|
||||
gap: 10px;
|
||||
/* Questo crea una piccola distanza tra gli elementi nella riga */
|
||||
}
|
||||
|
||||
.table-custom .form-control,
|
||||
.table-custom .form-select {
|
||||
height: 25px;
|
||||
/* Puoi modificare questo valore per adattarlo al tuo design */
|
||||
padding: 2px 6px;
|
||||
/* riduce la dimensione del padding */
|
||||
font-size: 14px;
|
||||
/* riduce la dimensione del font */
|
||||
}
|
||||
|
||||
.table-custom .form-control-sm.analysis-input {
|
||||
height: 25px;
|
||||
/* Questo modifica la dimensione degli input con classe 'form-control-sm' e 'analysis-input' */
|
||||
padding: 2px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<style>
|
||||
.bg-danger {
|
||||
background-color: #ff4d4d !important;
|
||||
/* Rosso per fallimenti */
|
||||
}
|
||||
|
||||
.bg-success {
|
||||
background-color: #28a745 !important;
|
||||
/* Verde per successi */
|
||||
}
|
||||
|
||||
.bg-warning {
|
||||
background-color: #ffc107 !important;
|
||||
/* Giallo per N/A o // */
|
||||
}
|
||||
|
||||
.text-white {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.text-dark {
|
||||
color: black !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body class="fixed-left">
|
||||
|
||||
<!-- Loader -->
|
||||
<div id="preloader">
|
||||
<div id="status">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="wrapper">
|
||||
|
||||
<?php include('../include/navigationbar.php'); ?>
|
||||
|
||||
<!-- Start right Content here -->
|
||||
|
||||
<div class="content-page">
|
||||
<!-- Start content -->
|
||||
<div class="content">
|
||||
|
||||
<?php include('../include/topbar.php'); ?>
|
||||
|
||||
<div class="page-content-wrapper ">
|
||||
|
||||
<div class="page-content-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="page-title-box">
|
||||
<div class="btn-group float-right">
|
||||
<ol class="breadcrumb hide-phone p-0 m-0">
|
||||
<li class="breadcrumb-item"><a href="#">Reportify</a></li>
|
||||
<li class="breadcrumb-item active">Importify</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Reports</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title end breadcrumb -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="header-title pb-3 mt-0">Reports</h5>
|
||||
<a class="btn btn-primary" href="insert-importifytemplate.php" role="button">Reports Dahboard</a>
|
||||
<a class="btn btn-danger" href="../index.php" role="button">Dahboard</a>
|
||||
|
||||
<br><br>
|
||||
<div class="col-sm-12 mb-3">
|
||||
<input type="text" class="form-control" id="searchInput" placeholder="Search by Component or CAS">
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm sm-0">
|
||||
<table id="reportsTable" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><strong>Report N.</strong></th>
|
||||
<th><strong>Lab</strong></th>
|
||||
<th><strong>Ref. Number</strong></th>
|
||||
<th><strong>Description</strong></th>
|
||||
<th><strong>Test Out</strong></th>
|
||||
<th><strong>Rating</strong></th>
|
||||
<th><strong>Action</strong></th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th>Report Number</th>
|
||||
<th>Report Date</th>
|
||||
<th>Product Ref</th>
|
||||
<th>Product Description</th>
|
||||
<th>Rating</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $reportslist = new WA_MySQLi_RS("rsl", $repnew, 0);
|
||||
$reportslist->setQuery("SELECT * FROM reports LEFT JOIN products ON reports.idproducts=products.idproducts ORDER BY reports.reportsDateOut ");
|
||||
$reportslist->execute();
|
||||
|
||||
$wa_startindex = 0;
|
||||
while (!$reportslist->atEnd()) {
|
||||
$wa_startindex = $reportslist->Index;
|
||||
?> <tr>
|
||||
<td><?php echo ($reportslist->getColumnVal("reportsNumberLab")); ?></td>
|
||||
<td><?php echo ($reportslist->getColumnVal("lab")); ?></td>
|
||||
<td><?php echo ($reportslist->getColumnVal("products_refnumber")); ?></td>
|
||||
<td><?php echo substr($reportslist->getColumnVal("products_description"), 0, 50); ?></td>
|
||||
|
||||
<td><?php echo ($reportslist->getColumnVal("reportsDateOut")); ?></td>
|
||||
<td><?php echo ($reportslist->getColumnVal("reportsRating")); ?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php while ($row = $result->fetch_assoc()) { ?>
|
||||
<tr data-reportid="<?php echo $row['idreports']; ?>">
|
||||
<td><?php echo $row['reportsNumberLab']; ?></td>
|
||||
<td><?php echo $row['reportDateIn']; ?></td>
|
||||
<td><?php echo $row['products_refnumber']; ?></td>
|
||||
<td><?php echo $row['products_description']; ?></td>
|
||||
<td><?php echo $row['reportsRating']; ?></td>
|
||||
<td>
|
||||
<a class="btn btn-success" href="material-rsl.php?id=<?php echo ($reportslist->getColumnVal("idimporttemplates")); ?>" role="button" data-toggle="tooltip" title="Go"><i class="fas fa-angle-double-right font-size-16 align-middle"></i></a>
|
||||
<a class="btn btn-primary" href="material-rsl.php?id=<?php echo ($reportslist->getColumnVal("idimporttemplates")); ?>" role="button" data-toggle="tooltip" title="Expand"><i class="fas fa-angle-double-down font-size-16 align-middle"></i></a>
|
||||
|
||||
<button class="btn btn-info btn-sm show-analysis">Analysis</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php $reportslist->moveNext();
|
||||
}
|
||||
$reportslist->moveFirst(); //return RS to first record
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
|
||||
?></tbody>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!--end table-responsive-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
|
||||
</div><!-- container -->
|
||||
|
||||
</div> <!-- Page content Wrapper -->
|
||||
|
||||
</div> <!-- content -->
|
||||
|
||||
</div><!-- Page content Wrapper -->
|
||||
</div><!-- content -->
|
||||
<?php include('../include/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
<!-- End Right content here -->
|
||||
|
||||
</div>
|
||||
<!-- END wrapper -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
// Inizializza DataTables con filtri per le colonne
|
||||
var table = $('#reportsTable').DataTable({
|
||||
responsive: true,
|
||||
"pageLength": 50,
|
||||
"order": [
|
||||
[0, 'asc']
|
||||
], // Ordina per numero di report
|
||||
initComplete: function() {
|
||||
// Aggiungi i filtri per ogni colonna
|
||||
this.api().columns().every(function() {
|
||||
var column = this;
|
||||
var input = $('<input class="form-control form-control-sm" type="text" placeholder="Search"/>')
|
||||
.appendTo($(column.header()))
|
||||
.on('keyup change clear', function() {
|
||||
if (column.search() !== this.value) {
|
||||
column.search(this.value).draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Gestione del click su "Analysis" per visualizzare la tabella delle analisi
|
||||
$('#reportsTable').on('click', '.show-analysis', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var reportId = tr.data('reportid');
|
||||
var row = $('#reportsTable').DataTable().row(tr);
|
||||
var button = $(this);
|
||||
|
||||
console.log('Loading analysis for reportId:', reportId); // Debug
|
||||
|
||||
button.prop('disabled', true);
|
||||
button.html('<i class="fa fa-spinner fa-spin"></i> Loading...');
|
||||
|
||||
// Se la riga child è già visibile, non facciamo nulla
|
||||
if (row.child.isShown()) {
|
||||
button.prop('disabled', false);
|
||||
button.html('Analysis');
|
||||
return;
|
||||
}
|
||||
|
||||
// Carica le analisi tramite AJAX
|
||||
$.ajax({
|
||||
url: 'get_analysis_by_report.php', // Nuovo script PHP per ottenere le analisi del report
|
||||
type: 'POST',
|
||||
data: {
|
||||
reportId: reportId
|
||||
},
|
||||
success: function(data) {
|
||||
console.log('Analysis data loaded:', data); // Debug
|
||||
row.child(formatAnalysis(data)).show();
|
||||
tr.addClass('shown');
|
||||
},
|
||||
complete: function() {
|
||||
button.prop('disabled', false);
|
||||
button.html('Analysis');
|
||||
},
|
||||
error: function() {
|
||||
Swal.fire('Error!', 'There was an error loading the analysis.', 'error');
|
||||
button.prop('disabled', false);
|
||||
button.html('Analysis');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Funzione per formattare le analisi
|
||||
function formatAnalysis(data) {
|
||||
var parsedData = JSON.parse(data);
|
||||
var html = '<table class="table table-bordered child-table">';
|
||||
html += '<thead><tr><th>Analysis Name</th><th>Final Rating</th></tr></thead>';
|
||||
html += '<tbody>';
|
||||
|
||||
// Per ogni analisi, aggiungi la riga corrispondente
|
||||
$.each(parsedData, function(index, analysis) {
|
||||
var ratingClass = ''; // Classe CSS per la colorazione della cella
|
||||
if (analysis.finalRating === 'FAIL') {
|
||||
ratingClass = 'bg-danger text-white'; // Colore rosso per i fallimenti
|
||||
} else if (analysis.finalRating === 'PASS') {
|
||||
ratingClass = 'bg-success text-white'; // Colore verde per i successi
|
||||
} else if (analysis.finalRating === '//' || analysis.finalRating === 'N/A') {
|
||||
ratingClass = 'bg-warning text-dark'; // Colore giallo per risultati ambigui
|
||||
}
|
||||
|
||||
html += '<tr>';
|
||||
html += '<td>' + (analysis.name ? analysis.name : 'N/A') + '</td>';
|
||||
html += '<td class="' + ratingClass + '">' + (analysis.finalRating ? analysis.finalRating : 'N/A') + '</td>';
|
||||
html += '</tr>';
|
||||
});
|
||||
|
||||
html += '</tbody></table>';
|
||||
return html;
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- plugin JS -->
|
||||
<script src="../assets/js/jquery.min.js"></script>
|
||||
<script src="../assets/js/popper.min.js"></script>
|
||||
<script src="../assets/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/js/modernizr.min.js"></script>
|
||||
<script src="../assets/js/detect.js"></script>
|
||||
<script src="../assets/js/fastclick.js"></script>
|
||||
<script src="../assets/js/jquery.slimscroll.js"></script>
|
||||
<script src="../assets/js/jquery.blockUI.js"></script>
|
||||
<script src="../assets/js/waves.js"></script>
|
||||
<script src="../assets/js/jquery.nicescroll.js"></script>
|
||||
<script src="../assets/js/jquery.scrollTo.min.js"></script>
|
||||
|
||||
<script src="../assets/plugins/chart.js/chart.min.js"></script>
|
||||
<script src="../assets/pages/dashboard.js"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="../assets/js/app.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,260 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Query per ottenere tutti i report e i prodotti associati
|
||||
$query = "
|
||||
SELECT r.*, p.products_refnumber, p.products_description
|
||||
FROM reports r
|
||||
LEFT JOIN products p ON r.idproducts = p.idproducts";
|
||||
$result = $conn->query($query);
|
||||
?>
|
||||
|
||||
<!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">
|
||||
<title>Reports</title>
|
||||
|
||||
<!-- Includi prima jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
||||
<!-- Includi DataTables CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
|
||||
|
||||
<!-- Includi DataTables JS -->
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
|
||||
<!-- Altri riferimenti al CSS e JS -->
|
||||
<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">
|
||||
</head>
|
||||
|
||||
<style>
|
||||
.bg-danger {
|
||||
background-color: #ff4d4d !important;
|
||||
/* Rosso per fallimenti */
|
||||
}
|
||||
|
||||
.bg-success {
|
||||
background-color: #28a745 !important;
|
||||
/* Verde per successi */
|
||||
}
|
||||
|
||||
.bg-warning {
|
||||
background-color: #ffc107 !important;
|
||||
/* Giallo per N/A o // */
|
||||
}
|
||||
|
||||
.text-white {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.text-dark {
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
/* Stile per le righe del report */
|
||||
.report-row {
|
||||
background-color: #f8f9fa;
|
||||
/* Colore di sfondo leggero per il report */
|
||||
font-weight: bold;
|
||||
/* Rendi il testo in grassetto */
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
/* Aggiungi un bordo più evidente per separare il report dalle analisi */
|
||||
}
|
||||
|
||||
/* Stile per le righe delle analisi */
|
||||
.analysis-row {
|
||||
background-color: #ffffff;
|
||||
/* Sfondo bianco per le analisi */
|
||||
font-weight: normal;
|
||||
/* Testo normale */
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
/* Bordo più leggero per le analisi */
|
||||
}
|
||||
|
||||
/* Hover effect per evidenziare */
|
||||
.report-row:hover,
|
||||
.analysis-row:hover {
|
||||
background-color: #e9ecef;
|
||||
/* Colore di sfondo leggermente più scuro al passaggio del mouse */
|
||||
}
|
||||
</style>
|
||||
|
||||
<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">Reports</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="reportsTable" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Report Number</th>
|
||||
<th>Report Date</th>
|
||||
<th>Product Ref</th>
|
||||
<th>Product Description</th>
|
||||
<th>Rating</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php while ($row = $result->fetch_assoc()) { ?>
|
||||
<tr data-reportid="<?php echo $row['idreports']; ?>">
|
||||
<td><?php echo $row['reportsNumberLab']; ?></td>
|
||||
<td><?php echo $row['reportDateIn']; ?></td>
|
||||
<td><?php echo $row['products_refnumber']; ?></td>
|
||||
<td><?php echo $row['products_description']; ?></td>
|
||||
<td><?php echo $row['reportsRating']; ?></td>
|
||||
<td>
|
||||
<button class="btn btn-info btn-sm show-analysis">Analysis</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- container -->
|
||||
</div><!-- Page content Wrapper -->
|
||||
</div><!-- content -->
|
||||
<?php include('../include/footer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Inizializza DataTables con filtri per le colonne
|
||||
var table = $('#reportsTable').DataTable({
|
||||
responsive: true,
|
||||
"pageLength": 50,
|
||||
"order": [
|
||||
[0, 'asc']
|
||||
], // Ordina per numero di report
|
||||
initComplete: function() {
|
||||
// Aggiungi i filtri per ogni colonna
|
||||
this.api().columns().every(function() {
|
||||
var column = this;
|
||||
var input = $('<input class="form-control form-control-sm" type="text" placeholder="Search"/>')
|
||||
.appendTo($(column.header()))
|
||||
.on('keyup change clear', function() {
|
||||
if (column.search() !== this.value) {
|
||||
column.search(this.value).draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Gestione del click su "Analysis" per visualizzare la tabella delle analisi
|
||||
$('#reportsTable').on('click', '.show-analysis', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var reportId = tr.data('reportid');
|
||||
var row = $('#reportsTable').DataTable().row(tr);
|
||||
var button = $(this);
|
||||
|
||||
console.log('Loading analysis for reportId:', reportId); // Debug
|
||||
|
||||
button.prop('disabled', true);
|
||||
button.html('<i class="fa fa-spinner fa-spin"></i> Loading...');
|
||||
|
||||
// Se la riga child è già visibile, non facciamo nulla
|
||||
if (row.child.isShown()) {
|
||||
button.prop('disabled', false);
|
||||
button.html('Analysis');
|
||||
return;
|
||||
}
|
||||
|
||||
// Carica le analisi tramite AJAX
|
||||
$.ajax({
|
||||
url: 'get_analysis_by_report.php', // Nuovo script PHP per ottenere le analisi del report
|
||||
type: 'POST',
|
||||
data: {
|
||||
reportId: reportId
|
||||
},
|
||||
success: function(data) {
|
||||
console.log('Analysis data loaded:', data); // Debug
|
||||
row.child(formatAnalysis(data)).show();
|
||||
tr.addClass('shown');
|
||||
},
|
||||
complete: function() {
|
||||
button.prop('disabled', false);
|
||||
button.html('Analysis');
|
||||
},
|
||||
error: function() {
|
||||
Swal.fire('Error!', 'There was an error loading the analysis.', 'error');
|
||||
button.prop('disabled', false);
|
||||
button.html('Analysis');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Funzione per formattare le analisi
|
||||
function formatAnalysis(data) {
|
||||
var parsedData = JSON.parse(data);
|
||||
var html = '<table class="table table-bordered child-table">';
|
||||
html += '<thead><tr><th>Analysis Name</th><th>Final Rating</th></tr></thead>';
|
||||
html += '<tbody>';
|
||||
|
||||
// Per ogni analisi, aggiungi la riga corrispondente
|
||||
$.each(parsedData, function(index, analysis) {
|
||||
var ratingClass = ''; // Classe CSS per la colorazione della cella
|
||||
if (analysis.finalRating === 'FAIL') {
|
||||
ratingClass = 'bg-danger text-white'; // Colore rosso per i fallimenti
|
||||
} else if (analysis.finalRating === 'PASS') {
|
||||
ratingClass = 'bg-success text-white'; // Colore verde per i successi
|
||||
} else if (analysis.finalRating === '//' || analysis.finalRating === 'N/A') {
|
||||
ratingClass = 'bg-warning text-dark'; // Colore giallo per risultati ambigui
|
||||
}
|
||||
|
||||
html += '<tr class="analysis-row">'; // Aggiungi la classe analysis-row
|
||||
html += '<td>' + (analysis.name ? analysis.name : 'N/A') + '</td>';
|
||||
html += '<td class="' + ratingClass + '">' + (analysis.finalRating ? analysis.finalRating : 'N/A') + '</td>';
|
||||
html += '</tr>';
|
||||
});
|
||||
|
||||
html += '</tbody></table>';
|
||||
return html;
|
||||
}
|
||||
|
||||
// Aggiungi la classe report-row a ogni riga del report
|
||||
$('#reportsTable tbody tr').each(function() {
|
||||
$(this).addClass('report-row');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user