160 lines
6.1 KiB
PHP
160 lines
6.1 KiB
PHP
<?php require_once '../Connections/cmctrfdb.php'; ?>
|
|
<?php require_once '../webassist/mysqli/rsobj.php'; ?>
|
|
<?php
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', TRUE);
|
|
ini_set('display_startup_errors', TRUE);
|
|
include 'include/headscript.php';
|
|
include('languages/' . $_SESSION['langselect'] . '/tdgen.php');
|
|
?>
|
|
<?php
|
|
if (isset($_POST['submit'])) {
|
|
$description = $_POST['descriptionqualcheck']; // Assicurati che la validazione dell'input sia stata fatta
|
|
$qualchecktext = $_POST['qualchecktext']; // Testo dalla textarea
|
|
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
$sql = "INSERT INTO qualcheck_td (descriptionqualcheck, qualchecktext, idcompany) VALUES (?, ?, ?)";
|
|
$stmt = $conn->prepare($sql);
|
|
|
|
if ($stmt) {
|
|
$stmt->bind_param("ssi", $description, $qualchecktext, $idcompany);
|
|
$stmt->execute();
|
|
} else {
|
|
echo "Errore durante l'inserimento nel database.";
|
|
}
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Aggiungi Qualificazione</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">
|
|
|
|
<script src="ckeditor/build/ckeditor.js"></script>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
ClassicEditor
|
|
.create(document.querySelector('#qualcheckText'), {
|
|
toolbar: {
|
|
items: [
|
|
'undo', 'redo',
|
|
'|', 'heading',
|
|
'|', 'fontFamily', 'fontSize',
|
|
'|', 'bold', 'italic',
|
|
'|', 'link', 'blockQuote',
|
|
'|', 'alignment:left', 'alignment:right', 'alignment:center', 'alignment:justify',
|
|
'|', 'bulletedList', 'numberedList', 'outdent', 'indent',
|
|
'|', 'insertTable',
|
|
'|', 'imageUpload'
|
|
],
|
|
shouldNotGroupWhenFull: true
|
|
},
|
|
// Configurazione per l'inserimento delle tabelle
|
|
table: {
|
|
contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']
|
|
},
|
|
// Configurazione per l'upload delle immagini
|
|
simpleUpload: {
|
|
// Il URL dove le immagini caricate vengono processate
|
|
uploadUrl: 'uploadck.php',
|
|
|
|
// Abilita il caricamento automatico di immagini inserite
|
|
withCredentials: true,
|
|
|
|
// Headers aggiuntivi inviati con l'upload dell'immagine
|
|
headers: {
|
|
'X-CSRF-TOKEN': 'CSRF-Token',
|
|
Authorization: 'Bearer <JSON Web Token>'
|
|
}
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error(error);
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<style>
|
|
.ck-editor__editable_inline {
|
|
min-height: 200px;
|
|
/* Adatta questo valore in base alle tue necessità */
|
|
}
|
|
|
|
.ck-editor__editable {
|
|
resize: vertical;
|
|
overflow: auto;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container mt-5">
|
|
<button type="button" class="btn btn-secondary" onclick="closeAndRefresh()">Chiudi e Aggiorna</button>
|
|
|
|
<script>
|
|
function closeAndRefresh() {
|
|
window.opener.location.reload(); // Aggiorna la pagina genitore
|
|
window.close(); // Chiude il popup
|
|
}
|
|
</script>
|
|
<h3>Aggiungi Controllo Qualità produzione </h3>
|
|
|
|
<form action="qualcheck.php" method="post">
|
|
<div class="form-group">
|
|
<label for="descriptionQualcheck">Descrizione:</label>
|
|
<input type="text" class="form-control" id="descriptionQualcheck" name="descriptionqualcheck" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="qualcheckText">Controllo Qualità produzione:</label>
|
|
<textarea class="form-control" id="qualcheckText" name="qualchecktext" rows="5"></textarea>
|
|
</div>
|
|
|
|
|
|
<button type="submit" class="btn btn-primary" name="submit">Aggiungi</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="container mt-5">
|
|
<h3>Controllo Qualità produzione Inseriti</h3>
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Descrizione</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
$query = "SELECT idqualcheck_td, descriptionqualcheck, qualchecktext FROM qualcheck_td WHERE idcompany = ?";
|
|
$stmt = $conn->prepare($query);
|
|
$stmt->bind_param("i", $idcompany);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
while ($row = $result->fetch_assoc()) {
|
|
echo "<tr>";
|
|
echo "<td>" . htmlspecialchars($row['descriptionqualcheck']) . "</td>";
|
|
// Aggiungi una colonna con un'icona di cestino che quando cliccata invoca uno script di cancellazione
|
|
echo "<td><a href='delete_qualcheck.php?id=" . $row['idqualcheck_td'] . "' style='color: red;'><i class='fas fa-trash-alt'></i></a></td>";
|
|
echo "</tr>";
|
|
}
|
|
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
|
<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>
|
|
</body>
|
|
|
|
</html>
|