diff --git a/fe/js/mapScript.js b/fe/js/mapScript.js index 6bc5c8a..0b69230 100644 --- a/fe/js/mapScript.js +++ b/fe/js/mapScript.js @@ -29,13 +29,17 @@ function initializeMap(latitude, longitude) { mapElement.innerHTML = "

There was an error loading the map

"; } } - +/* +* Checks for the geolocation +*/ if ("geolocation" in navigator) { navigator.geolocation.getCurrentPosition((position) => { initializeMap(position.coords.latitude, position.coords.longitude); }) } - +/* +*Using checkbox elements we can filter the results by interacting with the API. +*/ function submitFilter(){ const filterData = {}; const checkboxes = document.querySelectorAll('input[type="checkbox"]'); @@ -47,7 +51,6 @@ function submitFilter(){ branchOpts = document.querySelectorAll('input[data-category="branch"]'); atmOpts = document.querySelectorAll('input[data-category="atm"]'); - checkboxes.forEach(checkbox => { if (checkbox.checked){ branchOpts.forEach(opt => { @@ -98,6 +101,9 @@ async function filterBranches(filterData){ shadowSize: [41, 41] }); + /* + * Calling the endpoint for branch and atm filter. + */ try { for (i = 0; i < 2; i++){ if (i == 0){ @@ -277,7 +283,9 @@ async function filterBranches(filterData){ console.error("Error fetching data:", error); } } - + /* + * Makes the list view visible/hidden when interacted with + */ function toggleListView() { listView = document.getElementById("list-view"); if (listView.classList.contains("hidden")) { @@ -293,6 +301,10 @@ function toggleListView() { } } + /* + * Makes the filter box visible/hidden when interacted with + */ + function toggleFilterBox() { filterBox = document.getElementById("filter-box"); diff --git a/fe/map.html b/fe/map.html index eeb8c62..db62ac3 100644 --- a/fe/map.html +++ b/fe/map.html @@ -16,7 +16,7 @@ integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="" > - + NCR Branches & ATMs -