From 682e396470e8d4293242a4585cfb9a457f117fe8 Mon Sep 17 00:00:00 2001
From: Rhys Nute <nuterd@cardiff.ac.uk>
Date: Fri, 8 Dec 2023 19:45:13 +0000
Subject: [PATCH] added businesses database

---
 .../resources/WorkWith/business-data.html     | 36 ++++++++++++++++++-
 src/main/resources/WorkWith/businesses.html   |  2 +-
 src/main/resources/data.sql                   |  7 +++-
 src/main/resources/schema.sql                 | 15 +++++++-
 4 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/WorkWith/business-data.html b/src/main/resources/WorkWith/business-data.html
index 5636d33f..b550c48c 100644
--- a/src/main/resources/WorkWith/business-data.html
+++ b/src/main/resources/WorkWith/business-data.html
@@ -5,6 +5,40 @@
     <title>Businesses</title>
 </head>
 <body>
-
+<div id="container1">
+    <h2>Enter your Business information</h2>
+    <form action="businesses.php" method="post" id="data">
+        <p>
+            <label for="businessName">Enter your business name</label>
+            <input type="text" name="business_name" id="businessName">
+        </p>
+        <p>
+            <label for="address1">Please enter first line of your address</label>
+            <input type="text" name="address_1" id="address1">
+        </p>
+        <p>
+            <label for="address2">Please enter second line of your address (optional)</label>
+            <input type="text" name="address_2" id="address2">
+        </p>
+        <p>
+            <label for="city">Please enter the City/Town</label>
+            <input type="text" name="city" id="city">
+        </p>
+        <p>
+            <label for="county">Please enter you county (optional)</label>
+            <input type="text" name="county" id="county">
+        </p>
+        <p>
+            <label for="postcode">Please enter your postcode</label>
+            <input type="text" name="post_code" id="postcode">
+        </p>
+        <p>
+            <label for="website">Please enter your website address</label>
+            <input type="url" name="web_site" id="website">
+        </p>
+        <input type="submit" value="Submit Data">
+    </form>
+</div>
 </body>
+
 </html>
\ No newline at end of file
diff --git a/src/main/resources/WorkWith/businesses.html b/src/main/resources/WorkWith/businesses.html
index 32422f14..6fd24d7b 100644
--- a/src/main/resources/WorkWith/businesses.html
+++ b/src/main/resources/WorkWith/businesses.html
@@ -10,7 +10,7 @@
 <h1>Compete with Online Retailers</h1>
 <h1>Drive Footfall to the high street</h1>
 <h1>Increase Sales</h1>
-<p>Businesses please enter here</p><button><a href="local-auth-data.html" id="business">Login</a></button>
+<p>Businesses please enter here</p><button><a href="businesses.html" id="business">Login</a></button>
 </body>
 <footer th:insert="~{/towns/Templating.html::footer}"></footer>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
index e40208ba..44a871f4 100644
--- a/src/main/resources/data.sql
+++ b/src/main/resources/data.sql
@@ -54,4 +54,9 @@ insert into badgeprogress (userID, badgeID, progress) value ('2', '2', '70');
 delete from stickerprogress;
 insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true);
 insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true);
-insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true);
\ No newline at end of file
+insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true);
+
+delete from businesses;
+insert into businesses ( businessName, address1, address2, city, county, postcode, website) value ( 'Caerphilly Castle', 'Castle Street', '', 'Caerphilly', '', 'CF83 1JD', 'https://cadw.gov.wales/visit/places-to-visit/caerphilly-castle');
+insert into businesses ( businessName, address1, address2, city, county, postcode, website) value ( 'Risca Colliers Institute', 'Grove Road', '', 'Risca', '', 'NP11 6GN', 'https://www.nmrs.org.uk/mines-map/coal-mining-in-the-british-isles/swales/abercarn/risca-colliery/');
+insert into businesses ( businessName, address1, address2, city, county, postcode, website) value ( 'Penarth Esplanade', '7 Pier Buildings', 'Penarth Pier', '', 'CF64 3AU', 'https://www.facebook.com/DecksPenarth/', '');
\ No newline at end of file
diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql
index 92b8d4e0..f6042727 100644
--- a/src/main/resources/schema.sql
+++ b/src/main/resources/schema.sql
@@ -57,4 +57,17 @@ create table if not exists stickerProgress
     userID bigint,
     stickerID bigint,
     hasSticker boolean /*Has sticker or not*/
-) engine=InnoDB;
\ No newline at end of file
+) engine=InnoDB;
+
+drop table if exists businesses;
+create table if not exists businesses
+(
+    businessID bigint auto_increment primary key,
+    businessName varchar(250),
+    address1 varchar(250),
+    address2 varchar(250),
+    city varchar(100),
+    county varchar(75),
+    postcode varchar(15),
+    website varchar(250)
+) engine=InnoDB;
-- 
GitLab