From 397ce8b14d41d95c2380d4632d1c48cb504635a8 Mon Sep 17 00:00:00 2001
From: c2065864 <barnards3@cardiff.ac.uk>
Date: Thu, 9 Dec 2021 13:36:51 +0000
Subject: [PATCH] Fixed tab and enter on business register form

---
 src/main/resources/static/js/registerbusiness.js   | 9 +++++++++
 src/main/resources/templates/allUserShops.html     | 2 ++
 src/main/resources/templates/registerbusiness.html | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/main/resources/static/js/registerbusiness.js b/src/main/resources/static/js/registerbusiness.js
index e551c7f..985522e 100644
--- a/src/main/resources/static/js/registerbusiness.js
+++ b/src/main/resources/static/js/registerbusiness.js
@@ -1,6 +1,15 @@
 var modalStage = 0
 var urlInput, urlPrefixInput, nameInput, descInput, tagsInput, amountInput = null;
 
+function keyPress(e) {
+    if(e.key == "Enter"){
+        e.preventDefault()
+        progress()
+    }if(e.key == "Tab"){
+        e.preventDefault()
+    }
+}
+
 function htmlDecode(input) {
     var doc = new DOMParser().parseFromString(input, "text/html");
     return doc.documentElement.textContent;
diff --git a/src/main/resources/templates/allUserShops.html b/src/main/resources/templates/allUserShops.html
index 1599d62..4aa3e36 100644
--- a/src/main/resources/templates/allUserShops.html
+++ b/src/main/resources/templates/allUserShops.html
@@ -49,6 +49,8 @@
 					 total_reward_amount=${shop.getStampBoard.getRewards.size},
 					 img_path=${shop.shopImage},
 					 shopId=${shop.shopId}"></div>
+        <h1 class="subtitle is-5" th:if="${favouriteShops.size == 0 && activeShops.size == 0}"> Looks like you don't have any stamps yet, favourite a shop or make a purchase to start collecting!</h1>
+
 </div>
 
 
diff --git a/src/main/resources/templates/registerbusiness.html b/src/main/resources/templates/registerbusiness.html
index 7e1d3c0..a0fc4e7 100644
--- a/src/main/resources/templates/registerbusiness.html
+++ b/src/main/resources/templates/registerbusiness.html
@@ -28,7 +28,7 @@
             <div id="progressBar" class="progressBar">
                 <div style="width:20%"></div>
             </div>
-            <form name="businessForm" id="businessForm" action="/businessRegister" th:method="post" onsubmit="return false">
+            <form onkeydown="keyPress(event)" name="businessForm" id="businessForm" action="/businessRegister" th:method="post" onsubmit="return false">
             <section class="modal-card-body url-centering" id="modal_container">
                     <div id="modal_page1" class="modal_page">
                         <h5 class="title is-5" style="text-align:center">Enter your shop URL</h5>
-- 
GitLab