corrected subject notes manipulation
This commit is contained in:
		| @@ -26,6 +26,7 @@ public class ThemeController extends CommonController { | ||||
| 	@GetMapping("/theme") | ||||
| 	public String getThemeManipulationBySlotId(@RequestParam("slotId") Integer slotId, Model model) { | ||||
| 		model.addAttribute("slotId", slotId); | ||||
| 		model.addAttribute("day", service.getSlotDay(slotId)); | ||||
| 		model.addAttribute("list", service.getThemeManipulation(slotId)); | ||||
| 		model.addAttribute("themes", service.getAllThemes()); | ||||
| 		model.addAttribute("lesson", service.getLesson(slotId)); | ||||
| @@ -49,6 +50,6 @@ public class ThemeController extends CommonController { | ||||
| 	@PostMapping("/theme/update") | ||||
| 	public String updateLesson(@RequestParam("slotId") Integer slotId, @ModelAttribute("lesson") TLessonRecord bean) { | ||||
| 		service.updateLesson(bean); | ||||
| 		return "redirect:/theme?slotId=" + bean.getFkSlot(); | ||||
| 		return "redirect:/theme?slotId=" + slotId; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -2,9 +2,11 @@ package de.jottyfan.bico.modules.theme; | ||||
|  | ||||
| import static de.jottyfan.bico.db.Tables.T_LESSON; | ||||
| import static de.jottyfan.bico.db.Tables.T_LESSON_SUBJECT; | ||||
| import static de.jottyfan.bico.db.Tables.T_SLOT; | ||||
| import static de.jottyfan.bico.db.Tables.T_SOURCE; | ||||
| import static de.jottyfan.bico.db.Tables.T_SUBJECT; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
| @@ -13,6 +15,7 @@ import org.jboss.logging.Logger; | ||||
| import org.jooq.DSLContext; | ||||
| import org.jooq.DeleteConditionStep; | ||||
| import org.jooq.InsertOnDuplicateStep; | ||||
| import org.jooq.Record1; | ||||
| import org.jooq.Record10; | ||||
| import org.jooq.Record4; | ||||
| import org.jooq.SelectConditionStep; | ||||
| @@ -138,4 +141,15 @@ public class ThemeRepository { | ||||
| 		sql.execute(); | ||||
| 	} | ||||
|  | ||||
| 	public LocalDate getSlotDay(Integer slotId) { | ||||
| 		SelectConditionStep<Record1<LocalDate>> sql = jooq | ||||
| 		// @formatter:off | ||||
| 			.select(T_SLOT.SLOT_DAY) | ||||
| 			.from(T_SLOT) | ||||
| 			.where(T_SLOT.PK_SLOT.eq(slotId)); | ||||
| 		// @formatter:on | ||||
| 		LOGGER.trace(sql); | ||||
| 		return sql.fetchOne().get(T_SLOT.SLOT_DAY); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package de.jottyfan.bico.modules.theme; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.List; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -44,4 +45,7 @@ public class ThemeService { | ||||
| 		repository.updateLesson(bean); | ||||
| 	} | ||||
|  | ||||
| 	public LocalDate getSlotDay(Integer slotId) { | ||||
| 		return repository.getSlotDay(slotId); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -4,32 +4,51 @@ | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			<div class="container"> | ||||
| 				<div class="row g-2"> | ||||
| 					<h1> | ||||
| 						Themen für den <span th:text="${#temporals.format(day, 'dd.MM.yyyy')}"></span> | ||||
| 					</h1> | ||||
| 				</div> | ||||
| 				<th:block th:each="b : ${list}" th:if="${list.size() > 0}"> | ||||
| 					<div class="row g-2 blockframe"> | ||||
| 						<div class="col-sm-3">Thema:</div> | ||||
| 						<div class="col-sm-8"><span th:text="${b.theme}"></span></div> | ||||
| 						<div class="col-sm-8"> | ||||
| 							<span th:text="${b.theme}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-1"> | ||||
| 							<div class="dropdown"> | ||||
|   							<button class="btn btn-outline-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> | ||||
|     							<i class="bi bi-trash"></i> | ||||
|   							</button> | ||||
|   							<ul class="dropdown-menu"> | ||||
|     							<li><a class="dropdown-item" th:href="@{/theme/delete?lessonSubjectId={id}&slotId={s}(id=${b.pkLessonSubject},s=${slotId})}">ja, endgültig verwerfen</a></li> | ||||
|   							</ul> | ||||
| 								<button class="btn btn-outline-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> | ||||
| 									<i class="bi bi-trash"></i> | ||||
| 								</button> | ||||
| 								<ul class="dropdown-menu"> | ||||
| 									<li><a class="dropdown-item" th:href="@{/theme/delete?lessonSubjectId={id}&slotId={s}(id=${b.pkLessonSubject},s=${slotId})}">ja, endgültig verwerfen</a></li> | ||||
| 								</ul> | ||||
| 							</div> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3">Unterthema:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.subtheme}"></span></div> | ||||
| 						<div class="col-sm-3">Buchseiten:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.bookPages}"></span></div> | ||||
| 						<div class="col-sm-3">Arbeitsblätter:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.worksheets}"></span></div> | ||||
| 						<div class="col-sm-3">Bibelvers (Lernvers):</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.bibleverse}"></span></div> | ||||
| 						<div class="col-sm-3">Anmerkungen zum Thema:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.notes}"></span></div> | ||||
| 						<div class="col-sm-3" th:if="${b.subtheme}">Unterthema:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.subtheme}"> | ||||
| 							<span th:text="${b.subtheme}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.bookPages}">Buchseiten:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.bookPages}"> | ||||
| 							<span th:text="${b.bookPages}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.worksheets}">Arbeitsblätter:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.worksheets}"> | ||||
| 							<span th:text="${b.worksheets}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.bibleverse}">Bibelvers (Lernvers):</div> | ||||
| 						<div class="col-sm-9" th:if="${b.bibleverse}"> | ||||
| 							<span th:text="${b.bibleverse}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.notes}">Anmerkungen zum Thema:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.notes}"> | ||||
| 							<span th:text="${b.notes}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3">Quelle:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.sourceName}"></span></div> | ||||
| 						<div class="col-sm-9"> | ||||
| 							<span th:text="${b.sourceName}"></span> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 				</th:block> | ||||
| 				<form th:action="@{/theme/update?slotId={id}(id=${slotId})}" method="post" th:object="${lesson}"> | ||||
| @@ -50,11 +69,13 @@ | ||||
| 					<div class="row g-2"> | ||||
| 						<div class="col-sm-3">ein Thema hinzufügen</div> | ||||
| 						<div class="col-sm-7"> | ||||
| 						  <select name="pkSubject" class="form-select"> | ||||
| 							<select name="pkSubject" class="form-select"> | ||||
| 								<option th:each="t : ${themes}" th:value="${t.key}" th:text="${t.value}"></option> | ||||
| 						  </select> | ||||
| 						 </div> | ||||
| 						<div class="col-sm-2"><button type="submit" class="btn btn-outline-primary">hinzufügen</button></div> | ||||
| 							</select> | ||||
| 						</div> | ||||
| 						<div class="col-sm-2"> | ||||
| 							<button type="submit" class="btn btn-outline-primary">hinzufügen</button> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 				</form> | ||||
| 			</div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user