added charts and fixed analysis component
This commit is contained in:
parent
18735127bb
commit
22c95fa063
@ -1,6 +1,4 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php //include("class/company.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@ -9,101 +7,67 @@
|
||||
<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>EasySpec - Reportify</title>
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="../assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<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>
|
||||
|
||||
<!-- DataTables CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.1/css/buttons.dataTables.min.css">
|
||||
|
||||
<!-- SweetAlert CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.css">
|
||||
|
||||
<!-- Boxicons -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
.table {
|
||||
width: 100%;
|
||||
/* Assicura che la tabella utilizzi tutta la larghezza disponibile */
|
||||
table-layout: fixed;
|
||||
/* Opzionale, forza la tabella a rispettare la larghezza assegnata */
|
||||
}
|
||||
|
||||
.table th,
|
||||
.table td {
|
||||
.table-custom th,
|
||||
.table-custom td {
|
||||
word-wrap: break-word;
|
||||
/* Previene l'overflow del testo fuori dai confini della cella */
|
||||
}
|
||||
|
||||
.table-custom tr {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
.table td {
|
||||
white-space: nowrap;
|
||||
/* Impedisce che i contenuti vadano a capo automaticamente */
|
||||
}
|
||||
|
||||
.table-custom td,
|
||||
.table-custom th {
|
||||
padding: 4px 8px;
|
||||
.table td:first-child {
|
||||
white-space: normal;
|
||||
/* Forza il nome dell'analisi ad andare a capo */
|
||||
word-wrap: break-word;
|
||||
max-width: 200px;
|
||||
/* Regola la larghezza massima della cella */
|
||||
}
|
||||
|
||||
.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;
|
||||
.table td:last-child .btn {
|
||||
margin-right: 5px;
|
||||
/* Aggiunge spazi tra i pulsanti */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
</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="page-content-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Page Title -->
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="page-title-box">
|
||||
@ -117,213 +81,136 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title end breadcrumb -->
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="header-title pb-3 mt-0">EasySpec: <?php echo $analysis; ?></h5>
|
||||
<a class="btn btn-danger" href="insert-analysis.php" role="button">Insert Analysis</a> <a class="btn btn-danger" href="analysis-category.php" role="button">Analysis Category</a> <a class="btn btn-danger" href="rsl.php" role="button">RSL</a> <?php if (isset($action)) {
|
||||
if ($action == "wizard") { ?><a class="btn btn-dark" href="rsl-wizard.php" role="button">Back to the Wizard</a><?php }
|
||||
} ?><?php if ($infobox == "wizard") { ?> <a class="btn btn-dark" href="rslwizard1.php" role="button">Back to Wizard</a><?php } ?> <br><br>
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table table-striped table-sm sm-0">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><strong><?php echo $name_analysis_lang; ?></strong></th>
|
||||
<th><strong><?php echo $description_analysis_lang; ?></strong></th>
|
||||
<th>Family</th>
|
||||
<th></th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $tablequery = new WA_MySQLi_RS("analysis", $repnew, 0);
|
||||
$tablequery->setQuery("SELECT * FROM `analysis` LEFT JOIN family_analysis ON family_analysis.idfamilyanalysis=analysis.family_analysis WHERE analysis.company_id='$idcompany'");
|
||||
$tablequery->execute();
|
||||
|
||||
$wa_startindex = 0;
|
||||
while (!$tablequery->atEnd()) {
|
||||
$wa_startindex = $tablequery->Index;
|
||||
?> <tr>
|
||||
|
||||
<td><?php echo ($tablequery->getColumnVal("name_analysis")); ?></td>
|
||||
<td><?php echo ($tablequery->getColumnVal("description_analysis")); ?></td>
|
||||
<td><?php echo ($tablequery->getColumnVal("namefamily")); ?></td>
|
||||
<td><a class="btn btn-success" href="update-component-list.php?idanalysis=<?php echo ($tablequery->getColumnVal("idanalysis")); ?>" role="button">Update Component List</a>
|
||||
|
||||
<a class="btn btn-warning" href="update-analysis.php?idanalysis=<?php echo htmlspecialchars($tablequery->getColumnVal('idanalysis')); ?>" role="button">
|
||||
<i class="fas fa-pencil-alt text-white"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-danger" onclick="confirmDeletion(<?php echo htmlspecialchars($tablequery->getColumnVal('idanalysis')); ?>);" role="button">
|
||||
<i class="fas fa-trash-alt text-white"></i>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php $tablequery->moveNext();
|
||||
}
|
||||
$tablequery->moveFirst(); //return RS to first record
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
|
||||
?></tbody>
|
||||
</table>
|
||||
</div><!--end table-responsive-->
|
||||
|
||||
<h5 class="header-title pb-3 mt-0">EasySpec</h5>
|
||||
<a class="btn btn-danger" href="insert-analysis.php" role="button">Insert Analysis</a>
|
||||
<a class="btn btn-danger" href="analysis-category.php" role="button">Analysis Category</a>
|
||||
<a class="btn btn-danger" href="rsl.php" role="button">RSL</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<script>
|
||||
function confirmDeletion(idAnalysis) {
|
||||
Swal.fire({
|
||||
title: 'Do you want to cancel the analysis?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `cancel-analysis.php?idanalysis=${idAnalysis}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Selezioniamo tutti i bottoni con la classe 'clone-btn'
|
||||
let cloneBtns = document.querySelectorAll('.clone-btn');
|
||||
<!-- DataTable -->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="datatable-analysis" class="table table-striped table-sm table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Family</th>
|
||||
<th>SuperGroup</th>
|
||||
<th>Analysis Code</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$tablequery = new WA_MySQLi_RS("analysis", $repnew, 0);
|
||||
$tablequery->setQuery("SELECT * FROM `analysisvocabulary`
|
||||
LEFT JOIN family_analysis ON family_analysis.idfamilyanalysis = analysisvocabulary.family_analysis
|
||||
LEFT JOIN supergroup ON analysisvocabulary.supergroup=supergroup.idsupergroup
|
||||
WHERE analysisvocabulary.preferred = 'Y'
|
||||
ORDER BY analysisvocabulary.nameanalysisvoc");
|
||||
$tablequery->execute();
|
||||
|
||||
// Aggiungiamo un ascoltatore d'evento a ciascun bottone
|
||||
cloneBtns.forEach(cloneBtn => {
|
||||
cloneBtn.addEventListener('click', function(e) {
|
||||
// Preveniamo il comportamento predefinito del link
|
||||
e.preventDefault();
|
||||
while (!$tablequery->atEnd()) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $tablequery->getColumnVal("nameanalysisvoc"); ?></td>
|
||||
<td><?php echo $tablequery->getColumnVal("description_analysis"); ?></td>
|
||||
<td><?php echo $tablequery->getColumnVal("namefamily"); ?></td>
|
||||
<td><?php echo $tablequery->getColumnVal("name"); ?></td>
|
||||
<td><?php echo $tablequery->getColumnVal("analysiscode"); ?></td>
|
||||
<td>
|
||||
<a class="btn btn-success" href="update-component-list.php?idanalysis=<?php echo $tablequery->getColumnVal('idanalysisvocabulary'); ?>">Component List</a>
|
||||
<a class="btn btn-warning" href="update-analysis.php?idanalysis=<?php echo htmlspecialchars($tablequery->getColumnVal('idanalysisvocabulary')); ?>"><i class="fas fa-pencil-alt text-white"></i></a>
|
||||
<a class="btn btn-danger" onclick="confirmDeletion(<?php echo htmlspecialchars($tablequery->getColumnVal('idanalysisvocabulary')); ?>);"><i class="fas fa-trash-alt text-white"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$tablequery->moveNext();
|
||||
}
|
||||
$tablequery->moveFirst();
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Swal.fire({
|
||||
title: 'Clone TRL',
|
||||
text: "Do you want to clone the TRL?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se confermato, andiamo al link originale
|
||||
window.location.href = cloneBtn.getAttribute('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Selezioniamo tutti i bottoni con la classe 'clone-btn'
|
||||
let cloneBtns = document.querySelectorAll('.rev-btn');
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// Aggiungiamo un ascoltatore d'evento a ciascun bottone
|
||||
cloneBtns.forEach(cloneBtn => {
|
||||
cloneBtn.addEventListener('click', function(e) {
|
||||
// Preveniamo il comportamento predefinito del link
|
||||
e.preventDefault();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Swal.fire({
|
||||
title: 'Revise TRL',
|
||||
text: "Do you want to Revise the TRL?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se confermato, andiamo al link originale
|
||||
window.location.href = cloneBtn.getAttribute('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Selezioniamo tutti i bottoni con la classe 'clone-btn'
|
||||
let cloneBtns = document.querySelectorAll('.canc-btn');
|
||||
|
||||
// Aggiungiamo un ascoltatore d'evento a ciascun bottone
|
||||
cloneBtns.forEach(cloneBtn => {
|
||||
cloneBtn.addEventListener('click', function(e) {
|
||||
// Preveniamo il comportamento predefinito del link
|
||||
e.preventDefault();
|
||||
|
||||
Swal.fire({
|
||||
title: 'Cancel TRL',
|
||||
text: "Do you want to cancel the TRL?",
|
||||
icon: 'danger',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se confermato, andiamo al link originale
|
||||
window.location.href = cloneBtn.getAttribute('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div><!-- container -->
|
||||
|
||||
</div> <!-- Page content Wrapper -->
|
||||
|
||||
</div> <!-- content -->
|
||||
</div>
|
||||
|
||||
<?php include('../include/footer.php'); ?>
|
||||
|
||||
</div>
|
||||
<!-- End Right content here -->
|
||||
|
||||
</div>
|
||||
<!-- END wrapper -->
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="../assets/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- DataTables JS -->
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.print.min.js"></script>
|
||||
|
||||
<!-- SweetAlert2 JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.js"></script>
|
||||
|
||||
<!-- DataTable Initialization -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('#datatable-analysis').DataTable({
|
||||
dom: 'lBfrtip',
|
||||
buttons: ['copy', 'csv', 'excel', 'pdf', 'print'],
|
||||
paging: true,
|
||||
searching: true,
|
||||
pageLength: 50,
|
||||
ordering: true,
|
||||
responsive: true,
|
||||
language: {
|
||||
url: "https://cdn.datatables.net/plug-ins/1.13.6/i18n/en-GB.json"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function confirmDeletion(idAnalysis) {
|
||||
Swal.fire({
|
||||
title: 'Do you want to cancel the analysis?',
|
||||
text: "The Analysis will be deactivated!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = `cancel-analysis.php?idanalysis=${idAnalysis}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</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>
|
||||
@ -3,14 +3,16 @@
|
||||
<?php include("../class/company.php"); ?>
|
||||
<?php
|
||||
?>
|
||||
<?php if (true) {
|
||||
$DeleteQuery = new WA_MySQLi_Query($repnew);
|
||||
$DeleteQuery->Action = "delete";
|
||||
$DeleteQuery->Table = "`analysis`";
|
||||
$DeleteQuery->addFilter("idanalysis", "=", "i", "" . ($_GET['idanalysis']) . "");
|
||||
$DeleteQuery->execute();
|
||||
$DeleteGoTo = "analysis.php";
|
||||
if (function_exists("rel2abs")) $DeleteGoTo = $DeleteGoTo ? rel2abs($DeleteGoTo, dirname(__FILE__)) : "";
|
||||
$DeleteQuery->redirect($DeleteGoTo);
|
||||
<?php
|
||||
if (true) {
|
||||
$UpdateQuery = new WA_MySQLi_Query($repnew);
|
||||
$UpdateQuery->Action = "update";
|
||||
$UpdateQuery->Table = "`analysisvocabulary`";
|
||||
$UpdateQuery->addFilter("idanalysisvocabulary", "=", "i", "" . ($_GET['idanalysis']) . "");
|
||||
$UpdateQuery->addColumn("active", "s", "N"); // Imposta il campo active a 'N'
|
||||
$UpdateQuery->execute();
|
||||
$UpdateGoTo = "analysis.php";
|
||||
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";
|
||||
$UpdateQuery->redirect($UpdateGoTo);
|
||||
}
|
||||
?>
|
||||
@ -1,6 +1,5 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
?>
|
||||
<?php include("../class/company.php"); ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@ -14,13 +13,29 @@
|
||||
|
||||
<link rel="shortcut icon" href="../assets/images/favicon.ico">
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<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">
|
||||
|
||||
<!-- SweetAlert -->
|
||||
<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="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
||||
<!-- DataTables CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.1/css/buttons.dataTables.min.css">
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
||||
|
||||
<!-- DataTables JS -->
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.print.min.js"></script>
|
||||
|
||||
<style>
|
||||
.table-custom tr {
|
||||
@ -34,65 +49,23 @@
|
||||
}
|
||||
|
||||
.table-custom .btn {
|
||||
padding: 2px 15px;
|
||||
line-height: 1.7;
|
||||
padding: 5px 15px;
|
||||
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">
|
||||
@ -106,262 +79,140 @@
|
||||
</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">EasySpec: STANDARDS </h5>
|
||||
<a class="btn btn-danger" href="insert-standards.php" role="button">Insert new Standard</a> <a class="btn btn-danger" href="rsl-category.php" role="button">RSL Category</a> <a class="btn btn-danger" href="material.php" role="button"><?php echo $materialstitle; ?></a> <a class="btn btn-danger" href="analysis.php" role="button">Analysis</a><?php if ($infobox == "wizard") { ?> <a class="btn btn-dark" href="rslwizard1.php" role="button">Back to Wizard</a><?php } ?>
|
||||
<a href="component.php"><button type="button" class="btn btn-danger w-md waves-effect waves-light">Components</button></a>
|
||||
<a href="rsl.php"><button type="button" class="btn btn-danger w-md waves-effect waves-light">RSL</button></a>
|
||||
<h5 class="header-title pb-3 mt-0">EasySpec: Standards</h5>
|
||||
<div class="mb-3">
|
||||
<a class="btn btn-danger" href="insert-standards.php" role="button">Insert new Standard</a> <a class="btn btn-danger" href="rsl-category.php" role="button">RSL Category</a> <a class="btn btn-danger" href="material.php" role="button"><?php echo $materialstitle; ?></a> <a class="btn btn-danger" href="analysis.php" role="button">Analysis</a><?php if ($infobox == "wizard") { ?> <a class="btn btn-dark" href="rslwizard1.php" role="button">Back to Wizard</a><?php } ?>
|
||||
<a href="component.php"><button type="button" class="btn btn-danger w-md waves-effect waves-light">Components</button></a>
|
||||
<a href="rsl.php"><button type="button" class="btn btn-danger w-md waves-effect waves-light">RSL</button></a>
|
||||
|
||||
<a href="saytrl-newsletter.php"><button type="button" class="btn btn-success w-lg waves-effect waves-light">SayTRL</button></a>
|
||||
<br><br>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control mb-3" id="searchInput" placeholder="Search by Title or Number">
|
||||
</div>
|
||||
<a href="saytrl-newsletter.php"><button type="button" class="btn btn-success w-lg waves-effect waves-light">SayTRL</button></a>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm sm-0">
|
||||
<table id="datatable-standards" class="table table-striped table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><strong><?php echo $active_lang; ?></strong></th>
|
||||
<th><strong>Standards Name</strong></th>
|
||||
<th><strong>Number</strong></th>
|
||||
<th><strong>Year</strong></th>
|
||||
<th><strong>Active From</strong></th>
|
||||
<th><strong>Active to</strong></th>
|
||||
|
||||
|
||||
<th><?php echo $active_lang; ?></th>
|
||||
<th>Standards Name</th>
|
||||
<th>Number</th>
|
||||
<th>Year</th>
|
||||
<th>Active From</th>
|
||||
<th>Active To</th>
|
||||
<th>PDF</th>
|
||||
<th width="170"></th>
|
||||
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $rsllist = new WA_MySQLi_RS("rsl", $repnew, 0);
|
||||
$rsllist->setQuery("SELECT * FROM standards WHERE company_id='$idcompany'");
|
||||
<?php
|
||||
$rsllist = new WA_MySQLi_RS("rsl", $repnew, 0);
|
||||
$rsllist->setQuery("SELECT * FROM standards WHERE company_id='$idcompany'");
|
||||
$rsllist->execute();
|
||||
|
||||
$wa_startindex = 0;
|
||||
while (!$rsllist->atEnd()) {
|
||||
$wa_startindex = $rsllist->Index;
|
||||
?> <tr>
|
||||
$idstandards = $rsllist->getColumnVal("idstandards");
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
$query = $conn->prepare("SELECT pdffilename FROM pdfstandards WHERE idstandards = ?");
|
||||
$query->bind_param("i", $idstandards);
|
||||
$query->execute();
|
||||
$result = $query->get_result();
|
||||
$pdfFiles = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$pdfFiles[] = $row['pdffilename'];
|
||||
}
|
||||
$pdfCount = count($pdfFiles);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php $actstatus = $rsllist->getColumnVal("status");
|
||||
if ($actstatus == "A") { ?><button type="button" class="btn btn-success waves-effect waves-light" data-toggle="tooltip" title="Active"><i class="bx bx-check-double font-size-16 align-middle"></i></button><?php } else { ?><button type="button" class="btn btn-danger waves-effect waves-light" data-toggle="tooltip" title="Inactive"><i class="bx bx-block font-size-16 align-middle"></i></button><?php } ?></td>
|
||||
<td><?php echo ($rsllist->getColumnVal("titlestandards")); ?></td>
|
||||
<td><?php echo ($rsllist->getColumnVal("numberstandards")); ?></td>
|
||||
<td><?php echo ($rsllist->getColumnVal("yearstandards")); ?></td>
|
||||
<td><?php echo ($rsllist->getColumnVal("activefrom")); ?></td>
|
||||
<td><?php echo ($rsllist->getColumnVal("activeto")); ?></td>
|
||||
<?php $idstandards = $rsllist->getColumnVal("idstandards");
|
||||
// Assumendo che $conn sia l'oggetto della connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
$query = $conn->prepare("SELECT pdffilename FROM pdfstandards WHERE idstandards = ?");
|
||||
$query->bind_param("i", $idstandards);
|
||||
$query->execute();
|
||||
$result = $query->get_result();
|
||||
|
||||
$pdfFiles = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$pdfFiles[] = $row['pdffilename'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- Esempio di come aggiungere il pulsante con data-id -->
|
||||
<?php if ($rsllist->getColumnVal("status") == "A") { ?>
|
||||
<button class="btn btn-success" title="Active"><i class="bx bx-check-double"></i></button>
|
||||
<?php } else { ?>
|
||||
<button class="btn btn-danger" title="Inactive"><i class="bx bx-block"></i></button>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td><?php echo $rsllist->getColumnVal("titlestandards"); ?></td>
|
||||
<td><?php echo $rsllist->getColumnVal("numberstandards"); ?></td>
|
||||
<td><?php echo $rsllist->getColumnVal("yearstandards"); ?></td>
|
||||
<td><?php echo $rsllist->getColumnVal("activefrom"); ?></td>
|
||||
<td><?php echo $rsllist->getColumnVal("activeto"); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$pdfCount = count($pdfFiles);
|
||||
if ($pdfCount === 1) {
|
||||
// Solo un PDF, mostra il link diretto
|
||||
<?php if ($pdfCount === 1) {
|
||||
$pdfUrl = "../pdfstandards/" . $pdfFiles[0];
|
||||
echo "<a href='$pdfUrl' target='_blank' class='btn btn-danger'>Open PDF</a>";
|
||||
} elseif ($pdfCount > 1) {
|
||||
// Più PDF, link alla pagina di gestione
|
||||
$updateUrl = "update-standards.php?id=" . $rsllist->getColumnVal('idstandards');
|
||||
echo "<a href='$updateUrl' class='btn btn-danger'>Manage PDFs</a>";
|
||||
} else {
|
||||
echo "<a href='' class='btn btn-secondary'>No PDFs</a>"; // Nessun PDF disponibile
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $pdfUrl; ?>" target="_blank" class="btn btn-danger">Open PDF</a>
|
||||
<?php } elseif ($pdfCount > 1) { ?>
|
||||
<a href="update-standards.php?id=<?php echo $idstandards; ?>" class="btn btn-danger">Manage PDFs</a>
|
||||
<?php } else { ?>
|
||||
<button class="btn btn-secondary" disabled>No PDFs</button>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<a class="btn btn-success" href="update-standards.php?id=<?php echo ($rsllist->getColumnVal("idstandards")); ?>" 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-danger canc-btn" href="cancel-standards.php?id=<?php echo ($rsllist->getColumnVal("idstandards")); ?>" role="button" data-toggle="tooltip" title="Delete"><i class="fas fa-trash font-size-16 align-middle"></i></a>
|
||||
|
||||
<a class="btn btn-success" href="update-standards.php?id=<?php echo $idstandards; ?>" title="Edit">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a class="btn btn-danger canc-btn" href="cancel-standards.php?id=<?php echo $idstandards; ?>" title="Delete">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php $rsllist->moveNext();
|
||||
<?php
|
||||
$rsllist->moveNext();
|
||||
}
|
||||
$rsllist->moveFirst(); //return RS to first record
|
||||
unset($wa_startindex);
|
||||
unset($wa_repeatcount);
|
||||
|
||||
?></tbody>
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!--end table-responsive-->
|
||||
|
||||
</div><!-- end table-responsive -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#searchInput').on('keyup', function() {
|
||||
var searchValue = $(this).val().toLowerCase();
|
||||
|
||||
// Filtra solo se sono stati digitati almeno 3 caratteri
|
||||
if (searchValue.length >= 3) {
|
||||
$('table tbody tr').filter(function() {
|
||||
$(this).toggle($(this).find('td:nth-child(2)').text().toLowerCase().indexOf(searchValue) > -1 ||
|
||||
$(this).find('td:nth-child(3)').text().toLowerCase().indexOf(searchValue) > -1);
|
||||
});
|
||||
} else if (searchValue.length === 0) {
|
||||
// Se il campo di ricerca è vuoto, mostra tutte le righe
|
||||
$('table tbody tr').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Selezioniamo tutti i bottoni con la classe 'clone-btn'
|
||||
let cloneBtns = document.querySelectorAll('.clone-btn');
|
||||
|
||||
// Aggiungiamo un ascoltatore d'evento a ciascun bottone
|
||||
cloneBtns.forEach(cloneBtn => {
|
||||
cloneBtn.addEventListener('click', function(e) {
|
||||
// Preveniamo il comportamento predefinito del link
|
||||
e.preventDefault();
|
||||
|
||||
Swal.fire({
|
||||
title: 'Clone TRL',
|
||||
text: "Do you want to clone the TRL?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se confermato, andiamo al link originale
|
||||
window.location.href = cloneBtn.getAttribute('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Selezioniamo tutti i bottoni con la classe 'clone-btn'
|
||||
let cloneBtns = document.querySelectorAll('.rev-btn');
|
||||
|
||||
// Aggiungiamo un ascoltatore d'evento a ciascun bottone
|
||||
cloneBtns.forEach(cloneBtn => {
|
||||
cloneBtn.addEventListener('click', function(e) {
|
||||
// Preveniamo il comportamento predefinito del link
|
||||
e.preventDefault();
|
||||
|
||||
Swal.fire({
|
||||
title: 'Revise TRL',
|
||||
text: "Do you want to Revise the TRL?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se confermato, andiamo al link originale
|
||||
window.location.href = cloneBtn.getAttribute('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Selezioniamo tutti i bottoni con la classe 'clone-btn'
|
||||
let cloneBtns = document.querySelectorAll('.canc-btn');
|
||||
|
||||
// Aggiungiamo un ascoltatore d'evento a ciascun bottone
|
||||
cloneBtns.forEach(cloneBtn => {
|
||||
cloneBtn.addEventListener('click', function(e) {
|
||||
// Preveniamo il comportamento predefinito del link
|
||||
e.preventDefault();
|
||||
|
||||
Swal.fire({
|
||||
title: 'Cancel TRL',
|
||||
text: "Do you want to cancel the Standard?",
|
||||
icon: 'danger',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Proceed',
|
||||
cancelButtonText: 'Cancel',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Se confermato, andiamo al link originale
|
||||
window.location.href = cloneBtn.getAttribute('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div><!-- container -->
|
||||
|
||||
</div> <!-- Page content Wrapper -->
|
||||
|
||||
</div> <!-- content -->
|
||||
|
||||
<?php include('../include/footer.php'); ?>
|
||||
</div> <!-- End content-page -->
|
||||
</div><!-- END wrapper -->
|
||||
|
||||
</div>
|
||||
<!-- End Right content here -->
|
||||
|
||||
</div>
|
||||
<!-- END wrapper -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('#datatable-standards').DataTable({
|
||||
dom: 'lBfrtip',
|
||||
buttons: ['copy', 'csv', 'excel', 'pdf', 'print'],
|
||||
pageLength: 10,
|
||||
responsive: true,
|
||||
language: {
|
||||
url: "https://cdn.datatables.net/plug-ins/1.13.6/i18n/en-GB.json"
|
||||
}
|
||||
});
|
||||
|
||||
$('.canc-btn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
const url = $(this).attr('href');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = url;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- plugin JS -->
|
||||
<script src="../assets/js/jquery.min.js"></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/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>
|
||||
@ -42,12 +42,12 @@
|
||||
|
||||
<body class="fixed-left">
|
||||
|
||||
<!-- Loader -->
|
||||
<!-- Loader
|
||||
<div id="preloader">
|
||||
<div id="status">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="wrapper">
|
||||
@ -132,52 +132,75 @@
|
||||
}
|
||||
?>
|
||||
<?php $idanalysis = $_GET['idanalysis']; ?><?php $tablequery = new WA_MySQLi_RS("analysis", $repnew, 0);
|
||||
$tablequery->setQuery("SELECT * FROM `analysis` WHERE analysis.idanalysis='$idanalysis'");
|
||||
$tablequery->setQuery("SELECT * FROM `analysisvocabulary` WHERE analysisvocabulary.idanalysisvocabulary='$idanalysis'");
|
||||
$tablequery->execute();
|
||||
?>
|
||||
<?php
|
||||
$componentlist = new WA_MySQLi_RS("componentlist", $repnew, 0);
|
||||
$componentlist->setQuery("SELECT * FROM component WHERE component.company_id='$idcompany' ORDER BY component.name_component");
|
||||
$componentlist->setQuery("SELECT * FROM compundsvocabulary WHERE preferred='Y' ORDER BY compundsvocabulary.namecompoundsvocabulary");
|
||||
$componentlist->execute();
|
||||
?>
|
||||
<?php
|
||||
$companalysis = new WA_MySQLi_RS("companalysis", $repnew, 0);
|
||||
$companalysis->setQuery("SELECT * FROM analysis_component LEFT JOIN component ON analysis_component.idcomponent=component.idcomponent WHERE analysis_component.idanalysis=$idanalysis ORDER BY component.name_component");
|
||||
$companalysis->setQuery("SELECT * FROM analysis_component LEFT JOIN compundsvocabulary ON analysis_component.idcomponent=compundsvocabulary.idcompoundsvocabulary WHERE analysis_component.idanalysis=$idanalysis ORDER BY compundsvocabulary.namecompoundsvocabulary");
|
||||
$companalysis->execute();
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="header-title pb-3 mt-0">EasySpec: <?php echo $dashboard; ?></h5>
|
||||
|
||||
|
||||
<div>
|
||||
<a class="btn btn-danger" href="update-analysis.php?idanalysis=<?php echo ($tablequery->getColumnVal("idanalysis")); ?>" role="button">Edit</a> <a class="btn btn-danger" href="analysis.php" role="button"><?php echo $analysis; ?></a> <a class="btn btn-danger" href="rsl.php" role="button">RSL</a><br><br>
|
||||
<h4 class="card-title">Analysis: <?php echo ($tablequery->getColumnVal("name_analysis")); ?> </h4>
|
||||
<h6 class="card-subtitle"><?php echo $textaddcomplist; ?><code></code></h6>
|
||||
</div><!--end table-responsive-->
|
||||
|
||||
<form method="post" id="addcomp">
|
||||
<div class="mb-3 row">
|
||||
<div class="col-sm-4">
|
||||
<?php echo $yourcomponentstitle; ?>
|
||||
<select name="component" class="selectpicker m-b-20 m-r-10" id="component" data-style="btn-primary" data-live-search="true">
|
||||
<?php while (!$componentlist->atEnd()) { ?>
|
||||
<option value="<?php echo $componentlist->getColumnVal("idcomponent"); ?>">
|
||||
<?php echo $componentlist->getColumnVal("name_component"); ?>
|
||||
</option>
|
||||
<?php $componentlist->moveNext();
|
||||
}
|
||||
$componentlist->moveFirst(); ?>
|
||||
</select>
|
||||
<input name="idanalysis" type="hidden" id="idanalysis" value="<?php echo $idanalysis; ?>">
|
||||
<input name="Add" type="submit" id="Add" class="btn btn-primary">
|
||||
</div>
|
||||
<!-- Action Buttons -->
|
||||
<div class="d-flex flex-wrap mb-3">
|
||||
<a class="btn btn-danger" href="update-analysis.php?idanalysis=<?php echo ($tablequery->getColumnVal("idanalysis")); ?>" role="button" style="margin-right: 5px;">Edit</a>
|
||||
<a class="btn btn-danger" href="analysis.php" role="button" style="margin-right: 5px;"><?php echo $analysis; ?></a>
|
||||
<a class="btn btn-danger" href="rsl.php" role="button" style="margin-right: 5px;">RSL</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<a onclick="window.open('searchengine.php?idanalysis=<?php echo ($tablequery->getColumnVal("idanalysis")); ?>', '_blank', 'location=yes,height=720,width=1000,scrollbars=yes,status=yes');"><button type="button" class="btn btn-danger waves-effect waves-light"><?php echo $clickaddcomponentstitle; ?></button></a>
|
||||
<br><br>
|
||||
|
||||
|
||||
|
||||
<!-- Title with Badge -->
|
||||
<h4 class="mt-3">
|
||||
Analysis: <span class="badge bg-info text-dark"><?php echo $tablequery->getColumnVal("nameanalysisvoc"); ?></span>
|
||||
</h4>
|
||||
|
||||
<p class="text-muted"><?php echo $textaddcomplist; ?></p>
|
||||
|
||||
<!-- Add Component Form -->
|
||||
<form method="post" id="addcomp" class="my-4">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="component" class="form-label fw-bold">
|
||||
<?php echo $yourcomponentstitle; ?>
|
||||
</label>
|
||||
<select name="component" class="form-select selectpicker" id="component" data-style="btn-primary" data-live-search="true">
|
||||
<?php while (!$componentlist->atEnd()) { ?>
|
||||
<option value="<?php echo $componentlist->getColumnVal("idcompoundsvocabulary"); ?>">
|
||||
<?php echo $componentlist->getColumnVal("namecompoundsvocabulary"); ?> - <?php echo $componentlist->getColumnVal("cascompoundvocabulary"); ?>
|
||||
</option>
|
||||
<?php $componentlist->moveNext();
|
||||
}
|
||||
$componentlist->moveFirst(); ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input name="idanalysis" type="hidden" id="idanalysis" value="<?php echo $idanalysis; ?>">
|
||||
<input name="Add" type="submit" id="Add" class="btn btn-primary w-100" value="Add Component">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Add Components Button -->
|
||||
<div class="text-end">
|
||||
<button type="button" class="btn btn-danger" onclick="window.open('searchengine.php?idanalysis=<?php echo ($tablequery->getColumnVal("idanalysis")); ?>', '_blank', 'location=yes,height=720,width=1000,scrollbars=yes,status=yes');">
|
||||
<?php echo $clickaddcomponentstitle; ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table table-striped table-sm sm-0">
|
||||
@ -185,7 +208,7 @@
|
||||
<tr>
|
||||
|
||||
<th><?php echo $name_component_lang; ?></th>
|
||||
<th><?php echo $description_component_lang; ?></th>
|
||||
<th>CAS</th>
|
||||
<th></th>
|
||||
|
||||
|
||||
@ -199,13 +222,18 @@
|
||||
?>
|
||||
<tr>
|
||||
|
||||
<td><?php echo $companalysis->getColumnVal("name_component"); ?></td>
|
||||
<td><?php echo $companalysis->getColumnVal("description_component"); ?></td>
|
||||
<td><?php echo $companalysis->getColumnVal("namecompoundsvocabulary"); ?></td>
|
||||
<td><?php echo $companalysis->getColumnVal("cascompoundvocabulary"); ?></td>
|
||||
<?php
|
||||
|
||||
?>
|
||||
|
||||
<td><a class="btn btn-danger" href="cancel-componentanalysis.php?idanalysiscomponent=<?php echo ($companalysis->getColumnVal("idanalysiscomponent")); ?>&idanalysis=<?php echo $idanalysis; ?>" role="button">C</a></td>
|
||||
<td>
|
||||
<a class="btn btn-danger" onclick="confirmDeletion(<?php echo $companalysis->getColumnVal('idanalysiscomponent'); ?>, <?php echo $idanalysis; ?>);" role="button">
|
||||
<i class="bx bx-trash" style="color: white;"></i> <!-- Forza l'icona ad essere bianca -->
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
$companalysis->moveNext();
|
||||
@ -247,6 +275,25 @@
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function confirmDeletion(idAnalysisComponent, idAnalysis) {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "This component will be removed permanently!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Redirige all'URL di cancellazione
|
||||
window.location.href = `cancel-componentanalysis.php?idanalysiscomponent=${idAnalysisComponent}&idanalysis=${idAnalysis}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- plugin JS -->
|
||||
<script src="../assets/js/jquery.min.js"></script>
|
||||
|
||||
18
public/userarea/importify/importfiledate.php
Normal file
18
public/userarea/importify/importfiledate.php
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Upload Excel</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form action="upload_excel.php" method="POST" enctype="multipart/form-data">
|
||||
<label for="file">Upload Excel File:</label>
|
||||
<input type="file" name="file" accept=".xlsx, .xls" required>
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
30
public/userarea/importify/updatedate.php
Normal file
30
public/userarea/importify/updatedate.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
include('../include/headscript.php');
|
||||
include("../class/company.php");
|
||||
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Controllo connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Aggiorna le date in reports utilizzando i dati di reportsbydate
|
||||
$updateQuery = "
|
||||
UPDATE reports AS r
|
||||
INNER JOIN reportsbydate AS rb
|
||||
ON r.reportsNumberLab = rb.report_no
|
||||
SET
|
||||
r.reportDatein = IF(rb.in_date IS NOT NULL, rb.in_date, r.reportDatein),
|
||||
r.reportsDateDue = IF(rb.due_date IS NOT NULL, rb.due_date, r.reportsDateDue),
|
||||
r.reportsDateOut = IF(rb.out_date IS NOT NULL, rb.out_date, r.reportsDateOut)
|
||||
";
|
||||
|
||||
if ($conn->query($updateQuery) === TRUE) {
|
||||
echo "Reports updated successfully.";
|
||||
} else {
|
||||
echo "Error updating reports: " . $conn->error;
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
73
public/userarea/importify/upload_excel.php
Normal file
73
public/userarea/importify/upload_excel.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
include('../include/headscript.php');
|
||||
include("../class/company.php");
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
require '../../vendor/autoload.php';
|
||||
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Controllo connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
|
||||
$fileTmpPath = $_FILES['file']['tmp_name'];
|
||||
$fileName = $_FILES['file']['name'];
|
||||
$fileExtension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
|
||||
|
||||
if ($fileExtension === 'xlsx' || $fileExtension === 'xls') {
|
||||
try {
|
||||
$spreadsheet = IOFactory::load($fileTmpPath);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$rows = $sheet->toArray();
|
||||
|
||||
// Trova gli indici delle colonne dall'header
|
||||
$header = $rows[0]; // Prima riga
|
||||
$colIndex = array_flip($header); // Map header to column index
|
||||
|
||||
$reportNoIndex = isset($colIndex['Report no.']) ? $colIndex['Report no.'] : 'S';
|
||||
$inDateIndex = isset($colIndex['IN Date']) ? $colIndex['IN Date'] : 'T';
|
||||
$dueDateIndex = isset($colIndex['DUE Date']) ? $colIndex['DUE Date'] : 'U';
|
||||
$outDateIndex = isset($colIndex['OUT Date']) ? $colIndex['OUT Date'] : 'V';
|
||||
|
||||
foreach ($rows as $index => $row) {
|
||||
if ($index == 0) continue; // Salta l'intestazione
|
||||
|
||||
// Ottieni i dati dalle colonne specificate
|
||||
$reportNo = $conn->real_escape_string(trim($row[$reportNoIndex]));
|
||||
$inDate = isset($row[$inDateIndex]) ? date('Y-m-d', strtotime(str_replace('/', '-', $row[$inDateIndex]))) : null;
|
||||
$dueDate = isset($row[$dueDateIndex]) ? date('Y-m-d', strtotime(str_replace('/', '-', $row[$dueDateIndex]))) : null;
|
||||
$outDate = isset($row[$outDateIndex]) ? date('Y-m-d', strtotime(str_replace('/', '-', $row[$outDateIndex]))) : null;
|
||||
|
||||
// Controlla se il report esiste già
|
||||
$checkQuery = "SELECT id FROM reportsbydate WHERE report_no = '$reportNo'";
|
||||
$result = $conn->query($checkQuery);
|
||||
|
||||
if ($result->num_rows == 0 && !empty($reportNo)) {
|
||||
// Inserisci solo se il report non esiste e il Report No è valido
|
||||
$insertQuery = "
|
||||
INSERT INTO reportsbydate (report_no, in_date, due_date, out_date)
|
||||
VALUES ('$reportNo', " .
|
||||
($inDate ? "'$inDate'" : "NULL") . ", " .
|
||||
($dueDate ? "'$dueDate'" : "NULL") . ", " .
|
||||
($outDate ? "'$outDate'" : "NULL") . ")";
|
||||
$conn->query($insertQuery);
|
||||
}
|
||||
}
|
||||
|
||||
echo "File imported successfully.";
|
||||
} catch (Exception $e) {
|
||||
echo "Error processing file: " . $e->getMessage();
|
||||
}
|
||||
} else {
|
||||
echo "Invalid file format. Please upload an Excel file.";
|
||||
}
|
||||
} else {
|
||||
echo "No file uploaded.";
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
@ -7,7 +7,7 @@
|
||||
<!-- LOGO -->
|
||||
<div class="topbar-left">
|
||||
<div class="text-center bg-logo">
|
||||
<a href="<?php echo USERAREA_PATH;?>index.php" class="logo"><i class="mdi mdi-bowling text-success"></i> Reportify</a>
|
||||
<a href="<?php echo USERAREA_PATH; ?>index.php" class="logo"><i class="mdi mdi-bowling text-success"></i> Reportify</a>
|
||||
<!-- <a href="index.html" class="logo"><img src="assets/images/logo.png" height="24" alt="logo"></a> -->
|
||||
</div>
|
||||
</div>
|
||||
@ -41,7 +41,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo USERAREA_PATH;?>notifications/notifications.php">
|
||||
<a href="<?php echo USERAREA_PATH; ?>notifications/notifications.php">
|
||||
<i class="mdi mdi-bell icon nav-icon"></i>
|
||||
<span> Notifications </span>
|
||||
</a>
|
||||
@ -121,6 +121,7 @@
|
||||
<a href="javascript:void(0);" class="waves-effect"><i class="fas fa-chart-bar"></i> <span> StatKPI </span> <span class="float-right"><i class="mdi mdi-chevron-right"></i></span></a>
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="<?php echo USERAREA_PATH; ?>statkpi/statkpi.php">StatKPI</a></li>
|
||||
<li><a href="<?php echo USERAREA_PATH; ?>statkpi/analytes_stats.php">Components Stats</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
360
public/userarea/statkpi/analytes_stats.php
Normal file
360
public/userarea/statkpi/analytes_stats.php
Normal file
@ -0,0 +1,360 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
$limit = isset($_GET['limit']) && is_numeric($_GET['limit']) ? intval($_GET['limit']) : 50;
|
||||
// Query per ottenere i dati delle sostanze
|
||||
$query = "
|
||||
SELECT
|
||||
cv.idcompoundsvocabulary AS substance_id,
|
||||
cv.namecompoundsvocabulary AS substance_name,
|
||||
COUNT(CASE WHEN rp.result_AnalytsRating IN ('PASS', 'P', 'Complies') THEN 1 END) AS pass_count,
|
||||
COUNT(CASE WHEN rp.result_AnalytsRating IN ('FAIL', 'F', 'Doesn\'t Comply') THEN 1 END) AS fail_count
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||
WHERE cv.preferred = 'Y'
|
||||
GROUP BY cv.idcompoundsvocabulary, cv.namecompoundsvocabulary
|
||||
ORDER BY
|
||||
COUNT(CASE WHEN rp.result_AnalytsRating IN ('PASS', 'P', 'Complies') THEN 1 END) +
|
||||
COUNT(CASE WHEN rp.result_AnalytsRating IN ('FAIL', 'F', 'Doesn\'t Comply') THEN 1 END) DESC
|
||||
LIMIT 200;
|
||||
";
|
||||
|
||||
|
||||
$result = $conn->query($query);
|
||||
|
||||
$tableData = []; // Array per la tabella
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$substances[] = $row['substance_name'];
|
||||
$passCounts[] = $row['pass_count'];
|
||||
$failCounts[] = $row['fail_count'];
|
||||
$substanceIds[] = $row['substance_id']; // Aggiungi l'ID della sostanza
|
||||
|
||||
// Aggiungi dati al $tableData per la tabella
|
||||
$tableData[] = [
|
||||
'id' => $row['substance_id'],
|
||||
'name' => $row['substance_name'],
|
||||
'pass_count' => $row['pass_count'],
|
||||
'fail_count' => $row['fail_count'],
|
||||
'total' => $row['pass_count'] + $row['fail_count']
|
||||
];
|
||||
}
|
||||
|
||||
$queryDetectable = "
|
||||
SELECT
|
||||
cv.idcompoundsvocabulary AS substance_id,
|
||||
cv.namecompoundsvocabulary AS substance_name,
|
||||
cv.cascompoundvocabulary AS cas_number,
|
||||
COUNT(*) AS total_results,
|
||||
COUNT(CASE WHEN rp.result_Value NOT LIKE '<%' THEN 1 END) AS detectable_count,
|
||||
ROUND((COUNT(CASE WHEN rp.result_Value NOT LIKE '<%' THEN 1 END) / COUNT(*)) * 100, 2) AS detectable_percentage
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||
WHERE cv.preferred = 'Y' AND cv.component_type = 'CH'
|
||||
GROUP BY cv.idcompoundsvocabulary, cv.namecompoundsvocabulary, cv.cascompoundvocabulary
|
||||
ORDER BY total_results DESC;
|
||||
";
|
||||
|
||||
$resultDetectable = $conn->query($queryDetectable);
|
||||
|
||||
$detectableData = []; // Array per la nuova tabella
|
||||
|
||||
while ($row = $resultDetectable->fetch_assoc()) {
|
||||
$detectableData[] = [
|
||||
'id' => $row['substance_id'],
|
||||
'name' => $row['substance_name'],
|
||||
'cas_number' => $row['cas_number'], // Aggiunge il CAS number
|
||||
'total_results' => $row['total_results'],
|
||||
'detectable_count' => $row['detectable_count'],
|
||||
'detectable_percentage' => $row['detectable_percentage']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!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">
|
||||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet">
|
||||
<script src="../assets/js/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
|
||||
</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">
|
||||
<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">Substance Statistics</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Substance Statistics</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="GET" action="">
|
||||
<label for="limit">Show:</label>
|
||||
<select id="limit" name="limit" onchange="this.form.submit()">
|
||||
<option value="10" <?php echo isset($_GET['limit']) && $_GET['limit'] == 10 ? 'selected' : ''; ?>>10</option>
|
||||
<option value="50" <?php echo isset($_GET['limit']) && $_GET['limit'] == 50 ? 'selected' : ''; ?>>50</option>
|
||||
<option value="100" <?php echo isset($_GET['limit']) && $_GET['limit'] == 100 ? 'selected' : ''; ?>>100</option>
|
||||
<option value="200" <?php echo isset($_GET['limit']) && $_GET['limit'] == 200 ? 'selected' : ''; ?>>200</option>
|
||||
<option value="500" <?php echo isset($_GET['limit']) && $_GET['limit'] == 500 ? 'selected' : ''; ?>>500</option>
|
||||
</select>
|
||||
records
|
||||
</form>
|
||||
|
||||
<!-- Grafico delle sostanze -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Substances by Rating</h5>
|
||||
<div id="substance-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabella delle sostanze -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Substances Data</h5>
|
||||
<table id="substances-table" class="display nowrap" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Substance Name</th>
|
||||
<th>Pass Count</th>
|
||||
<th>Fail Count</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($tableData as $data) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="substance-detail.php?id=<?php echo $data['id']; ?>" style="text-decoration:none;color:#007bff;">
|
||||
<?php echo htmlspecialchars($data['name']); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $data['pass_count']; ?></td>
|
||||
<td><?php echo $data['fail_count']; ?></td>
|
||||
<td><?php echo $data['total']; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabella dei risultati totali e dei valori detectable -->
|
||||
<!-- Tabella dei risultati totali e dei valori detectable -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Chemical Substance Result Summary</h5>
|
||||
<table id="detectable-table" class="display nowrap" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Substance Name</th>
|
||||
<th>CAS Number</th>
|
||||
<th>Total Results</th>
|
||||
<th>Detectable Count</th>
|
||||
<th>Detectable %</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($detectableData as $data) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="substance-detail.php?id=<?php echo $data['id']; ?>" style="text-decoration:none;color:#007bff;">
|
||||
<?php echo htmlspecialchars($data['name']); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($data['cas_number']); ?></td>
|
||||
<td><?php echo $data['total_results']; ?></td>
|
||||
<td><?php echo $data['detectable_count']; ?></td>
|
||||
<td><?php echo $data['detectable_percentage']; ?>%</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include('../include/footer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Recupera il numero di categorie (sostanze)
|
||||
const numberOfCategories = <?php echo count($substances); ?>;
|
||||
|
||||
// Calcola dinamicamente l'altezza del grafico
|
||||
const chartHeight = Math.min(Math.max(numberOfCategories * 40, 400), 5000);
|
||||
// 40px per categoria, altezza minima 400px, altezza massima 5000px
|
||||
|
||||
const options = {
|
||||
series: [{
|
||||
name: 'PASS',
|
||||
data: <?php echo json_encode($passCounts); ?>
|
||||
},
|
||||
{
|
||||
name: 'FAIL',
|
||||
data: <?php echo json_encode($failCounts); ?>
|
||||
}
|
||||
],
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: chartHeight, // Altezza dinamica basata sul numero di categorie
|
||||
stacked: true,
|
||||
horizontal: true
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: true,
|
||||
barHeight: '80%' // Barre più alte
|
||||
}
|
||||
},
|
||||
xaxis: {
|
||||
categories: <?php echo json_encode($substances); ?>,
|
||||
labels: {
|
||||
style: {
|
||||
fontSize: '12px',
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: 'Number of Ratings',
|
||||
style: {
|
||||
fontSize: '16px',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
style: {
|
||||
fontSize: '12px',
|
||||
fontWeight: 'normal',
|
||||
lineHeight: '2.0'
|
||||
},
|
||||
maxWidth: 400 // Larghezza massima per i nomi delle sostanze
|
||||
},
|
||||
title: {
|
||||
text: 'Substances',
|
||||
style: {
|
||||
fontSize: '16px',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
},
|
||||
colors: ['#28a745', '#dc3545'], // Colori delle barre
|
||||
title: {
|
||||
text: 'Substances by Rating',
|
||||
align: 'center',
|
||||
style: {
|
||||
fontSize: '20px',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom',
|
||||
labels: {
|
||||
style: {
|
||||
fontSize: '14px',
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const chart = new ApexCharts(document.querySelector("#substance-chart"), options);
|
||||
chart.render();
|
||||
|
||||
|
||||
// DataTables initialization
|
||||
$('#substances-table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
order: [
|
||||
[3, 'desc']
|
||||
], // Ordina per colonna totale
|
||||
pageLength: 50
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#detectable-table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
order: [
|
||||
[2, 'desc']
|
||||
], // Ordina per numero totale di risultati
|
||||
pageLength: 50
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -489,15 +489,21 @@ while ($row = $analysisDistributionResult->fetch_assoc()) {
|
||||
|
||||
// fecth analytes with most fails
|
||||
$failedAnalytesQuery = "
|
||||
SELECT c.namecompoundsvocabulary AS AnalyteName, COUNT(*) AS FailCount
|
||||
SELECT
|
||||
c.namecompoundsvocabulary AS AnalyteName,
|
||||
COUNT(*) AS FailCount
|
||||
FROM result_project rp
|
||||
LEFT JOIN compundsvocabulary c ON rp.result_AnalytsName = c.idcompoundsvocabulary
|
||||
WHERE LOWER(rp.result_AnalytsRating) IN ('f', 'fail', 'doesn\'t comply')
|
||||
LEFT JOIN reports r ON rp.idreports = r.idreports
|
||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||
$filters
|
||||
AND LOWER(rp.result_AnalytsRating) IN ('f', 'fail', 'doesn\'t comply')
|
||||
GROUP BY c.namecompoundsvocabulary
|
||||
ORDER BY FailCount DESC
|
||||
LIMIT 10;
|
||||
";
|
||||
|
||||
|
||||
$resultFailedAnalytes = mysqli_query($repnew, $failedAnalytesQuery) or die("Error in Selecting " . mysqli_error($repnew));
|
||||
|
||||
// Verifica se ci sono risultati
|
||||
@ -510,6 +516,68 @@ while ($row = mysqli_fetch_assoc($resultFailedAnalytes)) {
|
||||
];
|
||||
}
|
||||
|
||||
// New Query: phasequery
|
||||
$phaseQuery = "
|
||||
SELECT
|
||||
p.products_phase AS phase,
|
||||
COUNT(*) AS totalProducts
|
||||
FROM products p
|
||||
LEFT JOIN reports r ON p.idproducts = r.idproducts
|
||||
$filters
|
||||
AND p.products_phase IS NOT NULL
|
||||
GROUP BY p.products_phase
|
||||
ORDER BY totalProducts DESC
|
||||
";
|
||||
|
||||
$phaseQueryResult = $conn->query($phaseQuery);
|
||||
|
||||
// Process the results
|
||||
$phaseData = [];
|
||||
while ($row = $phaseQueryResult->fetch_assoc()) {
|
||||
$phaseData[] = [
|
||||
'phase' => $row['phase'],
|
||||
'totalProducts' => $row['totalProducts']
|
||||
];
|
||||
}
|
||||
|
||||
// New Query: Phase ratings distribution
|
||||
$phaseRatingsQuery = "
|
||||
SELECT
|
||||
p.products_phase AS phase,
|
||||
SUM(CASE
|
||||
WHEN UPPER(r.reportsRating) IN ('PASS', 'P', 'COMPLY') THEN 1
|
||||
ELSE 0
|
||||
END) AS passCount,
|
||||
SUM(CASE
|
||||
WHEN UPPER(r.reportsRating) IN ('FAIL', 'F', 'DOESN\'T COMPLY') THEN 1
|
||||
ELSE 0
|
||||
END) AS failCount,
|
||||
SUM(CASE
|
||||
WHEN UPPER(r.reportsRating) NOT IN ('PASS', 'P', 'COMPLY', 'FAIL', 'F', 'DOESN\'T COMPLY') THEN 1
|
||||
ELSE 0
|
||||
END) AS otherCount
|
||||
FROM products p
|
||||
LEFT JOIN reports r ON p.idproducts = r.idproducts
|
||||
$filters
|
||||
AND p.products_phase IS NOT NULL
|
||||
GROUP BY p.products_phase
|
||||
ORDER BY p.products_phase ASC
|
||||
";
|
||||
|
||||
$phaseRatingsResult = $conn->query($phaseRatingsQuery);
|
||||
|
||||
// Process the results
|
||||
$phaseRatingsData = [];
|
||||
while ($row = $phaseRatingsResult->fetch_assoc()) {
|
||||
$phaseRatingsData[] = [
|
||||
'phase' => $row['phase'],
|
||||
'passCount' => (int)$row['passCount'],
|
||||
'failCount' => (int)$row['failCount'],
|
||||
'otherCount' => (int)$row['otherCount']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// Ora controlliamo se è una richiesta AJAX
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// Rispondi ai dati aggiornati tramite AJAX
|
||||
@ -537,7 +605,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
'failedAnalytes' => $failedAnalytes,
|
||||
'analysisDistribution' => $analysisDistribution, // Distribuzione delle analisi per il grafico a torta
|
||||
'horizontalBarData' => $horizontalBarData, // Dati per il grafico a barre orizzontali
|
||||
'horizontalBarAnalysisData' => $horizontalBarAnalysisData // Nuovi dati per le analisi
|
||||
'phaseData' => $phaseData,
|
||||
'horizontalBarAnalysisData' => $horizontalBarAnalysisData,
|
||||
'phaseRatingsData' => $phaseRatingsData // Nuovi dati per il grafico delle fasi
|
||||
]);
|
||||
exit; // Ferma l'esecuzione del resto dello script dopo aver risposto all'AJAX
|
||||
}
|
||||
|
||||
@ -641,6 +641,27 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<!-- Colonna Sinistra per il Grafico a Torta -->
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Products Distribution by Phase</h5>
|
||||
<div id="phasePieChart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Colonna Destra (Vuota o per futuri contenuti) -->
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Phase Rating Distribution</h5>
|
||||
<div id="phaseBarChart"></div> <!-- Contenitore per il grafico -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@ -1273,6 +1294,144 @@ include('parsedatachart.php');
|
||||
alert('Error retrieving data.');
|
||||
}
|
||||
});
|
||||
|
||||
function renderPhasePieChart(phaseData) {
|
||||
const labels = phaseData.map(item => item.phase);
|
||||
const values = phaseData.map(item => parseInt(item.totalProducts, 10));
|
||||
|
||||
const options = {
|
||||
series: values,
|
||||
chart: {
|
||||
type: 'pie',
|
||||
height: 350
|
||||
},
|
||||
labels: labels,
|
||||
responsive: [{
|
||||
breakpoint: 480,
|
||||
options: {
|
||||
chart: {
|
||||
width: 300
|
||||
},
|
||||
legend: {
|
||||
position: 'bottom'
|
||||
}
|
||||
}
|
||||
}],
|
||||
colors: ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF', '#C9CB8D'], // Custom Colors
|
||||
legend: {
|
||||
position: 'bottom'
|
||||
}
|
||||
};
|
||||
|
||||
const chart = new ApexCharts(document.querySelector("#phasePieChart"), options);
|
||||
chart.render();
|
||||
}
|
||||
|
||||
// Funzione per il grafico a barre (Phase Ratings)
|
||||
function renderPhaseBarChart(phaseRatingsData) {
|
||||
const labels = phaseRatingsData.map(item => item.phase); // Etichette per le fasi
|
||||
const passCounts = phaseRatingsData.map(item => parseInt(item.passCount, 10));
|
||||
const failCounts = phaseRatingsData.map(item => parseInt(item.failCount, 10));
|
||||
const otherCounts = phaseRatingsData.map(item => parseInt(item.otherCount, 10));
|
||||
|
||||
const options = {
|
||||
series: [{
|
||||
name: 'Pass',
|
||||
data: passCounts
|
||||
},
|
||||
{
|
||||
name: 'Fail',
|
||||
data: failCounts
|
||||
},
|
||||
{
|
||||
name: 'Other',
|
||||
data: otherCounts
|
||||
}
|
||||
],
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: 400,
|
||||
stacked: true, // Barre impilate
|
||||
horizontal: true
|
||||
},
|
||||
xaxis: {
|
||||
categories: labels, // Fasi come categorie
|
||||
title: {
|
||||
text: 'Ratings Count' // Titolo per l'asse X
|
||||
}
|
||||
},
|
||||
colors: ['#28A745', '#FF4D4D', '#FFA500'], // Colori per Pass, Fail e Other
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: true,
|
||||
dataLabels: {
|
||||
enabled: false // Disabilitiamo le etichette per ogni barra
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: 'top', // Posizioniamo la leggenda sopra il grafico
|
||||
},
|
||||
tooltip: {
|
||||
y: {
|
||||
formatter: val => `${val} reports` // Tooltip personalizzato
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$('#phaseBarChart').html(''); // Reset grafico esistente
|
||||
const chart = new ApexCharts(document.querySelector("#phaseBarChart"), options);
|
||||
chart.render();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Chiama questa funzione dopo aver recuperato i dati tramite AJAX
|
||||
$(document).ready(function() {
|
||||
updateData(); // Aggiorna i dati iniziali
|
||||
});
|
||||
|
||||
function updateData() {
|
||||
$.ajax({
|
||||
url: 'parsedatachart.php', // Endpoint per ottenere i dati
|
||||
method: 'POST',
|
||||
data: {
|
||||
startDate: $('#startDate').val(),
|
||||
endDate: $('#endDate').val(),
|
||||
supplier: $('#supplierFilter').val(),
|
||||
productsRefnumber: $('#productsRefnumber').val(),
|
||||
productsSeason: $('#productsSeason').val(),
|
||||
ageRange: $('#ageRange').val(),
|
||||
reportsLabName: $('#reportsLabName').val(),
|
||||
reportsTestType: $('#reportsTestType').val(),
|
||||
reportsNumberLab: $('#reportsNumberLab').val(),
|
||||
},
|
||||
success: function(response) {
|
||||
const data = JSON.parse(response);
|
||||
|
||||
// Aggiorna il grafico della distribuzione per fase
|
||||
if (data.phaseData && data.phaseData.length > 0) {
|
||||
renderPhasePieChart(data.phaseData);
|
||||
} else {
|
||||
console.log('No phase data available.');
|
||||
}
|
||||
|
||||
// Aggiorna il grafico delle valutazioni per fase (Bar Chart)
|
||||
if (data.phaseRatingsData && data.phaseRatingsData.length > 0) {
|
||||
renderPhaseBarChart(data.phaseRatingsData);
|
||||
} else {
|
||||
console.log('No phase ratings data available for Bar Chart.');
|
||||
$('#phaseBarChart').html('<p>No data available</p>');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
console.log('Error retrieving data.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
301
public/userarea/statkpi/substance-detail.php
Normal file
301
public/userarea/statkpi/substance-detail.php
Normal file
@ -0,0 +1,301 @@
|
||||
<?php include('../include/headscript.php'); ?>
|
||||
<?php include("../class/company.php");
|
||||
|
||||
// Connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $database);
|
||||
|
||||
// Recupera l'ID della sostanza dalla query string
|
||||
$substance_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0;
|
||||
|
||||
// Query per ottenere i dettagli della sostanza
|
||||
$query = "
|
||||
SELECT cv.namecompoundsvocabulary AS substance_name
|
||||
FROM compundsvocabulary cv
|
||||
WHERE cv.idcompoundsvocabulary = ?";
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("i", $substance_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$substance = $result->fetch_assoc();
|
||||
|
||||
// Query per ottenere i valori della sostanza
|
||||
$queryValues = "
|
||||
SELECT
|
||||
rp.result_Value,
|
||||
rp.result_UnitofMeasure,
|
||||
r.reportDateIn,
|
||||
r.reportsNumberLab,
|
||||
p.products_refnumber,
|
||||
p.products_description,
|
||||
r.idreports
|
||||
FROM result_project rp
|
||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||
LEFT JOIN reports r ON rp.idreports = r.idreports
|
||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||
WHERE cv.idcompoundsvocabulary = ?
|
||||
AND (rp.result_Value REGEXP '^[0-9]+([,][0-9]+)?$' OR rp.result_Value LIKE '<%')
|
||||
ORDER BY r.reportDateIn ASC;
|
||||
";
|
||||
|
||||
$stmtValues = $conn->prepare($queryValues);
|
||||
$stmtValues->bind_param("i", $substance_id);
|
||||
$stmtValues->execute();
|
||||
$resultValues = $stmtValues->get_result();
|
||||
|
||||
$values = [];
|
||||
while ($row = $resultValues->fetch_assoc()) {
|
||||
$values[] = $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Query per calcolare la percentuale di valori detected
|
||||
$queryDetectablePercentage = "
|
||||
SELECT
|
||||
ROUND(
|
||||
(COUNT(CASE WHEN rp.result_Value NOT LIKE '<%' THEN 1 END) / COUNT(*)) * 100, 2
|
||||
) AS detectable_percentage
|
||||
FROM result_project rp
|
||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||
WHERE cv.idcompoundsvocabulary = ? AND cv.component_type = 'CH';
|
||||
";
|
||||
|
||||
$stmtDetectablePercentage = $conn->prepare($queryDetectablePercentage);
|
||||
$stmtDetectablePercentage->bind_param("i", $substance_id);
|
||||
$stmtDetectablePercentage->execute();
|
||||
$resultDetectablePercentage = $stmtDetectablePercentage->get_result();
|
||||
$detectableData = $resultDetectablePercentage->fetch_assoc();
|
||||
$detectablePercentage = $detectableData['detectable_percentage'] ?? 0;
|
||||
|
||||
// Determina la classe del badge in base alla percentuale
|
||||
$badgeClass = '';
|
||||
if ($detectablePercentage < 3) {
|
||||
$badgeClass = 'bg-success'; // Verde
|
||||
} elseif ($detectablePercentage >= 3 && $detectablePercentage < 10) {
|
||||
$badgeClass = 'bg-info'; // Azzurro
|
||||
} elseif ($detectablePercentage >= 10 && $detectablePercentage < 30) {
|
||||
$badgeClass = 'bg-warning'; // Arancio
|
||||
} else {
|
||||
$badgeClass = 'bg-danger'; // Rosso
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!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.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet">
|
||||
<script src="../assets/js/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
|
||||
|
||||
|
||||
|
||||
</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">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card shadow">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h1 class="mb-1 text-primary">
|
||||
<i class="fas fa-flask"></i>
|
||||
<?php echo htmlspecialchars($substance['substance_name']); ?>
|
||||
<span class="badge <?php echo $badgeClass; ?> px-3 py-2">
|
||||
<?php echo $detectablePercentage; ?>% Detected
|
||||
</span>
|
||||
</h1>
|
||||
<p class="text-muted mb-0">Comprehensive analysis and details</p>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<span class="badge bg-success px-3 py-2">
|
||||
ID: <?php echo $substance_id; ?>
|
||||
</span>
|
||||
<span class="badge bg-info px-3 py-2">
|
||||
Last Updated: <?php echo date('d M Y'); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Grafico -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Distribution of Values</h5>
|
||||
<div id="value-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabella -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Values Table</h5>
|
||||
<table id="values-table" class="display nowrap" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Report Number</th>
|
||||
<th>Product Ref</th>
|
||||
|
||||
<th>Value</th>
|
||||
<th>Unit</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($values as $value): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($value['reportDateIn']); ?></td>
|
||||
<td>
|
||||
<a href="../products/reportdetails.php?idreports=<?php echo $value['idreports']; ?>" style="text-decoration:none;color:#007bff;">
|
||||
<?php echo htmlspecialchars($value['reportsNumberLab']); ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td><?php echo htmlspecialchars($value['products_refnumber']); ?></td>
|
||||
|
||||
|
||||
<td>
|
||||
<?php
|
||||
$rawValue = str_replace(',', '.', $value['result_Value']);
|
||||
if (str_starts_with($rawValue, '<')) {
|
||||
echo '<span style="color: gray;">' . htmlspecialchars($rawValue) . '</span>';
|
||||
} else {
|
||||
echo '<span style="color: green;">' . htmlspecialchars($rawValue) . '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($value['result_UnitofMeasure']); ?></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include('../include/footer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const values = <?php echo json_encode(array_values(array_filter($values, function ($row) {
|
||||
$rawValue = str_replace(',', '.', $row['result_Value']);
|
||||
return is_numeric($rawValue) || str_starts_with($rawValue, '<');
|
||||
}))); ?>;
|
||||
|
||||
const dataPoints = values.map((val) => ({
|
||||
x: val.reportDateIn,
|
||||
y: parseFloat(val.result_Value.replace(',', '.')) || null,
|
||||
}));
|
||||
|
||||
// Configura il grafico scatter
|
||||
const options = {
|
||||
series: [{
|
||||
name: 'Value',
|
||||
data: dataPoints,
|
||||
}, ],
|
||||
chart: {
|
||||
type: 'scatter',
|
||||
height: 500,
|
||||
},
|
||||
xaxis: {
|
||||
type: 'datetime',
|
||||
title: {
|
||||
text: 'Date',
|
||||
},
|
||||
labels: {
|
||||
datetimeFormatter: {
|
||||
year: 'yyyy',
|
||||
month: 'MMM yyyy',
|
||||
day: 'dd MMM',
|
||||
},
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
title: {
|
||||
text: 'Value',
|
||||
},
|
||||
},
|
||||
markers: {
|
||||
size: 5,
|
||||
},
|
||||
};
|
||||
|
||||
const chart = new ApexCharts(document.querySelector("#value-chart"), options);
|
||||
chart.render();
|
||||
|
||||
// Configurazione DataTables
|
||||
$('#values-table').DataTable({
|
||||
pageLength: 100,
|
||||
dom: 'Bfrtip',
|
||||
buttons: ['copy', 'csv', 'excel', 'pdf', 'print'],
|
||||
order: [
|
||||
[0, 'asc']
|
||||
], // Ordina per data in modo crescente
|
||||
columnDefs: [{
|
||||
targets: 0, // Colonna delle date
|
||||
render: function(data, type, row) {
|
||||
if (type === 'display' || type === 'filter') {
|
||||
return new Date(data).toLocaleDateString();
|
||||
}
|
||||
return data; // Mantiene il formato originale per l'ordinamento
|
||||
},
|
||||
}, ],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user