From c44928f2dd41263afede27a82bfc6473df64ddb4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Mar 2025 11:38:17 +0100 Subject: [PATCH 1/7] fixed bug that when loaning a book doesnt auto give us the correct due date, now works --- js/self-check.js | 68 +++++++++++++++++++++++++++++++++++++++++++----- self-check.html | 2 +- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/js/self-check.js b/js/self-check.js index 855b49b..4693344 100644 --- a/js/self-check.js +++ b/js/self-check.js @@ -177,11 +177,20 @@ function loan() { data: "" + circDesk + "" + libraryName + "", dataType: "xml" }).done(function(data){ - - var dueDate = new Date($(data).find("due_date").text()); - var dueDateText = (parseInt(dueDate.getDate() + "/" + dueDate.getMonth()) + 1) + "/" + dueDate.getFullYear(); - $("#loanstable").append("" + $(data).find("title").text() + "" + dueDateText + ""); - returnToBarcode(); + // Extract loanId from the POST response + var loanId = $(data).find("loan_id").text(); + if (!loanId) { + console.error('Loan ID is undefined'); + alert('Failed to retrieve loan ID'); + $("#myModal").hide(); + returnToBarcode(); + return; + } + // var dueDate = new Date($(data).find("due_date").text()); + // var dueDateText = (parseInt(dueDate.getDate() + "/" + dueDate.getMonth()) + 1) + "/" + dueDate.getFullYear(); + // $("#loanstable").append("" + $(data).find("title").text() + "" + dueDateText + ""); + // returnToBarcode(); + fetchUserDetailsAndLoans(); }).fail(function(jqxhr, textStatus, error) { console.log(jqxhr.responseText); $("#modalheader").text(""); @@ -198,6 +207,45 @@ function loan() { } } + +function fetchUserDetailsAndLoans() { + $.ajax({ + type: "GET", + url: baseURL + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json", + contentType: "text/plain", + dataType: "json", + crossDomain: true + }).done(function(data) { + user = data; + $("#scanboxtitle").text("Welcome " + data.first_name + " " + data.last_name); + $("#userloans").text(data.loans.value); + $("#userrequests").text(data.requests.value); + $("#userfees").text("€ " + data.fees.value); + $("#loanstable").find("tr:gt(0)").remove(); + + $.ajax({ + type: "GET", + url: data.loans.link, + contentType: "text/plain", + dataType: "json", + crossDomain: true + }).done(function(loanData) { + loanData.item_loan.forEach(function(loan) { + var dueDate = new Date(loan.due_date); + var dueDateText = `${dueDate.getDate()}/${dueDate.getMonth() + 1}/${dueDate.getFullYear()}`; + $("#loanstable").append("" + loan.title + "" + dueDateText + ""); + returnToBarcode(); + }); + }).fail(function(jqxhr, textStatus, error) { + console.log(jqxhr.responseText); + }); + + + $("#barcode").focus(); + }).fail(function(jqxhr, textStatus, error) { + console.log(jqxhr.responseText); + }); +} function renewLoan(loanId) { const userId = user.primary_id; $("#modalheader").text("processing renewal, please wait..."); @@ -259,4 +307,12 @@ function logout() { $( document ).ready(function() { $( "#userid" ).focus(); - }); \ No newline at end of file + }); + +// function keepSessionActive() { +// setInterval(() => { +// console.log("Keeping the session active"); +// }, 2 * 60 * 1000); // 2 minutes in milliseconds +// } + +// keepSessionActive(); \ No newline at end of file diff --git a/self-check.html b/self-check.html index 71baeff..7ca9afd 100644 --- a/self-check.html +++ b/self-check.html @@ -24,7 +24,7 @@
-
Self-Check Service
+
Self-Checkout Service


Please scan your user card ID:
From 0d271e2c9b2dfb5bd391e013d5ac522239b3c142 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Apr 2025 10:05:56 +0200 Subject: [PATCH 2/7] commit --- js/self-check.js | 562 ++++++++++++++++++++++++++--------------------- self-check.html | 4 +- 2 files changed, 315 insertions(+), 251 deletions(-) diff --git a/js/self-check.js b/js/self-check.js index 4693344..1e08911 100644 --- a/js/self-check.js +++ b/js/self-check.js @@ -1,49 +1,44 @@ - var baseURL = "https://services.libis.be"; var libraryName = "RBIB"; var circDesk = "DEFAULT_CIRC_DESK"; - function initiate() { - getModalBox(); - - $("#barcode").bind("keypress", function(e) { - var code = e.keyCode || e.which; - if(code == 13) { - loan(); - } - }); - - - $("#userid").bind("keypress", function(e) { - var code = e.keyCode || e.which; - if(code == 13) { - login(); - } - }); + getModalBox(); + + $("#barcode").bind("keypress", function (e) { + var code = e.keyCode || e.which; + if (code == 13) { + loan(); + } + }); + + $("#userid").bind("keypress", function (e) { + var code = e.keyCode || e.which; + if (code == 13) { + login(); + } + }); } var modal; var span; var user = null; // User data to track login state - function getModalBox() { - - // Get the modal - modal = document.getElementById('myModal'); - $("#myModal").hide(); - - // Get the element that closes the modal - span = document.getElementsByClassName("close")[0]; - - // When the user clicks on (x), close the modal - span.onclick = function() { - $("#myModal").hide(); - } + // Get the modal + modal = document.getElementById("myModal"); + $("#myModal").hide(); + + // Get the element that closes the modal + span = document.getElementsByClassName("close")[0]; - // When the user clicks anywhere outside of the modal, close it - /* + // When the user clicks on (x), close the modal + span.onclick = function () { + $("#myModal").hide(); + }; + + // When the user clicks anywhere outside of the modal, close it + /* window.onclick = function(event) { if (event.target == modal) { $("#myModal").hide(); @@ -53,266 +48,335 @@ function getModalBox() { } function returnToBarcode() { - $("#barcode").prop("disabled", false); - $("#myModal").hide(); - - $("#barcode").val(""); - $("#barcode").focus(); + $("#barcode").prop("disabled", false); + $("#myModal").hide(); + + $("#barcode").val(""); + $("#barcode").focus(); } var inactivityTime = function () { - var time; - var logoutTime = 30000; // 30 seconds + var time; + var logoutTime = 30000; // 30 seconds - function resetTimer() { - if (user) { // Only reset the timer if the user is logged in - clearTimeout(time); - time = setTimeout(logoutUser, logoutTime); - } + function resetTimer() { + if (user) { + // Only reset the timer if the user is logged in + clearTimeout(time); + time = setTimeout(logoutUser, logoutTime); } + } - // Events to reset the timer - window.onload = resetTimer; - document.onmousemove = resetTimer; - document.onkeypress = resetTimer; - document.ontouchstart = resetTimer; + // Events to reset the timer + window.onload = resetTimer; + document.onmousemove = resetTimer; + document.onkeypress = resetTimer; + document.ontouchstart = resetTimer; - // Logout function - function logoutUser() { - if (user) { // Only log out if the user is logged in - logout(); - returnToBarcode(); - user = null; - } + // Logout function + function logoutUser() { + if (user) { + // Only log out if the user is logged in + logout(); + returnToBarcode(); + user = null; } + } }; // Initialize the inactivity timer inactivityTime(); -var renewButtonText = 'RENEW' +var renewButtonText = "RENEW"; /* LOGIN */ function login() { - var loginid = $("#userid").val(); - if ((loginid != null) && (loginid != "")) { - - $("#userid").prop("disabled", true); - $("#loginerror").addClass("hide"); - - $("#modalheader").text("loading data, please wait..."); - $("#myModal").show(); - $(".close").hide(); - - $.ajax({ - type: "GET", - url: baseURL + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json", - contentType: "text/plain", - dataType: "json", - crossDomain: true - - }).done(function(data) { - user = data; - // Prepare scan box - $("#scanboxtitle").text("Welcome " + data.first_name + " " + data.last_name); - $("#userloans").text(data.loans.value); - $("#userrequests").text(data.requests.value); - $("#userfees").text("€ " + data.fees.value); - - $("#loanstable").find("tr:gt(0)").remove(); - - // Fetch loan details - $.ajax({ - type: "GET", - url: data.loans.link , - contentType: "text/plain", - dataType: "json", - crossDomain: true - }).done(function(loanData) { - // Iterate through loans and append to table - loanData.item_loan.forEach(function(loan) { - var dueDate = new Date(loan.due_date); - var dueDateText = (dueDate.getDate() ) + "/" + (dueDate.getMonth() + 1) + "/" + dueDate.getFullYear(); - $("#loanstable").append("" + loan.title + "" + dueDateText + ""); - returnToBarcode(); - }); - }).fail(function(jqxhr, textStatus, error) { - console.log(jqxhr.responseText); - }); + var loginid = $("#userid").val(); + if (loginid != null && loginid != "") { + $("#userid").prop("disabled", true); + $("#loginerror").addClass("hide"); - $("#loginbox").addClass("hide"); - $("#scanbox").toggleClass("hide"); - - $("#barcode").focus(); - - }).fail(function(jqxhr, textStatus, error) { - $("#loginerror").toggleClass("hide"); - console.log(jqxhr.responseText); - - }).always(function() { - $("#userid").prop("disabled", false); - $("#myModal").hide(); - }); - } -} - -function loaduser(data) { - alert(data); -} - -function loan() { - - var barcode = $("#barcode").val(); - if ((barcode != null) && (barcode != "")) { - - $("#modalheader").text("processing request, please wait..."); - $("#myModal").show(); - $(".close").hide(); - - $("#barcode").prop("disabled", true); - - $.ajax({ - type: "POST", - url: baseURL + "/almaws/v1/users/" + user.primary_id + "/loans?user_id_type=all_unique&item_barcode=" + $("#barcode").val(), - contentType: "application/xml", - data: "" + circDesk + "" + libraryName + "", - dataType: "xml" - }).done(function(data){ - // Extract loanId from the POST response - var loanId = $(data).find("loan_id").text(); - if (!loanId) { - console.error('Loan ID is undefined'); - alert('Failed to retrieve loan ID'); - $("#myModal").hide(); - returnToBarcode(); - return; - } - // var dueDate = new Date($(data).find("due_date").text()); - // var dueDateText = (parseInt(dueDate.getDate() + "/" + dueDate.getMonth()) + 1) + "/" + dueDate.getFullYear(); - // $("#loanstable").append("" + $(data).find("title").text() + "" + dueDateText + ""); - // returnToBarcode(); - fetchUserDetailsAndLoans(); - }).fail(function(jqxhr, textStatus, error) { - console.log(jqxhr.responseText); - $("#modalheader").text(""); - $("#modalheader").append("item not avaiable for loan.

please see the reference desk for more information

"); - $("#barcodeerrorbutton").focus(); - - $(".close").show(); - - $("#barcode").val(""); - - }).always(function() { - - }); - - } -} + $("#modalheader").text("loading data, please wait..."); + $("#myModal").show(); + $(".close").hide(); -function fetchUserDetailsAndLoans() { $.ajax({ - type: "GET", - url: baseURL + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json", - contentType: "text/plain", - dataType: "json", - crossDomain: true - }).done(function(data) { + type: "GET", + url: + baseURL + + "/almaws/v1/users/" + + $("#userid").val() + + "?expand=loans,requests,fees&format=json", + contentType: "text/plain", + dataType: "json", + crossDomain: true, + }) + .done(function (data) { user = data; - $("#scanboxtitle").text("Welcome " + data.first_name + " " + data.last_name); + // Prepare scan box + $("#scanboxtitle").text( + "Welcome " + data.first_name + " " + data.last_name + ); $("#userloans").text(data.loans.value); $("#userrequests").text(data.requests.value); $("#userfees").text("€ " + data.fees.value); + $("#loanstable").find("tr:gt(0)").remove(); + // Fetch loan details $.ajax({ - type: "GET", - url: data.loans.link, - contentType: "text/plain", - dataType: "json", - crossDomain: true - }).done(function(loanData) { - loanData.item_loan.forEach(function(loan) { - var dueDate = new Date(loan.due_date); - var dueDateText = `${dueDate.getDate()}/${dueDate.getMonth() + 1}/${dueDate.getFullYear()}`; - $("#loanstable").append("" + loan.title + "" + dueDateText + ""); - returnToBarcode(); + type: "GET", + url: data.loans.link, + contentType: "text/plain", + dataType: "json", + crossDomain: true, + }) + .done(function (loanData) { + // Iterate through loans and append to table + loanData.item_loan.forEach(function (loan) { + var dueDate = new Date(loan.due_date); + var dueDateText = + dueDate.getDate() + + "/" + + (dueDate.getMonth() + 1) + + "/" + + dueDate.getFullYear(); + $("#loanstable").append( + "" + + loan.title + + "" + + dueDateText + + "" + ); + returnToBarcode(); }); - }).fail(function(jqxhr, textStatus, error) { + }) + .fail(function (jqxhr, textStatus, error) { console.log(jqxhr.responseText); - }); + }); + + $("#loginbox").addClass("hide"); + $("#scanbox").toggleClass("hide"); - $("#barcode").focus(); - }).fail(function(jqxhr, textStatus, error) { + }) + .fail(function (jqxhr, textStatus, error) { + $("#loginerror").toggleClass("hide"); console.log(jqxhr.responseText); - }); + }) + .always(function () { + $("#userid").prop("disabled", false); + $("#myModal").hide(); + }); + } } -function renewLoan(loanId) { - const userId = user.primary_id; - $("#modalheader").text("processing renewal, please wait..."); + +function loaduser(data) { + alert(data); +} + +function loan() { + var barcode = $("#barcode").val(); + if (barcode != null && barcode != "") { + $("#modalheader").text("processing request, please wait..."); $("#myModal").show(); $(".close").hide(); + + $("#barcode").prop("disabled", true); + $.ajax({ - type: "POST", - url: baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId + "?op=renew", - contentType: "application/xml", - data: "" + circDesk + "" + libraryName + "", - dataType: "xml" - }).done(function(data) { - // Make a new GET request to fetch the updated loan data to fix bug of not seeing immediatly - $.ajax({ - type: "GET", - url: baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId, - contentType: "application/json", - dataType: "json" - }).done(function(updatedLoanData) { - var updatedDueDate = new Date(updatedLoanData.due_date); - var updatedDueDateText = `${updatedDueDate.getDate()}/${updatedDueDate.getMonth() + 1}/${updatedDueDate.getFullYear()}`; - // Update the due date in the table - var dueDateCell = $("#loan-" + loanId + " td:nth-child(2)"); - dueDateCell.text(updatedDueDateText); - - // if 401193 value for last renew status -> means that renewd succes, else not succes renewed for whatever reason - var succesfullyRenewedValueCode = '401193;' - var LastRenewedValueCode = updatedLoanData?.last_renew_status?.value - - var renewCell = $("#loan-" + loanId + " td:nth-child(3)"); - if(LastRenewedValueCode == succesfullyRenewedValueCode){ - renewCell.text('RENEWED'); - renewCell.removeClass('not-renewable').addClass('renewed'); - } else { - renewCell.text('NOT RENEWABLE'); - renewCell.removeClass('renewed').addClass('not-renewable'); - } - $("#myModal").hide(); - }).fail(function(error) { - console.error('Error fetching updated loan data:', error); - alert('Failed to fetch updated loan data'); - $("#myModal").hide(); + type: "POST", + url: + baseURL + + "/almaws/v1/users/" + + user.primary_id + + "/loans?user_id_type=all_unique&item_barcode=" + + $("#barcode").val(), + contentType: "application/xml", + data: + "" + + circDesk + + "" + + libraryName + + "", + dataType: "xml", + }) + .done(function (data) { + // Extract loanId from the POST response + var loanId = $(data).find("loan_id").text(); + if (!loanId) { + console.error("Loan ID is undefined"); + alert("Failed to retrieve loan ID"); + $("#myModal").hide(); + returnToBarcode(); + return; + } + // var dueDate = new Date($(data).find("due_date").text()); + // var dueDateText = (parseInt(dueDate.getDate() + "/" + dueDate.getMonth()) + 1) + "/" + dueDate.getFullYear(); + // $("#loanstable").append("" + $(data).find("title").text() + "" + dueDateText + ""); + // returnToBarcode(); + fetchUserDetailsAndLoans(); + }) + .fail(function (jqxhr, textStatus, error) { + console.log(jqxhr.responseText); + $("#modalheader").text(""); + $("#modalheader").append( + "Something went wrong.

Please consult the library information desk for more information

" + ); + $("#barcodeerrorbutton").focus(); + + $(".close").show(); + + $("#barcode").val(""); + }) + .always(function () {}); + } +} + +function fetchUserDetailsAndLoans() { + $.ajax({ + type: "GET", + url: + baseURL + + "/almaws/v1/users/" + + $("#userid").val() + + "?expand=loans,requests,fees&format=json", + contentType: "text/plain", + dataType: "json", + crossDomain: true, + }) + .done(function (data) { + user = data; + $("#scanboxtitle").text( + "Welcome " + data.first_name + " " + data.last_name + ); + $("#userloans").text(data.loans.value); + $("#userrequests").text(data.requests.value); + $("#userfees").text("€ " + data.fees.value); + $("#loanstable").find("tr:gt(0)").remove(); + + $.ajax({ + type: "GET", + url: data.loans.link, + contentType: "text/plain", + dataType: "json", + crossDomain: true, + }) + .done(function (loanData) { + loanData.item_loan.forEach(function (loan) { + var dueDate = new Date(loan.due_date); + var dueDateText = `${dueDate.getDate()}/${ + dueDate.getMonth() + 1 + }/${dueDate.getFullYear()}`; + $("#loanstable").append( + "" + + loan.title + + "" + + dueDateText + + "" + ); + returnToBarcode(); + }); + }) + .fail(function (jqxhr, textStatus, error) { + console.log(jqxhr.responseText); }); - - }).fail(function(error) { - console.error('Error:', error); - alert('Failed to renew loan'); - $("#myModal").hide(); + + $("#barcode").focus(); + }) + .fail(function (jqxhr, textStatus, error) { + console.log(jqxhr.responseText); + }); +} +function renewLoan(loanId) { + const userId = user.primary_id; + $("#modalheader").text("processing renewal, please wait..."); + $("#myModal").show(); + $(".close").hide(); + $.ajax({ + type: "POST", + url: + baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId + "?op=renew", + contentType: "application/xml", + data: + "" + + circDesk + + "" + + libraryName + + "", + dataType: "xml", + }) + .done(function (data) { + // Make a new GET request to fetch the updated loan data to fix bug of not seeing immediatly + $.ajax({ + type: "GET", + url: baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId, + contentType: "application/json", + dataType: "json", + }) + .done(function (updatedLoanData) { + var updatedDueDate = new Date(updatedLoanData.due_date); + var updatedDueDateText = `${updatedDueDate.getDate()}/${ + updatedDueDate.getMonth() + 1 + }/${updatedDueDate.getFullYear()}`; + // Update the due date in the table + var dueDateCell = $("#loan-" + loanId + " td:nth-child(2)"); + dueDateCell.text(updatedDueDateText); + + // if 401193 value for last renew status -> means that renewd succes, else not succes renewed for whatever reason + var succesfullyRenewedValueCode = "401193;"; + var LastRenewedValueCode = updatedLoanData?.last_renew_status?.value; + + var renewCell = $("#loan-" + loanId + " td:nth-child(3)"); + if (LastRenewedValueCode == succesfullyRenewedValueCode) { + renewCell.text("RENEWED"); + renewCell.removeClass("not-renewable").addClass("renewed"); + } else { + renewCell.text("NOT RENEWABLE"); + renewCell.removeClass("renewed").addClass("not-renewable"); + } + $("#myModal").hide(); + }) + .fail(function (error) { + console.error("Error fetching updated loan data:", error); + alert("Failed to fetch updated loan data"); + $("#myModal").hide(); + }); + }) + .fail(function (error) { + console.error("Error:", error); + alert("Failed to renew loan"); + $("#myModal").hide(); }); } function logout() { - user = null; - $("#userid").val(""); - $("#loginbox").toggleClass("hide"); - $("#scanbox").toggleClass("hide"); - $("#userid").focus(); + user = null; + $("#userid").val(""); + $("#loginbox").toggleClass("hide"); + $("#scanbox").toggleClass("hide"); + $("#userid").focus(); } -$( document ).ready(function() { - $( "#userid" ).focus(); - }); +$(document).ready(function () { + $("#userid").focus(); +}); // function keepSessionActive() { // setInterval(() => { // console.log("Keeping the session active"); // }, 2 * 60 * 1000); // 2 minutes in milliseconds // } - -// keepSessionActive(); \ No newline at end of file + +// keepSessionActive(); diff --git a/self-check.html b/self-check.html index 7ca9afd..a8d7d79 100644 --- a/self-check.html +++ b/self-check.html @@ -10,7 +10,7 @@ - KU Leuven - Self Check + KU Leuven - Check out - - - KU Leuven - Check out - + + - - - - -
- -
-
- -
-
Check-out Service
-

-
-
Please scan your user card ID:
-
-
Inccorect ID, please try again
- -

- -
-
-

-
- -
-
-
-
- - - - - - - - -
Loans: Requests: Fines & Fees: 
-
-

-
Please scan the item barcode
-
- -
-
-
- - - - - + + + - -
TitleDue Date
-
-
-

-
-

+ KU Leuven - Check out + - - + +
+ +
+
+
+
Check-out Service
+

+
+
Please scan your user card ID:
+
+
+ Inccorect ID, please try again
+
+ +

+ +
+
+

+
- +
+
+
+
+ + + + + + + + +
+ Loans:  + + Requests:  + + Fines & Fees:  + + +
+
+

+
Please scan the item barcode
+
+ +
+
+
+ + + + + + +
TitleDue Date
+
+
+

+
+

+ + + + From bd2f2a810fdbeb519562c9889cae3b1bc291b859 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Aug 2025 14:43:45 +0200 Subject: [PATCH 4/7] works agai for kuleuevn only --- css/self-check.css | 46 +++++++++++++++++++++++++++++- images/vlericklogo.png | Bin 0 -> 6373 bytes js/self-check.js | 63 ++++++++++++++++++++++++++++------------- 3 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 images/vlericklogo.png diff --git a/css/self-check.css b/css/self-check.css index 16250a0..6be87b3 100644 --- a/css/self-check.css +++ b/css/self-check.css @@ -33,6 +33,26 @@ textarea { } /* TOP TOOLBAR */ +/* .toptoolbar.kuleuven { + height: 62px; + width: 100%; + + background: #ededed; + + background: -webkit-linear-gradient(#ffffff, #ededed); + background: -o-linear-gradient(#ffffff, #ededed); + background: -moz-linear-gradient(#ffffff, #ededed); + background: linear-gradient(#ffffff, #ededed); + + border-bottom: 1px solid #909090; + box-shadow: 0px 3px 5px 0px #acacac; +} + +.toptoolbar.kuleuven .logo { + padding-top: 4px; + margin-left: 10px; + text-align: center; +} */ .toptoolbar { height: 62px; width: 100%; @@ -54,6 +74,27 @@ textarea { text-align: center; } +.toptoolbar.vlerick { + height: 62px; + width: 100%; + + background: #0d0d0d; + + background: -webkit-linear-gradient(#0d0d0d, #0d0d0d); + background: -o-linear-gradient(#0d0d0d, #0d0d0d); + background: -moz-linear-gradient(#0d0d0d, #0d0d0d); + background: linear-gradient(#0d0d0d, #0d0d0d); + + border-bottom: 1px solid #909090; + box-shadow: 0px 3px 5px 0px #acacac; +} + +.toptoolbar.vlerick .logo { + padding-top: 4px; + margin-left: 10px; + text-align: center; +} + /* MAIN CONTENT */ .maincontent { text-align: center; @@ -87,7 +128,10 @@ textarea { background: -o-linear-gradient(#14436c, #1c5d97); background: -moz-linear-gradient(#14436c, #1c5d97); background: linear-gradient(#14436c, #1c5d97); - + /* background: -webkit-linear-gradient(#000000, #000000); + background: -o-linear-gradient(#000000, #000000); + background: -moz-linear-gradient(#000000, #000000); + background: linear-gradient(#000000, #000000); */ color: #ffffff; font-weight: bold; border-radius: 15px 15px 0px 0px; diff --git a/images/vlericklogo.png b/images/vlericklogo.png new file mode 100644 index 0000000000000000000000000000000000000000..079045da7065994c06137f481cb2720253b9d983 GIT binary patch literal 6373 zcmdT}hgVbIlMhW$R0xP5QbK@$6p@b7L_=><484hTklslUR0v&=UNtl!6zN~OAmvMq z0RibH(h`s!Ftm-o-Lrqg?mK7Rl=sd(_s-lm?=y2_p6RLIxW;}B007+3)PNe2`3#w2 z>8_CP!yk-A$n2_@hM6w_K+pV_C;-{HYybe8q9#ZpOmdLX%wQ)&dYU5h-m?_slJ^XMxJdpT%u79pw@pu$J%U{q9 zACezKq-Er5kSzy=)Nd6II?6}@9kz&>j`AT01RbJy>CHn&)*1dk=(h3BjUHlOM9z{2 z9)ZTx78$}_#-d$j8$B>}B9@+G48S>V>aKYR9Jx)RW8-B990uicQZ9+SN!S%wWKeSa z-r+r7<+d1yw2|4|_{PA1@Y`8v50}||>K>Tryc9gj4ls4A1)}IW7^%Cebx98#W)B=W zbPto87;C0d8NeatWnRhmPG2-Vq}EAve&9A)fh*D3yfG5McamV(Wj6A>sa31F>YNjL zmOuR&nojv-V$VKseB=P z+`vGAgZgr;kEhef&#?NG7l$96FA<{P^%HFbqUh6lE_XCm$R6rfX}DbZcZF+=5A>vN zemmGw1}wF$JsGr)MK17m+edG?yk;0N21f4U)mKRrW$rsdRDXCGMA&4mp6JYE-o$yyy9+2BOhBssiqn{p*=h774(b= zA~07>zy~FWYYspBwM!^qX*Xu39ImX0J6&EMnPwd_1OA)f9ISB;ICNWN=zP!eR$-{M z>Rc3h7NJ=H#WEF>xMj()ae4}pMR}W6xhcO!vO3V${28NpPr@E-DMIQT22(m{0Y4Oc z49BD>o0%%Bt9McttO@)d(!i)At#@c$lJi94`m{F1?kCue=b92~<54lm^HoVj>HtH8 zWlZ0Mgy<2~SKC`%T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E zJPqiF5L=idG*#+T1Yca<1z*@(KakaKJPcC9L|}xi_r}erAvdt>9)nU8zJ!;Bs{@6z zIz14XR{99dr}g`viMPP{$pSs(eJY%IRFeD%!YrmTT-ULJmZpZVVDX%}NnHH?l_H|=c0UFE83b#SCURg3w3mK1aE7a3aPvU*cTcfM1R_k z)ji8pw>4x+uscvVZ33J;JYbX|f>IFn@sQ9MO>L>EZFyGgN}x#KSuAR!pWKjp+E0}X zcog-uh@ZXF3FGh4IT<&1@FbTX4nB+o(H-pHL$r`*ts~_%-{A=|SKb!cIz;Y7v--(g z*;{a-hDc*g@db~LkWCazyLuG5Qa;&+q1GFz;d`^3bULo6G}UAqz*1UXgazOE=+Xk* zT0jx|=-!dKLA?YWNjAWyP8%A``(QH$#x;SUeO3dHV({V6Chb-`{nw{FAp|sx~86*3m*TTkYmr4}AKqC87uZ?29Wt<3J zp^UzcRq*V?0>+8Ic#a4e`K*QX8mYk`uYVa6y8Nu1sK6Bu=*jIi$34-Kqo=XXbxs(i z#-^sg!#N5nk0`mK)DVI{RY~v52%uaM61EhO@|`~MHDl${4Z&qrDheKR@fl5&h#cjU z`bgQ2Z*8tqzjf|)7Ko``A~(3NExcwzh%+*xSPJv_1|xYvP~jjdt&`rzkCCwWfE2<1 zivxYVq)Pi@s;nbuS3^Es&~q@=bkx-a2$5wv05t_WfQBqlkV%Q+?*Gba6oLS%|JW%3 j07~Znk^jE+-" + @@ -328,7 +355,13 @@ function renewLoan(loanId) { // Make a new GET request to fetch the updated loan data to fix bug of not seeing immediatly $.ajax({ type: "GET", - url: baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId, + url: + baseURL + + // institution + + "/almaws/v1/users/" + + userId + + "/loans/" + + loanId, contentType: "application/json", dataType: "json", }) @@ -379,11 +412,3 @@ function logout() { $(document).ready(function () { $("#userid").focus(); }); - -// function keepSessionActive() { -// setInterval(() => { -// console.log("Keeping the session active"); -// }, 2 * 60 * 1000); // 2 minutes in milliseconds -// } - -// keepSessionActive(); From 6ec38710eb4986e57c2921a298e95afc8076671e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Aug 2025 10:39:29 +0200 Subject: [PATCH 5/7] commit with changes for vlerick, also commit to go back to restore prod --- css/self-check.css | 54 +++++++++++-------------------- js/self-check.js | 80 +++++++++++++++++++++++++++++++--------------- self-check.html | 2 +- 3 files changed, 75 insertions(+), 61 deletions(-) diff --git a/css/self-check.css b/css/self-check.css index 6be87b3..e206939 100644 --- a/css/self-check.css +++ b/css/self-check.css @@ -33,26 +33,6 @@ textarea { } /* TOP TOOLBAR */ -/* .toptoolbar.kuleuven { - height: 62px; - width: 100%; - - background: #ededed; - - background: -webkit-linear-gradient(#ffffff, #ededed); - background: -o-linear-gradient(#ffffff, #ededed); - background: -moz-linear-gradient(#ffffff, #ededed); - background: linear-gradient(#ffffff, #ededed); - - border-bottom: 1px solid #909090; - box-shadow: 0px 3px 5px 0px #acacac; -} - -.toptoolbar.kuleuven .logo { - padding-top: 4px; - margin-left: 10px; - text-align: center; -} */ .toptoolbar { height: 62px; width: 100%; @@ -74,21 +54,6 @@ textarea { text-align: center; } -.toptoolbar.vlerick { - height: 62px; - width: 100%; - - background: #0d0d0d; - - background: -webkit-linear-gradient(#0d0d0d, #0d0d0d); - background: -o-linear-gradient(#0d0d0d, #0d0d0d); - background: -moz-linear-gradient(#0d0d0d, #0d0d0d); - background: linear-gradient(#0d0d0d, #0d0d0d); - - border-bottom: 1px solid #909090; - box-shadow: 0px 3px 5px 0px #acacac; -} - .toptoolbar.vlerick .logo { padding-top: 4px; margin-left: 10px; @@ -137,7 +102,26 @@ textarea { border-radius: 15px 15px 0px 0px; font-size: 140%; } +.vlerickclass { + background: #000000; +} +.maincontent .h1title.vlerickclass { + padding: 20px; + background: #000000; + /* background: -webkit-linear-gradient(#14436c, #1c5d97); + background: -o-linear-gradient(#14436c, #1c5d97); + background: -moz-linear-gradient(#14436c, #1c5d97); + background: linear-gradient(#14436c, #1c5d97); */ + background: -webkit-linear-gradient(#000000, #000000); + background: -o-linear-gradient(#000000, #000000); + background: -moz-linear-gradient(#000000, #000000); + background: linear-gradient(#000000, #000000); + color: #ffffff; + font-weight: bold; + border-radius: 15px 15px 0px 0px; + font-size: 140%; +} .maincontent .h2title { font-size: 120%; font-weight: bold; diff --git a/js/self-check.js b/js/self-check.js index 916f02a..f8a7525 100644 --- a/js/self-check.js +++ b/js/self-check.js @@ -4,13 +4,13 @@ console.log("baseURL", baseURL); var libraryName = "RBIB"; -// var institution = "kuleuven"; +var institution = "kuleuven"; // check if the pathname includes 'vlerick' -// if (window.location.pathname.toLowerCase().includes("vlerick")) { -// libraryName = "VBS"; -// institution = "vlerick"; -// } +if (window.location.pathname.toLowerCase().includes("vlerick")) { + libraryName = "VBS"; + institution = "vlerick"; +} console.log("libraryName", libraryName); var circDesk = "DEFAULT_CIRC_DESK"; @@ -18,21 +18,31 @@ function initiate() { getModalBox(); ///////////////////////////////////////////////////////////////////////////////////////////// // Add institution as a class to .toptoolbar - // var topToolbar = document.querySelector(".toptoolbar"); - // if (topToolbar) { - // topToolbar.className = "toptoolbar " + institution; - // // or topToolbar.classList.add(institution); - // } - - // Optional: change logo dynamically too - // var logoImg = document.querySelector(".logo img"); - // if (logoImg && institution === "vlerick") { - // logoImg.src = "images/vlericklogo.png"; - // } else { - // logoImg.src = "images/vlericklogo.png"; - // // "images/libisnewkuljr.png"; // default logo - // } + var topToolbar = document.querySelector(".toptoolbar"); + if (topToolbar) { + topToolbar.className = "toptoolbar " + institution; + // or topToolbar.classList.add(institution); + } + + // change logo dynamically too + var logoImg = document.querySelector(".logo img"); + if (logoImg && institution === "vlerick") { + logoImg.src = "images/vlericklogo.png"; + } else { + logoImg.src = "images/libisnewkuljr.png"; // default logo + } + + // change from blue to black background color + var h1Title = document.querySelector(".maincontent .h1title"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } + + var h1Title = document.getElementById("scanboxtitle"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } ///////////////////////////////////////////////////////////////////////////////////////////// $("#barcode").bind("keypress", function (e) { @@ -124,7 +134,8 @@ function login() { type: "GET", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json&limit=100", // added limit to 100 (default == 10) @@ -142,6 +153,15 @@ function login() { $("#userrequests").text(data.requests.value); $("#userfees").text("€ " + data.fees.value); + // Add Vlerick styling after loggin + var h1Title = document.querySelector(".maincontent .h1title"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } + var h1Title = document.getElementById("scanboxtitle"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } $("#loanstable").find("tr:gt(0)").remove(); // Fetch loan details @@ -219,7 +239,8 @@ function loan() { type: "POST", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + user.primary_id + "/loans?user_id_type=all_unique&item_barcode=" + @@ -270,7 +291,8 @@ function fetchUserDetailsAndLoans() { type: "GET", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json&limit=100", @@ -286,7 +308,13 @@ function fetchUserDetailsAndLoans() { $("#userloans").text(data.loans.value); $("#userrequests").text(data.requests.value); $("#userfees").text("€ " + data.fees.value); - $("#loanstable").find("tr:gt(0)").remove(); + // Add Vlerick styling after + var h1Title = document.querySelector(".maincontent .h1title"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } + + "#loanstable".find("tr:gt(0)").remove(); $.ajax({ type: "GET", @@ -336,7 +364,8 @@ function renewLoan(loanId) { type: "POST", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + userId + "/loans/" + @@ -357,7 +386,8 @@ function renewLoan(loanId) { type: "GET", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + userId + "/loans/" + diff --git a/self-check.html b/self-check.html index 9d86732..79d7f09 100644 --- a/self-check.html +++ b/self-check.html @@ -3,7 +3,7 @@ - + Date: Thu, 14 Aug 2025 10:46:50 +0200 Subject: [PATCH 6/7] should work again for old production --- css/self-check.css | 55 +++++++++++++++++--------- js/self-check.js | 98 ++++++++++++++++++++-------------------------- 2 files changed, 79 insertions(+), 74 deletions(-) diff --git a/css/self-check.css b/css/self-check.css index e206939..79ea5ad 100644 --- a/css/self-check.css +++ b/css/self-check.css @@ -33,6 +33,26 @@ textarea { } /* TOP TOOLBAR */ +/* .toptoolbar.kuleuven { + height: 62px; + width: 100%; + + background: #ededed; + + background: -webkit-linear-gradient(#ffffff, #ededed); + background: -o-linear-gradient(#ffffff, #ededed); + background: -moz-linear-gradient(#ffffff, #ededed); + background: linear-gradient(#ffffff, #ededed); + + border-bottom: 1px solid #909090; + box-shadow: 0px 3px 5px 0px #acacac; +} + +.toptoolbar.kuleuven .logo { + padding-top: 4px; + margin-left: 10px; + text-align: center; +} */ .toptoolbar { height: 62px; width: 100%; @@ -54,6 +74,21 @@ textarea { text-align: center; } +.toptoolbar.vlerick { + height: 62px; + width: 100%; + + background: #0d0d0d; + + background: -webkit-linear-gradient(#0d0d0d, #0d0d0d); + background: -o-linear-gradient(#0d0d0d, #0d0d0d); + background: -moz-linear-gradient(#0d0d0d, #0d0d0d); + background: linear-gradient(#0d0d0d, #0d0d0d); + + border-bottom: 1px solid #909090; + box-shadow: 0px 3px 5px 0px #acacac; +} + .toptoolbar.vlerick .logo { padding-top: 4px; margin-left: 10px; @@ -93,6 +128,7 @@ textarea { background: -o-linear-gradient(#14436c, #1c5d97); background: -moz-linear-gradient(#14436c, #1c5d97); background: linear-gradient(#14436c, #1c5d97); + /* background: -webkit-linear-gradient(#000000, #000000); background: -o-linear-gradient(#000000, #000000); background: -moz-linear-gradient(#000000, #000000); @@ -102,26 +138,7 @@ textarea { border-radius: 15px 15px 0px 0px; font-size: 140%; } -.vlerickclass { - background: #000000; -} -.maincontent .h1title.vlerickclass { - padding: 20px; - background: #000000; - /* background: -webkit-linear-gradient(#14436c, #1c5d97); - background: -o-linear-gradient(#14436c, #1c5d97); - background: -moz-linear-gradient(#14436c, #1c5d97); - background: linear-gradient(#14436c, #1c5d97); */ - background: -webkit-linear-gradient(#000000, #000000); - background: -o-linear-gradient(#000000, #000000); - background: -moz-linear-gradient(#000000, #000000); - background: linear-gradient(#000000, #000000); - color: #ffffff; - font-weight: bold; - border-radius: 15px 15px 0px 0px; - font-size: 140%; -} .maincontent .h2title { font-size: 120%; font-weight: bold; diff --git a/js/self-check.js b/js/self-check.js index f8a7525..0edab50 100644 --- a/js/self-check.js +++ b/js/self-check.js @@ -4,13 +4,13 @@ console.log("baseURL", baseURL); var libraryName = "RBIB"; -var institution = "kuleuven"; +// var institution = "kuleuven"; // check if the pathname includes 'vlerick' -if (window.location.pathname.toLowerCase().includes("vlerick")) { - libraryName = "VBS"; - institution = "vlerick"; -} +// if (window.location.pathname.toLowerCase().includes("vlerick")) { +// libraryName = "VBS"; +// institution = "vlerick"; +// } console.log("libraryName", libraryName); var circDesk = "DEFAULT_CIRC_DESK"; @@ -18,31 +18,21 @@ function initiate() { getModalBox(); ///////////////////////////////////////////////////////////////////////////////////////////// // Add institution as a class to .toptoolbar - var topToolbar = document.querySelector(".toptoolbar"); - if (topToolbar) { - topToolbar.className = "toptoolbar " + institution; - // or topToolbar.classList.add(institution); - } - - // change logo dynamically too - var logoImg = document.querySelector(".logo img"); - if (logoImg && institution === "vlerick") { - logoImg.src = "images/vlericklogo.png"; - } else { - logoImg.src = "images/libisnewkuljr.png"; // default logo - } - - // change from blue to black background color - - var h1Title = document.querySelector(".maincontent .h1title"); - if (h1Title && institution === "vlerick") { - h1Title.classList.add("vlerickclass"); - } + // var topToolbar = document.querySelector(".toptoolbar"); + // if (topToolbar) { + // topToolbar.className = "toptoolbar " + institution; + // // or topToolbar.classList.add(institution); + // } + + // Optional: change logo dynamically too + // var logoImg = document.querySelector(".logo img"); + // if (logoImg && institution === "vlerick") { + // logoImg.src = "images/vlericklogo.png"; + // } else { + // logoImg.src = "images/vlericklogo.png"; + // // "images/libisnewkuljr.png"; // default logo + // } - var h1Title = document.getElementById("scanboxtitle"); - if (h1Title && institution === "vlerick") { - h1Title.classList.add("vlerickclass"); - } ///////////////////////////////////////////////////////////////////////////////////////////// $("#barcode").bind("keypress", function (e) { @@ -76,6 +66,15 @@ function getModalBox() { span.onclick = function () { $("#myModal").hide(); }; + + // When the user clicks anywhere outside of the modal, close it + /* + window.onclick = function(event) { + if (event.target == modal) { + $("#myModal").hide(); + } + } + */ } function returnToBarcode() { @@ -134,8 +133,7 @@ function login() { type: "GET", url: baseURL + - "/" + - institution + + // institution + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json&limit=100", // added limit to 100 (default == 10) @@ -153,15 +151,6 @@ function login() { $("#userrequests").text(data.requests.value); $("#userfees").text("€ " + data.fees.value); - // Add Vlerick styling after loggin - var h1Title = document.querySelector(".maincontent .h1title"); - if (h1Title && institution === "vlerick") { - h1Title.classList.add("vlerickclass"); - } - var h1Title = document.getElementById("scanboxtitle"); - if (h1Title && institution === "vlerick") { - h1Title.classList.add("vlerickclass"); - } $("#loanstable").find("tr:gt(0)").remove(); // Fetch loan details @@ -239,8 +228,7 @@ function loan() { type: "POST", url: baseURL + - "/" + - institution + + // institution + "/almaws/v1/users/" + user.primary_id + "/loans?user_id_type=all_unique&item_barcode=" + @@ -291,8 +279,7 @@ function fetchUserDetailsAndLoans() { type: "GET", url: baseURL + - "/" + - institution + + // institution + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json&limit=100", @@ -308,13 +295,7 @@ function fetchUserDetailsAndLoans() { $("#userloans").text(data.loans.value); $("#userrequests").text(data.requests.value); $("#userfees").text("€ " + data.fees.value); - // Add Vlerick styling after - var h1Title = document.querySelector(".maincontent .h1title"); - if (h1Title && institution === "vlerick") { - h1Title.classList.add("vlerickclass"); - } - - "#loanstable".find("tr:gt(0)").remove(); + $("#loanstable").find("tr:gt(0)").remove(); $.ajax({ type: "GET", @@ -364,8 +345,7 @@ function renewLoan(loanId) { type: "POST", url: baseURL + - "/" + - institution + + // institution + "/almaws/v1/users/" + userId + "/loans/" + @@ -384,10 +364,10 @@ function renewLoan(loanId) { // Make a new GET request to fetch the updated loan data to fix bug of not seeing immediatly $.ajax({ type: "GET", + url: baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId, url: baseURL + - "/" + - institution + + // institution + "/almaws/v1/users/" + userId + "/loans/" + @@ -442,3 +422,11 @@ function logout() { $(document).ready(function () { $("#userid").focus(); }); + +// function keepSessionActive() { +// setInterval(() => { +// console.log("Keeping the session active"); +// }, 2 * 60 * 1000); // 2 minutes in milliseconds +// } + +// keepSessionActive(); From a2e914a20371c833822c5bc56492cf9e72aa6832 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Sep 2026 13:36:38 +0200 Subject: [PATCH 7/7] prod version --- css/self-check.css | 55 ++++++------------ js/self-check.js | 142 ++++++++++++++++++++++++++++----------------- package-lock.json | 6 ++ self-check.html | 6 +- 4 files changed, 117 insertions(+), 92 deletions(-) create mode 100644 package-lock.json diff --git a/css/self-check.css b/css/self-check.css index 79ea5ad..e206939 100644 --- a/css/self-check.css +++ b/css/self-check.css @@ -33,26 +33,6 @@ textarea { } /* TOP TOOLBAR */ -/* .toptoolbar.kuleuven { - height: 62px; - width: 100%; - - background: #ededed; - - background: -webkit-linear-gradient(#ffffff, #ededed); - background: -o-linear-gradient(#ffffff, #ededed); - background: -moz-linear-gradient(#ffffff, #ededed); - background: linear-gradient(#ffffff, #ededed); - - border-bottom: 1px solid #909090; - box-shadow: 0px 3px 5px 0px #acacac; -} - -.toptoolbar.kuleuven .logo { - padding-top: 4px; - margin-left: 10px; - text-align: center; -} */ .toptoolbar { height: 62px; width: 100%; @@ -74,21 +54,6 @@ textarea { text-align: center; } -.toptoolbar.vlerick { - height: 62px; - width: 100%; - - background: #0d0d0d; - - background: -webkit-linear-gradient(#0d0d0d, #0d0d0d); - background: -o-linear-gradient(#0d0d0d, #0d0d0d); - background: -moz-linear-gradient(#0d0d0d, #0d0d0d); - background: linear-gradient(#0d0d0d, #0d0d0d); - - border-bottom: 1px solid #909090; - box-shadow: 0px 3px 5px 0px #acacac; -} - .toptoolbar.vlerick .logo { padding-top: 4px; margin-left: 10px; @@ -128,7 +93,6 @@ textarea { background: -o-linear-gradient(#14436c, #1c5d97); background: -moz-linear-gradient(#14436c, #1c5d97); background: linear-gradient(#14436c, #1c5d97); - /* background: -webkit-linear-gradient(#000000, #000000); background: -o-linear-gradient(#000000, #000000); background: -moz-linear-gradient(#000000, #000000); @@ -138,7 +102,26 @@ textarea { border-radius: 15px 15px 0px 0px; font-size: 140%; } +.vlerickclass { + background: #000000; +} +.maincontent .h1title.vlerickclass { + padding: 20px; + background: #000000; + /* background: -webkit-linear-gradient(#14436c, #1c5d97); + background: -o-linear-gradient(#14436c, #1c5d97); + background: -moz-linear-gradient(#14436c, #1c5d97); + background: linear-gradient(#14436c, #1c5d97); */ + background: -webkit-linear-gradient(#000000, #000000); + background: -o-linear-gradient(#000000, #000000); + background: -moz-linear-gradient(#000000, #000000); + background: linear-gradient(#000000, #000000); + color: #ffffff; + font-weight: bold; + border-radius: 15px 15px 0px 0px; + font-size: 140%; +} .maincontent .h2title { font-size: 120%; font-weight: bold; diff --git a/js/self-check.js b/js/self-check.js index 0edab50..b69ce5d 100644 --- a/js/self-check.js +++ b/js/self-check.js @@ -1,38 +1,56 @@ -// var baseURL = "https://services.libis.be"; var baseURL = window.location.origin; console.log("baseURL", baseURL); +var path = window.location.pathname.toLowerCase(); + var libraryName = "RBIB"; +var institution = "kuleuven"; +var circDesk = "DEFAULT_CIRC_DESK"; -// var institution = "kuleuven"; +// match exact pathnames +if (path === "/self-check-vlerick/") { + libraryName = "VBS"; + institution = "vlerick"; + circDesk = "ZU"; +} else if (path === "/self-check-vlerick-br/") { + libraryName = "BRU"; + institution = "vlerick"; + circDesk = "BZU"; +} -// check if the pathname includes 'vlerick' -// if (window.location.pathname.toLowerCase().includes("vlerick")) { -// libraryName = "VBS"; -// institution = "vlerick"; -// } console.log("libraryName", libraryName); -var circDesk = "DEFAULT_CIRC_DESK"; +console.log("institution", institution); +console.log("circDesk", circDesk); function initiate() { getModalBox(); ///////////////////////////////////////////////////////////////////////////////////////////// // Add institution as a class to .toptoolbar - // var topToolbar = document.querySelector(".toptoolbar"); - // if (topToolbar) { - // topToolbar.className = "toptoolbar " + institution; - // // or topToolbar.classList.add(institution); - // } - - // Optional: change logo dynamically too - // var logoImg = document.querySelector(".logo img"); - // if (logoImg && institution === "vlerick") { - // logoImg.src = "images/vlericklogo.png"; - // } else { - // logoImg.src = "images/vlericklogo.png"; - // // "images/libisnewkuljr.png"; // default logo - // } + var topToolbar = document.querySelector(".toptoolbar"); + if (topToolbar) { + topToolbar.className = "toptoolbar " + institution; + // or topToolbar.classList.add(institution); + } + // change logo dynamically too + var logoImg = document.querySelector(".logo img"); + if (logoImg && institution === "vlerick") { + logoImg.src = "images/vlericklogo.png"; + } else { + logoImg.src = "images/libisnewkuljr.png"; // default logo + } + + // change from blue to black background color + + var h1Title = document.querySelector(".maincontent .h1title"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } + + var h1Title = document.getElementById("scanboxtitle"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } ///////////////////////////////////////////////////////////////////////////////////////////// $("#barcode").bind("keypress", function (e) { @@ -66,15 +84,6 @@ function getModalBox() { span.onclick = function () { $("#myModal").hide(); }; - - // When the user clicks anywhere outside of the modal, close it - /* - window.onclick = function(event) { - if (event.target == modal) { - $("#myModal").hide(); - } - } - */ } function returnToBarcode() { @@ -133,7 +142,8 @@ function login() { type: "GET", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json&limit=100", // added limit to 100 (default == 10) @@ -145,17 +155,32 @@ function login() { user = data; // Prepare scan box $("#scanboxtitle").text( - "Welcome " + data.first_name + " " + data.last_name + "Welcome " + data.first_name + " " + data.last_name, ); $("#userloans").text(data.loans.value); $("#userrequests").text(data.requests.value); - $("#userfees").text("€ " + data.fees.value); + $("#userfees").text("€ " + data.fees.value); + // Add Vlerick styling after loggin + var h1Title = document.querySelector(".maincontent .h1title"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } + var h1Title = document.getElementById("scanboxtitle"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } $("#loanstable").find("tr:gt(0)").remove(); // Fetch loan details + // let loanUrl = data.loans.link; + // loanUrl += (loanUrl.includes("?") ? "&" : "?") + "limit=100"; + let loanUrl = data.loans.link; + if (!loanUrl.includes("/" + institution + "/")) { + loanUrl = loanUrl.replace("/almaws/", "/" + institution + "/almaws/"); + } loanUrl += (loanUrl.includes("?") ? "&" : "?") + "limit=100"; $.ajax({ @@ -186,7 +211,7 @@ function login() { loan.loan_id + "\")'>" + renewButtonText + - "" + "", ); returnToBarcode(); }); @@ -228,7 +253,8 @@ function loan() { type: "POST", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + user.primary_id + "/loans?user_id_type=all_unique&item_barcode=" + @@ -262,7 +288,11 @@ function loan() { console.log(jqxhr.responseText); $("#modalheader").text(""); $("#modalheader").append( - "Something went wrong.

Please consult the library information desk for more information

" + `Something went wrong.

${ + libraryName === "VBS" + ? "Contact someone from reception services for help." + : "Please consult the library information desk for more information" + }

`, ); $("#barcodeerrorbutton").focus(); @@ -279,7 +309,8 @@ function fetchUserDetailsAndLoans() { type: "GET", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + $("#userid").val() + "?expand=loans,requests,fees&format=json&limit=100", @@ -290,16 +321,28 @@ function fetchUserDetailsAndLoans() { .done(function (data) { user = data; $("#scanboxtitle").text( - "Welcome " + data.first_name + " " + data.last_name + "Welcome " + data.first_name + " " + data.last_name, ); $("#userloans").text(data.loans.value); $("#userrequests").text(data.requests.value); - $("#userfees").text("€ " + data.fees.value); + $("#userfees").text("€ " + data.fees.value); + // add Vlerick styling after + var h1Title = document.querySelector(".maincontent .h1title"); + if (h1Title && institution === "vlerick") { + h1Title.classList.add("vlerickclass"); + } + $("#loanstable").find("tr:gt(0)").remove(); $.ajax({ type: "GET", - url: data.loans.link, + url: + baseURL + + "/" + + institution + + "/almaws/v1/users/" + + user.primary_id + + "/loans?limit=100", contentType: "text/plain", dataType: "json", crossDomain: true, @@ -321,7 +364,7 @@ function fetchUserDetailsAndLoans() { loan.loan_id + "\")'>" + renewButtonText + - "" + "", ); returnToBarcode(); }); @@ -345,7 +388,8 @@ function renewLoan(loanId) { type: "POST", url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + userId + "/loans/" + @@ -364,10 +408,10 @@ function renewLoan(loanId) { // Make a new GET request to fetch the updated loan data to fix bug of not seeing immediatly $.ajax({ type: "GET", - url: baseURL + "/almaws/v1/users/" + userId + "/loans/" + loanId, url: baseURL + - // institution + + "/" + + institution + "/almaws/v1/users/" + userId + "/loans/" + @@ -422,11 +466,3 @@ function logout() { $(document).ready(function () { $("#userid").focus(); }); - -// function keepSessionActive() { -// setInterval(() => { -// console.log("Keeping the session active"); -// }, 2 * 60 * 1000); // 2 minutes in milliseconds -// } - -// keepSessionActive(); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3625c5e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "self-check", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/self-check.html b/self-check.html index 79d7f09..cd837e5 100644 --- a/self-check.html +++ b/self-check.html @@ -20,7 +20,7 @@ - +


- +


@@ -74,7 +74,7 @@