Combo-box partidas

This commit is contained in:
2025-05-22 09:00:17 -06:00
parent f3a7f5497f
commit ffcf1e51f4
2 changed files with 15 additions and 3 deletions

View File

@@ -167,4 +167,4 @@
<?php endif; ?>
</script>
</body>
</html>
</html>

View File

@@ -265,12 +265,24 @@
<td><button type="button" class="btn btn-danger btn-sm remove-row">✖️</button></td>
`;
tbody.appendChild(row);
// re-init Choices on new selects
// Re-inicializar Choices.js en los nuevos selects
row.querySelectorAll('.searchable').forEach(el => {
new Choices(el, { searchEnabled: true, itemSelectText: '', shouldSort: false });
});
});
// Manejador para controlar el overflow al abrir dropdowns
document.addEventListener('click', function(e) {
const tableContainer = document.querySelector('.table-responsive');
if (!tableContainer) return;
if (e.target.closest('.choices__inner')) {
tableContainer.style.overflow = 'visible';
} else {
tableContainer.style.overflow = 'auto';
}
});
document.querySelector('#tabla-partidas tbody').addEventListener('click', e => {
if (e.target.matches('.remove-row')) e.target.closest('tr').remove();
});
@@ -317,4 +329,4 @@
});
</script>
</body>
</html>
</html>