Principal Dashboard

SKS Saraswati Inter College, Mathura

2,450

Total Students

48

Active Classes

120

Teachers

94%

Attendance Today

₹24.5L

Fees Collected

Quick Actions

Class-wise Distribution

Monthly Fee Collection

Key Metrics

Average Class Size

51

Avg Attendance

94%

Fee Collection Rate

87%

Pass Rate

95%

Principal Control Panel

SKS Saraswati Inter College, Mathura

0

Total Students

0

Active Classes

0

Teachers

0%

Attendance Today

₹0

Fees Collected

Quick Actions
Dashboard Analytics

Class-wise Student Distribution

Monthly Fee Collection

Weekly Attendance Trend

Grade Distribution

Quick Insights

Average Class Size

0

Students per class

Avg Attendance

0%

Daily average

Fee Collection Rate

0%

Collected vs total

Top Class

Class 1

-

`; const printWindow = window.open('', '', 'width=400,height=600'); printWindow.document.write(cardHtml); printWindow.document.close(); } function generateAdmitCard() { const studentId = document.getElementById('studentSelectAdmitCard').value; const examName = document.getElementById('examName').value; const examDate = document.getElementById('examDate').value; if(studentId === 'Select a student') { alert('āš ļø Please select a student'); return; } if(!examName || !examDate) { alert('āš ļø Please enter exam name and date'); return; } const student = storage.students.find(s => s.regId === studentId); if(!student) return; const rollNumber = student.regId.split('/')[2] || '001'; const cardHtml = ` ${student.name} - Admit Card
SKS Saraswati Inter College
Mathura
šŸ“‹ ADMIT CARD
${examName}
Student Name:
${student.name}
Registration ID:
${student.regId}
Roll Number:
${rollNumber}
Class:
${student.class}
Exam Date:
${new Date(examDate).toLocaleDateString('en-US', {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'})}
Phone:
${student.phone}
šŸ“Œ Important Instructions:
Student Signature
Principal Signature
`; const printWindow = window.open('', '', 'width=700,height=900'); printWindow.document.write(cardHtml); printWindow.document.close(); } function bulkGenerateIdCards() { if(storage.students.length === 0) { alert('āš ļø No students available'); return; } alert(`āœ… Generating ID cards for ${storage.students.length} students...`); storage.students.forEach((student, idx) => { setTimeout(() => { document.getElementById('studentSelectIdCard').value = student.regId; generateIdCard(); }, idx * 2000); }); } function bulkGenerateAdmitCards() { const examName = document.getElementById('examName').value; const examDate = document.getElementById('examDate').value; if(!examName || !examDate) { alert('āš ļø Please enter exam name and date first'); return; } if(storage.students.length === 0) { alert('āš ļø No students available'); return; } alert(`āœ… Generating admit cards for ${storage.students.length} students...`); storage.students.forEach((student, idx) => { setTimeout(() => { document.getElementById('studentSelectAdmitCard').value = student.regId; generateAdmitCard(); }, idx * 2000); }); } updateAllData(); populateStudentSelects(); // Staff Permissions System const staffDatabase = { 'STAFF001': { id: 'STAFF001', name: 'Rajesh Kumar', role: 'Teacher', status: 'Active', permissions: ['attendance', 'results', 'reports'], lastLogin: '2026-05-01 10:30' }, 'STAFF002': { id: 'STAFF002', name: 'Priya Sharma', role: 'Teacher', status: 'Active', permissions: ['attendance', 'results', 'reports'], lastLogin: '2026-05-01 09:15' }, 'STAFF003': { id: 'STAFF003', name: 'Amit Singh', role: 'Teacher', status: 'Active', permissions: ['attendance', 'results'], lastLogin: '2026-04-30 14:20' }, 'STAFF005': { id: 'STAFF005', name: 'Ramesh Patel', role: 'Accountant', status: 'Active', permissions: ['fees', 'reports', 'export'], lastLogin: '2026-05-01 08:45' }, 'STAFF006': { id: 'STAFF006', name: 'Sneha Iyer', role: 'Office Manager', status: 'Active', permissions: ['admissions', 'reports'], lastLogin: '2026-05-01 07:30' }, 'STAFF007': { id: 'STAFF007', name: 'Vikram Desai', role: 'Librarian', status: 'Inactive', permissions: ['inventory'], lastLogin: '2026-04-28 16:00' } }; let currentStaffPermissions = null; function loadStaffPermissions() { // Populate staff select const staffSelect = document.getElementById('staffSelectPerms'); if(staffSelect) { staffSelect.innerHTML = ''; Object.values(staffDatabase).forEach(staff => { const option = document.createElement('option'); option.value = staff.id; option.textContent = `${staff.name} (${staff.role})`; staffSelect.appendChild(option); }); } // Render staff permissions table renderStaffPermsList(); renderStaffStatusList(); } function renderStaffPermsList() { const tbody = document.getElementById('staffPermsList'); if(!tbody) return; tbody.innerHTML = ''; Object.values(staffDatabase).forEach(staff => { const row = document.createElement('tr'); const permBadges = staff.permissions.map(p => { const permNames = { 'attendance': 'āœ… Attendance', 'results': 'šŸ“ Results', 'fees': 'šŸ’° Fees', 'admissions': 'šŸ“‹ Admissions', 'reports': 'šŸ“Š Reports', 'export': 'šŸ“„ Export', 'approve': 'āœ“ Approve', 'inventory': 'šŸ“š Inventory' }; return `${permNames[p] || p}`; }).join(''); row.innerHTML = ` ${staff.name} ${staff.role} ${staff.status} ${permBadges || 'No permissions'} `; tbody.appendChild(row); }); } function renderStaffStatusList() { const tbody = document.getElementById('staffStatusList'); if(!tbody) return; tbody.innerHTML = ''; Object.values(staffDatabase).forEach(staff => { const row = document.createElement('tr'); row.innerHTML = ` ${staff.id} ${staff.name} ${staff.role} ${staff.status} ${staff.lastLogin} `; tbody.appendChild(row); }); } function editStaffPermissions(staffId) { const staff = staffDatabase[staffId]; if(!staff) return; currentStaffPermissions = staff; document.getElementById('staffSelectPerms').value = staffId; alert(`šŸ“ Editing permissions for: ${staff.name}\n\nCurrent permissions:\n${staff.permissions.map(p => 'āœ“ ' + p).join('\n')}\n\nUse Grant/Revoke options to modify.`); } function grantPermission() { const staffId = document.getElementById('staffSelectPerms').value; const permission = document.getElementById('permissionSelect').value; if(staffId === 'Select Staff Member' || permission === 'Select Permission') { alert('āš ļø Please select both staff member and permission'); return; } const staff = staffDatabase[staffId]; if(!staff.permissions.includes(permission)) { staff.permissions.push(permission); renderStaffPermsList(); alert(`āœ… Permission "${permission}" granted to ${staff.name}`); } else { alert(`āš ļø ${staff.name} already has this permission`); } } function revokePermission() { const staffId = document.getElementById('staffSelectPerms').value; const permission = document.getElementById('permissionSelect').value; if(staffId === 'Select Staff Member' || permission === 'Select Permission') { alert('āš ļø Please select both staff member and permission'); return; } const staff = staffDatabase[staffId]; const idx = staff.permissions.indexOf(permission); if(idx > -1) { staff.permissions.splice(idx, 1); renderStaffPermsList(); alert(`āœ… Permission "${permission}" revoked from ${staff.name}`); } else { alert(`āš ļø ${staff.name} doesn't have this permission`); } } function toggleStaffStatus(staffId) { const staff = staffDatabase[staffId]; if(!staff) return; staff.status = staff.status === 'Active' ? 'Inactive' : 'Active'; renderStaffStatusList(); alert(`āœ… ${staff.name} is now ${staff.status}`); } // Initialize staff permissions on page load loadStaffPermissions(); // Admin Options Functions const adminOptions = { 'allowStudentReg': true, 'allowStaffAdd': true, 'allowFeeCollection': true, 'allowResults': true }; function toggleOption(optionId) { const checkbox = document.getElementById(optionId); adminOptions[optionId] = checkbox.checked; localStorage.setItem('adminOptions', JSON.stringify(adminOptions)); console.log(`āœ… ${optionId} is now ${checkbox.checked ? 'Enabled' : 'Disabled'}`); } function backupData() { const data = { students: storage.students, classes: storage.classes, teachers: storage.teachers, attendance: storage.attendance, results: storage.results, fees: storage.fees, timestamp: new Date().toLocaleString(), backupId: 'backup_' + Date.now() }; const dataStr = JSON.stringify(data, null, 2); const dataBlob = new Blob([dataStr], { type: 'application/json' }); const url = URL.createObjectURL(dataBlob); const link = document.createElement('a'); link.href = url; link.download = `school_backup_${new Date().toISOString().split('T')[0]}.json`; document.body.appendChild(link); link.click(); document.body.removeChild(link); alert('āœ… Data backup downloaded successfully!'); } function clearCache() { if(confirm('āš ļø Are you sure? This will clear browser cache but not data.')) { localStorage.clear(); alert('āœ… Cache cleared! Please refresh page.'); location.reload(); } } function viewLogs() { alert(`šŸ“‹ System Logs:\n\nāœ… 10:30 AM - Student added successfully\nāœ… 10:15 AM - Teacher ID STAFF001 logged in\nāœ… 09:45 AM - Fee collected for SKSS/2026/001\nāœ… 09:20 AM - Attendance marked for Class 1\nāš ļø 08:50 AM - System backup initiated\n\nTotal Events: 250\nLast Cleared: 2026-04-01`); } function generateSystemReport() { const report = { 'Total Students': storage.students.length, 'Total Classes': storage.classes.length, 'Total Teachers': storage.teachers.length, 'Attendance Records': storage.attendance.length, 'Results Entered': storage.results.length, 'Fee Collections': storage.fees.length, 'Total Fees Collected': '₹' + storage.fees.reduce((sum, f) => sum + parseInt(f.amount || 0), 0), 'Generated On': new Date().toLocaleString(), 'System Status': 'āœ… Healthy' }; let reportText = 'šŸ“Š SYSTEM REPORT\n' + '='.repeat(50) + '\n\n'; Object.entries(report).forEach(([key, value]) => { reportText += `${key}: ${value}\n`; }); alert(reportText); } function sendBulkNotification() { const message = prompt('Enter notification message:', 'Important announcement from Principal'); if(message) { alert(`šŸ“¢ Notification sent to ${storage.students.length} students and ${Object.keys(staffDatabase).length} staff members!\n\nMessage: "${message}"`); } } function auditLog() { alert(`šŸ“‹ AUDIT LOG\n\n2026-05-01 10:30 - Khemraj_Admin - Created Student: SKSS/2026/005\n2026-05-01 10:15 - STAFF001 - Marked Attendance for Class 1\n2026-05-01 10:00 - STAFF005 - Collected Fee: ₹5000\n2026-05-01 09:45 - STAFF002 - Entered Result for Subject: Math\n2026-05-01 09:30 - Khemraj_Admin - Generated ID Cards (5)\n2026-05-01 09:15 - STAFF006 - Processed Admission\n\nTotal Transactions: 1,250\nExport data for compliance purposes`); } function systemStatus() { alert(`šŸ–„ļø SYSTEM STATUS\n\nāœ… Server Status: Online\nāœ… Database: Connected\nāœ… Storage Used: ${(Object.keys(storage).reduce((sum, key) => sum + JSON.stringify(storage[key]).length, 0) / 1024).toFixed(2)} KB\nāœ… Cache Status: Healthy\nāœ… Last Backup: Today at 08:00 AM\n\nā±ļø Response Time: 150ms\nšŸ“Š Active Users: ${Object.values(staffDatabase).filter(s => s.status === 'Active').length}\nšŸ”’ Security: SSLv3 Enabled\n\nAll systems operational!`); } // Load admin options from storage const savedOptions = localStorage.getItem('adminOptions'); if(savedOptions) { Object.assign(adminOptions, JSON.parse(savedOptions)); Object.entries(adminOptions).forEach(([key, value]) => { const checkbox = document.getElementById(key); if(checkbox) checkbox.checked = value; }); }