Skip to content
Snippets Groups Projects
Commit 243f1693 authored by Seb Barnard's avatar Seb Barnard :speech_balloon:
Browse files

Added data to details page with thymeleaf, needs styling. Removed some redundant print statements

parent aecf3316
No related branches found
No related tags found
4 merge requests!56tags will be saved to userFavTags table (needs user ID of current logged in user),!50Merging for latest changes,!46Develop,!44Branch update
...@@ -66,7 +66,7 @@ public class BusinessRegisterSaver { ...@@ -66,7 +66,7 @@ public class BusinessRegisterSaver {
//System.out.println(tagsRepo.findAll()); //System.out.println(tagsRepo.findAll());
System.out.println(shopsRepo.findByShopName(business.getBusiness_register_name()).get().getShopName()); //System.out.println(shopsRepo.findByShopName(business.getBusiness_register_name()).get().getShopName());
} }
} }
...@@ -31,7 +31,7 @@ public class registerUserServiceStatic implements registerUserService{ ...@@ -31,7 +31,7 @@ public class registerUserServiceStatic implements registerUserService{
LocalDateTime.now().format(formatter), twoFactorMethods); LocalDateTime.now().format(formatter), twoFactorMethods);
usersRepo.save(newUser); usersRepo.save(newUser);
System.out.println(usersRepo.findById(newUser.getUserId())); //System.out.println(usersRepo.findById(newUser.getUserId()));
} }
} }
...@@ -2,29 +2,40 @@ package com.example.clientproject.web.controllers; ...@@ -2,29 +2,40 @@ package com.example.clientproject.web.controllers;
import com.example.clientproject.data.shops.Shops; import com.example.clientproject.data.shops.Shops;
import com.example.clientproject.data.shops.ShopsRepo; import com.example.clientproject.data.shops.ShopsRepo;
import com.example.clientproject.data.stampBoards.StampBoards;
import com.example.clientproject.data.stampBoards.StampBoardsRepo;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Controller @Controller
public class BusinessDetails { public class BusinessDetails {
private ShopsRepo shopsRepo; private ShopsRepo shopsRepo;
public BusinessDetails(ShopsRepo aShopRepo){ private StampBoardsRepo stampRepo;
public BusinessDetails(ShopsRepo aShopRepo, StampBoardsRepo aStampBoard){
shopsRepo = aShopRepo; shopsRepo = aShopRepo;
stampRepo = aStampBoard;
} }
@GetMapping("/businessDetails") @GetMapping("/businessDetails")
public String getBusiness(@RequestParam(value = "shopId") int shopId, Model model){ public String getBusiness(@RequestParam(value = "shopId") int shopId, Model model){
StampBoards stampBoard;
Shops shop; Shops shop;
try { try {
shop = shopsRepo.getById(Long.valueOf(shopId)); shop = shopsRepo.getById(Long.valueOf(shopId));
//stampBoard = stampRepo.findById(Long.valueOf(shopId)).get();
}catch(Exception e){ }catch(Exception e){
e.printStackTrace(); e.printStackTrace();
return "redirect:/"; return "redirect:/";
} }
//model.addAttribute("stampBoard", stampBoard);
model.addAttribute("shop", shop); model.addAttribute("shop", shop);
return "shopDetails.html"; return "shopDetails.html";
} }
......
...@@ -30,10 +30,6 @@ public class selectCategoriesControllers { ...@@ -30,10 +30,6 @@ public class selectCategoriesControllers {
public String selectCategories(Model model){ public String selectCategories(Model model){
List<Tags> allTags = getTagService.findAll(); List<Tags> allTags = getTagService.findAll();
model.addAttribute("allTags", allTags); model.addAttribute("allTags", allTags);
for (Tags allTag : allTags) {
System.out.println(allTag);
}
System.out.println("Test");
return("selectCategories"); return("selectCategories");
} }
} }
...@@ -38,7 +38,6 @@ public class BusinessRegisterForm { ...@@ -38,7 +38,6 @@ public class BusinessRegisterForm {
int earnings; int earnings;
public void setBusinessTags(String tempTags){ public void setBusinessTags(String tempTags){
System.out.println(tempTags);
this.businessTags = new ArrayList(Arrays.asList(tempTags.split(","))); this.businessTags = new ArrayList(Arrays.asList(tempTags.split(",")));
} }
} }
...@@ -9,5 +9,14 @@ ...@@ -9,5 +9,14 @@
<body> <body>
<div th:replace="fragments/nav.html :: nav"></div> <div th:replace="fragments/nav.html :: nav"></div>
<div>
<h1 th:text="${shop.shopName}"></h1>
<p th:text="${shop.shopDescription}"></p>
<p th:text="${shop.shopWebsite}"></p>
<p th:text="${shop.shopEarnings}"></p>
<p th:text="${shop.shopCountries}"></p>
<img th:src="${shop.shopImage}" alt="">
</div>
</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.
Please register or to comment