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 {
public ModelAndView getLocalAuthoritiesPage(){
ModelAndView mav = new ModelAndView("local-authorities");
List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority();
mav.addObject("localAuthority", localAuthority);
return mav;
}
@GetMapping("/localForm")
public ModelAndView getLocalAuthForm(){
ModelAndView modelAndView = new ModelAndView("local-auth-data.html");
modelAndView.addObject("localAuthority",new localAuthority());
return modelAndView;
}
@Autowired
private localAuthorityRepository localAuthorityRepository;
@GetMapping("/local-auth-data")
@PostMapping("/local-auth-data1")
public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
if (bindingResult.hasErrors()){
ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap());
ModelAndView modelAndView = new ModelAndView("local-auth-data.html", model.asMap());
return modelAndView;
}else{// converts user input using the organisation constructor into a submittable format to the sql table
......@@ -40,7 +45,7 @@ public class organisationControllers {
return modelAndView;
}
}
@PostMapping
@GetMapping("/businesses")
public ModelAndView getBusinessesPage(){
ModelAndView mav1 = new ModelAndView("Businesses");
......
......@@ -2,10 +2,12 @@ package Team5.SmartTowns.localauthority;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.net.URL;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class localAuthority {
private String localAuthorityName;
......
......@@ -5,13 +5,13 @@
<title>Local Authority</title>
<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>
<header th:insert="~{/towns/Templating.html::header}"></header>
<body>
<div id="container1">
<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>
<label for="localAuthorityName">Enter your local authority</label>
<input type="text" name="authority_name" id="localAuthorityName">
......
......@@ -14,7 +14,7 @@
<li th:text="${localauthorities}"></li>
</ul>
</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>
</body>
</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