206 lines
7.9 KiB
PHP
206 lines
7.9 KiB
PHP
<?php include('include/headscript.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">
|
|
<!-- Title -->
|
|
<title> Edmate Learning Dashboard HTML Template</title>
|
|
<!-- Favicon -->
|
|
<link rel="shortcut icon" href="assets/images/logo/favicon.png">
|
|
<?php include('cssinclude.php'); ?>
|
|
<!-- DataTables CSS -->
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css">
|
|
|
|
<style>
|
|
.btn-success i {
|
|
margin-right: 5px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!--==================== Preloader Start ====================-->
|
|
<div class="preloader">
|
|
<div class="loader"></div>
|
|
</div>
|
|
<!--==================== Preloader End ====================-->
|
|
|
|
<!--==================== Sidebar Overlay End ====================-->
|
|
<div class="side-overlay"></div>
|
|
<!--==================== Sidebar Overlay End ====================-->
|
|
|
|
<!-- ============================ Sidebar Start ============================ -->
|
|
|
|
<?php include('include/navbar.php'); ?>
|
|
<!-- ============================ Sidebar End ============================ -->
|
|
|
|
<div class="dashboard-main-wrapper">
|
|
<?php include('include/topbar.php'); ?>
|
|
|
|
|
|
<div class="dashboard-body">
|
|
|
|
<div class="row gy-4">
|
|
<div class="col-lg-12">
|
|
|
|
<!-- Top Course Start -->
|
|
<div class="card mt-24">
|
|
<div class="card-body">
|
|
<div class="mb-20 flex-between flex-wrap gap-8">
|
|
<h4 class="mb-0">XLS Templates</h4>
|
|
<div class="mb-3">
|
|
<a href="insert_template_xls.php" class="btn btn-success">
|
|
<i class="fas fa-plus"></i> New Template
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row gy-4">
|
|
<div class="col-12">
|
|
<div class="table-responsive">
|
|
<table id="xlsTemplatesTable" class="table table-striped table-hover table-bordered align-middle text-nowrap">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th><?= htmlspecialchars($nametemplate, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
<th><?= htmlspecialchars($lastmodtemplate, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
<th><?= htmlspecialchars($rowheader, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
<th><?= htmlspecialchars($columnheader, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
<th><?= htmlspecialchars($desctemplate, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
<th><?= htmlspecialchars($desttable, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
<th><?= htmlspecialchars($action, ENT_QUOTES, 'UTF-8'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<!-- Top Course End -->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<?php include('include/footer.php'); ?>
|
|
</div>
|
|
|
|
<?php include('jsinclude.php'); ?>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#xlsTemplatesTable').DataTable({
|
|
processing: true,
|
|
serverSide: false, // Se il dataset è grande, puoi impostarlo su true
|
|
ajax: 'load_templates.php', // Recupera dati dal tuo PHP
|
|
columns: [{
|
|
data: 'id'
|
|
},
|
|
{
|
|
data: 'name'
|
|
},
|
|
{
|
|
data: 'updated_at',
|
|
render: function(data) {
|
|
return new Date(data).toLocaleDateString();
|
|
}
|
|
},
|
|
{
|
|
data: 'header_row'
|
|
},
|
|
{
|
|
data: 'start_column'
|
|
},
|
|
{
|
|
data: 'description',
|
|
defaultContent: 'Nessuna descrizione' // Se null, mostra un default
|
|
},
|
|
{
|
|
data: 'target_table'
|
|
},
|
|
{
|
|
data: 'id',
|
|
orderable: false,
|
|
searchable: false,
|
|
render: function(data) {
|
|
return `
|
|
<a href="edit_template_xls.php?id=${data}" class="btn btn-sm btn-primary text-white" title="Edit">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a href="mapping_template_xls.php?id=${data}" class="btn btn-sm btn-success text-white" title="Associate Columns">
|
|
<i class="fas fa-link"></i>
|
|
</a>
|
|
<button class="btn btn-sm btn-danger text-white" onclick="confirmDelete(${data})" title="Delete">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
`;
|
|
}
|
|
}
|
|
|
|
|
|
],
|
|
language: {
|
|
url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/Italian.json" // 🇮🇹 Traduzione in italiano
|
|
}
|
|
});
|
|
});
|
|
|
|
function confirmDelete(id) {
|
|
Swal.fire({
|
|
title: "Are you sure?",
|
|
text: "This action cannot be undone!",
|
|
icon: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#d33",
|
|
cancelButtonColor: "#3085d6",
|
|
confirmButtonText: "Yes, delete it!",
|
|
cancelButtonText: "Cancel"
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
// Se conferma, reindirizza alla pagina PHP per la cancellazione
|
|
window.location.href = `delete_template_xls.php?id=${id}`;
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<!-- DataTables JS -->
|
|
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
|
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
|
|
|
|
<!-- Modal di conferma per la cancellazione -->
|
|
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="deleteModalLabel">Confirm Deletion</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
Are you sure you want to delete this template?
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<a href="#" id="confirmDeleteBtn" class="btn btn-danger">Delete</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|