added field for td and hide show identification parts

This commit is contained in:
Claudio 2025-05-21 09:54:12 +02:00
parent fa44531778
commit 449bcc3153
18 changed files with 387 additions and 114 deletions

View File

@ -246,29 +246,60 @@ while ($row = mysqli_fetch_assoc($result)) {
// Connessione al database
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Imposta la codifica UTF-8 per gestire correttamente i caratteri speciali
$conn->set_charset("utf8mb4");
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
// Query per selezionare le righe da duplicare
$query = "SELECT * FROM identificationparts WHERE idtrfdetails = '$idtrf'";
$result = mysqli_query($conn, $query);
// Ciclo attraverso i risultati e duplico le righe
while ($row = mysqli_fetch_assoc($result)) {
// Imposto il valore di idtrfdetails come 250
// Imposto il valore di idtrfdetails con il nuovo ID
$row['idtrfdetails'] = $newidtrfnumber;
// Lascio identificationparts nullo
// Lascio identificationparts nullo (sarà generato automaticamente)
unset($row['ididentificationparts']);
// Query per duplicare la riga
$columns = implode(", ", array_keys($row));
$values = "'" . implode("', '", array_values($row)) . "'";
$sql_insert = "INSERT INTO identificationparts ($columns) VALUES ($values)";
if ($conn->query($sql_insert) === TRUE) {
echo "Nuova riga inserita con successo identificationparts";
} else {
echo "Errore nell'inserimento della nuova riga: " . $conn->error;
// Controllo la lunghezza di article_identificationparts (limite 250 caratteri)
if (isset($row['article_identificationparts']) && mb_strlen($row['article_identificationparts'], 'UTF-8') > 250) {
$row['article_identificationparts'] = mb_substr($row['article_identificationparts'], 0, 250, 'UTF-8');
echo "Attenzione: article_identificationparts troncato a 250 caratteri.";
}
// Preparo la query con prepared statements
$columns = implode(", ", array_keys($row));
$placeholders = implode(", ", array_fill(0, count($row), "?"));
$sql_insert = "INSERT INTO identificationparts ($columns) VALUES ($placeholders)";
// Preparo lo statement
$stmt = $conn->prepare($sql_insert);
if ($stmt === false) {
echo "Errore nella preparazione della query: " . $conn->error;
continue;
}
// Creo un array di valori e determino i tipi per il bind
$values = array_values($row);
$types = str_repeat("s", count($values)); // Tratto tutto come stringa per semplicità, puoi ottimizzare i tipi se necessario
$stmt->bind_param($types, ...$values);
// Eseguo l'inserimento
if ($stmt->execute()) {
echo "Nuova riga inserita con successo in identificationparts";
} else {
echo "Errore nell'inserimento della nuova riga in identificationparts: " . $stmt->error;
}
// Chiudo lo statement
$stmt->close();
}
// Chiudo la connessione
$conn->close();
?>
<?php

View File

@ -1,30 +1,55 @@
<?php
require_once '../Connections/cmctrfdb.php'; // Assumi che questo sia il tuo file di configurazione del database
require_once '../Connections/cmctrfdb.php';
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$id = $_GET['id'];
// Verifica se l'ID e idcompany sono presenti
if (isset($_GET['id']) && is_numeric($_GET['id']) && isset($_GET['idcompany']) && is_numeric($_GET['idcompany'])) {
$id = intval($_GET['id']);
$idcompany = intval($_GET['idcompany']);
$conn = new mysqli($servername, $username, $password, $dbname);
// Recupera il nome del file prima di cancellare il record
$query = "SELECT filenamelogo FROM logo_td WHERE idlogo_td = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {
$fileToDelete = "logos/" . $row['filenamelogo'];
// Cancellazione del file dal server
if (file_exists($fileToDelete)) {
unlink($fileToDelete);
}
if ($conn->connect_error) {
die("Connessione al database fallita: " . $conn->connect_error);
}
// Cancellazione del record dal database
$query = "DELETE FROM logo_td WHERE idlogo_td = ?";
// Recupera il nome del file per eliminarlo
$query = "SELECT filenamelogo FROM logo_td WHERE idlogo_td = ? AND idcompany = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $id);
$stmt->bind_param("ii", $id, $idcompany);
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {
$filePath = 'logos/' . $row['filenamelogo'];
if (file_exists($filePath)) {
unlink($filePath); // Elimina il file fisico
}
} else {
echo "Errore: logo non trovato o non autorizzato.";
$stmt->close();
$conn->close();
exit;
}
$stmt->close();
// Esegui la cancellazione dal database
$query = "DELETE FROM logo_td WHERE idlogo_td = ? AND idcompany = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("ii", $id, $idcompany);
$stmt->execute();
header("Location: logoPopup.php"); // Reindirizza indietro alla pagina dei loghi
if ($stmt->affected_rows > 0) {
// Cancellazione riuscita
} else {
echo "Errore durante la cancellazione del logo.";
}
$stmt->close();
$conn->close();
// Reindirizza indietro con idcompany
header("Location: logopopup.php?idcompany=$idcompany");
exit;
} else {
echo "Operazione non valida.";
echo "Errore: parametri mancanti o non validi.";
exit;
}

View File

@ -129,6 +129,7 @@ if ($addpart == "Y") {
$InsertQuery->bindColumn("arttypeid", "i", "$arttypeid", "WA_DEFAULT");
$InsertQuery->bindColumn("useridn", "i", "$useridn", "WA_DEFAULT");
$InsertQuery->bindColumn("companyidn", "i", "$companyidn", "WA_DEFAULT");
$InsertQuery->bindColumn("hide", "s", "N", "WA_DEFAULT"); // Imposta hide a 'N' per default
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
@ -304,15 +305,24 @@ $partids[] = '0';
} ?>
<!-- div new parts -->
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationServer01"><?php echo $whichkindofpart; ?></label>
<select class="form-control" name="kindoftest" id="combo">
<option value="new"><?php echo $newpartlist; ?></option>
<option value="cmc"><?php echo $cmctesttitle; ?></option>
<option value="trd"><?php echo $trdpartlist; ?></option>
</select>
<div class="col-md-8 mb-3 d-flex align-items-end">
<div class="mr-4" style="min-width: 200px;">
<label for="validationServer01"><?php echo $whichkindofpart; ?></label>
<select class="form-control" name="kindoftest" id="combo">
<option value="new"><?php echo $newpartlist; ?></option>
<option value="cmc"><?php echo $cmctesttitle; ?></option>
<option value="trd"><?php echo $trdpartlist; ?></option>
</select>
</div>
<div class="d-flex align-items-center">
<label for="showHiddenParts" class="mb-0 mr-2">
Mostra parti nascoste ricerca / Show SearchHidden Parts
</label>
<input type="checkbox" id="showHiddenParts" name="showHiddenParts">
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationServer01"><?php echo $reportnumbercmctitle; ?></label>

View File

@ -55,3 +55,5 @@ $nrep = "Report No.";
$daterep = "Date";
$toreview = "Send for Review";
$toreviewhelp = "The Technical File will be sent to Cimac for document review";
$techapplied = "Any technical specifications applied (other than harmonised standards)";
$corrtdcertified = "Matching with already certified PPE";

View File

@ -55,3 +55,5 @@ $nrep = "N. Rapporto";
$daterep = "Date";
$toreview = "Invia in Revisione";
$toreviewhelp = "Il Fascicolo tecnico verrà inviato a Cimac per la revisione documentale";
$techapplied = "Eventuali specifiche tecniche applicate (diverse dalle norme armonizzate)";
$corrtdcertified = "Corrispondenza DPI già certificati:";

View File

@ -6,47 +6,52 @@ ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
include 'include/headscript.php';
include('languages/' . $_SESSION['langselect'] . '/tdgen.php');
?>
<?php
// Controlla se il form è stato inviato
// Recupera idcompany
if (isset($_POST['idcompany'])) {
$idcompany = intval($_POST['idcompany']);
} elseif (isset($_GET['idcompany'])) {
$idcompany = intval($_GET['idcompany']);
} else {
die("Errore: idcompany non specificato.");
}
// Gestione del submit (solo INSERT)
if (isset($_POST['submit'])) {
$description = $_POST['descriptionlogo']; // Assumi che la validazione dell'input sia già stata fatta
$targetDir = "logos/"; // Assicurati che questa directory esista e sia scrivibile
$description = $_POST['descriptionlogo'];
$targetDir = "logos/";
$file = $_FILES['logofile'];
$fileName = $file['name'];
$fileTmpName = $file['tmp_name'];
$fileError = $file['error'];
$fileExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
// Estrai l'estensione del file
$exploded = explode('.', $fileName);
$fileExt = strtolower(end($exploded));
// Controlla se non ci sono errori e se il file è un PNG o JPG
if ($fileError === 0 && ($fileExt === 'png' || $fileExt === 'jpg' || $fileExt === 'jpeg')) {
$newFileName = $idcompany . "_" . time() . "." . $fileExt; // Rinomina il file
if ($fileError === 0 && in_array($fileExt, ['png', 'jpg', 'jpeg'])) {
$newFileName = $idcompany . "_" . time() . "." . $fileExt;
$fileDestination = $targetDir . $newFileName;
$conn = new mysqli($servername, $username, $password, $dbname);
// Sposta il file nella directory definitiva
if (move_uploaded_file($fileTmpName, $fileDestination)) {
// Qui esegui l'inserimento nel database
$sql = "INSERT INTO logo_td (descriptionlogo, filenamelogo, idcompany) VALUES (?, ?, ?)";
$stmt = $conn->prepare($sql);
if ($stmt) {
$stmt->bind_param("ssi", $description, $newFileName, $idcompany);
$stmt->execute();
$stmt->close();
} else {
echo "Errore durante l'inserimento nel database.";
}
} else {
echo "C'è stato un errore nel caricamento del file.";
echo "Errore nel caricamento del file.";
}
$conn->close();
} else {
echo "Sono ammessi solo file PNG e JPG.";
}
// Reindirizza per evitare reinvii
header("Location: logopopup.php?idcompany=$idcompany");
exit();
}
?>
@ -59,7 +64,6 @@ if (isset($_POST['submit'])) {
<title>Aggiungi Logo</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
<style>
.drag-area {
border: 2px dashed #ccc;
@ -85,24 +89,25 @@ if (isset($_POST['submit'])) {
<body>
<div class="container mt-5">
<button onclick="closeAndRefresh()">Chiudi e Aggiorna</button>
<h3 style="display: inline-block;">Aggiungi Logo</h3>
<button type="button" class="btn btn-secondary" onclick="closeAndRefresh()">Chiudi e Aggiorna</button>
<h3>Aggiungi Logo</h3>
<form id="uploadLogoForm" action="logopopup.php" method="post" enctype="multipart/form-data">
<form id="uploadLogoForm" action="logopopup.php?idcompany=<?php echo $idcompany; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="idcompany" value="<?php echo $idcompany; ?>">
<div class="form-group">
<label for="logoDescription">Descrizione Logo:</label>
<input type="text" class="form-control" id="logoDescription" name="descriptionlogo" required>
</div>
<div class="drag-area" id="drag-area">
<p>Trascina qui il file o clicca per selezionare</p>
<div class="form-group">
<label for="logoFile">File Logo:</label>
<div class="drag-area" id="drag-area">
<p>Trascina qui il file o clicca per selezionare</p>
</div>
<div class="custom-file mb-3">
<input type="file" class="custom-file-input" id="logoFile" name="logofile" accept=".png,.jpg,.jpeg" required>
<label class="custom-file-label" for="logoFile">Scegli file</label>
</div>
</div>
<div class="custom-file mb-3">
<input type="file" class="custom-file-input" id="logoFile" name="logofile" accept=".png, .jpg, .jpeg" required hidden>
<label class="custom-file-label" for="logoFile">Scegli file</label>
</div>
<button type="submit" class="btn btn-primary" name="submit">Carica Logo</button>
</form>
</div>
@ -121,7 +126,7 @@ if (isset($_POST['submit'])) {
$conn = new mysqli($servername, $username, $password, $dbname);
$query = "SELECT idlogo_td, descriptionlogo, filenamelogo FROM logo_td WHERE idcompany = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $idcompany); // Assumi che $idcompany sia già definita e pulita
$stmt->bind_param("i", $idcompany);
$stmt->execute();
$result = $stmt->get_result();
@ -129,9 +134,13 @@ if (isset($_POST['submit'])) {
echo "<tr>";
echo "<td>" . htmlspecialchars($row['descriptionlogo']) . "</td>";
echo "<td><img src='logos/" . htmlspecialchars($row['filenamelogo']) . "' alt='Logo' style='width: 50px;'></td>";
echo "<td><a href='deleteLogo.php?id=" . $row['idlogo_td'] . "' onclick='return confirm(\"Sei sicuro di voler cancellare questo logo?\");'><i class='fas fa-trash-alt' style='color: red;'></i></a></td>";
echo "<td>";
echo "<a href='deletelogo.php?id=" . $row['idlogo_td'] . "&idcompany=$idcompany' onclick='return confirm(\"Sei sicuro di voler cancellare questo logo?\");'><i class='fas fa-trash-alt' style='color: red;'></i></a>";
echo "</td>";
echo "</tr>";
}
$stmt->close();
$conn->close();
?>
</tbody>
</table>
@ -141,7 +150,6 @@ if (isset($_POST['submit'])) {
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
// Mostra il nome del file nel campo custom file di Bootstrap quando selezionato
$(".custom-file-input").on("change", function() {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
@ -150,7 +158,6 @@ if (isset($_POST['submit'])) {
var dragArea = document.getElementById('drag-area');
var input = document.getElementById('logoFile');
// Highlight drag area
['dragenter', 'dragover'].forEach(eventName => {
dragArea.addEventListener(eventName, (e) => {
preventDefaults(e);
@ -158,7 +165,6 @@ if (isset($_POST['submit'])) {
}, false);
});
// Unhighlight drag area
['dragleave', 'drop'].forEach(eventName => {
dragArea.addEventListener(eventName, (e) => {
preventDefaults(e);
@ -166,7 +172,6 @@ if (isset($_POST['submit'])) {
}, false);
});
// Handle drop
dragArea.addEventListener('drop', (e) => {
preventDefaults(e);
let dt = e.dataTransfer;
@ -180,10 +185,8 @@ if (isset($_POST['submit'])) {
e.stopPropagation();
}
// Click on drag area to open file dialog
dragArea.addEventListener('click', () => input.click());
</script>
<script>
function closeAndRefresh() {
if (window.opener && !window.opener.closed) {
window.opener.updateSelectDropdown();
@ -191,7 +194,6 @@ if (isset($_POST['submit'])) {
window.close();
}
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -12,6 +12,8 @@ $idcompany = $_SESSION["compid"];
if (isset($_POST['articlepartvalue'])) {
// Recupera e decodifica il valore inviato
$Name = urldecode($_POST['articlepartvalue']);
// Verifica se l'utente vuole mostrare le parti nascoste
$showHidden = isset($_POST['showHidden']) && $_POST['showHidden'] === 'true' ? true : false;
// Prepara la query con prepared statement
$Query = "SELECT
@ -29,6 +31,7 @@ if (isset($_POST['articlepartvalue'])) {
MAX(identificationparts.kindoftest) AS kindoftest,
MAX(identificationparts.partsidnumber) AS partsidnumber,
MAX(identificationparts.arttypeid) AS arttypeid,
MAX(identificationparts.hide) AS hide,
MAX(`trf-details`.idtrfdetails) AS idtrfdetails,
`trf-details`.idcompany
FROM
@ -40,11 +43,12 @@ if (isset($_POST['articlepartvalue'])) {
WHERE
identificationparts.article_identificationparts LIKE ?
AND `trf-details`.idcompany = ?
" . ($showHidden ? "" : "AND identificationparts.hide = 'N'") . "
GROUP BY
identificationparts.article_identificationparts,
identificationparts.description_identificationparts,
identificationparts.material_identificationparts
LIMIT 15";
LIMIT 30";
// Prepara lo statement
$stmt = $conn->prepare($Query);
@ -72,19 +76,19 @@ if (isset($_POST['articlepartvalue'])) {
// Alterna il colore di sfondo
$bgcolor = ($bgcolor == "#f2f2f2") ? "#e6f7ff" : "#f2f2f2";
?>
<li onclick='fill(
<?php echo json_encode($Result['article_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['material_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['color_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['description_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['partsidnumber'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['arttypeid'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['cmcreportnumber_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['cmcreportdate_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['reportof'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['kindoftest'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>
)' style="cursor: pointer; background-color: <?php echo $bgcolor; ?>; border: 1px solid #ccc; border-radius: 5px; padding: 10px; margin-bottom: 5px;">
<span style="text-decoration: none; color: #333;">
<li style="cursor: pointer; background-color: <?php echo $bgcolor; ?>; border: 1px solid #ccc; border-radius: 5px; padding: 10px; margin-bottom: 5px; position: relative;">
<span onclick='fill(
<?php echo json_encode($Result['article_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['material_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['color_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['description_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['partsidnumber'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['arttypeid'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['cmcreportnumber_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['cmcreportdate_identificationparts'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['reportof'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>,
<?php echo json_encode($Result['kindoftest'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>
)' style="text-decoration: none; color: #333; display: block;">
<?php echo htmlspecialchars($Result['article_identificationparts'], ENT_QUOTES, 'UTF-8'); ?> -
<?php echo htmlspecialchars($Result['material_identificationparts'], ENT_QUOTES, 'UTF-8'); ?> -
<?php echo htmlspecialchars($Result['color_identificationparts'], ENT_QUOTES, 'UTF-8'); ?> -
@ -96,6 +100,10 @@ if (isset($_POST['articlepartvalue'])) {
- Date: <?php echo htmlspecialchars($Result['cmcreportdate_identificationparts'], ENT_QUOTES, 'UTF-8'); ?>
<?php } ?>
</span>
<button id="toggle-btn-<?php echo $Result['id']; ?>" onclick="toggleHide(<?php echo $Result['id']; ?>, '<?php echo $Result['hide'] === 'N' ? 'Y' : 'N'; ?>', this)"
style="position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 2px 5px; border: none; background: none; cursor: pointer;">
<i class="fas <?php echo $Result['hide'] === 'N' ? 'fa-eye' : 'fa-eye-slash'; ?>" style="color: <?php echo $Result['hide'] === 'N' ? 'green' : 'red'; ?>;"></i>
</button>
</li>
<?php
}
@ -104,3 +112,4 @@ if (isset($_POST['articlepartvalue'])) {
// Chiudi lo statement e la connessione
$stmt->close();
}
?>

View File

@ -11,7 +11,6 @@ function fill(
reportof,
kindtest
) {
//Assigning values to corresponding input fields in "search.php" file.
$('#articlepartvalue').val(article)
$('#materialpartvalue').val(material)
$('#colorvalue').val(color)
@ -22,29 +21,56 @@ function fill(
$('#cmcdatereport').val(cmcreportdate)
$('#reportof').val(reportof)
$('#combo').val(kindtest).change()
//Hiding "display" div in "search.php" file.
$('#display').hide()
}
function toggleHide(id, newHide, button) {
// Cambia l'icona e il colore immediatamente
const $button = $(button)
const $icon = $button.find('i')
$icon
.removeClass('fa-eye fa-eye-slash')
.addClass(newHide === 'Y' ? 'fa-eye-slash' : 'fa-eye')
.css('color', newHide === 'Y' ? 'red' : 'green') // Cambia il colore
$.ajax({
type: 'POST',
url: 'searchengine/togglehide.php',
data: {
ididentificationparts: id,
hide: newHide,
},
success: function (response) {
// Aggiorna la ricerca per riflettere il cambiamento
performSearch()
},
error: function (xhr, status, error) {
console.log('Errore AJAX: ' + status + ' - ' + error)
// Ripristina l'icona e il colore originale in caso di errore
$icon
.removeClass('fa-eye fa-eye-slash')
.addClass(newHide === 'Y' ? 'fa-eye' : 'fa-eye-slash')
.css('color', newHide === 'Y' ? 'green' : 'red')
$('#display').html("Errore durante l'aggiornamento. Riprova.")
},
})
}
$(document).ready(function () {
//On pressing a key on "Search box" in "search.php" file. This function will be called.
$('#articlepartvalue').keyup(function () {
//Assigning search box value to javascript variable named as "name".
// Funzione per eseguire la ricerca
function performSearch() {
var name = $('#articlepartvalue').val()
//Validating, if "name" is empty.
var showHidden = $('#showHiddenParts').is(':checked')
if (name == '') {
//Assigning empty value to "display" div in "search.php" file.
$('#display').html('')
}
//If name is not empty.
else {
//AJAX is called.
} else {
$.ajax({
type: 'POST',
url: 'searchengine/ajaxsearch.php',
data: {
articlepartvalue: encodeURIComponent(name), // Codifica il valore
articlepartvalue: encodeURIComponent(name),
showHidden: showHidden,
},
success: function (html) {
$('#display').html(html).show()
@ -55,5 +81,15 @@ $(document).ready(function () {
},
})
}
}
// Esegui la ricerca quando l'utente digita nel campo
$('#articlepartvalue').keyup(function () {
performSearch()
})
// Esegui la ricerca quando l'utente cambia il checkbox
$('#showHiddenParts').change(function () {
performSearch()
})
})

View File

@ -0,0 +1,25 @@
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
include "../db.php";
if (isset($_POST['ididentificationparts']) && isset($_POST['hide'])) {
$ididentificationparts = $_POST['ididentificationparts'];
$newHide = $_POST['hide'];
$stmt = $conn->prepare("UPDATE identificationparts SET hide = ? WHERE ididentificationparts = ?");
$stmt->bind_param("si", $newHide, $ididentificationparts);
if ($stmt->execute()) {
echo "Stato aggiornato con successo";
} else {
echo "Errore: " . $stmt->error;
}
$stmt->close();
$conn->close();
} else {
echo "Parametri mancanti";
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -488,9 +488,12 @@ $conn->close();
<input type="text" class="form-control data-field" placeholder="<?php echo $obsoldate; ?>" data-column="obsolescencedeadline" id="obsolescencedeadline" required name="obsolescencedeadline" value="<?php echo isset($rowtd['obsolescencedeadline']) ? htmlspecialchars($rowtd['obsolescencedeadline'], ENT_QUOTES, 'UTF-8') : ''; ?>">
<br>
<label class="my-3"><?php echo $techapplied; ?></label>
<input type="text" class="form-control data-field" placeholder="<?php echo $techapplied; ?>" data-column="techspecificationapplied" id="techspecificationapplied" required name="techspecificationapplied" value="<?php echo isset($rowtd['techspecificationapplied']) ? htmlspecialchars($rowtd['techspecificationapplied'], ENT_QUOTES, 'UTF-8') : ''; ?>">
<br>
<label class="my-3">Corrispondenza DPI già certificati:</label>
<input type="text" class="form-control data-field" placeholder="Corrispondenza DPI già certificati:" data-column="dpialreadycerttificate" id="dpialreadycerttificate" name="dpialreadycerttificate" value="<?php echo isset($rowtd['dpialreadycerttificate']) ? htmlspecialchars($rowtd['dpialreadycerttificate'], ENT_QUOTES, 'UTF-8') : ''; ?>">
<label class="my-3"><?php echo $corrtdcertified; ?></label>
<input type="text" class="form-control data-field" placeholder="<?php echo $corrtdcertified; ?>" data-column="dpialreadycerttificate" id="dpialreadycerttificate" name="dpialreadycerttificate" value="<?php echo isset($rowtd['dpialreadycerttificate']) ? htmlspecialchars($rowtd['dpialreadycerttificate'], ENT_QUOTES, 'UTF-8') : ''; ?>">
@ -992,7 +995,8 @@ $conn->close();
</script>
<script>
function openPopup() {
var popupUrl = 'logopopup.php'; // Sostituisci con il percorso della tua pagina per l'aggiunta dei loghi
var idcompany = '<?php echo $idcompany; ?>';
var popupUrl = 'logopopup.php?idcompany=' + encodeURIComponent(idcompany);
var popupWidth = 800;
var popupHeight = 700;
var popupLeft = (screen.width - popupWidth) / 2;

View File

@ -48,11 +48,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Lista dei campi da sanificare e controllare se sono piene
$fields = [
'productionplace_same', 'classificationshoes', 'destinationuseppe',
'manufacutringprocess', 'ppeageing', 'obsolescencedeadline',
'localisationppemarking', 'manufacturerlogoid', 'sizeexamplecemark',
'monthyearprod', 'serialbatchnumber', 'standarduse', 'symbolsaddreq',
'proddescription', 'packaging', 'declarconformity', 'webaddress'
'productionplace_same',
'classificationshoes',
'destinationuseppe',
'manufacutringprocess',
'ppeageing',
'obsolescencedeadline',
'localisationppemarking',
'manufacturerlogoid',
'sizeexamplecemark',
'monthyearprod',
'serialbatchnumber',
'standarduse',
'symbolsaddreq',
'proddescription',
'packaging',
'declarconformity',
'webaddress',
'techspecificationapplied'
];
foreach ($fields as $field) {
@ -201,6 +214,13 @@ $virusprot = $tdquery->getColumnVal("virusprotection");
$idarttype = $tdquery->getColumnVal("idarticletype");
$slippingtext = $tdquery->getColumnVal("slipping") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("slipping") === '' ? 'No' : $tdquery->getColumnVal("slipping"));
$autoclavabletext = $tdquery->getColumnVal("autoclavable") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("autoclavable") === '' ? 'No' : $tdquery->getColumnVal("autoclavable"));
$ukcatext = $tdquery->getColumnVal("ukca") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("ukca") === '' ? 'No' : $tdquery->getColumnVal("ukca"));
$esdtext = $tdquery->getColumnVal("esd") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("esd") === '' ? 'No' : $tdquery->getColumnVal("esd"));
$shoesorthopedictext = $tdquery->getColumnVal("shoesorthopedic") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("shoesorthopedic") === '' ? 'No' : $tdquery->getColumnVal("shoesorthopedic"));
$shoesorthopedicmodtext = $tdquery->getColumnVal("shoesorthopedicmod") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("shoesorthopedicmod") === '' ? 'No' : $tdquery->getColumnVal("shoesorthopedicmod"));
$conn = new mysqli($servername, $username, $password, $dbname);
@ -562,6 +582,7 @@ $destppe = $row['destinationuseppe'];
$manprocess = $row['manufacutringprocess'];
$ppeage = $row['ppeageing'];
$obsol = $row['obsolescencedeadline'];
$techspec = $row['techspecificationapplied'];
if ($ppeage == 'Y') {
$ppeagetext = 'Sì';
} else {
@ -612,11 +633,20 @@ $html .= <<<HTML
<td class="first-column">DPI soggetto ad invecchiamento</td>
<td class="header-data">{$ppeagetext}</td>
</tr>
<tr>
<td class="first-column">{$obsoldate}</td>
<td class="header-data">{$obsol}</td>
</tr>
<tr>
<td class="first-column">{$techapplied}</td>
<td class="header-data">{$techspec}</td>
</tr>
</tbody>
</table>
HTML;
// dpi standard
$html .= '<table>
@ -637,6 +667,47 @@ while ($rowstd = $resultstd->fetch_assoc()) {
};
$html .= '</tbody></table>';
//other info
if ($idarttype == 1) {
$html .= <<<HTML
<table>
<thead>
<tr>
<th colspan="2">Altre informazioni</th>
</tr>
</thead>
<tbody>
<tr>
<td class="first-column">Resistenza allo scivolamento</td>
<td class="header-data" style="width: 50%;">{$slippingtext}</td>
</tr>
<tr>
<td class="first-column">Autoclavabile</td>
<td class="header-data">{$autoclavabletext}</td>
</tr>
<tr>
<td class="first-column">Certificazione UKCA</td>
<td class="header-data">{$ukcatext}</td>
</tr>
<tr>
<td class="first-column">Calzature con plantari personalizzati (DGUV)</td>
<td class="header-data">{$shoesorthopedictext}</td>
</tr>
<tr>
<td class="first-column">Calzature modificate con rialzi o inserti nel fondo (DGUV)</td>
<td class="header-data">{$shoesorthopedicmodtext}</td>
</tr>
<tr>
<td class="first-column">Calzature ESD</td>
<td class="header-data">{$esdtext}</td>
</tr>
</tbody>
</table>
HTML;
}
// Add prot category
$html .= '<table>

View File

@ -67,7 +67,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
'proddescription',
'packaging',
'declarconformity',
'webaddress'
'webaddress',
'techspecificationapplied'
];
foreach ($fields as $field) {
@ -216,6 +217,13 @@ $phototwo = $tdquery->getColumnVal("phototwo");
$virusprot = $tdquery->getColumnVal("virusprotection");
$idarttype = $tdquery->getColumnVal("idarticletype");
$slippingtext = $tdquery->getColumnVal("slipping") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("slipping") === '' ? 'No' : $tdquery->getColumnVal("slipping"));
$autoclavabletext = $tdquery->getColumnVal("autoclavable") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("autoclavable") === '' ? 'No' : $tdquery->getColumnVal("autoclavable"));
$ukcatext = $tdquery->getColumnVal("ukca") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("ukca") === '' ? 'No' : $tdquery->getColumnVal("ukca"));
$esdtext = $tdquery->getColumnVal("esd") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("esd") === '' ? 'No' : $tdquery->getColumnVal("esd"));
$shoesorthopedictext = $tdquery->getColumnVal("shoesorthopedic") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("shoesorthopedic") === '' ? 'No' : $tdquery->getColumnVal("shoesorthopedic"));
$shoesorthopedicmodtext = $tdquery->getColumnVal("shoesorthopedicmod") === 'Y' ? 'Sì' : ($tdquery->getColumnVal("shoesorthopedicmod") === '' ? 'No' : $tdquery->getColumnVal("shoesorthopedicmod"));
$conn = new mysqli($servername, $username, $password, $dbname);
@ -586,6 +594,7 @@ $destppe = $row['destinationuseppe'];
$manprocess = $row['manufacutringprocess'];
$ppeage = $row['ppeageing'];
$obsol = $row['obsolescencedeadline'];
$techspec = $row['techspecificationapplied'];
if ($ppeage == 'Y') {
$ppeagetext = 'Sì';
} else {
@ -636,6 +645,14 @@ $html .= <<<HTML
<td class="first-column">DPI soggetto ad invecchiamento</td>
<td class="header-data">{$ppeagetext}</td>
</tr>
<tr>
<td class="first-column">Data di obsolescenza (anni)</td>
<td class="header-data">{$obsol}</td>
</tr>
<tr>
<td class="first-column">{$techapplied}</td>
<td class="header-data">{$techspec}</td>
</tr>
</tbody>
</table>
HTML;
@ -661,6 +678,45 @@ while ($rowstd = $resultstd->fetch_assoc()) {
};
$html .= '</tbody></table>';
if ($idarttype == 1) {
$html .= <<<HTML
<table>
<thead>
<tr>
<th colspan="2">Altre informazioni</th>
</tr>
</thead>
<tbody>
<tr>
<td class="first-column">Resistenza allo scivolamento</td>
<td class="header-data" style="width: 50%;">{$slippingtext}</td>
</tr>
<tr>
<td class="first-column">Autoclavabile</td>
<td class="header-data">{$autoclavabletext}</td>
</tr>
<tr>
<td class="first-column">Certificazione UKCA</td>
<td class="header-data">{$ukcatext}</td>
</tr>
<tr>
<td class="first-column">Calzature con plantari personalizzati (DGUV)</td>
<td class="header-data">{$shoesorthopedictext}</td>
</tr>
<tr>
<td class="first-column">Calzature modificate con rialzi o inserti nel fondo (DGUV)</td>
<td class="header-data">{$shoesorthopedicmodtext}</td>
</tr>
<tr>
<td class="first-column">Calzature ESD</td>
<td class="header-data">{$esdtext}</td>
</tr>
</tbody>
</table>
HTML;
}
// Add prot category
$html .= '<table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.