/* ============================================================ misc.js — Hiring Managers, Calendar, Notifications, Help ============================================================ */ window.Views = window.Views || {}; // ---------------- Hiring Managers ---------------- Views.managers = function () { function card(m) { const jobs = DB.jobs.filter(j => j.manager === m.name && j.status === 'Open'); return `
${UI.avatar(m.name, m.initials, m.color, 'avatar-lg')}
${m.name}
${m.title}
${m.openReqs}Open Reqs
${m.teamSize}Team Size
${UI.icon('mail')} ${m.email.split('@')[0]}
`; } const html = `

Hiring Managers

${DB.managers.length} managers · ${DB.managers.reduce((s, m) => s + m.openReqs, 0)} active requisitions

${DB.managers.map(card).join('')}
`; return { html }; }; Views._mgrDetail = function (id) { const m = DB.getManager(id); const jobs = DB.jobs.filter(j => j.manager === m.name); const body = `
${UI.avatar(m.name, m.initials, m.color, 'avatar-lg')}
${m.name}
${m.title}
${UI.badge(m.department, 'b-indigo')}${m.teamSize} reports
${m.openReqs}Open Reqs
${jobs.length}Total Jobs
${jobs.reduce((s, j) => s + j.applications, 0)}Applications
Hiring Manager Portal
Requisitions
${jobs.length ? jobs.map(j => `
${UI.icon('briefcase')}
${j.title}
${j.applications} applications
${UI.badge(j.status)}
`).join('') : '

No requisitions

'}
`; UI.modal({ title: 'Hiring Manager', subtitle: m.id, body, size: 'modal-lg', footer: `` }); }; // ---------------- Calendar ---------------- Views.calendar = function () { const state = { month: 6, year: 2026 }; // July 2026 (0-indexed) const evColors = { 'Phone Screen': 'b-blue', 'Technical': 'b-indigo', 'System Design': 'b-purple', 'Onsite Loop': 'b-teal', 'Hiring Manager': 'b-amber', 'Culture Fit': 'b-green', 'Final Round': 'b-red' }; function build() { const first = new Date(state.year, state.month, 1); const startDow = first.getDay(); const daysInMonth = new Date(state.year, state.month + 1, 0).getDate(); const prevDays = new Date(state.year, state.month, 0).getDate(); const cells = []; for (let i = startDow - 1; i >= 0; i--) cells.push({ day: prevDays - i, other: true }); for (let d = 1; d <= daysInMonth; d++) cells.push({ day: d, other: false, date: new Date(state.year, state.month, d) }); while (cells.length % 7 !== 0 || cells.length < 42) cells.push({ day: cells.length - daysInMonth - startDow + 1, other: true }); const today = new Date('2026-07-09'); const dow = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; let html = dow.map(d => `
${d}
`).join(''); cells.slice(0, 42).forEach(c => { let evs = ''; if (!c.other && c.date) { const dayEvents = DB.interviews.filter(iv => iv.when.toDateString() === c.date.toDateString()); evs = dayEvents.slice(0, 3).map(iv => `
${iv.when.toLocaleTimeString('en-US', { hour: 'numeric' })} ${iv.candidate.split(' ')[0]}
`).join(''); if (dayEvents.length > 3) evs += `
+${dayEvents.length - 3} more
`; } const isToday = !c.other && c.date && c.date.toDateString() === today.toDateString(); html += `
${c.day}
${evs}
`; }); return html; } const monthName = new Date(state.year, state.month).toLocaleDateString('en-US', { month: 'long', year: 'numeric' }); const todayIvs = DB.interviews.filter(iv => iv.when.toDateString() === new Date('2026-07-09').toDateString()); const html = `

Calendar

Interview schedule at a glance

${monthName}
${build()}

Today

July 9, 2026
${todayIvs.length ? todayIvs.map(iv => `
${UI.avatar(iv.candidate, iv.candInitials, iv.color)}
${iv.candidate}
${iv.type}
${iv.when.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })}
`).join('') : '

No interviews today

'}
`; return { html, onMount() { const upd = () => { document.getElementById('calGrid').innerHTML = build(); document.getElementById('calMonth').textContent = new Date(state.year, state.month).toLocaleDateString('en-US', { month: 'long', year: 'numeric' }); }; document.getElementById('calPrev').onclick = () => { state.month--; if (state.month < 0) { state.month = 11; state.year--; } upd(); }; document.getElementById('calNext').onclick = () => { state.month++; if (state.month > 11) { state.month = 0; state.year++; } upd(); }; } }; }; // ---------------- Notifications ---------------- Views.notifications = function () { const rows = DB.notifications.map((n, i) => `
${UI.icon(n.icon)}
${n.title}
${n.text}
${n.time}
${n.unread ? '' : ''}
`).join(''); const html = `

Notifications

Stay on top of hiring activity

${rows}
`; return { html }; }; // ---------------- Help ---------------- Views.help = function () { const faqs = [ { q: 'How do I create a new job requisition?', a: 'Navigate to Jobs and click "Create Job". Fill in the required fields marked with an asterisk and click Save. The job will immediately appear in your listings.' }, { q: 'How does the AI candidate score work?', a: 'The AI score (0–100) evaluates how well a candidate matches the job requirements based on skills, experience, and education. Higher scores indicate stronger matches.' }, { q: 'Can I move candidates between pipeline stages?', a: 'Yes. Open the Pipeline view and simply drag any candidate card between stage columns. The candidate\'s status updates automatically.' }, { q: 'How do I schedule an interview?', a: 'Go to Interviews or Calendar and click "Schedule Interview". Select the candidate, round, date, time, and interviewers.' }, { q: 'How do I export reports?', a: 'On the Reports page, use the "Export Report" button for a full PDF, or the CSV buttons on individual tables.' } ]; const resources = [ { icn: 'file', t: 'Documentation', d: 'Complete product guides', cls: 'i-indigo' }, { icn: 'video', t: 'Video Tutorials', d: 'Watch step-by-step walkthroughs', cls: 'i-red' }, { icn: 'message', t: 'Live Chat', d: 'Chat with our support team', cls: 'i-green' }, { icn: 'users', t: 'Community', d: 'Connect with other recruiters', cls: 'i-purple' } ]; const html = `

Help Center

Find answers and get support

How can we help you?

Search our knowledge base or browse the topics below

${resources.map(r => `
${UI.icon(r.icn)}
${r.t}
${r.d}
`).join('')}

Frequently Asked Questions

${faqs.map((f, i) => `

${f.q}

${UI.icon('chevron-right')}
`).join('')}
`; return { html }; }; Views._toggleFaq = function (i) { const a = document.getElementById('faqA' + i); const chev = document.getElementById('faqChev' + i); const open = a.style.display === 'block'; a.style.display = open ? 'none' : 'block'; chev.style.transform = open ? 'rotate(0deg)' : 'rotate(90deg)'; };