update documenti obbligatori
This commit is contained in:
parent
1da7ee5208
commit
6749663730
@ -13,6 +13,9 @@ $idhome = isset($_GET['idhome']) ? intval($_GET['idhome']) : 0;
|
|||||||
// Recupera lo slug dalla richiesta
|
// Recupera lo slug dalla richiesta
|
||||||
$docpage = isset($_GET['slug']) ? $_GET['slug'] : 'legal';
|
$docpage = isset($_GET['slug']) ? $_GET['slug'] : 'legal';
|
||||||
|
|
||||||
|
// Recupera il parametro showOnlyRequired
|
||||||
|
$showOnlyRequired = isset($_GET['showOnlyRequired']) && $_GET['showOnlyRequired'] === 'true';
|
||||||
|
|
||||||
// Recupera i dettagli della casa (per verifica accesso)
|
// Recupera i dettagli della casa (per verifica accesso)
|
||||||
$queryHome = $conn->prepare("SELECT * FROM home WHERE idhome = ? AND iduser = ?");
|
$queryHome = $conn->prepare("SELECT * FROM home WHERE idhome = ? AND iduser = ?");
|
||||||
$queryHome->bind_param('ii', $idhome, $iduserlogin);
|
$queryHome->bind_param('ii', $idhome, $iduserlogin);
|
||||||
@ -40,20 +43,26 @@ if (!$pageData) {
|
|||||||
$page_id = $pageData['idpages'];
|
$page_id = $pageData['idpages'];
|
||||||
|
|
||||||
// Recupera i documenti associati al `page_id`, con le sezioni
|
// Recupera i documenti associati al `page_id`, con le sezioni
|
||||||
$queryDocuments = $conn->prepare("
|
$sql = "
|
||||||
SELECT d.*, s.section_name AS section_name
|
SELECT d.*, s.section_name AS section_name
|
||||||
FROM documents d
|
FROM documents d
|
||||||
LEFT JOIN sections s ON d.idsections = s.idsections
|
LEFT JOIN sections s ON d.idsections = s.idsections
|
||||||
WHERE d.page_id = ?
|
WHERE d.page_id = ?
|
||||||
ORDER BY s.section_name, d.document_name
|
";
|
||||||
");
|
if ($showOnlyRequired) {
|
||||||
|
$sql .= " AND d.is_required = 1";
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY s.section_name, d.document_name";
|
||||||
|
|
||||||
|
$queryDocuments = $conn->prepare($sql);
|
||||||
$queryDocuments->bind_param('i', $page_id);
|
$queryDocuments->bind_param('i', $page_id);
|
||||||
$queryDocuments->execute();
|
$queryDocuments->execute();
|
||||||
$resultDocuments = $queryDocuments->get_result();
|
$resultDocuments = $queryDocuments->get_result();
|
||||||
|
|
||||||
$documents = [];
|
$documents = [];
|
||||||
while ($row = $resultDocuments->fetch_assoc()) {
|
while ($row = $resultDocuments->fetch_assoc()) {
|
||||||
$documents[$row['section_name']][] = $row;
|
$sectionName = $row['section_name'] ?: 'Senza sezione';
|
||||||
|
$documents[$sectionName][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recupera i documenti già caricati per questa casa
|
// Recupera i documenti già caricati per questa casa
|
||||||
|
|||||||
@ -37,22 +37,35 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-4">
|
<!-- Sezione filtri -->
|
||||||
<div class="col-12 col-md-6 text-center text-md-start">
|
<div class="filter-section mb-4 p-3 bg-light rounded shadow-sm">
|
||||||
<label for="pageSelectDropdown" class="fw-bold d-block mb-2">Seleziona Categoria:</label>
|
<div class="row align-items-center">
|
||||||
<select id="pageSelectDropdown" class="form-control w-100 w-md-auto">
|
<!-- Checkbox "Mostra solo obbligatori" -->
|
||||||
<?php foreach ($pages as $page) { ?>
|
<div class="col-12 col-md-3 mb-2 mb-md-0">
|
||||||
<option value="<?php echo htmlspecialchars($page['slug']); ?>"
|
<div class="form-check form-switch">
|
||||||
<?php echo ($docpage === $page['slug']) ? 'selected' : ''; ?>>
|
<input class="form-check-input" type="checkbox" id="showOnlyRequired">
|
||||||
<?php echo ucfirst(htmlspecialchars($page['namepages'])); ?>
|
<label class="form-check-label" for="showOnlyRequired">
|
||||||
</option>
|
<i class="fas fa-filter me-1"></i> Solo obbligatori
|
||||||
<?php } ?>
|
</label>
|
||||||
</select>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6 text-center text-md-end mt-3 mt-md-0">
|
<!-- Dropdown "Seleziona Categoria" -->
|
||||||
<div class="input-group w-100 w-md-75 mx-auto mx-md-0">
|
<div class="col-12 col-md-4 mb-2 mb-md-0">
|
||||||
<input type="text" id="documentSearch" class="form-control" placeholder="Cerca sezione o documento..." autocomplete="off">
|
<label for="pageSelectDropdown" class="form-label mb-1 fw-bold">Categoria:</label>
|
||||||
<div id="searchResults" class="list-group dropdown-menu show" style="position: absolute; width: 100%; max-height: 200px; overflow-y: auto; z-index: 1000; display: none;"></div>
|
<select id="pageSelectDropdown" class="form-control w-100">
|
||||||
|
<?php foreach ($pages as $page) { ?>
|
||||||
|
<option value="<?php echo htmlspecialchars($page['slug']); ?>"
|
||||||
|
<?php echo ($docpage === $page['slug']) ? 'selected' : ''; ?>>
|
||||||
|
<?php echo ucfirst(htmlspecialchars($page['namepages'])); ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<!-- Campo di ricerca -->
|
||||||
|
<div class="col-12 col-md-5 mb-2 mb-md-0 position-relative">
|
||||||
|
<label for="documentSearch" class="form-label mb-1 fw-bold">Cerca:</label>
|
||||||
|
<input type="text" id="documentSearch" class="form-control w-100" placeholder="Sezione o documento..." autocomplete="off">
|
||||||
|
<div id="searchResults" class="list-group dropdown-menu show w-100" style="position: absolute; max-height: 200px; overflow-y: auto; z-index: 1000; display: none;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -230,6 +243,107 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stile per la sezione filtri */
|
||||||
|
.filter-section {
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 15px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stile per il checkbox */
|
||||||
|
.form-check.form-switch {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-input {
|
||||||
|
width: 2em;
|
||||||
|
height: 1em;
|
||||||
|
margin-right: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-input:checked {
|
||||||
|
background-color: #007bff;
|
||||||
|
border-color: #007bff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-label {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-label i {
|
||||||
|
color: #007bff;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-label:hover {
|
||||||
|
color: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stile per le etichette dei filtri */
|
||||||
|
.form-label {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stile per il dropdown e il campo di ricerca */
|
||||||
|
.form-control {
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
padding: 8px 12px;
|
||||||
|
transition: border-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control:focus {
|
||||||
|
border-color: #007bff;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stile per i risultati della ricerca */
|
||||||
|
#searchResults {
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchResults .list-group-item {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
padding: 8px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchResults .list-group-item:hover {
|
||||||
|
background-color: #f1f3f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive: impila i filtri su schermi piccoli */
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.filter-section {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check.form-switch {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -252,6 +366,12 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
loadDocuments(slug);
|
loadDocuments(slug);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Gestione del checkbox "Mostra solo obbligatori"
|
||||||
|
$("#showOnlyRequired").on("change", function() {
|
||||||
|
const slug = $("#pageSelectDropdown").val();
|
||||||
|
loadDocuments(slug);
|
||||||
|
});
|
||||||
|
|
||||||
// Carica tutti i documenti e le sezioni da tutte le pagine per la ricerca
|
// Carica tutti i documenti e le sezioni da tutte le pagine per la ricerca
|
||||||
let allDocuments = [];
|
let allDocuments = [];
|
||||||
<?php
|
<?php
|
||||||
@ -320,12 +440,15 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
});
|
});
|
||||||
|
|
||||||
function loadDocuments(slug, targetSectionId = null) {
|
function loadDocuments(slug, targetSectionId = null) {
|
||||||
|
const showOnlyRequired = $("#showOnlyRequired").is(":checked");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'get-documents.php',
|
url: 'get-documents.php',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: {
|
data: {
|
||||||
slug: slug,
|
slug: slug,
|
||||||
idhome: idhome
|
idhome: idhome,
|
||||||
|
showOnlyRequired: showOnlyRequired // Passa il filtro al backend
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
@ -404,27 +527,29 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h6 class="mt-4">Documenti già caricati:</h6>
|
<div class="loaded-documents-section" id="loaded-documents-${document.document_id}">
|
||||||
${(loadedDocuments[document.document_id] || []).length > 0 ? `
|
${(loadedDocuments[document.document_id] || []).length > 0 ? `
|
||||||
<table class="table table-bordered document-list-table" id="table-${document.document_id}">
|
<h6 class="mt-4">Documenti già caricati:</h6>
|
||||||
<thead>
|
<table class="table table-bordered document-list-table" id="table-${document.document_id}">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Nome Documento</th>
|
|
||||||
<th>Data Caricamento</th>
|
|
||||||
<th>Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
${loadedDocuments[document.document_id].map(doc => `
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="homedocuments/${doc.filename}" target="_blank">${doc.filename}</a></td>
|
<th>Nome Documento</th>
|
||||||
<td>${doc.created_at}</td>
|
<th>Data Caricamento</th>
|
||||||
<td><button class="btn btn-danger btn-sm delete-document" data-id="${doc.id}" data-file="${doc.filename}">Elimina</button></td>
|
<th>Azioni</th>
|
||||||
</tr>
|
</tr>
|
||||||
`).join('')}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
${loadedDocuments[document.document_id].map(doc => `
|
||||||
` : '<p class="text-muted">Nessun documento caricato</p>'}
|
<tr>
|
||||||
|
<td><a href="homedocuments/${doc.filename}" target="_blank">${doc.filename}</a></td>
|
||||||
|
<td>${doc.created_at}</td>
|
||||||
|
<td><button class="btn btn-danger btn-sm delete-document" data-id="${doc.id}" data-file="${doc.filename}">Elimina</button></td>
|
||||||
|
</tr>
|
||||||
|
`).join('')}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
` : ''}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
@ -471,38 +596,39 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
dictDefaultMessage: "Trascina qui i file o clicca per caricarli",
|
dictDefaultMessage: "Trascina qui i file o clicca per caricarli",
|
||||||
dictRemoveFile: "Rimuovi",
|
dictRemoveFile: "Rimuovi",
|
||||||
previewTemplate: `
|
previewTemplate: `
|
||||||
<div class="dz-preview dz-file-preview">
|
<div class="dz-preview dz-file-preview">
|
||||||
<div class="dz-image"><img data-dz-thumbnail /></div>
|
<div class="dz-image"><img data-dz-thumbnail /></div>
|
||||||
<div class="dz-details">
|
<div class="dz-details">
|
||||||
<div class="dz-filename"><span data-dz-name></span></div>
|
<div class="dz-filename"><span data-dz-name></span></div>
|
||||||
<div class="dz-size"><span data-dz-size></span></div>
|
<div class="dz-size"><span data-dz-size></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dz-progress">
|
<div class="dz-progress">
|
||||||
<span class="dz-upload" data-dz-uploadprogress></span>
|
<span class="dz-upload" data-dz-uploadprogress></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
<div class="dz-error-message"><span data-dz-errormessage></span></div>
|
||||||
<div class="dz-success-mark">
|
<div class="dz-success-mark">
|
||||||
<i class="fas fa-check-circle"></i>
|
<i class="fas fa-check-circle"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="dz-error-mark">
|
<div class="dz-error-mark">
|
||||||
<i class="fas fa-times-circle"></i>
|
<i class="fas fa-times-circle"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
init: function() {
|
init: function() {
|
||||||
this.on("success", function(file, response) {
|
this.on("success", function(file, response) {
|
||||||
try {
|
try {
|
||||||
let parsedResponse = typeof response === "string" ? JSON.parse(response) : response;
|
let parsedResponse = typeof response === "string" ? JSON.parse(response) : response;
|
||||||
|
|
||||||
if (parsedResponse.success) {
|
if (parsedResponse.success) {
|
||||||
let tableId = `#table-${document.document_id} tbody`;
|
// Usa document.document_id invece di parsedResponse.documentId
|
||||||
let row = `
|
updateDocumentTable(document.document_id, parsedResponse);
|
||||||
<tr>
|
Swal.fire({
|
||||||
<td><a href="homedocuments/${parsedResponse.fileName}" target="_blank">${parsedResponse.fileName}</a></td>
|
icon: "success",
|
||||||
<td>${parsedResponse.uploadDate}</td>
|
title: "Caricamento completato",
|
||||||
<td><button class="btn btn-danger btn-sm delete-document" data-id="${parsedResponse.documentId}" data-file="${parsedResponse.fileName}">Elimina</button></td>
|
text: "Il documento è stato caricato con successo.",
|
||||||
</tr>`;
|
timer: 1500,
|
||||||
$(tableId).append(row);
|
showConfirmButton: false
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: "error",
|
icon: "error",
|
||||||
@ -518,6 +644,7 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
text: "Risposta dal server non valida.",
|
text: "Risposta dal server non valida.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.removeFile(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("error", function(file, errorMessage) {
|
this.on("error", function(file, errorMessage) {
|
||||||
@ -563,6 +690,8 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
const documentId = $(this).data("id");
|
const documentId = $(this).data("id");
|
||||||
const fileName = $(this).data("file");
|
const fileName = $(this).data("file");
|
||||||
const $row = $(this).closest("tr");
|
const $row = $(this).closest("tr");
|
||||||
|
const $table = $row.closest("table");
|
||||||
|
const $section = $table.closest('.loaded-documents-section');
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Sei sicuro?",
|
title: "Sei sicuro?",
|
||||||
@ -588,6 +717,10 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
|
|
||||||
if (parsedResponse.success) {
|
if (parsedResponse.success) {
|
||||||
$row.remove();
|
$row.remove();
|
||||||
|
// Controlla se la tabella è vuota
|
||||||
|
if ($table.find("tbody tr").length === 0) {
|
||||||
|
$section.empty(); // Rimuove la tabella e il titolo
|
||||||
|
}
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: "success",
|
icon: "success",
|
||||||
title: "Eliminato",
|
title: "Eliminato",
|
||||||
@ -623,6 +756,56 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Funzione per aggiornare dinamicamente la tabella dei documenti
|
||||||
|
function updateDocumentTable(documentId, parsedResponse) {
|
||||||
|
console.log('Aggiornamento tabella per documentId:', documentId, 'con risposta:', parsedResponse); // Debug
|
||||||
|
const sectionId = `#loaded-documents-${documentId}`;
|
||||||
|
const $section = $(sectionId);
|
||||||
|
|
||||||
|
if (!$section.length) {
|
||||||
|
console.error('Sezione non trovata per documentId:', documentId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let $table = $section.find(`#table-${documentId}`);
|
||||||
|
if ($table.length === 0) {
|
||||||
|
// Se la tabella non esiste, crea la sezione e la tabella
|
||||||
|
console.log('Creazione nuova tabella per documentId:', documentId);
|
||||||
|
const tableHtml = `
|
||||||
|
<h6 class="mt-4">Documenti già caricati:</h6>
|
||||||
|
<table class="table table-bordered document-list-table" id="table-${documentId}">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nome Documento</th>
|
||||||
|
<th>Data Caricamento</th>
|
||||||
|
<th>Azioni</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><a href="homedocuments/${parsedResponse.fileName}" target="_blank">${parsedResponse.fileName}</a></td>
|
||||||
|
<td>${parsedResponse.uploadDate}</td>
|
||||||
|
<td><button class="btn btn-danger btn-sm delete-document" data-id="${parsedResponse.documentId}" data-file="${parsedResponse.fileName}">Elimina</button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
`;
|
||||||
|
$section.html(tableHtml);
|
||||||
|
console.log('Tabella creata:', $section.html()); // Debug
|
||||||
|
} else {
|
||||||
|
// Se la tabella esiste, aggiungi la nuova riga
|
||||||
|
console.log('Aggiunta riga alla tabella esistente per documentId:', documentId);
|
||||||
|
const row = `
|
||||||
|
<tr>
|
||||||
|
<td><a href="homedocuments/${parsedResponse.fileName}" target="_blank">${parsedResponse.fileName}</a></td>
|
||||||
|
<td>${parsedResponse.uploadDate}</td>
|
||||||
|
<td><button class="btn btn-danger btn-sm delete-document" data-id="${parsedResponse.documentId}" data-file="${parsedResponse.fileName}">Elimina</button></td>
|
||||||
|
</tr>`;
|
||||||
|
$table.find("tbody").append(row);
|
||||||
|
console.log('Riga aggiunta:', row); // Debug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Funzione per caricare un file dalla fotocamera
|
// Funzione per caricare un file dalla fotocamera
|
||||||
window.uploadFromCamera = function(input, documentId) {
|
window.uploadFromCamera = function(input, documentId) {
|
||||||
if (input.files && input.files[0]) {
|
if (input.files && input.files[0]) {
|
||||||
@ -642,14 +825,9 @@ $docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
|
|||||||
let parsedResponse = typeof response === "string" ? JSON.parse(response) : response;
|
let parsedResponse = typeof response === "string" ? JSON.parse(response) : response;
|
||||||
|
|
||||||
if (parsedResponse.success) {
|
if (parsedResponse.success) {
|
||||||
let tableId = `#table-${documentId} tbody`;
|
// Aggiorna dinamicamente la tabella
|
||||||
let row = `
|
updateDocumentTable(documentId, parsedResponse);
|
||||||
<tr>
|
// Mostra un messaggio di successo
|
||||||
<td><a href="homedocuments/${parsedResponse.fileName}" target="_blank">${parsedResponse.fileName}</a></td>
|
|
||||||
<td>${parsedResponse.uploadDate}</td>
|
|
||||||
<td><button class="btn btn-danger btn-sm delete-document" data-id="${parsedResponse.documentId}" data-file="${parsedResponse.fileName}">Elimina</button></td>
|
|
||||||
</tr>`;
|
|
||||||
$(tableId).append(row);
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: "success",
|
icon: "success",
|
||||||
title: "Caricamento completato",
|
title: "Caricamento completato",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user