Skip to content

Commit 616d94c

Browse files
authored
Add files via upload
1 parent 6b1064f commit 616d94c

File tree

8 files changed

+554
-0
lines changed

8 files changed

+554
-0
lines changed

admin.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Admin Dashboard</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="titlebar">
11+
<h1>Admin dashboard</h1>
12+
</div>
13+
<div class="home-button">
14+
<button onclick="location.href='index.html'">Home</button>
15+
</div>
16+
17+
<div class="admin-container">
18+
<h2>Admin - Payment details</h2>
19+
<table>
20+
<thead>
21+
<tr>
22+
<th>Student Name</th>
23+
<th>Registration No.</th>
24+
<th>Fee Payment Status</th>
25+
</tr>
26+
</thead>
27+
<tbody id="student-list">
28+
<!-- List of students -->
29+
</tbody>
30+
</table>
31+
</div>
32+
<script src="script.js"></script>
33+
</body>
34+
</html>

bill.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Payment Receipt</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="bill-container">
11+
<h1>Student Payment Management System</h1>
12+
<h2>Payment Receipt</h2>
13+
<hr>
14+
<div class="bill-details">
15+
<p><strong>Name:</strong> <span id="student-name"></span></p>
16+
<p><strong>Registration No:</strong> <span id="reg-no"></span></p>
17+
<p><strong>Date:</strong> <span id="payment-date"></span></p>
18+
<p><strong>Semester fees:</strong><span id="semester-fee">0.00</span></p>
19+
<p><strong>Exam fees:</strong><span id="exam-fee">0.00</span></p>
20+
<p><strong>Payment mode:</strong> Online</p>
21+
<p class="total-amount"><strong>Amount Paid:</strong><span id="amount-paid">0.00</span></p>
22+
</div>
23+
<button class="print-btn" onclick="window.print();">Print</button>
24+
</div>
25+
<script src="script.js"></script>
26+
</body>
27+
</html>

dashboard.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Student Dashboard</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="titlebar">
11+
<h1>Fee payment dashboard</h1>
12+
</div>
13+
<div class="home-button">
14+
<button onclick="location.href='index.html'">Home</button>
15+
</div>
16+
17+
<div class="dashboard-container">
18+
<h1>Welcome, <span id="student-name">Student</span></h1>
19+
<input type="hidden" id="reg-no">
20+
<hr>
21+
<div class="dashboard-content">
22+
<h2>Exam fee payment</h2>
23+
<div class="pay-container">
24+
<button id="pay-fee">Pay ₹1200</button>
25+
</div>
26+
<h2>Semester fee payment</h2>
27+
<div class="sem-pay-container">
28+
<button id="sem-pay-fee">Pay ₹85000</button>
29+
</div>
30+
31+
<h2>Payment History</h2>
32+
<ul id="payment-history"></ul>
33+
34+
<h2>Payment Status</h2>
35+
<p id="payment-status">Your payment status will be displayed here.</p>
36+
</div>
37+
38+
<!-- Logout Button -->
39+
<div class="logout-button">
40+
<button onclick="logout()">Logout</button>
41+
</div>
42+
</div>
43+
<script src="script.js"></script>
44+
</body>
45+
</html>

index.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Student Fee Management - Login</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="titlebar">
11+
<h1>Student Fee Management system</h1>
12+
</div>
13+
<!-- login -->
14+
<div class="login-container">
15+
<h2>Login</h2>
16+
<form id="login-form">
17+
<label for="reg-no">Registration Number:</label>
18+
<input type="text" id="reg-no" name="reg-no" required>
19+
20+
<label for="password">Password:</label>
21+
<input type="password" id="password" name="password" required>
22+
23+
<button type="submit">Login</button>
24+
</form>
25+
<p>New Student? <a href="register.html">Register Here→</a></p>
26+
<br>
27+
</div>
28+
29+
<!-- Admin Button -->
30+
<div class="admin-button">
31+
<button onclick="checkAdminPassword()">Admin</button>
32+
</div>
33+
34+
<script src="script.js"></script>
35+
</body>
36+
</html>

