-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
121 lines (93 loc) · 3.62 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
document.addEventListener("DOMContentLoaded", function () {
const borrowedBooks = [
{ title: "Book 1", IssueDate: "01/02/2024", borrowedDate: "01/01/2023", fine:"0.00 rs/-" },
{ title: "Book 2", IssueDate: "01/04/2024", borrowedDate: "01/01/2023", fine: "0.00 rs/-" },
{ title: "Book 3", IssueDate: "01/07/2024", borrowedDate: "01/01/2023", fine: "0.00 rs/-" },
];
const borrowedBooksTable = document.getElementById("borrowedBooksTable").getElementsByTagName("tbody")[0];
borrowedBooks.forEach(book => {
const row = borrowedBooksTable.insertRow();
row.insertCell(0).textContent = book.title;
row.insertCell(1).textContent = book.IssueDate;
row.insertCell(2).textContent = book.borrowedDate;
row.insertCell(3).textContent = book.fine;
});
// Function to handle file input change
document.getElementById('fileInput').addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('profilePhoto').src = e.target.result;
};
reader.readAsDataURL(file);
}
});
function showModalupdateProfile() {
var modal = document.getElementById("updateProfileModal");
if (modal) {
modal.style.display = "block";
}
}
// Function to hide the modal
function hideModalupdateProfile() {
var modal = document.getElementById("updateProfileModal");
if (modal) {
modal.style.display = "none";
}
}
function showModalPayFine() {
var modal = document.getElementById("PayFineModal");
if (modal) {
modal.style.display = "block";
}
}
function hideModalPayFine() {
var modal = document.getElementById("PayFineModal");
if (modal) {
modal.style.display = "none";
}
}
function showModalIssueBook() {
var modal = document.getElementById("IssueBookModal");
if (modal) {
modal.style.display = "block";
}
}
function hideModalIssueBook() {
var modal = document.getElementById("IssueBookModal");
if (modal) {
modal.style.display = "none";
}
}
// Function to save changes
function saveChanges() {
var newName = document.getElementById("updateName").value;
var username = document.getElementById("username");
if (newName) {
username.textContent = newName;
hideModalupdateProfile();
}
}
function PayFine() {
// Get the selected payment method
var paymentMethod = document.getElementById("paymentMethod").value;
// Validate if a payment method is selected
if (paymentMethod !== "") {
// Process payment
alert("Your Payment is initiated!, you are requested not to refresh the page and wait for the payment page arrival ! ");
} else {
// If no payment method is selected, show an error message
alert("Please select a payment method.");
}
}
function IssueNewBook(){
var updateBooks = document.getElementById("updateBooks").value;
if (updateBooks != ""){
alert("Your new book request is recorded , a conformation email is already has sent to you regarding this process , please go through the email and select your preferred book!")
}
else {
alert("Please select the between the existing options");
}
}
});