Update 18-09-2024 adding NAS
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
<?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">Products</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">Products</h5>
|
||||
<a class="btn btn-primary" href="insert-importifytemplate.php" role="button">Products</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>Ref. Number</strong></th>
|
||||
<th><strong>Description</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 $productslist = new WA_MySQLi_RS("rsl", $repnew, 0);
|
||||
$productslist->setQuery("SELECT * FROM products");
|
||||
$productslist->execute();
|
||||
|
||||
$wa_startindex = 0;
|
||||
while (!$productslist->atEnd()) {
|
||||
$wa_startindex = $productslist->Index;
|
||||
?> <tr>
|
||||
<td><?php echo ($productslist->getColumnVal("products_refnumber")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("products_description")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("products_refnumber")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("products_description")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("reportsDateOut")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("reportsRating")); ?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<a class="btn btn-success" href="material-rsl.php?id=<?php echo ($productslist->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 ($productslist->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 $productslist->moveNext();
|
||||
}
|
||||
$productslist->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,22 @@
|
||||
<?php
|
||||
include('../include/headscript.php');
|
||||
include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
if (isset($_POST['reportId'])) {
|
||||
$reportId = $_POST['reportId'];
|
||||
|
||||
// Query per ottenere i dati delle analisi
|
||||
$query = "SELECT * FROM result_project WHERE idreports = $reportId";
|
||||
$result = $conn->query($query);
|
||||
|
||||
$analysis = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$analysis[] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($analysis);
|
||||
} else {
|
||||
echo json_encode([]);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
include('../include/headscript.php');
|
||||
include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
$productId = $_POST['productId'];
|
||||
|
||||
$query = "SELECT * FROM reports WHERE idproducts = $productId";
|
||||
$result = $conn->query($query);
|
||||
|
||||
$reports = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$reports[] = $row;
|
||||
}
|
||||
echo json_encode($reports);
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
include('../include/headscript.php');
|
||||
include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
if (isset($_POST['productId'])) {
|
||||
$productId = $_POST['productId'];
|
||||
|
||||
// Query per ottenere i report associati al prodotto
|
||||
$queryReports = "SELECT * FROM reports WHERE idproducts = $productId";
|
||||
$resultReports = $conn->query($queryReports);
|
||||
|
||||
$reports = [];
|
||||
while ($report = $resultReports->fetch_assoc()) {
|
||||
// Query per ottenere le analisi associate a ogni report con LEFT JOIN su analysisvocabulary
|
||||
$reportId = $report['idreports'];
|
||||
$queryAnalysis = "
|
||||
SELECT rp.*, av.nameanalysisvoc
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysisvocabulary av ON rp.result_TestName = av.idanalysisvocabulary
|
||||
WHERE rp.idreports = $reportId";
|
||||
$resultAnalysis = $conn->query($queryAnalysis);
|
||||
|
||||
// Mappa per aggregare i risultati delle analisi in base a 'result_TestName' e calcolare il peggior rating
|
||||
$analysisGrouped = [];
|
||||
while ($analysis = $resultAnalysis->fetch_assoc()) {
|
||||
$testName = $analysis['nameanalysisvoc'];
|
||||
|
||||
// Normalizza il rating per confrontare varianti diverse
|
||||
$normalizedRating = strtoupper(trim($analysis['test_Rating']));
|
||||
|
||||
// Gestiamo anche varianti come "Complies", "Doesn't Comply", "//" e "N/A"
|
||||
if ($normalizedRating === 'P' || $normalizedRating === 'PASS' || $normalizedRating === 'COMPLIES') {
|
||||
$normalizedRating = 'PASS';
|
||||
} elseif ($normalizedRating === 'F' || $normalizedRating === 'FAIL' || $normalizedRating === 'DOESN\'T COMPLY') {
|
||||
$normalizedRating = 'FAIL';
|
||||
} elseif ($normalizedRating === '//' || $normalizedRating === 'N/A') {
|
||||
$normalizedRating = '//';
|
||||
} else {
|
||||
$normalizedRating = 'N/A'; // Per valori non riconosciuti
|
||||
}
|
||||
|
||||
// Se l'analisi per questo test è già stata trovata, confronta i rating e prendi il peggiore
|
||||
if (isset($analysisGrouped[$testName])) {
|
||||
$currentRating = $analysisGrouped[$testName]['finalRating'];
|
||||
// Logica di priorità: Fail > // > Pass
|
||||
if ($currentRating === 'PASS' && ($normalizedRating === 'FAIL' || $normalizedRating === '//')) {
|
||||
$analysisGrouped[$testName]['finalRating'] = $normalizedRating;
|
||||
} elseif ($currentRating === '//' && $normalizedRating === 'FAIL') {
|
||||
$analysisGrouped[$testName]['finalRating'] = 'FAIL'; // Peggiora il rating
|
||||
}
|
||||
} else {
|
||||
// Prima occorrenza dell'analisi, aggiungila alla mappa
|
||||
$analysisGrouped[$testName] = [
|
||||
'name' => $testName,
|
||||
'finalRating' => $normalizedRating
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Aggiungi le analisi raggruppate al report
|
||||
$report['analysis'] = array_values($analysisGrouped); // Converte la mappa in un array
|
||||
$reports[] = $report;
|
||||
}
|
||||
|
||||
// Restituisci i report e le analisi in formato JSON
|
||||
echo json_encode(['reports' => $reports]);
|
||||
} else {
|
||||
echo json_encode(['error' => 'Product ID not provided']);
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
<?php include("../class/company.php"); ?>
|
||||
|
||||
<?php
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Query per ottenere tutti i prodotti
|
||||
$query = "SELECT * FROM products";
|
||||
$result = $conn->query($query);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@@ -8,220 +16,241 @@
|
||||
<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>Products</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">Products</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Reports</h4>
|
||||
<h4 class="page-title">Products</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">Products</h5>
|
||||
<a class="btn btn-primary" href="insert-importifytemplate.php" role="button">Products</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="productsTable" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><strong>Ref. Number</strong></th>
|
||||
<th><strong>Description</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>Product Ref</th>
|
||||
<th>Description</th>
|
||||
<th>Style</th>
|
||||
<th>Color</th>
|
||||
<th>Season</th>
|
||||
<th>Market</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $productslist = new WA_MySQLi_RS("rsl", $repnew, 0);
|
||||
$productslist->setQuery("SELECT * FROM products");
|
||||
$productslist->execute();
|
||||
|
||||
$wa_startindex = 0;
|
||||
while (!$productslist->atEnd()) {
|
||||
$wa_startindex = $productslist->Index;
|
||||
?> <tr>
|
||||
<td><?php echo ($productslist->getColumnVal("products_refnumber")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("products_description")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("products_refnumber")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("products_description")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("reportsDateOut")); ?></td>
|
||||
<td><?php echo ($productslist->getColumnVal("reportsRating")); ?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php while ($row = $result->fetch_assoc()) { ?>
|
||||
<tr data-productid="<?php echo $row['idproducts']; ?>">
|
||||
<td><?php echo $row['products_refnumber']; ?></td>
|
||||
<td><?php echo $row['products_description']; ?></td>
|
||||
<td><?php echo $row['products_style']; ?></td>
|
||||
<td><?php echo $row['products_color']; ?></td>
|
||||
<td><?php echo $row['products_season']; ?></td>
|
||||
<td><?php echo $row['products_market']; ?></td>
|
||||
<td>
|
||||
<a class="btn btn-success" href="material-rsl.php?id=<?php echo ($productslist->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 ($productslist->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-reports">Reports</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php $productslist->moveNext();
|
||||
}
|
||||
$productslist->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 = $('#productsTable').DataTable({
|
||||
responsive: true,
|
||||
"pageLength": 50,
|
||||
"order": [
|
||||
[1, 'asc']
|
||||
], // Ordina per descrizione
|
||||
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 "Reports" per visualizzare la tabella report e analisi
|
||||
$('#productsTable').on('click', '.show-reports', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var productId = tr.data('productid');
|
||||
var row = $('#productsTable').DataTable().row(tr);
|
||||
var button = $(this);
|
||||
|
||||
console.log('Loading reports and analysis for productId:', productId); // 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('Reports');
|
||||
return;
|
||||
}
|
||||
|
||||
// Carica i report e le analisi insieme tramite AJAX
|
||||
$.ajax({
|
||||
url: 'get_reports_and_analysis.php', // Nuovo script PHP per ottenere sia i report che le analisi
|
||||
type: 'POST',
|
||||
data: {
|
||||
productId: productId
|
||||
},
|
||||
success: function(data) {
|
||||
console.log('Reports and Analysis data loaded:', data); // Debug
|
||||
row.child(formatReportsAndAnalysis(data)).show();
|
||||
tr.addClass('shown');
|
||||
},
|
||||
complete: function() {
|
||||
button.prop('disabled', false);
|
||||
button.html('Reports');
|
||||
},
|
||||
error: function() {
|
||||
Swal.fire('Error!', 'There was an error loading the reports and analysis.', 'error');
|
||||
button.prop('disabled', false);
|
||||
button.html('Reports');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Funzione per formattare i report e le analisi nella stessa tabella
|
||||
function formatReportsAndAnalysis(data) {
|
||||
var parsedData = JSON.parse(data);
|
||||
var reports = parsedData.reports;
|
||||
var html = '<table class="table table-bordered child-table">';
|
||||
html += '<thead><tr><th>Report Number</th><th>Report Date</th><th>Rating</th><th>Analysis (Name)</th><th>Final Rating</th><th>Action</th></tr></thead>';
|
||||
html += '<tbody>';
|
||||
|
||||
// Per ogni report, aggiungi il report e le analisi associate
|
||||
$.each(reports, function(index, report) {
|
||||
// Riga del report principale
|
||||
html += '<tr>';
|
||||
html += '<td>' + report.reportsNumberLab + '</td>';
|
||||
html += '<td>' + report.reportDateIn + '</td>';
|
||||
html += '<td>' + report.reportsRating + '</td>';
|
||||
html += '<td colspan="2"></td>'; // Righe vuote per mantenere l'allineamento
|
||||
html += '<td><button class="btn btn-primary btn-sm report-details" data-reportid="' + report.idreports + '">Details</button></td>'; // Aggiungi il bottone Details
|
||||
|
||||
// Se ci sono analisi associate al report, le aggiungi sotto lo stesso report
|
||||
if (report.analysis.length > 0) {
|
||||
$.each(report.analysis, function(i, 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></td>'; // Lascia vuoto per mantenere l'allineamento del report
|
||||
html += '<td></td>'; // Lascia vuoto per mantenere l'allineamento del report
|
||||
html += '<td></td>'; // Lascia vuoto per mantenere l'allineamento del report
|
||||
html += '<td>' + (analysis.name ? analysis.name : 'N/A') + '</td>'; // Nome dell'analisi
|
||||
html += '<td class="' + ratingClass + '">' + (analysis.finalRating ? analysis.finalRating : 'N/A') + '</td>';
|
||||
html += '<td></td>'; // Lascia vuoto per non aggiungere il bottone "Details" nella riga dell'analisi
|
||||
html += '</tr>';
|
||||
});
|
||||
} else {
|
||||
html += '<tr><td colspan="5">No analysis available for this report.</td></tr>';
|
||||
}
|
||||
html += '</tr>';
|
||||
});
|
||||
|
||||
html += '</tbody></table>';
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.report-details', function() {
|
||||
var reportId = $(this).data('reportid'); // Ottieni l'id del report
|
||||
window.location.href = 'reportdetails.php?idreports=' + reportId; // Reindirizza alla pagina reportdetails.php con idreports
|
||||
});
|
||||
</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,419 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Recupera il valore di idreports dalla query string
|
||||
$idreports = isset($_GET['idreports']) ? $_GET['idreports'] : 0;
|
||||
|
||||
// Query per ottenere i dettagli del report e del prodotto associato
|
||||
$queryReportDetails = "
|
||||
SELECT r.*, p.products_refnumber, p.products_description, p.products_style, p.products_color
|
||||
FROM reports r
|
||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||
WHERE r.idreports = ?";
|
||||
$stmt = $conn->prepare($queryReportDetails);
|
||||
$stmt->bind_param("i", $idreports);
|
||||
$stmt->execute();
|
||||
$reportDetails = $stmt->get_result()->fetch_assoc();
|
||||
|
||||
// Query per ottenere le parti e i risultati del report con il nome dell'analista e delle parti
|
||||
$queryPartsAndResults = "
|
||||
SELECT rp.*,
|
||||
a.nameanalysisvoc AS testName,
|
||||
cv.namecompoundsvocabulary AS analytsName,
|
||||
pr.partsDescription
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||
LEFT JOIN parts pr ON rp.idPart = pr.idParts
|
||||
WHERE rp.idreports = ?
|
||||
ORDER BY rp.result_TestName, rp.idPart";
|
||||
$stmtParts = $conn->prepare($queryPartsAndResults);
|
||||
$stmtParts->bind_param("i", $idreports);
|
||||
$stmtParts->execute();
|
||||
$partsAndResults = $stmtParts->get_result();
|
||||
?>
|
||||
|
||||
<!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>Report Details</title>
|
||||
|
||||
<!-- 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">
|
||||
<script src="../assets/js/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="../assets/plugins/select2/select2.min.css">
|
||||
<script src="../assets/plugins/select2/select2.min.js"></script>
|
||||
<style>
|
||||
.section-separator {
|
||||
background-color: #f1f3f5;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
margin-top: 20px;
|
||||
border-top: 3px solid #6c757d;
|
||||
}
|
||||
|
||||
.table-part {
|
||||
margin-top: 10px;
|
||||
border: 2px solid #dee2e6;
|
||||
}
|
||||
|
||||
.rating-pass {
|
||||
background-color: #28a745;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.rating-fail {
|
||||
background-color: #dc3545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.rating-ambiguous {
|
||||
background-color: #ffc107;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.report-header {
|
||||
background-color: #e9ecef;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.report-header h5 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.report-details-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.report-details-table td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.table-filter {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.fixed-width-analyts {
|
||||
width: 40%;
|
||||
/* Modifica questo valore per adattare la larghezza */
|
||||
}
|
||||
|
||||
.fixed-width-value {
|
||||
width: 30%;
|
||||
/* Modifica questo valore per adattare la larghezza */
|
||||
}
|
||||
|
||||
.fixed-width-rating {
|
||||
width: 30%;
|
||||
/* Modifica questo valore per adattare la larghezza */
|
||||
}
|
||||
</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">Report Details</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Dati del Report e del Prodotto -->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="report-header">
|
||||
<h5>Report: <?php echo $reportDetails['reportsNumberLab']; ?></h5>
|
||||
<table class="report-details-table">
|
||||
<tr>
|
||||
<td><strong>Report Date:</strong></td>
|
||||
<td><?php echo $reportDetails['reportDateIn']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Product Ref:</strong></td>
|
||||
<td><?php echo $reportDetails['products_refnumber']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Product Description:</strong></td>
|
||||
<td><?php echo $reportDetails['products_description']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Style:</strong></td>
|
||||
<td><?php echo $reportDetails['products_style']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Color:</strong></td>
|
||||
<td><?php echo $reportDetails['products_color']; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filtri -->
|
||||
<!-- Aggiungi questo filtro sopra la tabella -->
|
||||
<div class="row table-filter">
|
||||
<div class="col-md-4">
|
||||
<input type="text" id="searchTestName" class="form-control" placeholder="Search by Test Name">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" id="searchPart" class="form-control" placeholder="Search by Part">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<select id="searchRating" class="form-control">
|
||||
<option value="">All Ratings</option>
|
||||
<option value="pass" class="rating-pass">Pass</option>
|
||||
<option value="fail" class="rating-fail">Fail</option>
|
||||
<option value="ambiguous" class="rating-ambiguous">N/A or Ambiguous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Tabella con Parti e Risultati -->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="header-title pb-3 mt-0">Parts and Results</h5>
|
||||
<div class="table-responsive">
|
||||
<?php
|
||||
|
||||
$currentTestName = '';
|
||||
$currentPart = '';
|
||||
|
||||
while ($row = $partsAndResults->fetch_assoc()) {
|
||||
// Debug: Stampa i dati di ogni riga
|
||||
// Questo serve per stampare i risultati in modo più leggibile e debuggare
|
||||
|
||||
$previousPart = '';
|
||||
|
||||
|
||||
// Se il nome dell'analisi cambia, crea una nuova sezione
|
||||
if ($currentTestName != $row['testName']) {
|
||||
if ($currentTestName != '') {
|
||||
echo '</tbody></table>'; // Chiude la tabella precedente
|
||||
}
|
||||
$currentTestName = $row['testName'];
|
||||
echo '<div class="section-separator">Analysis: ' . $currentTestName . '</div>';
|
||||
}
|
||||
|
||||
// Verifica se la parte corrente è diversa dalla precedente per evitare duplicazioni
|
||||
$currentPart = $row['partsDescription'] ?? 'Unknown Part';
|
||||
if ($currentPart != $previousPart) {
|
||||
// Stampa il titolo della parte solo se cambia
|
||||
echo '<h6>Part: ' . (!empty($row['partsDescription']) ? $currentPart : 'Part Not Specified') . '</h6>';
|
||||
|
||||
// Apri una nuova tabella per la parte
|
||||
echo '<table class="table table-bordered table-part"><thead>';
|
||||
echo '<tr><th class="fixed-width-analyts">Analyts Name</th><th class="fixed-width-value">Result Value</th><th class="fixed-width-rating">Rating</th></tr>';
|
||||
echo '</thead><tbody>';
|
||||
|
||||
|
||||
// Aggiorna la variabile di controllo per la parte
|
||||
$previousPart = $currentPart;
|
||||
}
|
||||
|
||||
// Classificazione del rating
|
||||
$ratingClass = '';
|
||||
if (strtoupper($row['test_Rating']) == 'FAIL' || strtoupper($row['test_Rating']) == "DOESN'T COMPLY") {
|
||||
$ratingClass = 'rating-fail';
|
||||
} elseif (strtoupper($row['test_Rating']) == 'PASS' || strtoupper($row['test_Rating']) == 'COMPLIES') {
|
||||
$ratingClass = 'rating-pass';
|
||||
} else {
|
||||
$ratingClass = 'rating-ambiguous';
|
||||
}
|
||||
|
||||
// Stampa i dettagli della riga
|
||||
echo '<tr>';
|
||||
echo '<td>' . (!empty($row['analytsName']) ? $row['analytsName'] . ' (ID: ' . $row['result_AnalytsName'] . ')' : ' ') . '</td>';
|
||||
echo '<td>' . (!empty($row['result_Value']) ? htmlspecialchars($row['result_Value'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||
echo '<td class="' . $ratingClass . '">' . (!empty($row['test_Rating']) ? htmlspecialchars($row['test_Rating'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
if ($currentTestName != '') {
|
||||
echo '</tbody></table>'; // Chiude l'ultima tabella
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- container -->
|
||||
</div><!-- Page content Wrapper -->
|
||||
</div><!-- content -->
|
||||
<?php include('../include/footer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Filtro per Test Name
|
||||
$('#searchTestName').on('keyup', function() {
|
||||
var value = $(this).val().toLowerCase();
|
||||
$('.section-separator').each(function() {
|
||||
var section = $(this);
|
||||
if (section.text().toLowerCase().includes(value)) {
|
||||
section.show();
|
||||
section.nextUntil('.section-separator').show();
|
||||
} else {
|
||||
section.hide();
|
||||
section.nextUntil('.section-separator').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Filtro per Part Name
|
||||
$('#searchPart').on('keyup', function() {
|
||||
var value = $(this).val().toLowerCase();
|
||||
$('h6').each(function() {
|
||||
var part = $(this);
|
||||
if (part.text().toLowerCase().includes(value)) {
|
||||
part.show();
|
||||
part.next('table').show();
|
||||
} else {
|
||||
part.hide();
|
||||
part.next('table').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Filtro per Rating
|
||||
$('#searchRating').on('change', function() {
|
||||
var selectedRating = $(this).val().toLowerCase(); // Prende il rating selezionato
|
||||
|
||||
$('table.table-part').each(function() {
|
||||
var table = $(this);
|
||||
var visibleRows = 0;
|
||||
|
||||
// Controlla ogni riga della tabella
|
||||
table.find('tbody tr').each(function() {
|
||||
var ratingCell = $(this).find('td:last-child'); // L'ultima cella è quella del rating
|
||||
var ratingText = ratingCell.text().trim().toLowerCase();
|
||||
|
||||
// Mostra/nasconde la riga in base al filtro di rating
|
||||
if (selectedRating === '' ||
|
||||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
||||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'ambiguous' || ratingText === '//'))) {
|
||||
$(this).show();
|
||||
visibleRows++;
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Nasconde l'intera tabella se non ci sono righe visibili
|
||||
if (visibleRows === 0) {
|
||||
table.hide();
|
||||
table.prev('h6').hide(); // Nasconde anche il titolo della parte
|
||||
} else {
|
||||
table.show();
|
||||
table.prev('h6').show(); // Mostra il titolo della parte
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- plugin JS -->
|
||||
<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/js/common_helper.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>
|
||||
<script src="../assets/plugins/alertify/js/alertify.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Filtro per Test Name
|
||||
$('#searchTestName').on('keyup', function() {
|
||||
var value = $(this).val().toLowerCase();
|
||||
$('.section-separator').each(function() {
|
||||
var section = $(this);
|
||||
if (section.text().toLowerCase().includes(value)) {
|
||||
section.show();
|
||||
section.nextUntil('.section-separator').show();
|
||||
} else {
|
||||
section.hide();
|
||||
section.nextUntil('.section-separator').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Filtro per Part Name
|
||||
$('#searchPart').on('keyup', function() {
|
||||
var value = $(this).val().toLowerCase();
|
||||
$('h6').each(function() {
|
||||
var part = $(this);
|
||||
if (part.text().toLowerCase().includes(value)) {
|
||||
part.show();
|
||||
part.next('table').show();
|
||||
} else {
|
||||
part.hide();
|
||||
part.next('table').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Filtro per Rating
|
||||
$('#searchRating').on('change', function() {
|
||||
var selectedRating = $(this).val().toLowerCase(); // Prende il rating selezionato
|
||||
$('table.table-part tbody tr').each(function() {
|
||||
var ratingCell = $(this).find('td:last-child'); // L'ultima cella dovrebbe essere quella del rating
|
||||
var ratingText = ratingCell.text().trim().toLowerCase();
|
||||
|
||||
// Se l'utente non seleziona alcun valore (tutti i rating) o il rating corrisponde
|
||||
if (selectedRating === '' ||
|
||||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
||||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'ambiguous' || ratingText === '//'))) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user