register.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Student Fee Management - Register</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="titlebar">
11+
<h1>Registration for new student</h1>
12+
</div>
13+
<div class="home-button">
14+
<button onclick="location.href='index.html'">Home</button>
15+
</div>
16+
17+
<div class="register-container">
18+
<h2>Student Registration</h2>
19+
<form id="register-form">
20+
<label for="name">Full Name:</label>
21+
<input type="text" id="name" name="name" required>
22+
23+
<label for="reg-no">Registration Number:</label>
24+
<input type="text" id="reg-no" name="reg-no" required>
25+
26+
<label for="password">Password:</label>
27+
<input type="password" id="password" name="password" required>
28+
29+
<button type="submit">Register</button>
30+
</form>
31+
</div>
32+
<script src="script.js"></script>
33+
</body>
34+
</html>

script.js

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
const loginForm = document.getElementById('login-form');
3+
const registerForm = document.getElementById('register-form');
4+
const payFeeButton = document.getElementById('pay-fee');
5+
const semFeeButton = document.getElementById('sem-pay-fee');
6+
const paymentHistoryList = document.getElementById('payment-history');
7+
const paymentStatus = document.getElementById('payment-status');
8+
const studentList = document.getElementById('student-list');
9+
const loggedInStudent = JSON.parse(localStorage.getItem('loggedInStudent'));
10+
11+
//bill
12+
if (window.location.pathname.includes('bill.html')) {
13+
const urlParams = new URLSearchParams(window.location.search);
14+
const name = urlParams.get('name') || 'N/A';
15+
const regNo = urlParams.get('regNo') || 'N/A';
16+
const paymentDate = urlParams.get('date') || 'N/A';
17+
const feeType = urlParams.get('feeType') || '';
18+
const amountPaid = urlParams.get('amount') || '0.00';
19+
20+
document.getElementById('student-name').textContent = name;
21+
document.getElementById('reg-no').textContent = regNo;
22+
document.getElementById('payment-date').textContent = paymentDate;
23+
24+
// set specific fee
25+
if (feeType === 'Semester fee Paid') {
26+
document.getElementById('semester-fee').textContent = amountPaid;
27+
} else if (feeType === 'Exam fee Paid') {
28+
document.getElementById('exam-fee').textContent = amountPaid;
29+
}
30+
31+
document.querySelector('.total-amount').textContent = `Amount Paid: ₹${amountPaid}`;
32+
return;
33+
}
34+
35+
//open bill
36+
function openBillPage(studentName, regNo, paymentDate, feeType, amountPaid) {
37+
const billUrl = `bill.html?name=${encodeURIComponent(studentName)}&regNo=${encodeURIComponent(regNo)}&date=${encodeURIComponent(paymentDate)}&feeType=${encodeURIComponent(feeType)}&amount=${encodeURIComponent(amountPaid)}`;
38+
window.open(billUrl, '_blank');
39+
}
40+
41+
// Registration Logic
42+
if (registerForm) {
43+
registerForm.addEventListener('submit', (e) => {
44+
e.preventDefault();
45+
const name = document.getElementById('name').value;
46+
const regNo = document.getElementById('reg-no').value;
47+
const password = document.getElementById('password').value;
48+
49+
if (localStorage.getItem(regNo)) {
50+
alert('Registration number already exists.');
51+
} else {
52+
localStorage.setItem(regNo, JSON.stringify({ name, password, status: '', paymentHistory: [] }));
53+
alert(`Registered successfully as ${name}`);
54+
window.location.href = 'index.html';
55+
}
56+
});
57+
}
58+
59+
// Login Logic
60+
if (loginForm) {
61+
loginForm.addEventListener('submit', (e) => {
62+
e.preventDefault();
63+
const regNo = document.getElementById('reg-no').value;
64+
const password = document.getElementById('password').value;
65+
const userData = JSON.parse(localStorage.getItem(regNo));
66+
67+
if (userData && userData.password === password) {
68+
alert(`Logged in successfully as ${userData.name}`);
69+
localStorage.setItem('loggedInStudent', JSON.stringify({ studentName: userData.name, regNo }));
70+
window.location.href = 'dashboard.html';
71+
} else {
72+
alert('Invalid registration number or password.');
73+
}
74+
});
75+
}
76+
77+
//dashboard logic
78+
if (window.location.pathname.includes('dashboard.html')){
79+
80+
if (!loggedInStudent) {
81+
alert('No student information found. Please log in.');
82+
window.location.href = 'index.html';
83+
return;
84+
}
85+
document.getElementById('student-name').textContent = loggedInStudent.studentName;
86+
87+
const regNo = loggedInStudent.regNo;
88+
const userData = JSON.parse(localStorage.getItem(regNo));
89+
90+
if (userData) {
91+
updatePaymentButtons(userData);
92+
}
93+
// change button to 'paid' if paid
94+
function updatePaymentButtons(userData) {
95+
if (userData.status.includes('Exam fee Paid')) {
96+
payFeeButton.textContent = 'Paid';
97+
payFeeButton.disabled = true;
98+
}
99+
if (userData.status.includes('Semester fee Paid')) {
100+
semFeeButton.textContent = 'Paid';
101+
semFeeButton.disabled = true;
102+
}
103+
paymentStatus.textContent = userData.status || 'Your payment status will be displayed here.';
104+
}
105+
}
106+
107+
// Handle payments
108+
function handlePayment(button, feeType, amountPaid) {
109+
const loggedInStudent = JSON.parse(localStorage.getItem('loggedInStudent'));
110+
if (!loggedInStudent) {
111+
alert('No student information found. Please log in again.');
112+
window.location.href = 'index.html';
113+
return;
114+
}
115+
116+
const regNo = loggedInStudent.regNo;
117+
const userData = JSON.parse(localStorage.getItem(regNo));
118+
119+
if (userData) {
120+
userData.status += (userData.status ? ', ' : '') + feeType;
121+
const paymentDate = new Date().toLocaleDateString();
122+
const paymentRecord = `${feeType} of ₹${amountPaid} paid on ${paymentDate}`;
123+
userData.paymentHistory.push(paymentRecord);
124+
125+
localStorage.setItem(regNo, JSON.stringify(userData));
126+
alert(`${feeType} successfully!`);
127+
paymentStatus.textContent = userData.status;
128+
129+
const li = document.createElement('li'); //payment date time show
130+
li.textContent = paymentRecord;
131+
paymentHistoryList.appendChild(li);
132+
133+
button.textContent = 'Paid';
134+
button.disabled = true;
135+
openBillPage(loggedInStudent.studentName, regNo, paymentDate, feeType, amountPaid);
136+
137+
updateAdminStatus(userData);
138+
} else {
139+
alert('User not found!');
140+
}
141+
}
142+
143+
// Exam Fee Payment
144+
if (payFeeButton) {
145+
payFeeButton.addEventListener('click', () => {
146+
handlePayment(payFeeButton, 'Exam fee Paid', 1200);
147+
});
148+
}
149+
150+
// Semester Fee Payment
151+
if (semFeeButton) {
152+
semFeeButton.addEventListener('click', () => {
153+
handlePayment(semFeeButton, 'Semester fee Paid', 85000);
154+
});
155+
}
156+
157+
// Update admin dashboard
158+
function updateAdminStatus(userData) {
159+
const studentRows = document.querySelectorAll('#student-list tr');
160+
studentRows.forEach(row => {
161+
const regNo = row.children[1].textContent;
162+
if (regNo === userData.regNo) {
163+
row.children[2].textContent = userData.status;
164+
}
165+
});
166+
}
167+
168+
// Admin - Display all students
169+
if (studentList) {
170+
const students = Object.keys(localStorage).map((key) => {
171+
if (key !== 'loggedInStudent') {
172+
const student = JSON.parse(localStorage.getItem(key));
173+
return { name: student.name, regNo: key, status: student.status || 'Not Paid' };
174+
}
175+
}).filter(Boolean);
176+
177+
students.forEach(student => {
178+
const row = document.createElement('tr');
179+
row.innerHTML = `<td>${student.name}</td><td>${student.regNo}</td><td>${student.status}</td>`;
180+
studentList.appendChild(row);
181+
});
182+
}
183+
184+
// Admin password
185+
window.checkAdminPassword = function() {
186+
const adminPassword = "123";
187+
const enteredPassword = prompt("Please enter the admin password:");
188+
189+
if (enteredPassword === adminPassword) {
190+
window.location.href = 'admin.html';
191+
} else {
192+
alert("Incorrect password. Access denied.");
193+
}
194+
};
195+
196+
// Logout
197+
window.logout = function() {
198+
localStorage.removeItem('loggedInStudent');
199+
window.location.href = 'index.html';
200+
};
201+
});

0 commit comments

Comments
 (0)