Online Smart Automated Employee Exit Clearance System

Automated Employee Exit Clearance System

Ongoing & Completed Clearances

EmployeeDepartmentExit DateProgressStatusActions

Initiate New Employee Exit Clearance

Manage Departments

NameActions

Manage Clearance Checklist Items

TaskDepartmentActions
×

Exit Date: ${clearance.exitDate}

${checklistHtml}
`; this.elements.modal.style.display = 'flex'; // Attach event listeners for modal actions this.elements.modalBody.querySelectorAll('input[type="checkbox"]').forEach(cb => { cb.addEventListener('change', (e) => this.handleChecklistToggle(e, clearanceId)); }); this.elements.modalBody.querySelector('#download-report-btn').addEventListener('click', () => this.downloadClearancePDF(clearanceId)); }, closeModal() { this.elements.modal.style.display = 'none'; }, handleChecklistToggle(e, clearanceId) { const taskId = parseInt(e.target.dataset.taskId); const clearance = this.state.clearances.find(c => c.id === clearanceId); if (!clearance) return; if (e.target.checked) { if (!clearance.completedTasks.includes(taskId)) { clearance.completedTasks.push(taskId); } } else { clearance.completedTasks = clearance.completedTasks.filter(id => id !== taskId); } this.renderClearanceTable(); // Re-render dashboard to show progress update }, downloadClearancePDF(clearanceId) { const clearance = this.state.clearances.find(c => c.id === clearanceId); if (!clearance) return; const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(18); doc.text('Employee Exit Clearance Report', 105, 22, { align: 'center' }); doc.setFontSize(12); doc.text(`Employee: ${clearance.employeeName}`, 14, 40); doc.text(`Exit Date: ${clearance.exitDate}`, 14, 47); const tableData = this.state.checklistItems.map(item => { const dept = this.state.departments.find(d => d.id === item.departmentId)?.name || 'N/A'; const status = clearance.completedTasks.includes(item.id) ? 'Completed' : 'Pending'; return [item.task, dept, status]; }); doc.autoTable({ startY: 60, head: [['Task', 'Department', 'Status']], body: tableData, theme: 'striped', headStyles: { fillColor: [124, 58, 237] } }); doc.save(`Clearance_Report_${clearance.employeeName.replace(/\s/g, '_')}.pdf`); }, // --- UTILITY FUNCTIONS --- getClearanceStatus(progress) { if (progress === 100) return { status: 'Completed', statusClass: 'status-completed' }; if (progress > 0) return { status: 'In Progress', statusClass: 'status-in-progress' }; return { status: 'Pending', statusClass: 'status-pending' }; }, getNextId(array) { return array.length > 0 ? Math.max(...array.map(item => item.id)) + 1 : 1; }, showNotification(message, type = 'success') { const box = this.elements.notificationBox; if (!box) return; box.textContent = message; box.className = `saeecs-notification ${type}`; box.classList.add('show'); setTimeout(() => { box.classList.remove('show'); }, 3000); } }; // Make SAEECS object globally accessible window.SAEECS = SAEECS; // Start the application SAEECS.init(); });
Scroll to Top