From 9f349034438342e1de5c859ceadfe1850e9a3a15 Mon Sep 17 00:00:00 2001
From: John Watkins <watkinsj18@cardiff.ac.uk>
Date: Fri, 10 Dec 2021 13:16:26 +0000
Subject: [PATCH] Added text when you over filter on main search on dashboard

---
 src/main/resources/static/js/searchBar.js | 5 +++++
 src/main/resources/templates/index.html   | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/main/resources/static/js/searchBar.js b/src/main/resources/static/js/searchBar.js
index ebce210..3ed6bb7 100644
--- a/src/main/resources/static/js/searchBar.js
+++ b/src/main/resources/static/js/searchBar.js
@@ -57,6 +57,11 @@ function doSearch(fromNextPageBtn){
             if(!fromNextPageBtn){
                 document.getElementById("business_card_container").innerHTML = "";
             }
+            if(data["shops"].length == 0){
+                document.getElementById("searchText").style.display="block";
+            }else{
+                document.getElementById("searchText").style.display="none";
+            }
             for(let shop of data["shops"]){
                 addShop(shop);
             }
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index 041a8e8..c8c30de 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -81,6 +81,7 @@
 		<div class="is-full-width is-flex is-justify-content-center is-align-items-center" id="loadMoreBtn" style="display: none!important;;">
 			<a onclick="loadNextPage()">Load More</a>
 		</div>
+		<h1 class="subtitle is-5 is-full-width" style="text-align: center;display: none;" id="searchText">You've filtered too far!</h1>
 
 	</div>
 		<div th:if="${selectCategories}" class="modal is-active">
-- 
GitLab