/* ============================================================ settings.js — Settings page with many tabs ============================================================ */ window.Views = window.Views || {}; window.Settings = {}; Views.settings = function () { const tabs = ['General', 'Users', 'Roles', 'Permissions', 'Notifications', 'Email Templates', 'Career Portal', 'Branding', 'Security', 'Appearance']; const html = `

Settings

Configure your workspace and team preferences

${tabs.map((t, i) => `
${t}
`).join('')}
${tabs.map((t, i) => `
${Settings.pane(t)}
`).join('')}
`; return { html, onMount() { const panes = document.querySelectorAll('#setPanes .tab-pane'); document.querySelectorAll('#setTabs .tab').forEach(tab => tab.onclick = () => { document.querySelectorAll('#setTabs .tab').forEach(t => t.classList.remove('active')); tab.classList.add('active'); panes.forEach(p => p.classList.remove('active')); panes[+tab.dataset.tab].classList.add('active'); if (tab.textContent === 'Appearance') Settings._bindTheme(); }); Settings._bindTheme(); } }; }; function toggleRow(title, desc, checked) { return `

${title}

${desc}

`; } Settings.pane = function (name) { if (name === 'General') { return `
${toggleRow('Auto-archive stale jobs', 'Automatically close requisitions inactive for 90 days', true)} ${toggleRow('Duplicate detection', 'Flag candidates that already exist in the system', true)}
`; } if (name === 'Users') { const rows = DB.users.map(u => `
${UI.avatar(u.name, u.initials, u.color)}
${u.name}
${u.email}
${UI.badge(u.role, 'b-indigo')} ${UI.badge(u.status)} ${u.lastActive}
`).join(''); return `

Team Members

${DB.users.length} users
${rows}
UserRoleStatusLast ActiveActions
`; } if (name === 'Roles') { return `

Roles

Define access levels
${DB.roles.map(r => `
${UI.icon('users')}
${r.name}
${r.desc}
${r.users} users
${r.perms}
`).join('')}
`; } if (name === 'Permissions') { const modules = ['Jobs', 'Candidates', 'Interviews', 'Offers', 'Reports', 'Settings']; const perms = ['View', 'Create', 'Edit', 'Delete']; return `

Permission Matrix

Recruiter role
${perms.map(p => ``).join('')}${modules.map(m => `${perms.map((p, i) => ``).join('')}`).join('')}
Module${p}
${m}
`; } if (name === 'Notifications') { return `
Email Notifications
${toggleRow('New applications', 'Get notified when a candidate applies', true)} ${toggleRow('Interview reminders', 'Reminders 30 minutes before interviews', true)} ${toggleRow('Offer responses', 'When candidates accept or decline offers', true)} ${toggleRow('Weekly digest', 'A summary of hiring activity every Monday', false)}
In-App Notifications
${toggleRow('Mentions', 'When a teammate @mentions you', true)} ${toggleRow('Stage changes', 'When a candidate moves stages', false)} ${toggleRow('Task assignments', 'When you are assigned a task', true)}
`; } if (name === 'Email Templates') { const templates = ['Application Received', 'Interview Invitation', 'Assessment Assignment', 'Offer Letter', 'Rejection — Post Interview', 'Reference Request']; return `

Email Templates

${templates.map(t => `
${UI.icon('mail')}
${t}
Last edited 3 days ago
${UI.badge('Active', 'b-green')}
`).join('')}
`; } if (name === 'Career Portal') { return `
${toggleRow('Public job board', 'Make open roles visible to the public', true)} ${toggleRow('Allow one-click apply', 'Let candidates apply with LinkedIn', true)} ${toggleRow('Show salary ranges', 'Display compensation on job listings', false)} ${toggleRow('Enable referrals', 'Employees can refer candidates', true)}
`; } if (name === 'Branding') { return `

Company Logo

Displayed on career pages and emails

Brand Color

Primary accent across the portal

${['#004d43', '#ceff71', '#25e9a5', '#8e92ff', '#1a3134', '#eafff4'].map(c => ``).join('')}
`; } if (name === 'Security') { return `
${toggleRow('Two-factor authentication', 'Require 2FA for all team members', true)} ${toggleRow('Single Sign-On (SSO)', 'Enable SAML-based SSO login', false)} ${toggleRow('IP allowlist', 'Restrict access to approved IP ranges', false)} ${toggleRow('Audit logging', 'Track all data access and changes', true)}

Data Retention

Auto-delete candidate data after set period

`; } if (name === 'Appearance') { return `
Theme
Light
Clean and bright
Dark
Easy on the eyes
System
Match OS setting
${toggleRow('Compact mode', 'Reduce spacing for denser layouts', false)} ${toggleRow('Show animations', 'Enable transitions and motion', true)}
`; } return ''; }; Settings._bindTheme = function () { document.querySelectorAll('.theme-opt').forEach(opt => opt.onclick = () => { const mode = opt.dataset.themeSet; if (mode === 'system') { App.setTheme(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'); } else App.setTheme(mode); UI.toast('Theme updated to ' + mode, 'success'); }); };