From 023977e5dd1a524c0e50b174fa9cba784d8ce13f Mon Sep 17 00:00:00 2001
From: Rhys Nute <nuterd@cardiff.ac.uk>
Date: Mon, 11 Dec 2023 15:30:36 +0000
Subject: [PATCH] Database fixes

---
 .../Organisation/organisationControllers.java |  6 +++---
 src/main/resources/local-authorities.html     | 19 -------------------
 .../{ => templates}/local-auth-data.html      | 15 ++++++++-------
 .../templates/local-authorities.html          | 18 ++++++++++++++++++
 4 files changed, 29 insertions(+), 29 deletions(-)
 delete mode 100644 src/main/resources/local-authorities.html
 rename src/main/resources/{ => templates}/local-auth-data.html (77%)
 create mode 100644 src/main/resources/templates/local-authorities.html

diff --git a/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java b/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java
index 7851f2dc..451d1e3f 100644
--- a/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java
+++ b/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java
@@ -17,7 +17,7 @@ import java.util.List;
 
 @Controller
 public class organisationControllers {
-    @GetMapping("/localauthorities")
+    @GetMapping("/local-authorities")
     public ModelAndView getLocalAuthoritiesPage(){
         ModelAndView mav = new ModelAndView("local-authorities");
         List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority();
@@ -26,8 +26,8 @@ public class organisationControllers {
     }
     @Autowired
     private localAuthorityRepository localAuthorityRepository;
-    @PostMapping("/localauthsub")
-    public ModelAndView localAuthSent(@Valid @ModelAttribute("local-auth-data")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
+    @PostMapping("/local-auth-data")
+    public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
         if (bindingResult.hasErrors()){
             ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap());
             return modelAndView;
diff --git a/src/main/resources/local-authorities.html b/src/main/resources/local-authorities.html
deleted file mode 100644
index 567e0ae5..00000000
--- a/src/main/resources/local-authorities.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Local Authorities</title>
-    <link rel="stylesheet" href="static/css/templatingstyle.css">
-</head>
-<header th:insert="~{/towns/Templating.html::header}"></header>
-<body>
-<h1>Local Authorities</h1>
-<div id="councils">
-    <ul th:each="localauthority:${localauthorities}">
-        <li th:text="${localauthority}"></li>
-    </ul>
-</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>
-</body>
-</html>
\ No newline at end of file
diff --git a/src/main/resources/local-auth-data.html b/src/main/resources/templates/local-auth-data.html
similarity index 77%
rename from src/main/resources/local-auth-data.html
rename to src/main/resources/templates/local-auth-data.html
index 5bcc9883..ec9f30bb 100644
--- a/src/main/resources/local-auth-data.html
+++ b/src/main/resources/templates/local-auth-data.html
@@ -3,16 +3,17 @@
 <head>
     <meta charset="UTF-8">
     <title>Local Authority</title>
-    <link rel="stylesheet" th:href="@{css/landmarkFormStyle.css}">
-    <link rel="stylesheet" th:href="@{css/templatingstyle.css}">
-    <script src="scripts/landmarkFormThScript.js"></script></head>
+    <link rel="stylesheet" href=css\landmarkFormStyle.css>
+    <link rel="stylesheet" href=css\templatingstyle.css>
+</head>
+<header class="headerBar" th:fragment="header">
 <body>
 <div id="container1">
     <h2>Enter your Local authority</h2>
-        <form action="/localauthsub" method="post" id="data">
+        <form action="/localauthsub" method="post" id="data" object="localauthsub">
             <p>
-                <label for="localAthorityName">Enter your local authority</label>
-                <input type="text" name="authority_name" id="localAthorityName">
+                <label for="localAuthorityName">Enter your local authority</label>
+                <input type="text" name="authority_name" id="localAuthorityName">
             </p>
             <p>
                 <label for="address1">Please enter first line of your address</label>
@@ -42,5 +43,5 @@
         </form>
 </div>
 </body>
-<footer th:insert="~{/towns/Templating.html::footer}"></footer>
+<footer th:insert=/towns/Templating.html></footer>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/local-authorities.html b/src/main/resources/templates/local-authorities.html
new file mode 100644
index 00000000..b67e7b42
--- /dev/null
+++ b/src/main/resources/templates/local-authorities.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Local Authorities</title>
+    <link rel="stylesheet" href="../static/css/templatingstyle.css">
+</head>
+<body>
+<h1>Local Authorities</h1>
+<div id="councils">
+    <ul th:each="localauthority:${localauthorities}">
+        <li th:text="${localAuthority}"></li>
+    </ul>
+</div>
+<p>Local Authorities please enter here</p><button><a href="local-auth-data" id="authority">Login</a></button>
+<footer insert=towns/Templating.html::footer></footer>
+</body>
+</html>
\ No newline at end of file
-- 
GitLab