Update 18-09-2024 adding NAS

This commit is contained in:
2024-09-18 11:14:23 +02:00
parent 28a074a7e7
commit 225d1f3531
32 changed files with 5968 additions and 520 deletions
@@ -0,0 +1,16 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['nameanalysisvoc'];
$kind = $_POST['kindanalysisvoc'];
$conn = new mysqli($servername, $username, $password, $database);
$query = "INSERT INTO analysisvocabulary (nameanalysisvoc, kindanalysisvoc, preferred) VALUES ('$name', '$kind', 'Y')";
if ($conn->query($query)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => true]);
}
}
?>
+66 -66
View File
@@ -1,79 +1,79 @@
<?php include('../include/headscript.php'); ?>
<?php
$type = $_POST['type'];
$analysis_name = $_POST['analysis_name'];
$str_name = $_POST['str_name'];
$str_kind = $_POST['str_kind'];
$type = $_POST['type'];
$analysis_name = $_POST['analysis_name'];
$str_name = $_POST['str_name'];
$str_kind = $_POST['str_kind'];
$analysis_refid = 0;
if($analysis_name != "") {
$arr_analysis_refdata = new WA_MySQLi_RS("rsl", $repnew, 0);
$arr_analysis_refdata->setQuery("SELECT * FROM analysisvocabulary where nameanalysisvoc like '$analysis_name'");
$arr_analysis_refdata->execute();
$arr_analysis_ref = $arr_analysis_refdata->Results;
if(count($arr_analysis_ref) == 0) {
$analysis_refid = $arr_analysis_ref[0]['refid'];
}
$analysis_refid = 0;
if ($analysis_name != "") {
$arr_analysis_refdata = new WA_MySQLi_RS("rsl", $repnew, 0);
$arr_analysis_refdata->setQuery("SELECT * FROM analysisvocabulary where nameanalysisvoc like '$analysis_name'");
$arr_analysis_refdata->execute();
$arr_analysis_ref = $arr_analysis_refdata->Results;
if (count($arr_analysis_ref) > 0) {
$analysis_refid = $arr_analysis_ref[0]['refid'];
}
}
if ($type == 0) {
$InsertQuery = new WA_MySQLi_Query($repnew);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "`compundsvocabulary`";
$InsertQuery->bindColumn("namecompoundsvocabulary", "s", "" . $str_name, "WA_DEFAULT");
$InsertQuery->bindColumn("cascompoundvocabulary", "s", "" . $str_kind, "WA_DEFAULT");
$InsertQuery->bindColumn("analysisrefid", "i", "" . $analysis_refid, "WA_DEFAULT");
$InsertQuery->bindColumn("refid", "i", "0", "WA_DEFAULT");
$InsertQuery->bindColumn("preferred", "s", "Y", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$inserted_query = new WA_MySQLi_RS("getquery", $repnew, 0);
$inserted_query->setQuery("SELECT * FROM compundsvocabulary WHERE namecompoundsvocabulary like '$str_name' and preferred like 'Y' and refid=0");
$inserted_query->execute();
$inserted_data = $inserted_query->Results;
$ref_id = 0;
if (count($inserted_data) > 0) {
$ref_id = $inserted_data[0]['idcompoundsvocabulary'];
}
if($type == 0) {
$InsertQuery = new WA_MySQLi_Query($repnew);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "`compundsvocabulary`";
$InsertQuery->bindColumn("namecompoundsvocabulary", "s", "" . $str_name, "WA_DEFAULT");
$InsertQuery->bindColumn("cascompoundvocabulary", "s", "" .$str_kind, "WA_DEFAULT");
$InsertQuery->bindColumn("analysisrefid", "i", "".$analysis_refid, "WA_DEFAULT");
$InsertQuery->bindColumn("refid", "i", "0", "WA_DEFAULT");
$InsertQuery->bindColumn("preferred", "s", "Y", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$inserted_query = new WA_MySQLi_RS("getquery", $repnew, 0);
$inserted_query->setQuery("SELECT * FROM compundsvocabulary WHERE namecompoundsvocabulary like '$str_name' and preferred like 'Y' and refid=0");
$inserted_query->execute();
$inserted_data = $inserted_query->Results;
$ref_id = 0;
if(count($inserted_data) > 0) {
$ref_id = $inserted_data[0]['idcompoundsvocabulary'];
}
if($ref_id > 0) {
$UpdateQuery = new WA_MySQLi_Query($repnew);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`compundsvocabulary`";
$UpdateQuery->bindColumn("refid", "i", "" . $ref_id . "", "WA_DEFAULT");
$UpdateQuery->addFilter("idcompoundsvocabulary", "=", "i", "" . ($ref_id) . "");
$UpdateQuery->execute();
die(json_encode(array(
'code' => "success",
'info' => array(
'name' => $str_name,
'kind' => $str_kind,
'ref_id' => $ref_id,
)
)));
} else {
die("error");
}
} else {
$InsertQuery = new WA_MySQLi_Query($repnew);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "`compundsvocabulary`";
$InsertQuery->bindColumn("namecompoundsvocabulary", "s", "" . $str_name, "WA_DEFAULT");
$InsertQuery->bindColumn("analysisrefid", "i", "".$analysis_refid, "WA_DEFAULT");
$InsertQuery->bindColumn("refid", "i", $type, "WA_DEFAULT");
$InsertQuery->bindColumn("preferred", "s", "N", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
if ($ref_id > 0) {
$UpdateQuery = new WA_MySQLi_Query($repnew);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`compundsvocabulary`";
$UpdateQuery->bindColumn("refid", "i", "" . $ref_id . "", "WA_DEFAULT");
$UpdateQuery->addFilter("idcompoundsvocabulary", "=", "i", "" . ($ref_id) . "");
$UpdateQuery->execute();
die(json_encode(array(
'code' => "success",
'info' => array(
'name' => $str_name,
'kind' => $str_kind,
'ref_id' => $type,
'ref_id' => $ref_id,
)
)));
}
} else {
die("error");
}
} else {
$InsertQuery = new WA_MySQLi_Query($repnew);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "`compundsvocabulary`";
$InsertQuery->bindColumn("namecompoundsvocabulary", "s", "" . $str_name, "WA_DEFAULT");
$InsertQuery->bindColumn("analysisrefid", "i", "" . $analysis_refid, "WA_DEFAULT");
$InsertQuery->bindColumn("refid", "i", $type, "WA_DEFAULT");
$InsertQuery->bindColumn("preferred", "s", "N", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
die(json_encode(array(
'code' => "success",
'info' => array(
'name' => $str_name,
'kind' => $str_kind,
'ref_id' => $type,
)
)));
}
+19
View File
@@ -0,0 +1,19 @@
<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['nameanalysisvoc'];
$refid = $_POST['refid'];
$preferred = $_POST['preferred'];
$query = "INSERT INTO analysisvocabulary (nameanalysisvoc, refid, preferred) VALUES ('$name', $refid, '$preferred')";
if ($conn->query($query)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => $conn->error]);
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['nameanalysisvoc'];
$refid = $_POST['refid'];
$preferred = $_POST['preferred'];
$query = "INSERT INTO analysisvocabulary (nameanalysisvoc, refid, preferred) VALUES ('$name', $refid, '$preferred')";
if ($conn->query($query)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => $conn->error]);
}
}
+504
View File
@@ -0,0 +1,504 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<?php include('../include/seo.php'); ?>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="../assets/css/style.css" rel="stylesheet" type="text/css">
<link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.css">
<script src="../assets/js/jquery.min.js"></script>
<link rel="stylesheet" href="../assets/plugins/select2/select2.min.css">
<script src="../assets/plugins/select2/select2.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.js"></script>
<style>
.width-100 {
width: 100%;
}
.flex_center {
display: flex;
align-items: center;
}
.mg_none {
margin: 0 !important;
}
.hidden {
display: none !important;
}
.table-custom tr {
height: 40px;
line-height: 40px;
}
#ajax_preloader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: transparent;
z-index: 9999999;
}
.table-custom td,
.table-custom th {
padding: 4px 8px;
}
.table-custom .btn {
padding: 2px 15px;
line-height: 1.7;
font-size: 14px;
}
.form-row {
display: flex;
align-items: center;
/* Questo allinea verticalmente gli elementi nella riga */
gap: 10px;
/* Questo crea una piccola distanza tra gli elementi nella riga */
}
.table-custom .form-control,
.table-custom .form-select {
height: 25px;
/* Puoi modificare questo valore per adattarlo al tuo design */
padding: 2px 6px;
/* riduce la dimensione del padding */
font-size: 14px;
/* riduce la dimensione del font */
}
.table-custom .form-control-sm.analysis-input {
height: 25px;
/* Questo modifica la dimensione degli input con classe 'form-control-sm' e 'analysis-input' */
padding: 2px 6px;
font-size: 12px;
}
.padding_none {
padding: 0 !important;
}
.select2-container--open {
z-index: 9999;
}
</style>
</head>
<body class="fixed-left">
<!-- Loader
<div id="preloader">
<div id="status">
<div class="spinner"></div>
</div>
</div> -->
<!-- Begin page -->
<div id="wrapper">
<?php include('../include/navigationbar.php'); ?>
<!-- Start right Content here -->
<div class="content-page">
<!-- Start content -->
<div class="content">
<?php include('../include/topbar.php'); ?>
<div class="page-content-wrapper ">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="btn-group float-right">
<ol class="breadcrumb hide-phone p-0 m-0">
<li class="breadcrumb-item"><a href="#">Reportify</a></li>
<li class="breadcrumb-item active">Importify</li>
</ol>
</div>
<h4 class="page-title">Importify</h4>
</div>
</div>
</div>
<!-- end page title end breadcrumb -->
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<h5 class="header-title pb-3 mt-0">Importify: <?php echo $dashboard; ?></h5>
<br><br>
<div class="table-responsive">
<!-- Button for adding new analysis -->
<button id="add-analysis" class="btn btn-primary mb-3">Add New Analysis</button>
<!-- Form for adding new analysis (hidden by default) -->
<div id="add-analysis-form" class="hidden">
<form id="analysisForm">
<div class="form-row">
<input type="text" name="nameanalysisvoc" class="form-control" placeholder="Analysis Name" required>
<select name="kindanalysisvoc" class="form-control">
<option value="">Type</option>
<option value="Type1">Type1</option>
<option value="Type2">Type2</option>
</select>
<button type="submit" class="btn btn-success">Save</button>
</div>
</form>
</div>
<!-- Table of analysis -->
<!-- Table of analysis -->
<table id="analysisTable" class="table table-striped table-hover">
<thead>
<tr>
<th>Analysis Name</th>
<th>Type</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="analysis-list">
<?php
$conn = new mysqli($servername, $username, $password, $database);
$query = "SELECT * FROM analysisvocabulary WHERE preferred = 'Y'";
$result = $conn->query($query);
while ($row = $result->fetch_assoc()) {
echo '<tr class="main-analysis" data-id="' . $row['idanalysisvocabulary'] . '">';
echo '<td>' . $row['nameanalysisvoc'] . '</td>';
echo '<td>' . $row['kindanalysisvoc'] . '</td>';
echo '<td>
<button class="btn btn-info btn-sm show-synonyms">Synonyms</button>
<button class="btn btn-primary btn-sm add-synonym">Add Synonym</button>
<button class="btn btn-secondary btn-sm show-components" data-id="' . $row['idanalysisvocabulary'] . '">Components</button>
<button class="btn btn-danger btn-sm delete-analysis" data-id="' . $row['idanalysisvocabulary'] . '"><i class="bx bx-trash"></i> Delete</button>
</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
<input id="f_csv" type="file" name="f_csv" style="display: none" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/csv">
</div>
</div>
</div>
</div>
<!-- end row -->
</div><!-- container -->
</div> <!-- Page content Wrapper -->
</div> <!-- content -->
<?php include('../include/footer.php'); ?>
</div>
<!-- End Right content here -->
</div>
<!-- END wrapper -->
<script>
$(document).ready(function() {
// Inizializzazione di DataTables con filtraggio automatico
$('#analysisTable').DataTable();
// Toggle form visibility for adding a new analysis
$('#add-analysis').on('click', function() {
$('#add-analysis-form').toggleClass('hidden');
});
// Handle form submission for adding a new analysis
$('#analysisForm').on('submit', function(e) {
e.preventDefault();
var formData = $(this).serialize();
$.ajax({
type: 'POST',
url: 'add_analysis.php',
data: formData,
success: function(response) {
Swal.fire('Success!', 'Analysis added successfully.', 'success');
location.reload(); // Optionally reload the page to refresh the table
},
error: function() {
Swal.fire('Error!', 'There was an error adding the analysis.', 'error');
}
});
});
// Funzione per cancellare l'analisi principale con tutti i sinonimi
$('#analysisTable').on('click', '.delete-analysis', function() {
var analysisId = $(this).data('id');
var row = $(this).closest('tr');
var table = $('#analysisTable').DataTable(); // Riferimento alla DataTable
// SweetAlert per conferma
Swal.fire({
title: 'Are you sure?',
text: "This will permanently delete the analysis and all its synonyms!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, delete everything!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: 'delete_analysis.php',
type: 'POST',
data: {
idanalysisvocabulary: analysisId
},
success: function(response) {
Swal.fire('Deleted!', 'The analysis and all its synonyms have been deleted.', 'success');
// Rimuovi la riga principale
table.row(row).remove().draw();
// Rimuovi eventuali righe child (sinonimi) se sono visibili
var childRows = row.nextUntil('.main-analysis'); // Seleziona tutte le righe successive finché non incontri un'altra analisi principale
childRows.each(function() {
if ($(this).hasClass('child')) {
table.row($(this)).remove().draw(); // Rimuove le righe dei sinonimi
}
});
},
error: function() {
Swal.fire('Error!', 'There was an error deleting the analysis.', 'error');
}
});
}
});
});
// Gestione del click su "Synonyms" per visualizzare la tabella child
$('#analysisTable').on('click', '.show-synonyms', function() {
var tr = $(this).closest('tr');
var analysisId = tr.data('id');
var row = $('#analysisTable').DataTable().row(tr);
var button = $(this); // Riferimento al pulsante
// Disabilita il pulsante e aggiunge un indicatore di caricamento
button.prop('disabled', true);
button.html('<i class="fa fa-spinner fa-spin"></i> Loading...');
// Se la riga child è già aperta, la chiude
if (row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
// Riabilita il pulsante
button.prop('disabled', false);
button.html('Synonyms');
} else {
// Chiamata AJAX per ottenere i sinonimi
$.ajax({
url: 'get_synonyms.php',
type: 'POST',
data: {
idanalysisvocabulary: analysisId
},
success: function(data) {
// Visualizza la tabella child con i sinonimi
row.child(formatSynonyms(data)).show();
tr.addClass('shown');
},
complete: function() {
// Riabilita il pulsante e ripristina il testo originale
button.prop('disabled', false);
button.html('Synonyms');
},
error: function() {
Swal.fire('Error!', 'There was an error loading the synonyms.', 'error');
button.prop('disabled', false);
button.html('Synonyms');
}
});
}
});
// Funzione per formattare i sinonimi nella tabella child
function formatSynonyms(data) {
var html = '<table class="table table-bordered table-striped child-table" style="background-color: #f9f9f9;">';
html += '<thead><tr><th>Synonym Name</th><th>Actions</th></tr></thead>';
html += '<tbody>';
$.each(JSON.parse(data), function(index, synonym) {
html += '<tr><td>' + synonym.nameanalysisvoc + '</td>';
html += '<td><button class="btn btn-danger btn-sm delete-synonym" data-id="' + synonym.idanalysisvocabulary + '"><i class="bx bx-trash"></i></button></td></tr>';
});
html += '</tbody></table>';
return html;
}
// Funzione per cancellare il sinonimo con SweetAlert
$('#analysisTable').on('click', '.delete-synonym', function() {
var synonymId = $(this).data('id');
var row = $(this).closest('tr');
Swal.fire({
title: 'Are you sure?',
text: "This will permanently delete the synonym!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: 'delete_synonym.php',
type: 'POST',
data: {
idanalysisvocabulary: synonymId
},
success: function(response) {
Swal.fire('Deleted!', 'The synonym has been deleted.', 'success');
row.remove(); // Rimuove la riga dalla tabella
},
error: function() {
Swal.fire('Error!', 'There was an error deleting the synonym.', 'error');
}
});
}
});
});
// Funzione per cancellare l'analisi principale con tutti i sinonimi
$('#analysisTable').on('click', '.delete-analysis', function() {
var analysisId = $(this).data('id');
var row = $(this).closest('tr');
Swal.fire({
title: 'Are you sure?',
text: "This will permanently delete the analysis and all its synonyms!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, delete everything!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: 'delete_analysis.php',
type: 'POST',
data: {
idanalysisvocabulary: analysisId
},
success: function(response) {
Swal.fire('Deleted!', 'The analysis and all its synonyms have been deleted.', 'success');
row.remove(); // Rimuove la riga dalla tabella
},
error: function() {
Swal.fire('Error!', 'There was an error deleting the analysis.', 'error');
}
});
}
});
});
// Funzione per mostrare il form di aggiunta sinonimo sotto la riga dell'analisi
$('#analysisTable').on('click', '.add-synonym', function() {
var tr = $(this).closest('tr');
var analysisId = tr.data('id');
if (tr.next('.synonym-form').length) {
tr.next('.synonym-form').toggle();
} else {
var formHtml = '<tr class="synonym-form"><td colspan="3">';
formHtml += '<form class="add-synonym-form">';
formHtml += '<input type="text" name="synonym_name" class="form-control" placeholder="Synonym Name" required>';
formHtml += '<button type="submit" class="btn btn-success btn-sm mt-2">Save</button>';
formHtml += '</form></td></tr>';
tr.after(formHtml);
}
});
// Invia il form di aggiunta sinonimo
$('#analysisTable').on('submit', '.add-synonym-form', function(e) {
e.preventDefault();
var form = $(this);
var synonymName = form.find('input[name="synonym_name"]').val();
var analysisId = form.closest('tr').prev().data('id');
$.ajax({
url: 'add_synonym.php',
type: 'POST',
data: {
nameanalysisvoc: synonymName,
refid: analysisId,
preferred: 'N'
},
success: function(response) {
Swal.fire('Success!', 'Synonym added successfully.', 'success');
form.closest('.synonym-form').hide(); // Nasconde il form dopo il salvataggio
},
error: function() {
Swal.fire('Error!', 'There was an error adding the synonym.', 'error');
}
});
});
// Gestione del pulsante "Components"
$('#analysisTable').on('click', '.show-components', function() {
var analysisId = $(this).data('id');
window.location.href = 'components.php?analysisrefid=' + analysisId; // Reindirizza alla pagina dei componenti con l'ID dell'analisi
});
});
</script>
<!-- plugin JS -->
<script src="../assets/js/popper.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script src="../assets/js/modernizr.min.js"></script>
<script src="../assets/js/detect.js"></script>
<script src="../assets/js/fastclick.js"></script>
<script src="../assets/js/jquery.slimscroll.js"></script>
<script src="../assets/js/jquery.blockUI.js"></script>
<script src="../assets/js/waves.js"></script>
<script src="../assets/js/jquery.nicescroll.js"></script>
<script src="../assets/js/jquery.scrollTo.min.js"></script>
<script src="../assets/js/common_helper.js"></script>
<script src="../assets/plugins/chart.js/chart.min.js"></script>
<script src="../assets/pages/dashboard.js"></script>
<!-- App js -->
<script src="../assets/js/app.js"></script>
<script src="../assets/plugins/alertify/js/alertify.js"></script>
</body>
</html>
+238
View File
@@ -0,0 +1,238 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php"); ?>
<?php
$conn = new mysqli($servername, $username, $password, $database);
$analysisrefid = $_GET['analysisrefid']; // Ottieni l'ID dell'analisi dalla query string
// Recupera i componenti associati all'analisi selezionata
$query = "SELECT * FROM compundsvocabulary WHERE analysisrefid = $analysisrefid AND preferred = 'Y'";
$result = $conn->query($query);
// Recupera il nome dell'analisi
$analysisQuery = "SELECT nameanalysisvoc FROM analysisvocabulary WHERE idanalysisvocabulary = $analysisrefid AND preferred = 'Y'";
$analysisResult = $conn->query($analysisQuery);
$analysisn = $analysisResult->fetch_assoc();
$analysisName = $analysisn['nameanalysisvoc']; // Nome dell'analisi
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<title>Components</title>
<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 rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.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>
<script src="../assets/js/jquery.min.js"></script>
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
<!-- DataTables JS -->
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.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">
<h4 class="page-title">Components of Analysis: <?php echo $analysisName; ?></h4>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<!-- Tabella dei componenti -->
<table id="componentsTable" class="table table-striped table-hover">
<thead>
<tr>
<th>Component Name</th>
<th>CAS Number</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
while ($row = $result->fetch_assoc()) {
echo '<tr data-id="' . $row['idcompoundsvocabulary'] . '">';
echo '<td>' . $row['namecompoundsvocabulary'] . '</td>';
echo '<td>' . $row['cascompoundvocabulary'] . '</td>';
echo '<td>
<button class="btn btn-info btn-sm show-synonyms">Synonyms</button>
<button class="btn btn-danger btn-sm delete-component"><i class="bx bx-trash"></i> Delete</button>
</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div><!-- container -->
</div><!-- Page content Wrapper -->
</div><!-- content -->
<?php include('../include/footer.php'); ?>
</div>
</div>
<script>
$(document).ready(function() {
// Inizializza DataTables sulla tabella dei componenti
$('#componentsTable').DataTable();
// Gestione del click su "Synonyms" per visualizzare la tabella child
$('#componentsTable').on('click', '.show-synonyms', function() {
var tr = $(this).closest('tr');
var componentId = tr.data('id');
var row = $('#componentsTable').DataTable().row(tr);
var button = $(this); // Riferimento al pulsante
// Disabilita il pulsante e aggiunge un indicatore di caricamento
button.prop('disabled', true);
button.html('<i class="fa fa-spinner fa-spin"></i> Loading...');
// Se la riga child è già aperta, la chiude
if (row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
// Riabilita il pulsante
button.prop('disabled', false);
button.html('Synonyms');
} else {
// Chiamata AJAX per ottenere i sinonimi del componente
$.ajax({
url: 'get_component_synonyms.php',
type: 'POST',
data: {
refid: componentId
},
success: function(data) {
// Visualizza i sinonimi come tabella child
row.child(formatSynonyms(data)).show();
tr.addClass('shown');
},
complete: function() {
// Riabilita il pulsante e ripristina il testo originale
button.prop('disabled', false);
button.html('Synonyms');
},
error: function() {
Swal.fire('Error!', 'There was an error loading the synonyms.', 'error');
// Riabilita il pulsante in caso di errore
button.prop('disabled', false);
button.html('Synonyms');
}
});
}
});
// Funzione per formattare i sinonimi nella tabella child
function formatSynonyms(data) {
var html = '<table class="table table-bordered child-table">';
html += '<thead><tr><th>Synonym Name</th><th>Actions</th></tr></thead>';
html += '<tbody>';
$.each(JSON.parse(data), function(index, synonym) {
html += '<tr><td>' + synonym.namecompoundsvocabulary + '</td>';
html += '<td><button class="btn btn-danger btn-sm delete-synonym" data-id="' + synonym.idcompoundsvocabulary + '"><i class="bx bx-trash"></i></button></td></tr>';
});
html += '</tbody></table>';
return html;
}
// Funzione per cancellare un singolo sinonimo
$('#componentsTable').on('click', '.delete-synonym', function() {
var synonymId = $(this).data('id');
var row = $(this).closest('tr');
Swal.fire({
title: 'Are you sure?',
text: "This will permanently delete the synonym!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: 'delete_synonymcomp.php',
type: 'POST',
data: {
idcompoundsvocabulary: synonymId
},
success: function(response) {
Swal.fire('Deleted!', 'The synonym has been deleted.', 'success');
$('#componentsTable').DataTable().row(row).remove().draw(); // Rimuovi la riga del sinonimo dalla tabella
},
error: function() {
Swal.fire('Error!', 'There was an error deleting the synonym.', 'error');
}
});
}
});
});
// Funzione per cancellare il componente principale con i suoi sinonimi
$('#componentsTable').on('click', '.delete-component', function() {
var componentId = $(this).closest('tr').data('id');
Swal.fire({
title: 'Are you sure?',
text: "This will permanently delete the component and all its synonyms!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Yes, delete everything!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: 'delete_component.php',
type: 'POST',
data: {
idcompoundsvocabulary: componentId
},
success: function(response) {
Swal.fire('Deleted!', 'The component and all its synonyms have been deleted.', 'success');
$('#componentsTable').DataTable().row($(this).closest('tr')).remove().draw(); // Rimuovi la riga dalla tabella
},
error: function() {
Swal.fire('Error!', 'There was an error deleting the component.', 'error');
}
});
}
});
});
});
</script>
</body>
</html>
@@ -0,0 +1,21 @@
<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$idanalysisvocabulary = $_POST['idanalysisvocabulary'];
// Cancella l'analisi principale
$query1 = "DELETE FROM analysisvocabulary WHERE idanalysisvocabulary = $idanalysisvocabulary";
// Cancella tutti i sinonimi collegati
$query2 = "DELETE FROM analysisvocabulary WHERE refid = $idanalysisvocabulary";
if ($conn->query($query1) && $conn->query($query2)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => true]);
}
}
@@ -0,0 +1,18 @@
<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
$idcompoundsvocabulary = $_POST['idcompoundsvocabulary'];
// Cancella il componente principale
$query1 = "DELETE FROM compundsvocabulary WHERE idcompoundsvocabulary = $idcompoundsvocabulary";
// Cancella i sinonimi del componente
$query2 = "DELETE FROM compundsvocabulary WHERE refid = $idcompoundsvocabulary";
if ($conn->query($query1) && $conn->query($query2)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => true]);
}
@@ -0,0 +1,14 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$idanalysisvocabulary = $_POST['idanalysisvocabulary'];
$conn = new mysqli($servername, $username, $password, $database);
$query = "DELETE FROM analysisvocabulary WHERE idanalysisvocabulary = $idanalysisvocabulary";
if ($conn->query($query)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => true]);
}
}
?>
@@ -0,0 +1,17 @@
<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$idcompoundsvocabulary = $_POST['idcompoundsvocabulary'];
$query = "DELETE FROM compundsvocabulary WHERE idcompoundsvocabulary = $idcompoundsvocabulary";
if ($conn->query($query)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => true]);
}
}
@@ -0,0 +1,16 @@
<?php
include('../include/headscript.php');
include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
$refid = $_POST['refid'];
$query = "SELECT * FROM compundsvocabulary WHERE refid = $refid AND preferred = 'N'";
$result = $conn->query($query);
$synonyms = [];
while ($row = $result->fetch_assoc()) {
$synonyms[] = $row;
}
echo json_encode($synonyms);
@@ -0,0 +1,16 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$idanalysisvocabulary = $_POST['idanalysisvocabulary'];
$conn = new mysqli($servername, $username, $password, $database);
$query = "SELECT idanalysisvocabulary, nameanalysisvoc FROM analysisvocabulary WHERE refid = $idanalysisvocabulary AND preferred = 'N'";
$result = $conn->query($query);
$synonyms = [];
while ($row = $result->fetch_assoc()) {
$synonyms[] = $row;
}
echo json_encode($synonyms);
}
+153
View File
@@ -0,0 +1,153 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php");
$conn = new mysqli($servername, $username, $password, $database);
// Recupera il valore di idreports dalla query string
$idreports = isset($_GET['idreports']) ? $_GET['idreports'] : 0;
// Query per ottenere i dettagli del report e del prodotto associato
$queryReportDetails = "
SELECT r.*, p.products_refnumber, p.products_description, p.products_style, p.products_color
FROM reports r
LEFT JOIN products p ON r.idproducts = p.idproducts
WHERE r.idreports = ?";
$stmt = $conn->prepare($queryReportDetails);
$stmt->bind_param("i", $idreports);
$stmt->execute();
$reportDetails = $stmt->get_result()->fetch_assoc();
// Query per ottenere le parti e i risultati del report
$queryPartsAndResults = "
SELECT rp.*, a.nameanalysisvoc AS testName, av.nameanalysisvoc AS analytsName
FROM result_project rp
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
LEFT JOIN analysisvocabulary av ON rp.result_AnalytsName = av.idanalysisvocabulary
WHERE rp.idreports = ?";
$stmtParts = $conn->prepare($queryPartsAndResults);
$stmtParts->bind_param("i", $idreports);
$stmtParts->execute();
$partsAndResults = $stmtParts->get_result();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<title>Report Details</title>
<!-- Altri riferimenti al CSS e JS -->
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="../assets/css/style.css" rel="stylesheet" type="text/css">
<link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.css">
<script src="../assets/js/jquery.min.js"></script>
<link rel="stylesheet" href="../assets/plugins/select2/select2.min.css">
<script src="../assets/plugins/select2/select2.min.js"></script>
</head>
<body class="fixed-left">
<div id="wrapper">
<?php include('../include/navigationbar.php'); ?>
<div class="content-page">
<div class="content">
<?php include('../include/topbar.php'); ?>
<div class="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<h4 class="page-title">Report Details</h4>
</div>
</div>
</div>
<!-- Dati del Report e del Prodotto -->
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<h5 class="header-title pb-3 mt-0">Report: <?php echo $reportDetails['reportsNumberLab']; ?></h5>
<p><strong>Report Date:</strong> <?php echo $reportDetails['reportDateIn']; ?></p>
<p><strong>Product Ref:</strong> <?php echo $reportDetails['products_refnumber']; ?></p>
<p><strong>Product Description:</strong> <?php echo $reportDetails['products_description']; ?></p>
<p><strong>Style:</strong> <?php echo $reportDetails['products_style']; ?></p>
<p><strong>Color:</strong> <?php echo $reportDetails['products_color']; ?></p>
</div>
</div>
</div>
</div>
<!-- Tabella con Parti e Risultati -->
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<h5 class="header-title pb-3 mt-0">Parts and Results</h5>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Part Number</th>
<th>Test Name</th>
<th>Analyts Name</th>
<th>Result Value</th>
<th>Rating</th>
</tr>
</thead>
<tbody>
<?php while ($row = $partsAndResults->fetch_assoc()) { ?>
<tr>
<td><?php echo $row['partNumber']; ?></td>
<td><?php echo $row['testName']; ?></td>
<td><?php echo $row['analytsName']; ?></td>
<td><?php echo $row['result_Value']; ?></td>
<td><?php echo $row['test_Rating']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div><!-- container -->
</div><!-- Page content Wrapper -->
</div><!-- content -->
<?php include('../include/footer.php'); ?>
</div>
</div>
<!-- plugin JS -->
<script src="../assets/js/popper.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script src="../assets/js/modernizr.min.js"></script>
<script src="../assets/js/detect.js"></script>
<script src="../assets/js/fastclick.js"></script>
<script src="../assets/js/jquery.slimscroll.js"></script>
<script src="../assets/js/jquery.blockUI.js"></script>
<script src="../assets/js/waves.js"></script>
<script src="../assets/js/jquery.nicescroll.js"></script>
<script src="../assets/js/jquery.scrollTo.min.js"></script>
<script src="../assets/js/common_helper.js"></script>
<script src="../assets/plugins/chart.js/chart.min.js"></script>
<script src="../assets/pages/dashboard.js"></script>
<!-- App js -->
<script src="../assets/js/app.js"></script>
<script src="../assets/plugins/alertify/js/alertify.js"></script>
</body>
</html>
+205
View File
@@ -0,0 +1,205 @@
<?php include('../include/headscript.php'); ?>
<?php include("../class/company.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<?php include('../include/seo.php'); ?>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="../assets/css/style.css" rel="stylesheet" type="text/css">
<link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.css">
<script src="../assets/js/jquery.min.js"></script>
<link rel="stylesheet" href="../assets/plugins/select2/select2.min.css">
<script src="../assets/plugins/select2/select2.min.js"></script>
<style>
.width-100 {
width: 100%;
}
.flex_center {
display: flex;
align-items: center;
}
.mg_none {
margin: 0 !important;
}
.hidden {
display: none !important;
}
.table-custom tr {
height: 40px;
line-height: 40px;
}
#ajax_preloader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: transparent;
z-index: 9999999;
}
.table-custom td,
.table-custom th {
padding: 4px 8px;
}
.table-custom .btn {
padding: 2px 15px;
line-height: 1.7;
font-size: 14px;
}
.form-row {
display: flex;
align-items: center;
/* Questo allinea verticalmente gli elementi nella riga */
gap: 10px;
/* Questo crea una piccola distanza tra gli elementi nella riga */
}
.table-custom .form-control,
.table-custom .form-select {
height: 25px;
/* Puoi modificare questo valore per adattarlo al tuo design */
padding: 2px 6px;
/* riduce la dimensione del padding */
font-size: 14px;
/* riduce la dimensione del font */
}
.table-custom .form-control-sm.analysis-input {
height: 25px;
/* Questo modifica la dimensione degli input con classe 'form-control-sm' e 'analysis-input' */
padding: 2px 6px;
font-size: 12px;
}
.padding_none {
padding: 0 !important;
}
.select2-container--open {
z-index: 9999;
}
</style>
</head>
<body class="fixed-left">
<!-- Loader -->
<div id="preloader">
<div id="status">
<div class="spinner"></div>
</div>
</div>
<!-- Begin page -->
<div id="wrapper">
<?php include('../include/navigationbar.php'); ?>
<!-- Start right Content here -->
<div class="content-page">
<!-- Start content -->
<div class="content">
<?php include('../include/topbar.php'); ?>
<div class="page-content-wrapper ">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="btn-group float-right">
<ol class="breadcrumb hide-phone p-0 m-0">
<li class="breadcrumb-item"><a href="#">Reportify</a></li>
<li class="breadcrumb-item active">Importify</li>
</ol>
</div>
<h4 class="page-title">Importify</h4>
</div>
</div>
</div>
<!-- end page title end breadcrumb -->
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<h5 class="header-title pb-3 mt-0">Importify: <?php echo $dashboard; ?></h5>
<br><br>
<div class="table-responsive">
</div><!--end table-responsive-->
<input id="f_csv" type="file" name="f_csv" style="display: none" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/csv">
</div>
</div>
</div>
</div>
<!-- end row -->
</div><!-- container -->
</div> <!-- Page content Wrapper -->
</div> <!-- content -->
<?php include('../include/footer.php'); ?>
</div>
<!-- End Right content here -->
</div>
<!-- END wrapper -->
<!-- plugin JS -->
<script src="../assets/js/popper.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script src="../assets/js/modernizr.min.js"></script>
<script src="../assets/js/detect.js"></script>
<script src="../assets/js/fastclick.js"></script>
<script src="../assets/js/jquery.slimscroll.js"></script>
<script src="../assets/js/jquery.blockUI.js"></script>
<script src="../assets/js/waves.js"></script>
<script src="../assets/js/jquery.nicescroll.js"></script>
<script src="../assets/js/jquery.scrollTo.min.js"></script>
<script src="../assets/js/common_helper.js"></script>
<script src="../assets/plugins/chart.js/chart.min.js"></script>
<script src="../assets/pages/dashboard.js"></script>
<!-- App js -->
<script src="../assets/js/app.js"></script>
<script src="../assets/plugins/alertify/js/alertify.js"></script>
</body>
</html>