From d6c0e802b28128a3f0fe7c2dfb1d22692124a29b Mon Sep 17 00:00:00 2001 From: Saumya Sewwandi <122492063+BMSaumya@users.noreply.github.com> Date: Wed, 10 Jan 2024 10:51:02 +0530 Subject: [PATCH 1/2] Stop tracking function js --- common/func.js | 294 ------------------------------------------------- 1 file changed, 294 deletions(-) delete mode 100644 common/func.js diff --git a/common/func.js b/common/func.js deleted file mode 100644 index bf03885c..00000000 --- a/common/func.js +++ /dev/null @@ -1,294 +0,0 @@ -function checkLng() { - const body = document.querySelector("body"), - sin = body.querySelector(".sin"), - en = body.querySelector(".en"); - //reload language detecter - const curLng = getCookie("lang"); - if (curLng == "sin") { - sin.click(); - } else { - en.click(); - } -} - -function checkMode() { - const body = document.querySelector("body"), - modeSwitch = body.querySelector(".toggle-switch"); - //reload mode detecter - const curMode = getCookie("mode"); - if (curMode == "dark") { - modeSwitch.click(); - } -} - -function getGreetingTime(m) { - var g = null; //return g - if (!m || !m.isValid()) { - return; - } //if we can't find a valid or filled moment, we return. - - var split_afternoon = 12; //24hr time to split the afternoon - var split_evening = 17; //24hr time to split the evening - var currentHour = parseFloat(m.format("HH")); - - // const curLng = sessionStorage.getItem("lang"); - - const curLng = getCookie("lang"); - - if (currentHour >= split_afternoon && currentHour <= split_evening) { - if (curLng == "sin") { - g = "සුභ දහවලක්"; - } else { - g = "Good Afternoon"; - } - } else if (currentHour >= split_evening) { - if (curLng == "sin") { - g = "සුභ සන්ධ්‍යාවක්"; - } else { - g = "Good Evening"; - } - } else { - if (curLng == "sin") { - g = "සුභ උදෑසනක්"; - } else { - g = "Good Morning"; - } - } - return g; -} - -function setGreeting() { - const body = document.querySelector("body"), - greeting = body.querySelector(".greeting"); - greeting.innerHTML = getGreetingTime(moment()); -} - -function modeTranslate() { - var text = null; - const curMode = getCookie("mode"); - const curLng = getCookie("lang"); - - if (curMode == "dark") { - if (curLng == "sin") { - text = "ආලෝක මාදිලිය"; - } else { - text = "Light Mode"; - } - } else { - if (curLng == "sin") { - text = "අඳුරු මාදිලිය"; - } else { - text = "Dark Mode"; - } - } - return text; -} - -window.addEventListener("resize", (e) => { - const body = document.querySelector("body"), - sidebar = body.querySelector(".sidebar"), - bars = body.querySelector(".fa-bars"); - - if (!sidebar) return; - - if (window.innerWidth <= 1010 && window.innerWidth >= 718) { - sidebar.classList.add("close"); - sidebar.classList.remove("sidebar-active"); - bars.style.display = "none"; - sidebar.style.display = "block"; - } else { - sidebar.classList.remove("close"); - sidebar.style.display = "block"; - if (window.innerWidth <= 718) { - sidebar.style.display = "none"; - bars.style.display = "block"; - } - } -}); - -window.addEventListener("load", (e) => { - const body = document.querySelector("body"), - sidebar = body.querySelector(".sidebar"), - bars = body.querySelector(".fa-bars"); - - if (!sidebar) return; - - if (window.innerWidth <= 1010 && window.innerWidth >= 718) { - sidebar.classList.add("close"); - sidebar.classList.remove("sidebar-active"); - bars.style.display = "none"; - sidebar.style.display = "block"; - } else { - sidebar.classList.remove("close"); - sidebar.style.display = "block"; - if (window.innerWidth <= 718) { - sidebar.style.display = "none"; - bars.style.display = "block"; - } - } -}); - -function checkCookie(cName) { - const name = cName + "="; - const cDecoded = decodeURIComponent(document.cookie); //to be careful - const cArr = cDecoded.split("; "); - let res; - cArr.forEach((val) => { - if (val.indexOf(name) === 0) res = val.substring(name.length); - }); - return res; -} - -function getCookie(name) { - var myCookie = checkCookie(name); - if (myCookie == null) { - console.log(name + " - null"); - } - // else { - // console.log("not null " + myCookie); - // } - return myCookie; -} - -function signout() { - var lang = getCookie("lang"); - if (lang == "sin") { - var title = "ඔයාට විශ්වාස ද?", - text = "ඔබට මෙය ප්‍රතිවර්තනය කිරීමට නොහැකි වනු ඇත!", - confirmButtonText = "ඔව්, වරනය වන්න!", - cancelButtonText = "අවලංගු කරන්න"; - } else { - var title = "Are you sure?", - text = "You won't be able to revert this!", - confirmButtonText = "Yes, Sign out!", - cancelButtonText = "Cancel"; - } - Swal.fire({ - title: title, - text: text, - confirmButtonText: confirmButtonText, - cancelButtonText: cancelButtonText, - icon: "warning", - showCancelButton: true, - confirmButtonColor: confirmButtonColor, - cancelButtonColor: cancelButtonColor, - // buttonsStyling: false, - }).then((result) => { - if (result.isConfirmed) { - if (lang == "sin") { - var title = "වරනය විය!", - text = "ඔබ ඔබේ පැතිකඩ සාර්ථකව වරනය විය.", - confirmButtonText = "හරි"; - } else { - var title = "Signed out!", - text = "You signed out your profile successfully.", - confirmButtonText = "Ok"; - } - // sweet alert - Swal.fire({ - title: title, - text: text, - icon: "success", - confirmButtonText: confirmButtonText, - confirmButtonColor: confirmButtonColor, - }).then((response) => { - // remove previous data - document.cookie = "id=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; - document.cookie = "sId=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; - document.cookie = - "page=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; - document.cookie = "jwt=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; - pageLoading(); - window.location.href = frontProxy; - }); - } - }); -} - -const frontProxy = "http://127.0.0.1:5501"; -const backProxy = "http://127.0.0.1:8090/JOM_war_exploded"; - -// toast -toastr.options = { - closeButton: true, - debug: false, - newestOnTop: true, - progressBar: false, - positionClass: "toast-bottom-right", - preventDuplicates: false, - onclick: null, - showDuration: "300", - hideDuration: "1000", - timeOut: "5000", - extendedTimeOut: "1000", - showEasing: "swing", - hideEasing: "linear", - showMethod: "fadeIn", - hideMethod: "fadeOut", -}; - -// Sweet alerts colors -var confirmButtonColor = "#d4ac77", - cancelButtonColor = "#d33", - confirmButtonColor = "#d4ac77", - denyButtonColor = "#dd6b55"; - -function pageLoading() { - // const loader = document.querySelector(".loader-wrapper"); - // loader.style.display = "block"; - // loader.toggle() - $(".loader-wrapper").toggle(); -} - -function timeString(time) { - var T = time.split(":"); - - if (T[0] > 12) { - T[0] -= 12; - if (T[0] >= 12) { - return String(T[0]).padStart(2, "0") + ":" + T[1] + " AM"; - } else { - return String(T[0]).padStart(2, "0") + ":" + T[1] + " PM"; - } - } else if (T[0] == 12) { - return String(T[0]).padStart(2, "0") + ":" + T[1] + " PM"; - } else { - return String(T[0]).padStart(2, "0") + ":" + T[1] + " AM"; - } -} - -function capitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -//table search -function search(filter, table) { - var tr = table.getElementsByTagName("tr"); - - for (var i = 1; i < tr.length; i++) { - var displayRow = false, - td = tr[i].getElementsByTagName("td"); - - for (var j = 0; j < td.length; j++) { - var txtValue = td[j].textContent || td[j].innerText; - if (txtValue.toUpperCase().indexOf(filter) > -1) { - displayRow = true; - break; - } - } - - if (displayRow) { - tr[i].style.display = ""; - } else { - tr[i].style.display = "none"; - } - } -} - -//jwt -function getPayload(token) { - return JSON.parse(atob(token.split(".")[1])); -} - -// framework -var log = console.log; From d01cbb1fe972e5da5e68c4e2eeb8c6f4e90a551a Mon Sep 17 00:00:00 2001 From: Saumya Sewwandi <122492063+BMSaumya@users.noreply.github.com> Date: Thu, 11 Jan 2024 21:44:45 +0530 Subject: [PATCH 2/2] removed report Co-Authored-By: Buddhika Nipun --- .gitignore | 3 ++- sales-manager/index.html | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c1448042..a5f0a7f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # vs code .vscode -.metals \ No newline at end of file +.metals +common/func.js diff --git a/sales-manager/index.html b/sales-manager/index.html index 7359d3d6..267f1d5a 100644 --- a/sales-manager/index.html +++ b/sales-manager/index.html @@ -106,12 +106,12 @@

-
+
@@ -124,12 +124,12 @@

-
+