From 5458b022fe6741ab8852de87ee669a623e3611a2 Mon Sep 17 00:00:00 2001
From: Rhys Nute <nuterd@cardiff.ac.uk>
Date: Fri, 8 Dec 2023 17:48:24 +0000
Subject: [PATCH] added local authority database

---
 src/main/resources/data.sql               |  7 ++++-
 src/main/resources/local-auth-data.html   | 35 +++++++++++++++++++++--
 src/main/resources/local-authorities.html |  6 ----
 src/main/resources/schema.sql             | 13 +++++++++
 4 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
index e40208ba..dfbfde36 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 localAuthority;
+insert into localAuthority (localAthorityID, localAuthorityName, address1, address2, city, county, postcode, website) value ('1', 'Caerphilly County Borough Council', 'Tredomen Park', 'Ystrad Mynach, Hengoed', '', 'CF82 7PG', 'https://www.caerphilly.gov.uk/main.aspx?lang=en-GB');
+insert into localAuthority (localAthorityID, localAuthorityName, address1, address2, city, county, postcode, website) value ('2', 'Risca Town Council', 'Unit B, 75 Tredegar Street', '', 'Risca', '', 'NP11 6BW', 'https://www.riscatowncouncil.org.uk/');
+insert into localAuthority (localAthorityID, localAuthorityName, address1, address2, city, county, postcode, website) value ('3', 'Penarth Town Council West House', 'Stanwell Road', '', 'Penarth', '', 'CF64 2YG', 'https://www.penarthtowncouncil.gov.uk/your-council/');
\ No newline at end of file
diff --git a/src/main/resources/local-auth-data.html b/src/main/resources/local-auth-data.html
index 96d85135..d7c5e170 100644
--- a/src/main/resources/local-auth-data.html
+++ b/src/main/resources/local-auth-data.html
@@ -7,9 +7,38 @@
 </head>
 <body>
 <div id="container1">
-    <form id="data">
-
-    </form>
+    <h2>Enter your Local authority</h2>
+        <form action="local-auth-data.php" method="post" id="data">
+            <p>
+                <label for="localAthorityName">Enter your local authority</label>
+                <input type="text" name="authority_name" id="localAthorityName">
+            </p>
+            <p>
+                <label for="address1">Please enter first line of address</label>
+                <input type="text" name="address_1" id="address1">
+            </p>
+            <p>
+                <label for="address2">Please enter second line of 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>
 <footer th:insert="~{/towns/Templating.html::footer}"></footer>
diff --git a/src/main/resources/local-authorities.html b/src/main/resources/local-authorities.html
index ee520085..3526761a 100644
--- a/src/main/resources/local-authorities.html
+++ b/src/main/resources/local-authorities.html
@@ -9,12 +9,6 @@
 <body>
 <h1>Local Authorities</h1>
 <div id="councils">
-    <p>Caerphilly County Borough Council,<br>Tredomen Park,<br> Ystrad Mynach,<br> Hengoed,<br> CF82 7PG</p>
-    <a href="https://www.caerphilly.gov.uk/main.aspx?lang=en-GB">Caerphilly County Borough Council Website</a>
-    <p>Risca Town Council,<br>Risca Palace Library,<br>Unit B,<br>75 Tredegar Street,<br>Risca,<br>NP11 6BW</p>
-    <a href="https://www.riscatowncouncil.org.uk/">Risca Town Council Website</a>
-    <p>Penarth Town Council West House,<br>Stanwell Road,<br>Penarth,<br> CF64 2YG</p>
-    <a href="https://www.penarthtowncouncil.gov.uk/your-council/">Penarth Town Council Website</a>
 </div>
 <p>Local Autorities please enter here</p><button><a href="local-auth-data.html" id="authority">Login</a></button>
 <footer th:insert="~{/towns/Templating.html::footer}"></footer>
diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql
index 92b8d4e0..43f6da94 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;
+
+drop table if exists localAuthority;
+create table if not exists localAuthority
+(
+    localAuthorityID bigint auto_increment primary key,
+    localAuthorityName varchar(250),
+    address1 varchar(250),
+    address2 varchar(250),
+    city varchar(100),
+    county varchar(75),
+    postcode varchar(15),
+    website varchar(250)
 ) engine=InnoDB;
\ No newline at end of file
-- 
GitLab