Refactor to manager-centric model, add team calendar for all users

Key changes:
- Removed office-centric model (deleted offices.py, office-rules)
- Renamed to team-rules, managers are part of their own team
- Team calendar visible to all (read-only for employees)
- Admins can have a manager assigned
This commit is contained in:
Stefano Manfredi
2025-12-02 13:30:04 +00:00
parent 2ad8ba3424
commit 7168fa4b72
30 changed files with 1016 additions and 910 deletions

View File

@@ -43,8 +43,8 @@ const ICONS = {
const NAV_ITEMS = [
{ href: '/presence', icon: 'calendar', label: 'My Presence' },
{ href: '/team-calendar', icon: 'users', label: 'Team Calendar', roles: ['admin', 'manager'] },
{ href: '/office-rules', icon: 'rules', label: 'Office Rules', roles: ['admin', 'manager'] },
{ href: '/team-calendar', icon: 'users', label: 'Team Calendar' },
{ href: '/team-rules', icon: 'rules', label: 'Team Rules', roles: ['admin', 'manager'] },
{ href: '/admin/users', icon: 'user', label: 'Manage Users', roles: ['admin'] }
];
@@ -77,26 +77,19 @@ async function initNav() {
if (!navContainer) return;
const currentPath = window.location.pathname;
let userRole = null;
let currentUser = null;
// Get user info
if (api.isAuthenticated()) {
currentUser = await api.getCurrentUser();
if (currentUser) {
userRole = currentUser.role;
}
}
// Get user info (works with both JWT and Authelia)
const currentUser = await api.checkAuth();
// Render navigation
navContainer.innerHTML = renderNav(currentPath, userRole);
navContainer.innerHTML = renderNav(currentPath, currentUser?.role);
// Update user info in sidebar
if (currentUser) {
const userName = document.getElementById('userName');
const userRole = document.getElementById('userRole');
if (userName) userName.textContent = currentUser.name || 'User';
if (userRole) userRole.textContent = currentUser.role || '-';
const userNameEl = document.getElementById('userName');
const userRoleEl = document.getElementById('userRole');
if (userNameEl) userNameEl.textContent = currentUser.name || 'User';
if (userRoleEl) userRoleEl.textContent = currentUser.role || '-';
}
// Setup user menu