basic extensions
This commit is contained in:
@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'de.jottyfan.bico'
|
||||
version = '0.1.6'
|
||||
version = '0.1.7'
|
||||
|
||||
description = """BibleClassOrganizer"""
|
||||
|
||||
@ -47,7 +47,7 @@ war {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'de.jottyfan:bicolib:5'
|
||||
implementation 'de.jottyfan:bicolib:6'
|
||||
|
||||
implementation 'org.mnode.ical4j:ical4j:4.0.4'
|
||||
|
||||
|
@ -31,8 +31,9 @@ public class RegistrationController extends CommonController {
|
||||
@GetMapping("/camp/registration")
|
||||
public String loadForm(Model model, Principal principal) {
|
||||
model.addAttribute("registrations", service.getRegistrations(principal));
|
||||
model.addAttribute("bean", new RegistrationBean());
|
||||
model.addAttribute("bean", RegistrationBean.withAllDays());
|
||||
model.addAttribute("sexes", EnumSex.values());
|
||||
model.addAttribute("ages", service.getAges());
|
||||
return "/camp/registration";
|
||||
}
|
||||
|
||||
@ -42,6 +43,7 @@ public class RegistrationController extends CommonController {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("registrations", new ArrayList<RegistrationBean>()); // hack to make "Neue Anmeldung" appear
|
||||
model.addAttribute("sexes", EnumSex.values());
|
||||
model.addAttribute("ages", service.getAges());
|
||||
return "/camp/registration";
|
||||
}
|
||||
service.save(bean, principal);
|
||||
@ -52,6 +54,7 @@ public class RegistrationController extends CommonController {
|
||||
public String loadEditForm(@PathVariable("id") Integer id, Model model, Principal principal) {
|
||||
model.addAttribute("bean", service.getBeanOfPrincipal(id, principal));
|
||||
model.addAttribute("sexes", EnumSex.values());
|
||||
model.addAttribute("ages", service.getAges());
|
||||
return "/camp/edit";
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,15 @@
|
||||
package de.jottyfan.bico.modules.camp;
|
||||
|
||||
import static de.jottyfan.bico.db.camp.Tables.T_AGE;
|
||||
import static de.jottyfan.bico.db.camp.Tables.T_REGISTRATION;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.DeleteConditionStep;
|
||||
import org.jooq.InsertValuesStep5;
|
||||
import org.jooq.InsertValuesStep12;
|
||||
import org.jooq.SelectConditionStep;
|
||||
import org.jooq.SelectSeekStep1;
|
||||
import org.jooq.UpdateConditionStep;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -16,6 +18,7 @@ import org.springframework.stereotype.Repository;
|
||||
import de.jottyfan.bico.Main;
|
||||
import de.jottyfan.bico.db.camp.enums.EnumCamp;
|
||||
import de.jottyfan.bico.db.camp.enums.EnumSex;
|
||||
import de.jottyfan.bico.db.camp.tables.records.TAgeRecord;
|
||||
import de.jottyfan.bico.db.camp.tables.records.TRegistrationRecord;
|
||||
import de.jottyfan.bico.modules.camp.model.RegistrationBean;
|
||||
import jakarta.validation.Valid;
|
||||
@ -39,15 +42,24 @@ public class RegistrationRepository {
|
||||
public void save(@Valid RegistrationBean bean, String registrator) {
|
||||
jooq.transaction(t -> {
|
||||
if (bean.getPkRegistration() == null) {
|
||||
InsertValuesStep5<TRegistrationRecord, EnumCamp, String, String, String, EnumSex> sql = DSL.using(t)
|
||||
InsertValuesStep12<TRegistrationRecord, EnumCamp, String, String, String, EnumSex, Boolean, String, Integer, Boolean, String, Boolean, Integer> sql = DSL.using(t)
|
||||
// @formatter:off
|
||||
.insertInto(T_REGISTRATION,
|
||||
T_REGISTRATION.CAMP,
|
||||
T_REGISTRATION.REGISTRATOR,
|
||||
T_REGISTRATION.FORENAME,
|
||||
T_REGISTRATION.SURNAME,
|
||||
T_REGISTRATION.SEX)
|
||||
.values(EnumCamp.Gemeindefreizeit_2025, registrator, bean.getForename(), bean.getSurname(), EnumSex.lookupLiteral(bean.getSex()));
|
||||
T_REGISTRATION.SEX,
|
||||
T_REGISTRATION.BARRIER_FREE,
|
||||
T_REGISTRATION.NUTRITION,
|
||||
T_REGISTRATION.DRIVER_PROVIDE_PLACES,
|
||||
T_REGISTRATION.WANT_PLACE_IN_CAR,
|
||||
T_REGISTRATION.DISEASES,
|
||||
T_REGISTRATION.REQUIRE_PAYMENT,
|
||||
T_REGISTRATION.FK_AGE)
|
||||
.values(EnumCamp.Gemeindefreizeit_2025, registrator, bean.getForename(), bean.getSurname(), EnumSex.lookupLiteral(bean.getSex()),
|
||||
bean.getBarrierFree(), bean.getNutrition(), bean.getDriverProvidePlaces(), bean.getWantPlaceInCar(), bean.getDiseases(), bean.getRequirePayment(),
|
||||
bean.getFkAge());
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
sql.execute();
|
||||
@ -59,6 +71,13 @@ public class RegistrationRepository {
|
||||
.set(T_REGISTRATION.SURNAME, bean.getSurname())
|
||||
.set(T_REGISTRATION.SEX, EnumSex.lookupLiteral(bean.getSex()))
|
||||
.set(T_REGISTRATION.REGISTRATOR, registrator)
|
||||
.set(T_REGISTRATION.BARRIER_FREE, bean.getBarrierFree())
|
||||
.set(T_REGISTRATION.NUTRITION, bean.getNutrition())
|
||||
.set(T_REGISTRATION.DRIVER_PROVIDE_PLACES, bean.getDriverProvidePlaces())
|
||||
.set(T_REGISTRATION.WANT_PLACE_IN_CAR, bean.getWantPlaceInCar())
|
||||
.set(T_REGISTRATION.DISEASES, bean.getDiseases())
|
||||
.set(T_REGISTRATION.REQUIRE_PAYMENT, bean.getRequirePayment())
|
||||
.set(T_REGISTRATION.FK_AGE, bean.getFkAge())
|
||||
.where(T_REGISTRATION.PK_REGISTRATION.eq(bean.getPkRegistration()));
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
@ -117,4 +136,19 @@ public class RegistrationRepository {
|
||||
Main.LOGGER.trace(sql);
|
||||
sql.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* get all ages
|
||||
*
|
||||
* @return the ages
|
||||
*/
|
||||
public List<TAgeRecord> getAges() {
|
||||
SelectSeekStep1<TAgeRecord, Integer> sql = jooq
|
||||
// @formatter:off
|
||||
.selectFrom(T_AGE)
|
||||
.orderBy(T_AGE.PK_AGE);
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
return sql.fetchInto(TAgeRecord.class);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import de.jottyfan.bico.db.camp.tables.records.TAgeRecord;
|
||||
import de.jottyfan.bico.modules.camp.model.RegistrationBean;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@ -59,4 +60,13 @@ public class RegistrationService {
|
||||
public void delete(Integer id, Principal principal) {
|
||||
repository.delete(id, principal.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* get the ages
|
||||
*
|
||||
* @return the ages
|
||||
*/
|
||||
public List<TAgeRecord> getAges() {
|
||||
return repository.getAges();
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package de.jottyfan.bico.modules.camp.model;
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -19,6 +20,35 @@ public class RegistrationBean implements Serializable {
|
||||
private String surname;
|
||||
@NotBlank
|
||||
private String sex;
|
||||
@NotNull
|
||||
private Boolean barrierFree;
|
||||
|
||||
private Boolean day0;
|
||||
private Boolean day1;
|
||||
private Boolean day2;
|
||||
private Boolean day3;
|
||||
private Boolean day4;
|
||||
private Boolean day5;
|
||||
|
||||
private String nutrition;
|
||||
private Integer driverProvidePlaces;
|
||||
private Boolean wantPlaceInCar;
|
||||
private String diseases;
|
||||
private Boolean requirePayment;
|
||||
|
||||
@NotNull
|
||||
private Integer fkAge;
|
||||
|
||||
public static final RegistrationBean withAllDays() {
|
||||
RegistrationBean bean = new RegistrationBean();
|
||||
bean.setDay0(true);
|
||||
bean.setDay1(true);
|
||||
bean.setDay2(true);
|
||||
bean.setDay3(true);
|
||||
bean.setDay4(true);
|
||||
bean.setDay5(true);
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the forename
|
||||
@ -75,4 +105,186 @@ public class RegistrationBean implements Serializable {
|
||||
public void setPkRegistration(Integer pkRegistration) {
|
||||
this.pkRegistration = pkRegistration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the barrierFree
|
||||
*/
|
||||
public Boolean getBarrierFree() {
|
||||
return barrierFree;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param barrierFree the barrierFree to set
|
||||
*/
|
||||
public void setBarrierFree(Boolean barrierFree) {
|
||||
this.barrierFree = barrierFree;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nutrition
|
||||
*/
|
||||
public String getNutrition() {
|
||||
return nutrition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nutrition the nutrition to set
|
||||
*/
|
||||
public void setNutrition(String nutrition) {
|
||||
this.nutrition = nutrition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the diseases
|
||||
*/
|
||||
public String getDiseases() {
|
||||
return diseases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param diseases the diseases to set
|
||||
*/
|
||||
public void setDiseases(String diseases) {
|
||||
this.diseases = diseases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the driverProvidePlaces
|
||||
*/
|
||||
public Integer getDriverProvidePlaces() {
|
||||
return driverProvidePlaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param driverProvidePlaces the driverProvidePlaces to set
|
||||
*/
|
||||
public void setDriverProvidePlaces(Integer driverProvidePlaces) {
|
||||
this.driverProvidePlaces = driverProvidePlaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wantPlaceInCar
|
||||
*/
|
||||
public Boolean getWantPlaceInCar() {
|
||||
return wantPlaceInCar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wantPlaceInCar the wantPlaceInCar to set
|
||||
*/
|
||||
public void setWantPlaceInCar(Boolean wantPlaceInCar) {
|
||||
this.wantPlaceInCar = wantPlaceInCar;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the requirePayment
|
||||
*/
|
||||
public Boolean getRequirePayment() {
|
||||
return requirePayment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requirePayment the requirePayment to set
|
||||
*/
|
||||
public void setRequirePayment(Boolean requirePayment) {
|
||||
this.requirePayment = requirePayment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fkAge
|
||||
*/
|
||||
public Integer getFkAge() {
|
||||
return fkAge;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fkAge the fkAge to set
|
||||
*/
|
||||
public void setFkAge(Integer fkAge) {
|
||||
this.fkAge = fkAge;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the day0
|
||||
*/
|
||||
public Boolean getDay0() {
|
||||
return day0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param day0 the day0 to set
|
||||
*/
|
||||
public void setDay0(Boolean day0) {
|
||||
this.day0 = day0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the day1
|
||||
*/
|
||||
public Boolean getDay1() {
|
||||
return day1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param day1 the day1 to set
|
||||
*/
|
||||
public void setDay1(Boolean day1) {
|
||||
this.day1 = day1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the day2
|
||||
*/
|
||||
public Boolean getDay2() {
|
||||
return day2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param day2 the day2 to set
|
||||
*/
|
||||
public void setDay2(Boolean day2) {
|
||||
this.day2 = day2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the day3
|
||||
*/
|
||||
public Boolean getDay3() {
|
||||
return day3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param day3 the day3 to set
|
||||
*/
|
||||
public void setDay3(Boolean day3) {
|
||||
this.day3 = day3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the day4
|
||||
*/
|
||||
public Boolean getDay4() {
|
||||
return day4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param day4 the day4 to set
|
||||
*/
|
||||
public void setDay4(Boolean day4) {
|
||||
this.day4 = day4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the day5
|
||||
*/
|
||||
public Boolean getDay5() {
|
||||
return day5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param day5 the day5 to set
|
||||
*/
|
||||
public void setDay5(Boolean day5) {
|
||||
this.day5 = day5;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
<form th:action="@{/camp/registration/correct}" method="post" th:object="${bean}" th:if="${bean}">
|
||||
<input type="hidden" th:field="*{pkRegistration}" />
|
||||
<div class="row g-3">
|
||||
|
||||
<div class="col-sm-3">Vorname</div>
|
||||
<div class="col-sm-9">
|
||||
<span th:if="${#fields.hasErrors('forename')}" th:errors="*{forename}" class="text-danger"></span> <input type="text" th:field="*{forename}" class="form-control" />
|
||||
@ -28,6 +29,48 @@
|
||||
<option th:each="s : ${sexes}" th:value="${s}" th:text="${s}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">Alter</div>
|
||||
<div class="col-sm-9">
|
||||
<span th:if="${#fields.hasErrors('fkAge')}" th:errors="*{fkAge}" class="text-danger"></span>
|
||||
<select th:field="*{fkAge}" class="form-select">
|
||||
<option th:each="a : ${ages}" th:value="${a.pkAge}" th:label="${a.name} + ', ' + ${a.price} + ' € / Tag'"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">Barrierefrei</div>
|
||||
<div class="col-sm-9">
|
||||
<span th:if="${#fields.hasErrors('barrierFree')}" th:errors="*{barrierFree}" class="text-danger"></span>
|
||||
<select th:field="*{barrierFree}" class="form-select">
|
||||
<option value="false">Nein</option>
|
||||
<option value="true">Ja</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">Spezielle Ernährung (Allergien, Unverträglichkeiten)</div>
|
||||
<div class="col-sm-9">
|
||||
<textarea th:field="*{nutrition}" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-3">Besonderheiten / Krankheiten</div>
|
||||
<div class="col-sm-9">
|
||||
<textarea th:field="*{diseases}" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-3">Biete Plätze zum Mitfahren</div>
|
||||
<div class="col-sm-9">
|
||||
<input th:field="*{driverProvidePlaces}" type="number" min="0" max="8" class="form-control" />
|
||||
</div>
|
||||
<div class="col-sm-3">Benötige eine Mitfahrgelegenheit</div>
|
||||
<div class="col-sm-9">
|
||||
<input id="wantPlaceInCar" type="checkbox" name="active" th:checked="*{wantPlaceInCar}" class="form-check-input" />
|
||||
<label class="form-check-label" for="wantPlaceInCar">Ja, brauche ich</label>
|
||||
</div>
|
||||
<div class="col-sm-3">Besonderheiten / Krankheiten</div>
|
||||
<div class="col-sm-9">
|
||||
<textarea th:field="*{diseases}" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-3">Finanzierungsunterstützung</div>
|
||||
<div class="col-sm-9">
|
||||
<input id="requirePayment" type="checkbox" name="active" th:checked="*{requirePayment}" class="form-check-input" />
|
||||
<label class="form-check-label" for="requirePayment">Ja, brauche ich</label>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-9">
|
||||
<button type="submit" class="btn btn-outline-success">Korrigeren</button>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<div id="new" class="tabpanel">
|
||||
<form th:action="@{/camp/registration/submit}" method="post" th:object="${bean}">
|
||||
<div class="row g-3">
|
||||
|
||||
<div class="col-sm-3">Vorname</div>
|
||||
<div class="col-sm-9">
|
||||
<span th:if="${#fields.hasErrors('forename')}" th:errors="*{forename}" class="text-danger"></span> <input type="text" th:field="*{forename}" class="form-control" />
|
||||
@ -55,6 +56,60 @@
|
||||
<option th:each="s : ${sexes}" th:value="${s}" th:text="${s}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">Alter</div>
|
||||
<div class="col-sm-9">
|
||||
<span th:if="${#fields.hasErrors('fkAge')}" th:errors="*{fkAge}" class="text-danger"></span>
|
||||
<select th:field="*{fkAge}" class="form-select">
|
||||
<option th:each="a : ${ages}" th:value="${a.pkAge}" th:label="${a.name} + ', ' + ${a.price} + ' € / Tag'"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">Welche Tage</div>
|
||||
<div class="col-sm-9">
|
||||
<input id="day0" type="checkbox" name="active" th:checked="*{day0}" class="form-check-input" />
|
||||
<label class="form-check-label" for="day0">Mittwoch</label>
|
||||
<input id="day1" type="checkbox" name="active" th:checked="*{day1}" class="form-check-input" />
|
||||
<label class="form-check-label" for="day1">Donnerstag</label>
|
||||
<input id="day2" type="checkbox" name="active" th:checked="*{day2}" class="form-check-input" />
|
||||
<label class="form-check-label" for="day2">Freitag</label>
|
||||
<input id="day3" type="checkbox" name="active" th:checked="*{day3}" class="form-check-input" />
|
||||
<label class="form-check-label" for="day3">Sonnabend</label>
|
||||
<input id="day4" type="checkbox" name="active" th:checked="*{day4}" class="form-check-input" />
|
||||
<label class="form-check-label" for="day4">Sonntag</label>
|
||||
<input id="day5" type="checkbox" name="active" th:checked="*{day5}" class="form-check-input" />
|
||||
<label class="form-check-label" for="day5">Montag</label>
|
||||
<span id="calcprice"></span>
|
||||
</div>
|
||||
<div class="col-sm-3">Barrierefrei</div>
|
||||
<div class="col-sm-9">
|
||||
<span th:if="${#fields.hasErrors('barrierFree')}" th:errors="*{barrierFree}" class="text-danger"></span>
|
||||
<select th:field="*{barrierFree}" class="form-select">
|
||||
<option value="false">Nein</option>
|
||||
<option value="true">Ja</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">Spezielle Ernährung (Allergien, Unverträglichkeiten)</div>
|
||||
<div class="col-sm-9">
|
||||
<textarea th:field="*{nutrition}" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-3">Biete Plätze zum Mitfahren</div>
|
||||
<div class="col-sm-9">
|
||||
<input th:field="*{driverProvidePlaces}" type="number" min="0" max="8" class="form-control" />
|
||||
</div>
|
||||
<div class="col-sm-3">Benötige eine Mitfahrgelegenheit</div>
|
||||
<div class="col-sm-9">
|
||||
<input id="wantPlaceInCar" type="checkbox" name="active" th:checked="*{wantPlaceInCar}" class="form-check-input" />
|
||||
<label class="form-check-label" for="wantPlaceInCar">Ja, brauche ich</label>
|
||||
</div>
|
||||
<div class="col-sm-3">Besonderheiten / Krankheiten</div>
|
||||
<div class="col-sm-9">
|
||||
<textarea th:field="*{diseases}" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-3">Finanzierungsunterstützung</div>
|
||||
<div class="col-sm-9">
|
||||
<input id="requirePayment" type="checkbox" name="active" th:checked="*{requirePayment}" class="form-check-input" />
|
||||
<label class="form-check-label" for="requirePayment">Ja, brauche ich</label>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-9">
|
||||
<button type="submit" class="btn btn-outline-success">Speichern</button>
|
||||
|
Reference in New Issue
Block a user