home listd ocument

This commit is contained in:
Claudio 2025-02-25 17:58:31 +01:00
parent 6a7a346a76
commit bd350d3e2f

View File

@ -101,6 +101,8 @@ while ($row = $queryPages->fetch_assoc()) {
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.7/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Select2 CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet">
<style>
/* Personalizza la riga della sezione */
@ -277,21 +279,20 @@ while ($row = $queryPages->fetch_assoc()) {
<div class="row mb-4">
<div class="col-12 text-center">
<div class="btn-group" role="group" aria-label="Pagine">
<?php foreach ($pages as $page) {
if ($page['slug'] !== 'person') { ?>
<button
class="btn btn-outline-primary filter-btn <?php echo $docpage === $page['slug'] ? 'active' : ''; ?>"
onclick="window.location.href='?docpage=<?php echo htmlspecialchars($page['slug']); ?>&idhome=<?php echo htmlspecialchars($idhome); ?>';">
<?php echo ucfirst(htmlspecialchars($page['namepages'])); ?>
</button>
<?php }
} ?>
</div>
<label for="pageSelectDropdown" class="fw-bold d-block mb-2">Seleziona Categoria:</label>
<select id="pageSelectDropdown" class="form-control w-50 mx-auto">
<?php foreach ($pages as $page) { ?>
<option value="?docpage=<?php echo htmlspecialchars($page['slug']); ?>&idhome=<?php echo htmlspecialchars($idhome); ?>"
<?php echo ($docpage === $page['slug']) ? 'selected' : ''; ?>>
<?php echo ucfirst(htmlspecialchars($page['namepages'])); ?>
</option>
<?php } ?>
</select>
</div>
</div>
<!-- Sezioni per documenti -->
<div class="accordion" id="documentSections">
<?php foreach ($documents as $sectionName => $sectionDocuments) { ?>
@ -622,6 +623,27 @@ while ($row = $queryPages->fetch_assoc()) {
});
});
</script>
<!-- Select2 JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
<script>
$(document).ready(function() {
// Inizializza Select2 con uno stile migliore
$("#pageSelectDropdown").select2({
placeholder: "Seleziona una categoria...",
allowClear: true,
theme: "classic",
width: 'resolve' // Adatta il dropdown
});
// Cambia pagina automaticamente al cambio di selezione
$("#pageSelectDropdown").on("change", function() {
window.location.href = $(this).val();
});
});
</script>
</body>
</html>