<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inserimento dati</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
</head>
<body onload="loadtab();loadtabFam()">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="inserimentodati.html"><b style="color:rgb(4, 243, 4);">ATK</b> <b style="color:white;">BIND</b><b style="color:red;">INGS</b></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="inserimentodati.html">Grafica Scatole</a>
</li>
<li class="nav-item">
<a class="nav-link" href="anagrafica.html">Anagrafica Prodotti</a>
</li>
</ul>
</div>
</nav>
<!--fine menu-->
<br>
<h1 style="color:red;">ANAGRAFICA PRODOTTI</h1>
<br><br>
<h2>ricerca per famiglia</h2>
<table class = "table table-sm" >
<tr>
<th>famiglia</th>
<th>descrizione</th>
</tr>
<tbody id = "tabfam">
</tbody>
<table>
<div class="form-group">
<label for="exampleInputEmail1">Ricerca Prodotto</label>
<input type="text" class="form-control w-25" id="ricerca" aria-describedby="prodotto" placeholder="Inserisci il codice articolo" onkeyup="cerca()" >
<small id="emailHelp" class="form-text text-muted">Inserendo le prime lettere verranno mostrati i risultati pertinenti alla ricerca</small>
</div>
<br>
<!--tabella-->
<table class = "table table-sm" >
<tr>
<th>codice articolo</th>
<th>gruppo merceologico</th>
<th>catomo</th>
</tr>
<tbody id = "tab">
</tbody>
</body>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2"crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <!-- intestazioni per app json , css,ajax-->
<script>
function funz() {
var bottone=document.getElementById('prova').value;
window.open('prodotto.html?testo=' + bottone, '_blank');
}
function loadtab() { //funzione che inserisci i dati nella tabella
const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {
document.getElementById("tab").innerHTML = this.responseText;
}
xmlhttp.open("GET", "pimloadtab.php");
xmlhttp.send();
}
function loadtabFam() { //funzione che inserisci i dati nella tabella
const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {
document.getElementById("tabfam").innerHTML = this.responseText;
}
xmlhttp.open("GET", "pimloadtabFam.php");
xmlhttp.send();
}
function cerca() { //funzione che permette di cercare il risultato corretto nella tabella mostrandoci quello che stiamo cercando
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("ricerca");
filter = input.value.toUpperCase();
table = document.getElementById("tab");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
</table>
</html>