Internal Controls Dashboard
Control Effectiveness
0%
Failed Controls
0
Open Audit Findings
0
Controls Tested (YTD)
0
Control Status
Effectiveness by Process
Open Audit Findings by Severity
Control Log
| Control ID | Description | Process | Last Tested | Status |
|---|
Log or Update Control Test
Full Control Catalog
| ID | Description | Status | Action |
|---|
Error: A required library is missing.
'; return; } // --- DATA MANAGEMENT --- let controls = JSON.parse(localStorage.getItem('icd_controls')) || []; let auditFindings = [ // Static for demo { severity: 'High', count: 3 }, { severity: 'Medium', count: 8 }, { severity: 'Low', count: 5 } ]; const getSampleData = () => { const today = new Date('2025-07-09'); const d = (daysAgo) => new Date(today.getTime() - daysAgo * 24*3600*1000).toISOString().split('T')[0]; return [ { id: 'AC-01', desc: 'User Access Review', process: 'IT General Controls', lastTested: d(15), status: 'Effective' }, { id: 'AC-02', desc: 'Privileged Access Management', process: 'IT General Controls', lastTested: d(20), status: 'Effective' }, { id: 'FR-01', desc: 'Journal Entry Approval', process: 'Financial Reporting', lastTested: d(10), status: 'Ineffective' }, { id: 'FR-02', desc: 'Bank Reconciliation Review', process: 'Financial Reporting', lastTested: d(5), status: 'Effective' }, { id: 'HR-01', desc: 'New Hire Onboarding Checklist', process: 'Human Resources', lastTested: d(30), status: 'Effective' }, { id: 'HR-02', desc: 'Termination Checklist', process: 'Human Resources', lastTested: d(30), status: 'Needs Improvement' }, { id: 'PC-01', desc: 'Procure-to-Pay Authorization', process: 'Procurement', lastTested: d(45), status: 'Effective' }, ]; }; if (controls.length === 0) controls = getSampleData(); const saveState = () => localStorage.setItem('icd_controls', JSON.stringify(controls)); // --- CHART INSTANCES & UTILITIES --- let statusChart, processChart, findingsChart; const tabButtons = document.querySelectorAll('.icd-tab-button'); const tabContents = document.querySelectorAll('.icd-tab-content'); const nextBtn = document.getElementById('icd-next-btn'); const prevBtn = document.getElementById('icd-prev-btn'); // --- RENDER FUNCTIONS --- const renderAll = () => { try { renderKPIs(); renderStatusChart(); renderProcessChart(); renderFindingsChart(); renderControlsTable(); renderManageTable(); updateNavButtons(); } catch(error) { console.error("Dashboard rendering failed:", error); } }; const renderKPIs = () => { const totalControls = controls.length; const effectiveControls = controls.filter(c => c.status === 'Effective').length; const failedControls = controls.filter(c => c.status === 'Ineffective').length; const effectiveness = totalControls > 0 ? (effectiveControls / totalControls) * 100 : 0; const effectivenessEl = document.getElementById('icd-effectiveness-kpi'); effectivenessEl.textContent = `${effectiveness.toFixed(1)}%`; effectivenessEl.className = effectiveness >= 95 ? 'success' : 'danger'; document.getElementById('icd-failed-controls-kpi').textContent = failedControls; document.getElementById('icd-audit-findings-kpi').textContent = auditFindings.reduce((sum, f) => sum + f.count, 0); document.getElementById('icd-controls-tested-kpi').textContent = totalControls; }; const renderStatusChart = () => { const byStatus = controls.reduce((acc, c) => { acc[c.status] = (acc[c.status] || 0) + 1; return acc; }, {}); const order = ['Effective', 'Needs Improvement', 'Ineffective']; const series = order.map(status => byStatus[status] || 0); const options = { chart: { type: 'donut', height: 350 }, series: series, labels: order, colors: ['var(--icd-success-color)', 'var(--icd-warning-color)', 'var(--icd-danger-color)'], legend: { position: 'bottom' } }; if(statusChart) statusChart.destroy(); document.querySelector("#icd-status-chart").innerHTML = ''; statusChart = new ApexCharts(document.querySelector("#icd-status-chart"), options); statusChart.render(); }; const renderProcessChart = () => { const processes = [...new Set(controls.map(c => c.process))]; const processData = processes.map(p => { const processControls = controls.filter(c => c.process === p); const effective = processControls.filter(c => c.status === 'Effective').length; return (effective / processControls.length * 100).toFixed(1); }); const options = { chart: { type: 'bar', height: 350 }, series: [{ name: 'Effectiveness', data: processData }], xaxis: { categories: processes }, yaxis: { max: 100, labels: { formatter: val => `${val}%` } }, plotOptions: { bar: { horizontal: true, distributed: true } }, legend: { show: false }, colors: processData.map(p => p >= 95 ? 'var(--icd-success-color)' : 'var(--icd-warning-color)') }; if(processChart) processChart.destroy(); document.querySelector("#icd-process-chart").innerHTML = ''; processChart = new ApexCharts(document.querySelector("#icd-process-chart"), options); processChart.render(); }; const renderFindingsChart = () => { const options = { chart: { type: 'bar', height: 300 }, series: [{ name: 'Findings', data: auditFindings.map(f=>f.count) }], xaxis: { categories: auditFindings.map(f=>f.severity) }, plotOptions: { bar: { distributed: true } }, colors: ['var(--icd-danger-color)', 'var(--icd-warning-color)', '#7f8c8d'], legend: { show: false } }; if(findingsChart) findingsChart.destroy(); document.querySelector("#icd-findings-chart").innerHTML = ''; findingsChart = new ApexCharts(document.querySelector("#icd-findings-chart"), options); findingsChart.render(); }; const renderControlsTable = () => { const tbody = document.getElementById('icd-controls-tbody'); tbody.innerHTML = ''; controls.forEach(c => { tbody.innerHTML += `