feat: project scaffold with tabs, styles and package.json
This commit is contained in:
25
js/app.js
Normal file
25
js/app.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { renderEmployees } from './employees.js';
|
||||
import { renderCalendar } from './calendar.js';
|
||||
import { renderDataTab } from './history.js';
|
||||
|
||||
// Shared mutable state — imported by all other modules
|
||||
export const state = {
|
||||
employees: [],
|
||||
calendar: { holidays: [], companyClosures: [] },
|
||||
history: []
|
||||
};
|
||||
|
||||
// Tab switching
|
||||
document.querySelectorAll('.tab-btn').forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const tab = btn.dataset.tab;
|
||||
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
||||
document.querySelectorAll('.tab-content').forEach(s => s.classList.add('hidden'));
|
||||
btn.classList.add('active');
|
||||
document.getElementById('tab-' + tab).classList.remove('hidden');
|
||||
if (tab === 'planning') renderCalendar();
|
||||
if (tab === 'data') renderDataTab();
|
||||
});
|
||||
});
|
||||
|
||||
renderEmployees();
|
||||
Reference in New Issue
Block a user