Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets called when confirming a booking to add it to the DB.
- */
- @PostMapping("/roomBookingConfirmation")
- fun roomBookingConfirmation(model: Model, @ModelAttribute roomBookingRequest: RoomBookingRequest): String {
- makeBooking(roomBookingRequest)
- val date = roomBookingRequest.datetimeFrom
- val start = roomBookingRequest.datetimeFrom.minusDays(date.dayOfWeek.value.toLong())
- val end = roomBookingRequest.datetimeFrom.plusDays(7 - date.dayOfWeek.value.toLong())
- model.addAttribute("eventAppointmentSearchRequest", EventAppointmentSearchRequest(
- startDateTime = start,
- endDateTime = end,
- rooms = listOf(roomRepository.findByRoomName(roomBookingRequest.roomNr))
- ))
- return "roomBookingConfirmation"
- }
- /**
- * Displays the appointments in the calendar view according to the request
- */
- @PostMapping("/calendarView")
- fun calendarView(model: Model, @ModelAttribute eventAppointmentSearchRequest: EventAppointmentSearchRequest): String {
- // THIS THROWS THE EXCEPTION: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method ...requests.EventAppointmentSearchRequest.<init>, parameter startDateTime
- ...
- }
- <!-- /*@thymesVar id="eventAppointmentSearchRequest" type="de.tudarmstadt.pvw.tulpe.soonToBeArtifactory.requests.EventAppointmentSearchRequest"*/ -->
- <form th:action="@{/calendarView}" method="post" th:object="${eventAppointmentSearchRequest}" id="forwardToCalendar" style="grid-column: span 4">
- <H1 th:text="#{roomBooking.bookingConfirmed}">
- Booking confirmed.
- </H1>
- <div class="links">
- <a href="#" th:text="#{roomBooking.nowRedirecting}" onclick="forwardToCalendar()">Redirecting to
- calendarView in </a> <b id="secondsLeft">7</b>
- <input type="hidden" th:field="${eventAppointmentSearchRequest.startDateTime}" th:name="startDateTime" th:value="${eventAppointmentSearchRequest.startDateTime}">
- <input type="hidden" th:field="${eventAppointmentSearchRequest.endDateTime}" th:name="endDateTime" th:value="${eventAppointmentSearchRequest.endDateTime}">
- <input type="hidden" th:field="${eventAppointmentSearchRequest.rooms}" name="rooms[]" th:each="room: ${eventAppointmentSearchRequest.rooms}" th:value="${room.RoomId}">
- </div>
- ...
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement