api change dahsboard
This commit is contained in:
@@ -56,6 +56,56 @@
|
||||
input:checked+.slider:before {
|
||||
transform: translateX(14px);
|
||||
}
|
||||
|
||||
.badge-source {
|
||||
font-size: 11px;
|
||||
padding: 0.30rem 0.55rem;
|
||||
border-radius: 999px;
|
||||
font-weight: 600;
|
||||
display: inline-block;
|
||||
min-width: 50px;
|
||||
text-align: center;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.badge-source-xls {
|
||||
background-color: #e7f1ff;
|
||||
color: #0d6efd;
|
||||
}
|
||||
|
||||
.badge-source-api {
|
||||
background-color: #e8fff1;
|
||||
color: #198754;
|
||||
}
|
||||
|
||||
#xlsTemplatesTable {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#xlsTemplatesTable th,
|
||||
#xlsTemplatesTable td {
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#xlsTemplatesTable td.description-cell,
|
||||
#xlsTemplatesTable td.client-cell,
|
||||
#xlsTemplatesTable td.name-cell,
|
||||
#xlsTemplatesTable td.button-cell {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.table-actions .btn {
|
||||
padding: 0.25rem 0.45rem;
|
||||
}
|
||||
|
||||
.compact-card .card-body {
|
||||
padding: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -65,18 +115,20 @@
|
||||
<!--sidebar wrapper -->
|
||||
<?php include('include/navbar.php'); ?>
|
||||
<!--end sidebar wrapper -->
|
||||
|
||||
<!--start header -->
|
||||
<?php include('include/topbar.php'); ?>
|
||||
<!--end header -->
|
||||
|
||||
<!--start page wrapper -->
|
||||
<div class="page-wrapper">
|
||||
<div class="page-content">
|
||||
<?php include('top_stat_widget.php'); ?>
|
||||
|
||||
<div class="card radius-10">
|
||||
<div class="card radius-10 compact-card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<h6 class="mb-0">XLS Templates Dashboard</h6>
|
||||
<h6 class="mb-0">Templates Dashboard</h6>
|
||||
<a href="insert_template_xls.php" class="btn btn-success ms-auto">
|
||||
<i class="fas fa-plus"></i> New Template
|
||||
</a>
|
||||
@@ -85,22 +137,22 @@
|
||||
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="xlsTemplatesTable" class="table table-striped table-bordered">
|
||||
<table id="xlsTemplatesTable" class="table table-striped table-bordered table-sm w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th><?= htmlspecialchars($nametemplate, 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>Client Name</th>
|
||||
<th>Button Label</th>
|
||||
<th>Status</th> <!-- Aggiunta colonna Status -->
|
||||
<th><?= htmlspecialchars($action, ENT_QUOTES, 'UTF-8'); ?></th>
|
||||
<th><?= htmlspecialchars($nametemplate, ENT_QUOTES, 'UTF-8'); ?></th>
|
||||
<th>Type</th>
|
||||
<th>Row</th>
|
||||
<th>Col</th>
|
||||
<th><?= htmlspecialchars($desctemplate, ENT_QUOTES, 'UTF-8'); ?></th>
|
||||
<th>Client</th>
|
||||
<th>Button</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- DataTables riempirà questa sezione automaticamente -->
|
||||
<!-- DataTables will populate this section automatically -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -110,25 +162,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<!--end page wrapper -->
|
||||
|
||||
<!--start overlay-->
|
||||
<div class="overlay toggle-icon"></div>
|
||||
<!--end overlay-->
|
||||
|
||||
<!--Start Back To Top Button-->
|
||||
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
||||
<!--End Back To Top Button-->
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!--end wrapper-->
|
||||
|
||||
<!-- search modal -->
|
||||
<?php //include('include/searchmodal.php');
|
||||
?>
|
||||
<!-- end search modal -->
|
||||
|
||||
<!--start switcher-->
|
||||
<?php //include('include/themeswitcher.php');
|
||||
?>
|
||||
<!--end switcher-->
|
||||
<?php include('jsinclude.php'); ?>
|
||||
<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>
|
||||
@@ -139,47 +185,92 @@
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
ajax: 'load_templates.php',
|
||||
pageLength: 50,
|
||||
autoWidth: false,
|
||||
columns: [{
|
||||
data: 'id', // ID del template
|
||||
title: "ID"
|
||||
},
|
||||
{
|
||||
data: 'name', // Nome del template
|
||||
title: "Template Name"
|
||||
},
|
||||
|
||||
{
|
||||
data: 'header_row', // Riga degli header
|
||||
title: "Header Row"
|
||||
},
|
||||
{
|
||||
data: 'start_column', // Colonna di partenza
|
||||
title: "Start Column"
|
||||
},
|
||||
{
|
||||
data: 'description', // Descrizione del template
|
||||
title: "Description",
|
||||
defaultContent: 'No description'
|
||||
},
|
||||
{
|
||||
data: null, // Nuova colonna per Client Name e ID
|
||||
title: "Client Name",
|
||||
data: 'id',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
title: "Actions",
|
||||
className: "table-actions text-center",
|
||||
render: function(data, type, row) {
|
||||
const clientName = row.clientname || "No client";
|
||||
const clientId = row.idclient || "N/A";
|
||||
return `${clientName} (ID: ${clientId})`;
|
||||
return `
|
||||
<div class="d-flex justify-content-center gap-1">
|
||||
<a href="edit_template_xls.php?id=${data}" class="btn btn-sm btn-primary" title="Edit">
|
||||
<i class="bx bx-edit-alt"></i>
|
||||
</a>
|
||||
<a href="mapping_template_xls_scheme2.php?id=${data}" class="btn btn-sm btn-success" title="Mapping">
|
||||
<i class="bx bx-link-alt"></i>
|
||||
</a>
|
||||
<button class="btn btn-sm btn-danger" onclick="confirmDelete(${data})" title="Delete">
|
||||
<i class="bx bx-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'button_label', // Nuova colonna per Button Label
|
||||
title: "Button Label",
|
||||
data: 'name',
|
||||
title: "Template Name",
|
||||
className: "name-cell"
|
||||
},
|
||||
{
|
||||
data: 'source_type',
|
||||
title: "Type",
|
||||
className: "text-center",
|
||||
render: function(data, type, row) {
|
||||
const sourceType = (data || 'XLS').toUpperCase();
|
||||
|
||||
if (type === 'display') {
|
||||
if (sourceType === 'API') {
|
||||
return '<span class="badge-source badge-source-api">API</span>';
|
||||
}
|
||||
return '<span class="badge-source badge-source-xls">XLS</span>';
|
||||
}
|
||||
|
||||
return sourceType;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'header_row',
|
||||
title: "Row",
|
||||
className: "text-center",
|
||||
defaultContent: ''
|
||||
},
|
||||
{
|
||||
data: 'start_column',
|
||||
title: "Col",
|
||||
className: "text-center",
|
||||
defaultContent: ''
|
||||
},
|
||||
{
|
||||
data: 'description',
|
||||
title: "Description",
|
||||
className: "description-cell",
|
||||
defaultContent: 'No description'
|
||||
},
|
||||
{
|
||||
data: null,
|
||||
title: "Client",
|
||||
className: "client-cell",
|
||||
render: function(data, type, row) {
|
||||
const clientName = row.clientname || "No client";
|
||||
const clientId = row.idclient || "N/A";
|
||||
return `${clientName} <small class="text-muted">(ID: ${clientId})</small>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'button_label',
|
||||
title: "Button",
|
||||
className: "button-cell",
|
||||
defaultContent: 'Click Me'
|
||||
},
|
||||
{
|
||||
data: 'status', // Stato con Toggle Switch
|
||||
data: 'status',
|
||||
title: "Status",
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: "text-center",
|
||||
render: function(status, type, row) {
|
||||
let checked = (status === "active") ? "checked" : "";
|
||||
return `
|
||||
@@ -189,31 +280,13 @@
|
||||
</label>
|
||||
`;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'id', // Azioni: Modifica, Mappatura e Eliminazione
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
title: "Actions",
|
||||
render: function(data) {
|
||||
return `
|
||||
<div class="d-flex">
|
||||
<a href="edit_template_xls.php?id=${data}" class="btn btn-sm btn-primary me-1">
|
||||
<i class="bx bx-edit-alt"></i>
|
||||
</a>
|
||||
<a href="mapping_template_xls_scheme2.php?id=${data}" class="btn btn-sm btn-success me-1">
|
||||
<i class="bx bx-link-alt"></i>
|
||||
</a>
|
||||
<button class="btn btn-sm btn-danger" onclick="confirmDelete(${data})">
|
||||
<i class="bx bx-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
],
|
||||
dom: '<"card-header border-bottom p-3"<"d-flex align-items-center"<"card-title mb-0 flex-grow-1"f>>>rt<"card-footer border-top p-3"<"d-flex align-items-center"<"me-auto"l><"d-flex gap-2"ip>>>',
|
||||
lengthMenu: [10, 25, 50, 100],
|
||||
order: [
|
||||
[1, 'asc']
|
||||
],
|
||||
language: {
|
||||
search: "Cerca:",
|
||||
lengthMenu: "Mostra _MENU_ elementi",
|
||||
@@ -252,20 +325,21 @@
|
||||
$.ajax({
|
||||
url: "update_template_status.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: templateId,
|
||||
status: newStatus
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
console.log("✅ Status updated successfully.");
|
||||
console.log("Status updated successfully.");
|
||||
} else {
|
||||
console.error("❌ Error updating status:", response.message);
|
||||
console.error("Error updating status:", response.message);
|
||||
alert("Error updating status: " + response.message);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
console.error("❌ AJAX error.");
|
||||
error: function(xhr) {
|
||||
console.error("AJAX error:", xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user