added camp description database value, see #27

This commit is contained in:
Jottyfan committed 2026-10-12 21:35:20 +02:00
1 parent 1cf2e160eb
commit ccd6c78397
11 files changed
+74 -23

No files matched your search

+5 -2
View File
@@ -12,11 +12,14 @@
<attribute name="gradle_used_by_scope" value="main,test"/> <attribute name="gradle_used_by_scope" value="main,test"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-25/"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"> <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer">
<attributes> <attributes>
+3 -3
View File
@@ -1,4 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 org.eclipse.jdt.core.compiler.codegen.targetPlatform=25
org.eclipse.jdt.core.compiler.compliance=21 org.eclipse.jdt.core.compiler.compliance=25
org.eclipse.jdt.core.compiler.source=21 org.eclipse.jdt.core.compiler.source=25
+2 -9
View File
@@ -1,15 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="CampOrganizer2"> <wb-module deploy-name="CampOrganizer2">
<property name="context-root" value="CampOrganizer2"/> <property name="context-root" value="CampOrganizer2"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
</wb-module> </wb-module>
</project-modules> </project-modules>
@@ -3,5 +3,5 @@
<fixed facet="jst.java"/> <fixed facet="jst.java"/>
<fixed facet="jst.web"/> <fixed facet="jst.web"/>
<installed facet="jst.web" version="2.4"/> <installed facet="jst.web" version="2.4"/>
<installed facet="jst.java" version="21"/> <installed facet="jst.java" version="25"/>
</faceted-project> </faceted-project>
+3 -3
View File
@@ -8,7 +8,7 @@ plugins {
} }
group = 'de.jottyfan.camporganizer' group = 'de.jottyfan.camporganizer'
version = '1.0.5' version = '1.0.6'
description = """CampOrganizer2""" description = """CampOrganizer2"""
@@ -32,7 +32,7 @@ application {
java { java {
toolchain { toolchain {
languageVersion = JavaLanguageVersion.of(21) languageVersion = JavaLanguageVersion.of(25)
} }
} }
@@ -50,7 +50,7 @@ war {
dependencies { dependencies {
implementation 'org.jooq:jooq:3.20.8' implementation 'org.jooq:jooq:3.20.8'
implementation 'de.jottyfan:COJooq:2024.10.24' implementation 'de.jottyfan:COJooq:2026.10.12'
implementation 'org.apache.logging.log4j:log4j-api:2.25.2' implementation 'org.apache.logging.log4j:log4j-api:2.25.2'
implementation 'org.apache.logging.log4j:log4j-core:2.25.2' implementation 'org.apache.logging.log4j:log4j-core:2.25.2'
@@ -151,6 +151,7 @@ public class AdminController extends CommonController {
model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("documents", service.getCampDocuments());
model.addAttribute("locations", service.getLocations()); model.addAttribute("locations", service.getLocations());
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
model.addAttribute("campdescriptions", service.getCampdescriptions());
return "/admin/camp_edit"; return "/admin/camp_edit";
} }
@@ -160,6 +161,7 @@ public class AdminController extends CommonController {
model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("documents", service.getCampDocuments());
model.addAttribute("locations", service.getLocations()); model.addAttribute("locations", service.getLocations());
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
model.addAttribute("campdescriptions", service.getCampdescriptions());
String error = (String) request.getAttribute("error"); String error = (String) request.getAttribute("error");
if (error != null) { if (error != null) {
model.addAttribute("error", error); model.addAttribute("error", error);
@@ -177,6 +179,7 @@ public class AdminController extends CommonController {
model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("documents", service.getCampDocuments());
model.addAttribute("locations", service.getLocations()); model.addAttribute("locations", service.getLocations());
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
model.addAttribute("campdescriptions", service.getCampdescriptions());
return "/admin/camp_edit"; return "/admin/camp_edit";
} }
String error = service.upsertCamp(bean); String error = service.upsertCamp(bean);
@@ -1,6 +1,7 @@
package de.jottyfan.camporganizer.module.admin; package de.jottyfan.camporganizer.module.admin;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPDESCRIPTION;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPDOCUMENT; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPDOCUMENT;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_DOCUMENT; import static de.jottyfan.camporganizer.db.jooq.Tables.T_DOCUMENT;
@@ -26,7 +27,7 @@ import org.jooq.DeleteConditionStep;
import org.jooq.Field; import org.jooq.Field;
import org.jooq.InsertResultStep; import org.jooq.InsertResultStep;
import org.jooq.InsertReturningStep; import org.jooq.InsertReturningStep;
import org.jooq.InsertValuesStep16; import org.jooq.InsertValuesStep17;
import org.jooq.InsertValuesStep3; import org.jooq.InsertValuesStep3;
import org.jooq.Record4; import org.jooq.Record4;
import org.jooq.Record5; import org.jooq.Record5;
@@ -48,6 +49,7 @@ import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
import de.jottyfan.camporganizer.db.jooq.enums.EnumFiletype; import de.jottyfan.camporganizer.db.jooq.enums.EnumFiletype;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule; import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampdescriptionRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampdocumentRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TCampdocumentRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampprofileRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TCampprofileRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TDocumentRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TDocumentRecord;
@@ -448,7 +450,7 @@ public class AdminRepository {
LocalDateTime arrive = arriveDate == null ? null : arriveDate.atStartOfDay(); LocalDateTime arrive = arriveDate == null ? null : arriveDate.atStartOfDay();
LocalDateTime depart = departDate == null ? null : departDate.atStartOfDay(); LocalDateTime depart = departDate == null ? null : departDate.atStartOfDay();
if (bean.getPk() == null) { if (bean.getPk() == null) {
InsertValuesStep16<TCampRecord, LocalDateTime, String, LocalDateTime, Integer, Integer, Integer, Boolean, Integer, Integer, String, String, Integer, Integer, Integer, Integer, LocalDateTime> sql = DSL InsertValuesStep17<TCampRecord, LocalDateTime, String, LocalDateTime, Integer, Integer, Integer, Boolean, Integer, Integer, String, String, Integer, Integer, Integer, Integer, LocalDateTime, Integer> sql = DSL
.using(t) .using(t)
// @formatter:off // @formatter:off
.insertInto(T_CAMP, .insertInto(T_CAMP,
@@ -467,10 +469,11 @@ public class AdminRepository {
T_CAMP.BEDS_MALE, T_CAMP.BEDS_MALE,
T_CAMP.BLOCKED_BEDS_FEMALE, T_CAMP.BLOCKED_BEDS_FEMALE,
T_CAMP.BLOCKED_BEDS_MALE, T_CAMP.BLOCKED_BEDS_MALE,
T_CAMP.START_BOOKING) T_CAMP.START_BOOKING,
T_CAMP.FK_CAMPDESCRIPTION)
.values(arrive, bean.getCountries(), depart, bean.getFkDocument(), bean.getFkLocation(), bean.getFkProfile(), .values(arrive, bean.getCountries(), depart, bean.getFkDocument(), bean.getFkLocation(), bean.getFkProfile(),
bean.getLockSales() != null ? bean.getLockSales() : false, bean.getMaxAge(), bean.getMinAge(), bean.getName(), bean.getPrice(), bean.getLockSales() != null ? bean.getLockSales() : false, bean.getMaxAge(), bean.getMinAge(), bean.getName(), bean.getPrice(),
bean.getBedsFemale(), bean.getBedsMale(), bean.getBlockedBedsFemale(), bean.getBlockedBedsMale(), bean.getStartBooking()); bean.getBedsFemale(), bean.getBedsMale(), bean.getBlockedBedsFemale(), bean.getBlockedBedsMale(), bean.getStartBooking(), bean.getFkCampdescription());
// @formatter:on // @formatter:on
LOGGER.trace(sql); LOGGER.trace(sql);
sql.execute(); sql.execute();
@@ -494,6 +497,7 @@ public class AdminRepository {
.set(T_CAMP.BLOCKED_BEDS_FEMALE, bean.getBlockedBedsFemale()) .set(T_CAMP.BLOCKED_BEDS_FEMALE, bean.getBlockedBedsFemale())
.set(T_CAMP.BLOCKED_BEDS_MALE, bean.getBlockedBedsMale()) .set(T_CAMP.BLOCKED_BEDS_MALE, bean.getBlockedBedsMale())
.set(T_CAMP.START_BOOKING, bean.getStartBooking()) .set(T_CAMP.START_BOOKING, bean.getStartBooking())
.set(T_CAMP.FK_CAMPDESCRIPTION, bean.getFkCampdescription())
.where(T_CAMP.PK.eq(bean.getPk())); .where(T_CAMP.PK.eq(bean.getPk()));
// @formatter:on // @formatter:on
LOGGER.trace(sql); LOGGER.trace(sql);
@@ -739,4 +743,15 @@ public class AdminRepository {
LOGGER.trace(sql); LOGGER.trace(sql);
sql.execute(); sql.execute();
} }
/**
* get all camp descriptions
*
* @return the list of all camp descriptions
*/
public List<TCampdescriptionRecord> getCampdescriptions() {
SelectWhereStep<TCampdescriptionRecord> sql = jooq.selectFrom(T_CAMPDESCRIPTION);
LOGGER.trace(sql);
return sql.fetchInto(TCampdescriptionRecord.class);
}
} }
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument; import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampdescriptionRecord;
import de.jottyfan.camporganizer.module.admin.model.CampBean; import de.jottyfan.camporganizer.module.admin.model.CampBean;
import de.jottyfan.camporganizer.module.admin.model.CampDocumentBean; import de.jottyfan.camporganizer.module.admin.model.CampDocumentBean;
import de.jottyfan.camporganizer.module.admin.model.DocumentBean; import de.jottyfan.camporganizer.module.admin.model.DocumentBean;
@@ -247,4 +248,15 @@ public class AdminService {
public void deleteCampDocument(Integer id) { public void deleteCampDocument(Integer id) {
adminRepository.deleteCampDocument(id); adminRepository.deleteCampDocument(id);
} }
/**
* get all camp descriptions; replace line breaks by /
*
* @return all camp descriptions
*/
public List<TCampdescriptionRecord> getCampdescriptions() {
List<TCampdescriptionRecord> list = adminRepository.getCampdescriptions();
list.forEach(r -> r.setValue(r.getValue().replace("<br />", " / ")));
return list;
}
} }
@@ -60,6 +60,7 @@ public class CampBean implements Serializable {
@NotNull @NotNull
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime startBooking; private LocalDateTime startBooking;
private Integer fkCampdescription;
/** /**
* generate a camp bean out of r * generate a camp bean out of r
@@ -91,6 +92,7 @@ public class CampBean implements Serializable {
bean.setBlockedBedsFemale(r.getBlockedBedsFemale()); bean.setBlockedBedsFemale(r.getBlockedBedsFemale());
bean.setBlockedBedsMale(r.getBlockedBedsMale()); bean.setBlockedBedsMale(r.getBlockedBedsMale());
bean.setStartBooking(r.getStartBooking()); bean.setStartBooking(r.getStartBooking());
bean.setFkCampdescription(r.getFkCampdescription());
return bean; return bean;
} }
@@ -367,4 +369,18 @@ public class CampBean implements Serializable {
public void setStartBooking(LocalDateTime startBooking) { public void setStartBooking(LocalDateTime startBooking) {
this.startBooking = startBooking; this.startBooking = startBooking;
} }
/**
* @return the fkCampdescription
*/
public Integer getFkCampdescription() {
return fkCampdescription;
}
/**
* @param fkCampdescription the fkCampdescription to set
*/
public void setFkCampdescription(Integer fkCampdescription) {
this.fkCampdescription = fkCampdescription;
}
} }
@@ -19,6 +19,15 @@
th:class="${'form-control ' + (#fields.hasErrors('name') ? 'inputerror' : '')}"> th:class="${'form-control ' + (#fields.hasErrors('name') ? 'inputerror' : '')}">
</div> </div>
</div> </div>
<div class="row mb-2">
<label for="fkCampdescription" class="col-sm-2 col-form-label">Beschreibung</label>
<div class="col-sm-10">
<select id="fkCampdescription" th:field="*{fkCampdescription}" class="form-select">
<option value="">--- bitte wählen ---</option>
<option th:each="cd : ${campdescriptions}" th:value="${cd.pkCampdescription}" th:utext="${cd.value}" th:title="${cd.value}"></option>
</select>
</div>
</div>
<div class="row mb-2"> <div class="row mb-2">
<label for="inputLocation" class="col-sm-2 col-form-label">Ort</label> <label for="inputLocation" class="col-sm-2 col-form-label">Ort</label>
<div class="col-sm-10"> <div class="col-sm-10">
@@ -17,7 +17,7 @@
<div class="col-2 d-flex align-items-center"> <div class="col-2 d-flex align-items-center">
<img th:src="@{/images/Icon_Stern.svg}" width="36px" height="36px" /> <img th:src="@{/images/Icon_Stern.svg}" width="36px" height="36px" />
</div> </div>
<div class="col-4 d-flex align-items-center"> <div class="col-4 d-flex align-items-center" th:utext="${c.campdescription}">
Biblische Geschichten<br /> Nachtwanderung<br /> Gruppenspiele<br /> Ausflüge<br /> Überraschungen Biblische Geschichten<br /> Nachtwanderung<br /> Gruppenspiele<br /> Ausflüge<br /> Überraschungen
</div> </div>
<div class="col-6"> <div class="col-6">