Skip to content
This repository was archived by the owner on Jun 9, 2024. It is now read-only.

Commit 149641b

Browse files
committed
Change front-end display properties
1 parent a3c458f commit 149641b

5 files changed

Lines changed: 33 additions & 31 deletions

File tree

src/main/java/EJB/LoanOracleBean.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ public ArrayList<loanModel> getActiveLoans() {
117117
"b.PAGES PAGES," +
118118
"a.FIRST_NAME AUTHOR_FIRST_NAME," +
119119
"a.LAST_NAME AUTHOR_LAST_NAME FROM loans l " +
120-
"WHERE l.returned = 0 " +
121120
"INNER JOIN library_users u ON l.user_id = u.user_id " +
122121
"INNER JOIN books b ON b.book_id = l.book_id " +
123-
"INNER JOIN authors a ON b.author_id = a.author_id";
122+
"INNER JOIN authors a ON b.author_id = a.author_id " +
123+
"WHERE l.returned = 0";
124124
ArrayList loans_list = new ArrayList();
125125
Statement stmt = null;
126126

@@ -129,6 +129,8 @@ public ArrayList<loanModel> getActiveLoans() {
129129
stmt = con.createStatement();
130130
ResultSet rs = stmt.executeQuery(query);
131131

132+
System.out.println(rs);
133+
132134
while (rs.next()) {
133135
loanModel loan = new loanModel();
134136
loan.setLoanId(rs.getLong("LOAN_ID"));

src/main/webapp/fines.jsp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link href="./Assets/css/sb-admin-2.min.css" rel="stylesheet">
1010
<title>Library - Fines</title>
1111
<script>
12-
fetch("http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/fines").then(
12+
fetch("http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/fines").then(
1313
res => {
1414
res.json().then(
1515
data => {
@@ -18,15 +18,15 @@
1818
var temp = "";
1919
data.forEach((itemData) => {
2020
temp += "<tr>";
21-
temp += "<td>" + itemData.id + "</td>";
22-
temp += "<td>" + itemData.fine_amount + "</td>";
23-
temp += "<td>" + itemData.fine_date + "</td>";
24-
temp += "<td>" + itemData.paid + "</td>";
25-
temp += "<td>" + itemData.bookData.Title + "</td>";
26-
temp += "<td>" + itemData.bookData.Author + "</td>";
27-
temp += "<td>" + itemData.loanData.return_by + "</td>";
28-
temp += "<td>" + itemData.loanData.return_date + "</td>";
29-
temp += "<td>" + itemData.userData.name + "</td>";
21+
temp += "<td>" + itemData.FineId + "</td>";
22+
temp += "<td>£" + itemData.FineAmount + "</td>";
23+
temp += "<td>" + itemData.FineDate + "</td>";
24+
temp += "<td>" + itemData.Paid + "</td>";
25+
temp += "<td>" + itemData.BookTitle + "</td>";
26+
temp += "<td>" + itemData.AuthorFirstName + " " + itemData.AuthorLastName + "</td>";
27+
temp += "<td>" + itemData.ReturnBy + "</td>";
28+
temp += "<td>" + itemData.ReturnedOn + "</td>";
29+
temp += "<td>" + itemData.UserFirstName + " " + itemData.UserLastName + "</td>";
3030
3131
});
3232
document.getElementById('data').innerHTML = temp;

src/main/webapp/loanHistoryReport.jsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
<title>Library - Loan History</title>
1111
<!-- Get Books -->
1212
<script>
13-
fetch("http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/users").then(
13+
fetch("http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/users").then(
1414
res => {
1515
res.json().then(
1616
data => {
1717
if (data.length > 0) {
1818
var temp = "<option disabled selected>Select a user</option>";
1919
data.forEach((itemData) => {
20-
temp += "<option value='"+itemData.Id+"'>" + itemData.Name + " - (" + itemData.Email + ")</option>";
20+
temp += "<option value='"+itemData.UserId+"'>" + itemData.First_Name + " " + itemData.Last_Name + " - (" + itemData.Email + ")</option>";
2121
});
2222
document.getElementById('users').innerHTML = temp;
2323
}
@@ -161,7 +161,7 @@
161161
document.getElementById("submitbtn").addEventListener("click", function() {
162162
const customerId = document.getElementById("users").value
163163
const date = document.getElementById("monthFilter").value
164-
fetch(`http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/loan-report?id=`+customerId+`&date=`+date).then(
164+
fetch(`http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/loan-report?id=`+customerId+`&date=`+date).then(
165165
res => {
166166
res.json().then(
167167
data => {

src/main/webapp/returnBook.jsp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
loanId: loanId,
1717
bookId: bookId
1818
};
19-
$.post("http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/return", body, (data, status) => {
19+
$.post("http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/return", body, (data, status) => {
2020
console.log(data);
2121
location.reload();
2222
});
2323
}
24-
fetch("http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/return").then(
24+
fetch("http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/return").then(
2525
res => {
2626
res.json().then(
2727
data => {
@@ -30,11 +30,11 @@
3030
var temp = "";
3131
data.forEach((itemData) => {
3232
temp += "<tr>";
33-
temp += "<td>" + itemData.id + "</td>";
34-
temp += "<td>" + itemData.bookData.Title + "</td>";
35-
temp += "<td>" + itemData.bookData.Author + "</td>";
36-
temp += "<td>" + itemData.userData.name + "</td>";
37-
temp += `<td><button onclick="returnBook('`+itemData.id+`','`+itemData.bookData.id+`')">Return Book</button></td>`;
33+
temp += "<td>" + itemData.LoanId + "</td>";
34+
temp += "<td>" + itemData.BookTitle + "</td>";
35+
temp += "<td>" + itemData.AuthorFirstName + " " + itemData.AuthorLastName + "</td>";
36+
temp += "<td>" + itemData.UserFirstName + " " + itemData.UserLastName + "</td>";
37+
temp += `<td><button onclick="returnBook('`+itemData.LoanId+`','`+itemData.BookId+`')">Return Book</button></td>`;
3838
});
3939
document.getElementById('data').innerHTML = temp;
4040
$('#dataTable').DataTable();

src/main/webapp/unpaidfines.jsp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
const body = {
1515
fineId: fineId
1616
};
17-
$.post("http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/fines", body, (data, status) => {
17+
$.post("http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/fines", body, (data, status) => {
1818
console.log(data);
1919
location.reload();
2020
});
2121
}
22-
fetch("http://localhost:8080/MongoDB-Library-1.0-SNAPSHOT/unpaidFines").then(
22+
fetch("http://localhost:8080/OracleSQL-Library-1.0-SNAPSHOT/unpaidFines").then(
2323
res => {
2424
res.json().then(
2525
data => {
@@ -28,13 +28,13 @@
2828
var temp = "";
2929
data.forEach((itemData) => {
3030
temp += "<tr>";
31-
temp += "<td>" + itemData.id + "</td>";
32-
temp += "<td>£" + itemData.fine_amount + "</td>";
33-
temp += "<td>" + itemData.fine_date + "</td>";
34-
temp += "<td>" + itemData.loanData.return_by + "</td>";
35-
temp += "<td>" + itemData.loanData.return_date + "</td>";
36-
temp += "<td>" + itemData.userData.name + "</td>";
37-
temp += `<td><button onclick="payFine('`+itemData.id+`')">Mark as paid</button></td>`;
31+
temp += "<td>" + itemData.FineId + "</td>";
32+
temp += "<td>£" + itemData.FineAmount + "</td>";
33+
temp += "<td>" + itemData.FineDate + "</td>";
34+
temp += "<td>" + itemData.ReturnBy + "</td>";
35+
temp += "<td>" + itemData.ReturnedOn + "</td>";
36+
temp += "<td>" + itemData.UserFirstName + " " + itemData.UserLastName + "</td>";
37+
temp += `<td><button onclick="payFine('`+itemData.FineId+`')">Mark as paid</button></td>`;
3838
3939
});
4040
document.getElementById('data').innerHTML = temp;

0 commit comments

Comments
 (0)