Compare commits
1 Commits
08442dc7ea
...
youthgroup
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3726b9172c |
25
build.gradle
25
build.gradle
@@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'de.jottyfan.bico'
|
||||
version = '0.2.7'
|
||||
version = '0.2.8'
|
||||
|
||||
description = """BibleClassOrganizer"""
|
||||
|
||||
@@ -16,13 +16,10 @@ java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
sourceCompatibility = 21
|
||||
targetCompatibility = 21
|
||||
}
|
||||
|
||||
sourceCompatibility = 21
|
||||
targetCompatibility = 21
|
||||
|
||||
mainClassName = "de.jottyfan.bico.Main"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
@@ -47,9 +44,9 @@ war {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'de.jottyfan:bicolib:8'
|
||||
implementation 'de.jottyfan:bicolib:9'
|
||||
|
||||
implementation 'org.mnode.ical4j:ical4j:4.0.4'
|
||||
implementation 'org.mnode.ical4j:ical4j:4.2.2'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-jooq'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
|
||||
@@ -60,13 +57,13 @@ dependencies {
|
||||
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:latest.release'
|
||||
implementation 'org.springframework.security:spring-security-oauth2-client'
|
||||
|
||||
implementation 'org.webjars:bootstrap:5.3.3'
|
||||
implementation 'org.webjars.npm:bootstrap-icons:1.11.3'
|
||||
implementation 'org.webjars:bootstrap:5.3.8'
|
||||
implementation 'org.webjars.npm:bootstrap-icons:1.13.1'
|
||||
implementation 'org.webjars:jquery:3.7.1'
|
||||
implementation 'org.webjars.npm:datatables.net:2.1.7'
|
||||
implementation 'org.webjars.npm:datatables.net-buttons:3.1.1'
|
||||
implementation 'org.webjars.npm:datatables.net-responsive:3.0.1'
|
||||
implementation 'org.webjars.npm:datatables.net-bs5:2.1.7'
|
||||
implementation 'org.webjars.npm:datatables.net:2.3.5'
|
||||
implementation 'org.webjars.npm:datatables.net-buttons:3.2.5'
|
||||
implementation 'org.webjars.npm:datatables.net-responsive:3.0.6'
|
||||
implementation 'org.webjars.npm:datatables.net-bs5:2.3.5'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-devtools'
|
||||
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -19,7 +19,7 @@ import de.jottyfan.bico.modules.profile.ProfileService;
|
||||
*
|
||||
*/
|
||||
public abstract class CommonController {
|
||||
private static final List<String> admins = List.of("andre.sieber", "tobias.kuehne", "jotty", "kerstin.meisel");
|
||||
private static final List<String> admins = List.of("jotty");
|
||||
|
||||
@Autowired
|
||||
private ProfileService profileService;
|
||||
@@ -32,6 +32,20 @@ public abstract class CommonController {
|
||||
return principal == null ? false : admins.contains(principal.getName());
|
||||
}
|
||||
|
||||
@ModelAttribute("currentUserName")
|
||||
public String getUserFullname(Principal principal) {
|
||||
OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal;
|
||||
if (token != null) {
|
||||
OAuth2User user = token.getPrincipal();
|
||||
String nextcloudUsername = user.getName();
|
||||
String name = nextcloudUsername.replace(".", " ").replace("oe", "ö").replace("ae", "ä").replace("ue", "ü");
|
||||
return name;
|
||||
} else {
|
||||
Main.LOGGER.warn("Token is null, so no username can be found. Returned empty string instead.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@ModelAttribute("hasBUrole")
|
||||
public Boolean hasBURole(Principal principal) {
|
||||
OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package de.jottyfan.bico.modules.camp;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.Principal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@Controller
|
||||
public class AdminRegistrationController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private AdminRegistrationService service;
|
||||
|
||||
@GetMapping("/camp/registration/admin")
|
||||
public String getList(Model model, Principal principal) {
|
||||
if (isCampAdmin(principal)) {
|
||||
model.addAttribute("list", service.getAllRegistrations());
|
||||
model.addAttribute("ages", service.getAges());
|
||||
}
|
||||
return "/camp/list";
|
||||
}
|
||||
|
||||
@GetMapping("/camp/registration/admin/download")
|
||||
@ResponseBody
|
||||
public String download(HttpServletResponse response, Principal principal) throws IOException {
|
||||
if (isCampAdmin(principal)) {
|
||||
response.setHeader("Content-Disposition", String.format("attachment; filename=Gemeindefreizeit-Anmeldungen-%s.csv",
|
||||
LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)));
|
||||
response.setContentType("text/csv; charset=utf-8");
|
||||
return service.getDownload();
|
||||
} else {
|
||||
return "forbidden";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package de.jottyfan.bico.modules.camp;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class AdminRegistrationService {
|
||||
|
||||
@Autowired
|
||||
private RegistrationRepository repository;
|
||||
|
||||
public List<RegistrationBean> getAllRegistrations() {
|
||||
return repository.getAllRegistrations();
|
||||
}
|
||||
|
||||
public List<TAgeRecord> getAges() {
|
||||
return repository.getAges();
|
||||
}
|
||||
|
||||
public String getDownload() {
|
||||
return repository.getDownload();
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package de.jottyfan.bico.modules.camp;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import de.jottyfan.bico.db.camp.enums.EnumSex;
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
import de.jottyfan.bico.modules.camp.model.RegistrationBean;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class RegistrationController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private RegistrationService service;
|
||||
|
||||
@GetMapping("/camp/registration")
|
||||
public String loadForm(Model model, Principal principal) {
|
||||
model.addAttribute("registrations", service.getRegistrations(principal));
|
||||
model.addAttribute("bean", RegistrationBean.withAllDays());
|
||||
model.addAttribute("sexes", EnumSex.values());
|
||||
model.addAttribute("ages", service.getAges());
|
||||
return "/camp/registration";
|
||||
}
|
||||
|
||||
@PostMapping("/camp/registration/submit")
|
||||
public String submitAddForm(@Valid @ModelAttribute("bean") RegistrationBean bean, BindingResult bindingResult,
|
||||
Model model, Principal principal) {
|
||||
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);
|
||||
return "redirect:/camp/registration";
|
||||
}
|
||||
|
||||
@GetMapping("/camp/registration/edit/{id}")
|
||||
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";
|
||||
}
|
||||
|
||||
@GetMapping("/camp/registration/delete/{id}")
|
||||
public String delete(@PathVariable("id") Integer id, Model model, Principal principal) {
|
||||
service.delete(id, principal);
|
||||
return "redirect:/camp/registration";
|
||||
}
|
||||
|
||||
@PostMapping("/camp/registration/correct")
|
||||
public String submitEditForm(@Valid @ModelAttribute("bean") RegistrationBean bean, BindingResult bindingResult,
|
||||
Model model, Principal principal) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("sexes", EnumSex.values());
|
||||
return "/camp/registration";
|
||||
}
|
||||
service.save(bean, principal);
|
||||
return "redirect:/camp/registration";
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
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.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.DeleteConditionStep;
|
||||
import org.jooq.InsertValuesStep20;
|
||||
import org.jooq.Record19;
|
||||
import org.jooq.SelectConditionStep;
|
||||
import org.jooq.SelectOnConditionStep;
|
||||
import org.jooq.SelectSeekStep1;
|
||||
import org.jooq.UpdateConditionStep;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Repository
|
||||
public class RegistrationRepository {
|
||||
@Autowired
|
||||
private DSLContext jooq;
|
||||
|
||||
/**
|
||||
* save the validated bean
|
||||
*
|
||||
* @param bean the bean
|
||||
* @param registrator the principal name
|
||||
*/
|
||||
public void save(@Valid RegistrationBean bean, String registrator) {
|
||||
jooq.transaction(t -> {
|
||||
if (bean.getPkRegistration() == null) {
|
||||
InsertValuesStep20<TRegistrationRecord, EnumCamp, String, String, String, EnumSex, Boolean, String, Integer, Boolean, String, Boolean, Integer, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean> sql = DSL.using(t)
|
||||
// @formatter:off
|
||||
.insertInto(T_REGISTRATION,
|
||||
T_REGISTRATION.CAMP,
|
||||
T_REGISTRATION.REGISTRATOR,
|
||||
T_REGISTRATION.FORENAME,
|
||||
T_REGISTRATION.SURNAME,
|
||||
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,
|
||||
T_REGISTRATION.DAY0,
|
||||
T_REGISTRATION.DAY1,
|
||||
T_REGISTRATION.DAY2,
|
||||
T_REGISTRATION.DAY3,
|
||||
T_REGISTRATION.DAY4,
|
||||
T_REGISTRATION.TOWELS,
|
||||
T_REGISTRATION.BED_LINEN,
|
||||
T_REGISTRATION.COT)
|
||||
.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(), bean.getDay0(), bean.getDay1(), bean.getDay2(), bean.getDay3(), bean.getDay4(), bean.getTowels(), bean.getBedLinen(), bean.getCot());
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
sql.execute();
|
||||
} else {
|
||||
UpdateConditionStep<TRegistrationRecord> sql = DSL.using(t)
|
||||
// @formatter:off
|
||||
.update(T_REGISTRATION)
|
||||
.set(T_REGISTRATION.FORENAME, bean.getForename())
|
||||
.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())
|
||||
.set(T_REGISTRATION.DAY0, bean.getDay0())
|
||||
.set(T_REGISTRATION.DAY1, bean.getDay1())
|
||||
.set(T_REGISTRATION.DAY2, bean.getDay2())
|
||||
.set(T_REGISTRATION.DAY3, bean.getDay3())
|
||||
.set(T_REGISTRATION.DAY4, bean.getDay4())
|
||||
.set(T_REGISTRATION.TOWELS, bean.getTowels())
|
||||
.set(T_REGISTRATION.BED_LINEN, bean.getBedLinen())
|
||||
.set(T_REGISTRATION.COT, bean.getCot())
|
||||
.where(T_REGISTRATION.PK_REGISTRATION.eq(bean.getPkRegistration()));
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
sql.execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* get all registrations (for admins only)
|
||||
*
|
||||
* @return the registrations
|
||||
*/
|
||||
public List<RegistrationBean> getAllRegistrations() {
|
||||
SelectSeekStep1<TRegistrationRecord, LocalDateTime> sql = jooq
|
||||
// @formatter:off
|
||||
.selectFrom(T_REGISTRATION)
|
||||
.orderBy(T_REGISTRATION.CREATED);
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
return sql.fetchInto(RegistrationBean.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* get all registrations of name
|
||||
*
|
||||
* @param name the name
|
||||
* @return the registrations
|
||||
*/
|
||||
public List<RegistrationBean> getRegistrations(String name) {
|
||||
SelectConditionStep<TRegistrationRecord> sql = jooq
|
||||
// @formatter:off
|
||||
.selectFrom(T_REGISTRATION)
|
||||
.where(T_REGISTRATION.REGISTRATOR.eq(name));
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
return sql.fetchInto(RegistrationBean.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the registration of id if the creator is the name; null else
|
||||
*
|
||||
* @param id the id
|
||||
* @param name the name
|
||||
* @return the bean or null
|
||||
*/
|
||||
public RegistrationBean getBean(Integer id, String name) {
|
||||
SelectConditionStep<TRegistrationRecord> sql = jooq
|
||||
// @formatter:off
|
||||
.selectFrom(T_REGISTRATION)
|
||||
.where(T_REGISTRATION.PK_REGISTRATION.eq(id))
|
||||
.and(T_REGISTRATION.REGISTRATOR.eq(name));
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
return sql.fetchOneInto(RegistrationBean.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* delete the registration if the name is the creator
|
||||
*
|
||||
* @param id the id
|
||||
* @param name the name
|
||||
*/
|
||||
public void delete(Integer id, String name) {
|
||||
DeleteConditionStep<TRegistrationRecord> sql = jooq
|
||||
// @formatter:off
|
||||
.deleteFrom(T_REGISTRATION)
|
||||
.where(T_REGISTRATION.PK_REGISTRATION.eq(id))
|
||||
.and(T_REGISTRATION.REGISTRATOR.eq(name));
|
||||
// @formatter:on
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* get CSV version of the list, only for admins
|
||||
*
|
||||
* @return the csv
|
||||
*/
|
||||
public String getDownload() {
|
||||
SelectOnConditionStep<Record19<LocalDateTime, String, String, EnumSex, String, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, String, String, Integer, Boolean>> sql = jooq
|
||||
// @formatter:off
|
||||
.select(T_REGISTRATION.CREATED,
|
||||
T_REGISTRATION.FORENAME,
|
||||
T_REGISTRATION.SURNAME,
|
||||
T_REGISTRATION.SEX,
|
||||
T_AGE.NAME,
|
||||
T_REGISTRATION.DAY0,
|
||||
T_REGISTRATION.DAY1,
|
||||
T_REGISTRATION.DAY2,
|
||||
T_REGISTRATION.DAY3,
|
||||
T_REGISTRATION.DAY4,
|
||||
T_REGISTRATION.BARRIER_FREE,
|
||||
T_REGISTRATION.TOWELS,
|
||||
T_REGISTRATION.BED_LINEN,
|
||||
T_REGISTRATION.COT,
|
||||
T_REGISTRATION.REQUIRE_PAYMENT,
|
||||
T_REGISTRATION.DISEASES,
|
||||
T_REGISTRATION.NUTRITION,
|
||||
T_REGISTRATION.DRIVER_PROVIDE_PLACES,
|
||||
T_REGISTRATION.WANT_PLACE_IN_CAR)
|
||||
.from(T_REGISTRATION)
|
||||
.leftJoin(T_AGE).on(T_AGE.PK_AGE.eq(T_REGISTRATION.FK_AGE));
|
||||
// @formatter:on
|
||||
Main.LOGGER.trace(sql);
|
||||
return sql.fetch().formatCSV(true);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package de.jottyfan.bico.modules.camp;
|
||||
|
||||
import java.security.Principal;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class RegistrationService {
|
||||
|
||||
@Autowired
|
||||
private RegistrationRepository repository;
|
||||
|
||||
/**
|
||||
* save the bean content
|
||||
*
|
||||
* @param bean the bean
|
||||
*/
|
||||
public void save(@Valid RegistrationBean bean, Principal principal) {
|
||||
repository.save(bean, principal.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* get the registrations of principal
|
||||
*
|
||||
* @param principal the principal
|
||||
* @return the registrations
|
||||
*/
|
||||
public List<RegistrationBean> getRegistrations(Principal principal) {
|
||||
return repository.getRegistrations(principal.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* get the registration if the principal was the creator
|
||||
*
|
||||
* @param id the ID of the registration
|
||||
* @param principal the principal
|
||||
* @return the bean or null if not found or allowed
|
||||
*/
|
||||
public RegistrationBean getBeanOfPrincipal(Integer id, Principal principal) {
|
||||
return repository.getBean(id, principal.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* delete the registration if the principal was the creator
|
||||
*
|
||||
* @param id the ID of the registration
|
||||
* @param principal the principal
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
package de.jottyfan.bico.modules.camp.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public class RegistrationBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer pkRegistration;
|
||||
@NotBlank
|
||||
private String forename;
|
||||
@NotBlank
|
||||
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 towels;
|
||||
private Boolean bedLinen;
|
||||
private Boolean cot;
|
||||
|
||||
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);
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the forename
|
||||
*/
|
||||
public String getForename() {
|
||||
return forename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param forename the forename to set
|
||||
*/
|
||||
public void setForename(String forename) {
|
||||
this.forename = forename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the surname
|
||||
*/
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param surname the surname to set
|
||||
*/
|
||||
public void setSurname(String surname) {
|
||||
this.surname = surname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sex
|
||||
*/
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sex the sex to set
|
||||
*/
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pkRegistration
|
||||
*/
|
||||
public Integer getPkRegistration() {
|
||||
return pkRegistration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pkRegistration the pkRegistration to set
|
||||
*/
|
||||
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 towels
|
||||
*/
|
||||
public Boolean getTowels() {
|
||||
return towels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param towels the towels to set
|
||||
*/
|
||||
public void setTowels(Boolean towels) {
|
||||
this.towels = towels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bedLinen
|
||||
*/
|
||||
public Boolean getBedLinen() {
|
||||
return bedLinen;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bedLinen the bedLinen to set
|
||||
*/
|
||||
public void setBedLinen(Boolean bedLinen) {
|
||||
this.bedLinen = bedLinen;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cot
|
||||
*/
|
||||
public Boolean getCot() {
|
||||
return cot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cot the cot to set
|
||||
*/
|
||||
public void setCot(Boolean cot) {
|
||||
this.cot = cot;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.jottyfan.bico.modules.download;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.V_CALENDAR;
|
||||
import static de.jottyfan.bico.db.Tables.V_CALENDAR;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -9,7 +9,7 @@ import org.jooq.SelectWhereStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.VCalendarRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VCalendarRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.jottyfan.bico.modules.ical;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.V_CALENDAR;
|
||||
import static de.jottyfan.bico.db.Tables.V_CALENDAR;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -9,7 +9,7 @@ import org.jooq.SelectWhereStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.VCalendarRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VCalendarRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.time.LocalTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.VCalendarRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VCalendarRecord;
|
||||
import net.fortuna.ical4j.data.CalendarOutputter;
|
||||
import net.fortuna.ical4j.model.Calendar;
|
||||
import net.fortuna.ical4j.model.component.VEvent;
|
||||
@@ -29,7 +29,10 @@ public class IcalService {
|
||||
Calendar calendar = new Calendar();
|
||||
CalendarOutputter out = new CalendarOutputter();
|
||||
for (VCalendarRecord record : repository.getAllDates()) {
|
||||
String summary = record.getFullname();
|
||||
String groupname = "";
|
||||
groupname = record.getBibleclass() ? "Bibelunterricht" : groupname;
|
||||
groupname = record.getYouthgroup() ? "Jungschar" : groupname;
|
||||
String summary = String.format("%s %s", record.getFullname(), groupname).trim();
|
||||
LocalDateTime startEvent = LocalDateTime.of(record.getSlotDay(), LocalTime.of(10, 30));
|
||||
LocalDateTime endEvent = LocalDateTime.of(record.getSlotDay(), LocalTime.of(12, 0));
|
||||
VEvent event = new VEvent(startEvent, endEvent, summary);
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.jottyfan.bico.modules.lesson;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_LESSON;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_PERSON;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SLOT;
|
||||
import static de.jottyfan.bico.db.Tables.T_LESSON;
|
||||
import static de.jottyfan.bico.db.Tables.T_PERSON;
|
||||
import static de.jottyfan.bico.db.Tables.T_SLOT;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
@@ -19,8 +19,8 @@ import org.jooq.UpdateConditionStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.TPersonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TPersonRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public class LessonRepository {
|
||||
.values(slotId)
|
||||
.returning(T_LESSON.PK_LESSON);
|
||||
// @formatter:on
|
||||
LOGGER.trace(sql);
|
||||
LOGGER.info(sql);
|
||||
Integer pkLesson = sql2.fetchOne(T_LESSON.PK_LESSON);
|
||||
r = new TLessonRecord();
|
||||
r.setPkLesson(pkLesson);
|
||||
|
||||
@@ -6,8 +6,8 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.TPersonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TPersonRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.jottyfan.bico.modules.next;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.V_CALENDAR;
|
||||
import static de.jottyfan.bico.db.Tables.V_CALENDAR;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Record2;
|
||||
import org.jooq.Record4;
|
||||
import org.jooq.SelectSeekStep1;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -36,19 +36,19 @@ public class NextRepository {
|
||||
* @return the next dates as beans in a list; an empty list at least
|
||||
*/
|
||||
public List<NextBean> getNext(LocalDate date) {
|
||||
SelectSeekStep1<Record2<String, LocalDate>, LocalDate> sql = jooq
|
||||
SelectSeekStep1<Record4<String, LocalDate, Boolean, Boolean>, LocalDate> sql = jooq
|
||||
// @formatter:off
|
||||
.selectDistinct(V_CALENDAR.FULLNAME, V_CALENDAR.SLOT_DAY)
|
||||
.selectDistinct(V_CALENDAR.FULLNAME, V_CALENDAR.SLOT_DAY, V_CALENDAR.BIBLECLASS, V_CALENDAR.YOUTHGROUP)
|
||||
.from(V_CALENDAR)
|
||||
.where(V_CALENDAR.SLOT_DAY.ge(date))
|
||||
.orderBy(V_CALENDAR.SLOT_DAY.asc());
|
||||
// @formatter:on
|
||||
LOGGER.trace(sql);
|
||||
Iterator<Record2<String, LocalDate>> i = sql.fetch().iterator();
|
||||
Iterator<Record4<String, LocalDate, Boolean, Boolean>> i = sql.fetch().iterator();
|
||||
List<NextBean> list = new ArrayList<>();
|
||||
while (i.hasNext()) {
|
||||
Record2<String, LocalDate> r = i.next();
|
||||
list.add(NextBean.of(r.get(V_CALENDAR.FULLNAME), r.get(V_CALENDAR.SLOT_DAY)));
|
||||
Record4<String, LocalDate, Boolean, Boolean> r = i.next();
|
||||
list.add(NextBean.of(r.get(V_CALENDAR.FULLNAME), r.get(V_CALENDAR.SLOT_DAY), r.get(V_CALENDAR.BIBLECLASS), r.get(V_CALENDAR.YOUTHGROUP)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,18 @@ public class NextBean implements Serializable {
|
||||
|
||||
private String fullname;
|
||||
private LocalDate day;
|
||||
private Boolean isBibleclass;
|
||||
private Boolean isYouthgroup;
|
||||
|
||||
private NextBean() {
|
||||
}
|
||||
|
||||
public final static NextBean of(String fullname, LocalDate day) {
|
||||
public final static NextBean of(String fullname, LocalDate day, Boolean isBibleclass, Boolean isYouthgroup) {
|
||||
NextBean bean = new NextBean();
|
||||
bean.setDay(day);
|
||||
bean.setFullname(fullname);
|
||||
bean.setIsBibleclass(isBibleclass);
|
||||
bean.setIsYouthgroup(isYouthgroup);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@@ -51,4 +55,32 @@ public class NextBean implements Serializable {
|
||||
private void setDay(LocalDate day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isBibleclass
|
||||
*/
|
||||
public Boolean getIsBibleclass() {
|
||||
return isBibleclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isBibleclass the isBibleclass to set
|
||||
*/
|
||||
public void setIsBibleclass(Boolean isBibleclass) {
|
||||
this.isBibleclass = isBibleclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isYouthgroup
|
||||
*/
|
||||
public Boolean getIsYouthgroup() {
|
||||
return isYouthgroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isYouthgroup the isYouthgroup to set
|
||||
*/
|
||||
public void setIsYouthgroup(Boolean isYouthgroup) {
|
||||
this.isYouthgroup = isYouthgroup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.jottyfan.bico.modules.profile;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_PROFILE;
|
||||
import static de.jottyfan.bico.db.Tables.T_PROFILE;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -10,7 +10,7 @@ import org.jooq.SelectConditionStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TProfileRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TProfileRecord;
|
||||
import de.jottyfan.bico.modules.profile.model.ProfileBean;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.jottyfan.bico.modules.sheet;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.V_CALENDAR;
|
||||
import static de.jottyfan.bico.db.Tables.V_CALENDAR;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jooq.SelectWhereStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.VCalendarRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VCalendarRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.VCalendarRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VCalendarRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package de.jottyfan.bico.modules.slot;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -9,6 +12,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import de.jottyfan.bico.db.enums.EnumGroupname;
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
import de.jottyfan.bico.modules.slot.model.SlotBean;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -33,6 +37,7 @@ public class SlotController extends CommonController {
|
||||
public String load(@PathVariable("id") Integer id, Model model) {
|
||||
model.addAttribute("bean", id == null ? new SlotBean() : service.loadSlot(id));
|
||||
model.addAttribute("hasLesson", service.slotHasLesson(id));
|
||||
model.addAttribute("groupnames", EnumGroupname.values());
|
||||
return "/slot/item";
|
||||
}
|
||||
|
||||
@@ -56,4 +61,12 @@ public class SlotController extends CommonController {
|
||||
service.saveSlot(bean);
|
||||
return "redirect:/sheet";
|
||||
}
|
||||
|
||||
@ModelAttribute("groupnamemap")
|
||||
public Map<String, String> getTranslations() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("bibleclass", "Bibelunterricht");
|
||||
map.put("youthgroup", "Jungschar");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package de.jottyfan.bico.modules.slot;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_LESSON;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SLOT;
|
||||
import static de.jottyfan.bico.db.Tables.T_LESSON;
|
||||
import static de.jottyfan.bico.db.Tables.T_SLOT;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -15,8 +15,8 @@ import org.jooq.UpdateConditionStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSlotRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSlotRecord;
|
||||
import de.jottyfan.bico.modules.slot.model.SlotBean;
|
||||
|
||||
/**
|
||||
@@ -52,6 +52,7 @@ public class SlotRepository {
|
||||
bean.setPkSlot(r.getPkSlot());
|
||||
bean.setSlotDay(r.getSlotDay());
|
||||
bean.setNote(r.getNote());
|
||||
bean.setGroupname(r.getGroupname());
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
@@ -67,8 +68,9 @@ public class SlotRepository {
|
||||
// @formatter:off
|
||||
.insertInto(T_SLOT,
|
||||
T_SLOT.SLOT_DAY,
|
||||
T_SLOT.GROUPNAME,
|
||||
T_SLOT.NOTE)
|
||||
.values(slot.getSlotDay(), slot.getNote())
|
||||
.values(slot.getSlotDay(), slot.getGroupname(), slot.getNote())
|
||||
.returning(T_SLOT.PK_SLOT);
|
||||
// @formatter:on
|
||||
LOGGER.trace(sql);
|
||||
@@ -86,6 +88,7 @@ public class SlotRepository {
|
||||
.update(T_SLOT)
|
||||
.set(T_SLOT.SLOT_DAY, slot.getSlotDay())
|
||||
.set(T_SLOT.NOTE, slot.getNote())
|
||||
.set(T_SLOT.GROUPNAME, slot.getGroupname())
|
||||
.where(T_SLOT.PK_SLOT.eq(slot.getPkSlot()));
|
||||
// @formatter:on
|
||||
LOGGER.trace(sql);
|
||||
@@ -139,7 +142,7 @@ public class SlotRepository {
|
||||
.selectFrom(T_LESSON)
|
||||
.where(T_LESSON.FK_SLOT.eq(slotId));
|
||||
// @formatter:on
|
||||
LOGGER.info(sql);
|
||||
LOGGER.trace(sql);
|
||||
return sql.fetch().size() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.time.LocalDate;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import de.jottyfan.bico.db.enums.EnumGroupname;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,8 @@ public class SlotBean implements Serializable {
|
||||
|
||||
private String note;
|
||||
|
||||
private EnumGroupname groupname;
|
||||
|
||||
public SlotBean withNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
@@ -71,4 +74,18 @@ public class SlotBean implements Serializable {
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groupname
|
||||
*/
|
||||
public EnumGroupname getGroupname() {
|
||||
return groupname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupname the groupname to set
|
||||
*/
|
||||
public void setGroupname(EnumGroupname groupname) {
|
||||
this.groupname = groupname;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package de.jottyfan.bico.modules.subject;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_LESSON_SUBJECT;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SOURCE;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SUBJECT;
|
||||
import static de.jottyfan.bico.db.public_.Tables.V_LESSON;
|
||||
import static de.jottyfan.bico.db.Tables.T_LESSON_SUBJECT;
|
||||
import static de.jottyfan.bico.db.Tables.T_SOURCE;
|
||||
import static de.jottyfan.bico.db.Tables.T_SUBJECT;
|
||||
import static de.jottyfan.bico.db.Tables.V_LESSON;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,9 +19,9 @@ import org.jooq.UpdateConditionStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSourceRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.VLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSourceRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VLessonRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -5,9 +5,9 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSourceRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.VLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSourceRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.db.tables.records.VLessonRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@ package de.jottyfan.bico.modules.subject.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TSubjectRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TSubjectRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package de.jottyfan.bico.modules.theme;
|
||||
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_LESSON;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_LESSON_SUBJECT;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SLOT;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SOURCE;
|
||||
import static de.jottyfan.bico.db.public_.Tables.T_SUBJECT;
|
||||
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;
|
||||
@@ -25,8 +25,8 @@ import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonSubjectRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonSubjectRecord;
|
||||
import de.jottyfan.bico.modules.theme.model.KeyValueBean;
|
||||
import de.jottyfan.bico.modules.theme.model.ThemeBean;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import de.jottyfan.bico.db.public_.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.db.tables.records.TLessonRecord;
|
||||
import de.jottyfan.bico.modules.theme.model.KeyValueBean;
|
||||
import de.jottyfan.bico.modules.theme.model.ThemeBean;
|
||||
|
||||
|
||||
@@ -66,3 +66,51 @@ body {
|
||||
width: 100% !important;
|
||||
max-width: inherit !important;
|
||||
}
|
||||
|
||||
.tag {
|
||||
transform: rotate(270deg);
|
||||
-webkit-transform: rotate(270deg); /* Safari, Chrome */
|
||||
-moz-transform: rotate(270deg); /* Firefox */
|
||||
-ms-transform: rotate(270deg); /* IE 9 */
|
||||
-o-transform: rotate(270deg); /* Opera */
|
||||
font-size: small;
|
||||
position: absolute;
|
||||
left: -16px;
|
||||
top: 24px;
|
||||
border-bottom: 1px dashed silver;
|
||||
}
|
||||
|
||||
.tagbu {
|
||||
background: linear-gradient(to bottom, yellow, white);
|
||||
}
|
||||
|
||||
[data-bs-theme=dark] .tagbu {
|
||||
background: none;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.tagju {
|
||||
background: linear-gradient(to bottom, lime, white);
|
||||
}
|
||||
|
||||
[data-bs-theme=dark] .tagju {
|
||||
background: none;
|
||||
color: lime;
|
||||
}
|
||||
|
||||
.tagfollow {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.tagemphasize {
|
||||
font-weight: bolder;
|
||||
color: #ff4444;
|
||||
}
|
||||
|
||||
.smallbadge {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
[data-bs-theme=dark] .smallbadge {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
@@ -4,20 +4,16 @@
|
||||
<th:block layout:fragment="content">
|
||||
<div class="borderdist">
|
||||
<div class="container" th:if="${hasDateRole || hasBUrole}">
|
||||
<pre>Kommende Einteilung für den Bibelunterricht</pre>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-4 col-lg-2 card p-2 m-1" th:each="s : ${list}">
|
||||
<div th:text="${#temporals.format(s.day, 'dd.MM.yyyy')}"></div>
|
||||
<div th:text="${s.fullname}"></div>
|
||||
<div class="tag tagbu" th:if="${s.isBibleclass}">Bibelunt.</div>
|
||||
<div class="tag tagju" th:if="${s.isYouthgroup}">Jungsch.</div>
|
||||
<div class="tagfollow" th:text="${#temporals.format(s.day, 'dd.MM.yyyy')}"></div>
|
||||
<div th:class="'tagfollow' + ${currentUserName == #strings.toLowerCase(s.fullname) ? ' tagemphasize' : ''}" th:text="${s.fullname}"></div>
|
||||
</div>
|
||||
<div class="alert alert-info" th:if="${list.size() < 1}">Es gibt noch keine neuen Termine oder Zusagen für Termine.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" th:unless="${hasDateRole || hasBUrole}">
|
||||
<div class="alert alert-info">
|
||||
Willkommen im Anmeldeportal für die Gemeindefreizeit. Durch das Anklicken des Buttons <a class="btn btn-outline-secondary" th:href="@{/camp/registration}">Anmeldung Gemeindefreizeit</a> kannst du das Anmeldeformular öffnen.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
</body>
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="s : ${list}">
|
||||
<td th:data-sort="${#temporals.format(s.slotDay, 'yyyy-MM-dd')}"><a th:href="@{/slot/{id}(id=${s.pkSlot})}" th:text="${#temporals.format(s.slotDay, 'dd.MM.yyyy')}"></a></td>
|
||||
<td th:data-sort="${#temporals.format(s.slotDay, 'yyyy-MM-dd')}">
|
||||
<a th:href="@{/slot/{id}(id=${s.pkSlot})}" th:text="${#temporals.format(s.slotDay, 'dd.MM.yyyy')}"></a><br />
|
||||
<span class="smallbadge tagbu" th:if="${s.bibleclass}">Bibelunterricht</span>
|
||||
<span class="smallbadge tagju" th:if="${s.youthgroup}">Jungschar</span>
|
||||
</td>
|
||||
<td><a th:href="@{/lesson?slotId={id}(id=${s.pkSlot})}" class="btn btn-outline-secondary"> <span th:text="${s.abbreviation}" th:if="${s.abbreviation}"></span> <i
|
||||
class="bi bi-pencil" th:if="${s.abbreviation == null || s.abbreviation.isBlank()}"></i>
|
||||
</a></td>
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
<input type="date" th:field="*{slotDay}" th:class="${#fields.hasErrors('slotDay') ? 'form-control bg-danger' : 'form-control'}" />
|
||||
<div th:each="err : ${#fields.errors('slotDay')}" th:text="${err}" class="alert alert-danger"></div>
|
||||
</div>
|
||||
<div class="col-sm-2">Gruppenname</div>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" th:field="*{groupname}">
|
||||
<option th:each="g : ${groupnames}" th:value="${g}" th:text="${groupnamemap.get(g.literal)}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2">Notiz</div>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" th:field="*{note}"></textarea>
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
<title>Bible Class Organizer</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap/5.3.3/css/bootstrap.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap-icons/1.11.3/font/bootstrap-icons.css}" />
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/datatables.net-bs5/2.1.7/css/dataTables.bootstrap5.min.css}"/>
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap/5.3.8/css/bootstrap.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap-icons/1.13.1/font/bootstrap-icons.css}" />
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/datatables.net-bs5/2.3.5/css/dataTables.bootstrap5.min.css}"/>
|
||||
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/style.css}" />
|
||||
<script type="application/javascript" th:src="@{/webjars/bootstrap/5.3.3/js/bootstrap.bundle.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/bootstrap/5.3.8/js/bootstrap.bundle.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/jquery/3.7.1/jquery.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net/2.1.7/js/dataTables.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net/2.3.5/js/dataTables.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/js/dataTables.de.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net-bs5/2.1.7/js/dataTables.bootstrap5.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net-responsive/3.0.1/js/dataTables.responsive.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net-buttons/3.1.1/js/dataTables.buttons.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net-bs5/2.3.5/js/dataTables.bootstrap5.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net-responsive/3.0.6/js/dataTables.responsive.min.js}"></script>
|
||||
<script type="application/javascript" th:src="@{/webjars/datatables.net-buttons/3.2.5/js/dataTables.buttons.min.js}"></script>
|
||||
<script th:src="@{/js/stylehelp.js}"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user