Skip to content
Snippets Groups Projects
Commit 2a201d41 authored by Rhys Nute's avatar Rhys Nute
Browse files

PP with RE to fix bug issue

parent 08577135
No related branches found
No related tags found
2 merge requests!38Draft: Businesses,!31Resolve "As a user, I want to see a page of local authorities so that I can easily source contact details for a variety of different local authorities."
...@@ -21,15 +21,20 @@ public class organisationControllers { ...@@ -21,15 +21,20 @@ public class organisationControllers {
public ModelAndView getLocalAuthoritiesPage(){ public ModelAndView getLocalAuthoritiesPage(){
ModelAndView mav = new ModelAndView("local-authorities"); ModelAndView mav = new ModelAndView("local-authorities");
List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority(); List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority();
mav.addObject("localAuthority", localAuthority);
return mav; return mav;
} }
@GetMapping("/localForm")
public ModelAndView getLocalAuthForm(){
ModelAndView modelAndView = new ModelAndView("local-auth-data.html");
modelAndView.addObject("localAuthority",new localAuthority());
return modelAndView;
}
@Autowired @Autowired
private localAuthorityRepository localAuthorityRepository; private localAuthorityRepository localAuthorityRepository;
@GetMapping("/local-auth-data") @PostMapping("/local-auth-data1")
public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) { public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
if (bindingResult.hasErrors()){ if (bindingResult.hasErrors()){
ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap()); ModelAndView modelAndView = new ModelAndView("local-auth-data.html", model.asMap());
return modelAndView; return modelAndView;
}else{// converts user input using the organisation constructor into a submittable format to the sql table }else{// converts user input using the organisation constructor into a submittable format to the sql table
...@@ -40,7 +45,7 @@ public class organisationControllers { ...@@ -40,7 +45,7 @@ public class organisationControllers {
return modelAndView; return modelAndView;
} }
} }
@PostMapping
@GetMapping("/businesses") @GetMapping("/businesses")
public ModelAndView getBusinessesPage(){ public ModelAndView getBusinessesPage(){
ModelAndView mav1 = new ModelAndView("Businesses"); ModelAndView mav1 = new ModelAndView("Businesses");
......
...@@ -2,10 +2,12 @@ package Team5.SmartTowns.localauthority; ...@@ -2,10 +2,12 @@ package Team5.SmartTowns.localauthority;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.net.URL; import java.net.URL;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor
@Data @Data
public class localAuthority { public class localAuthority {
private String localAuthorityName; private String localAuthorityName;
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
<title>Local Authority</title> <title>Local Authority</title>
<link rel="stylesheet" th:href="@{css/localAuthortyPageStyle.css}"> <link rel="stylesheet" th:href="@{css/localAuthortyPageStyle.css}">
<link rel="stylesheet" th:href="@{css/templatingstyle.css}"> <link rel="stylesheet" th:href="@{../static/css/templatingstyle.css}">
</head> </head>
<header th:insert="~{/towns/Templating.html::header}"></header> <header th:insert="~{/towns/Templating.html::header}"></header>
<body> <body>
<div id="container1"> <div id="container1">
<h2>Enter your Local authority</h2> <h2>Enter your Local authority</h2>
<form action="/local-auth-data" method="post" id="data" object="local-auth-data"> <form action="/local-auth-data1" method="post" id="data">
<p> <p>
<label for="localAuthorityName">Enter your local authority</label> <label for="localAuthorityName">Enter your local authority</label>
<input type="text" name="authority_name" id="localAuthorityName"> <input type="text" name="authority_name" id="localAuthorityName">
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<li th:text="${localauthorities}"></li> <li th:text="${localauthorities}"></li>
</ul> </ul>
</div> </div>
<button><a href="../static/local-auth-data.html" id="authority">Local Authorities please enter here</a></button> <button><a href="local-auth-data.html" id="authority">Local Authorities please enter here</a></button>
<footer th:insert=/towns/Templating.html::footer></footer> <footer th:insert=/towns/Templating.html::footer></footer>
</body> </body>
</html> </html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment