added charts and fixed analysis component

This commit is contained in:
2024-11-22 11:57:39 +01:00
parent 18735127bb
commit 22c95fa063
12 changed files with 1355 additions and 556 deletions
+136 -249
View File
@@ -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>
+12 -10
View File
@@ -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);
}
?>
?>
+109 -258
View File
@@ -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>