27 lines
831 B
JavaScript
27 lines
831 B
JavaScript
document.addEventListener('DOMContentLoaded', function () {
|
|
const menuButtons = document.querySelectorAll('.menu-btn');
|
|
const sections = document.querySelectorAll('.section');
|
|
const sectionTitle = document.getElementById('section-title');
|
|
|
|
const titles = {
|
|
trabajadores: 'Trabajadores',
|
|
nominas: 'Nóminas',
|
|
liquidaciones: 'Liquidaciones',
|
|
licencia: 'Licencia'
|
|
};
|
|
|
|
menuButtons.forEach(button => {
|
|
button.addEventListener('click', function () {
|
|
const target = this.dataset.section;
|
|
|
|
menuButtons.forEach(btn => btn.classList.remove('active'));
|
|
this.classList.add('active');
|
|
|
|
sections.forEach(section => section.classList.remove('active'));
|
|
document.getElementById(target).classList.add('active');
|
|
|
|
sectionTitle.textContent = titles[target] || '';
|
|
});
|
|
});
|
|
});
|