fixed bug on adding a value in the booking view of a single user
This commit is contained in:
		| @@ -1,5 +1,10 @@ | ||||
| package de.jottyfan.camporganizer; | ||||
|  | ||||
| import java.nio.file.Path; | ||||
| import java.nio.file.Paths; | ||||
|  | ||||
| import org.apache.logging.log4j.LogManager; | ||||
| import org.apache.logging.log4j.Logger; | ||||
| import org.springframework.boot.SpringApplication; | ||||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||||
| import org.springframework.boot.builder.SpringApplicationBuilder; | ||||
| @@ -14,12 +19,20 @@ import org.springframework.web.bind.annotation.RestController; | ||||
| @SpringBootApplication | ||||
| @RestController | ||||
| public class Main extends SpringBootServletInitializer { | ||||
|  | ||||
| 	private static final Logger LOGGER = LogManager.getLogger(Main.class); | ||||
|  | ||||
| 	@Override | ||||
| 	protected SpringApplicationBuilder configure(SpringApplicationBuilder appication) { | ||||
| 		return appication.sources(Main.class); | ||||
| 	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||||
| 		return application.sources(Main.class); | ||||
| 	} | ||||
|  | ||||
| 	public static void main(String[] args) { | ||||
| 		Path path = Paths.get(""); | ||||
| 		String p = path.toAbsolutePath().toString(); | ||||
| 		p = p.substring(p.lastIndexOf("/") + 1); | ||||
| 		LOGGER.info("running in {}", p); | ||||
| 		// TODO: put p + "properties" somehow into consideration to load the application.properties | ||||
| 		SpringApplication.run(Main.class, args); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -59,7 +59,15 @@ public class BookingsController { | ||||
|  | ||||
| 	@PostMapping("/business/bookings/payment/{id}") | ||||
| 	@RolesAllowed({"business_booking"}) | ||||
| 	public String addBooking(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id, @RequestParam String search) { | ||||
| 	public String addPayment(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id) { | ||||
| 		Double payment = bean.getPayment(); | ||||
| 		bookingsService.addPayment(id, payment); | ||||
| 		return getBooking(model, id); | ||||
| 	} | ||||
|  | ||||
| 	@PostMapping("/business/bookings/listpayment/{id}") | ||||
| 	@RolesAllowed({"business_booking"}) | ||||
| 	public String addListPayment(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id, @RequestParam(defaultValue = "") String search) { | ||||
| 		Double payment = bean.getPayment(); | ||||
| 		bookingsService.addPayment(id, payment); | ||||
| 		LOGGER.debug("search is {}", search); | ||||
|   | ||||
| @@ -36,7 +36,7 @@ | ||||
| 								<td class="middled" th:text="${b.camp}"></td> | ||||
| 								<td class="middled" th:text="${b.role}"></td> | ||||
| 								<td class="middled"> | ||||
| 									<form action="#" th:action="@{'/business/bookings/payment/' + ${b.pk}}" th:object="${addBean}" method="post"> | ||||
| 									<form action="#" th:action="@{'/business/bookings/listpayment/' + ${b.pk}}" th:object="${addBean}" method="post"> | ||||
| 										<input th:id="'searchfield' + ${b.pk}" type="hidden" th:name="search" /> | ||||
| 										<div class="container"> | ||||
| 											<div class="row"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user