33 Commits

Author SHA1 Message Date
32ef8a67d9 added outlay 2024-08-19 17:23:41 +02:00
b10765fe89 fixed registration bugs 2024-05-28 23:24:45 +02:00
8522def65c added new main site with currently buggy layout 2024-05-28 18:29:26 +02:00
81d6f79857 added Linda 2024-05-28 17:51:27 +02:00
fbfccd0dfc added text anna 2024-05-28 17:15:32 +02:00
0e57c57ccc forbid spaces in login field, see #16 2024-05-04 14:09:35 +02:00
f0d30ec6ed fixed registration failure checks 2024-04-01 18:04:42 +02:00
7ab500e510 fixed correction of registrations 2024-04-01 15:33:03 +02:00
a373f5e758 finetuning 2024-03-18 19:45:46 +01:00
f577164781 added image of simeon 2024-03-18 19:39:56 +01:00
03eb781a98 added start_booking, see #14 2024-03-16 22:40:36 +01:00
ce819f80de finetuning 2024-03-14 09:28:36 +01:00
1c226caa48 added image of Jörg 2024-03-14 09:25:05 +01:00
1580369794 added about of Jörg 2024-03-14 09:15:47 +01:00
39805aec20 added Simeon about text 2024-03-14 09:02:51 +01:00
0eb90092e7 finetuning 2024-02-24 17:45:50 +01:00
fe8100c59e removed false corrections 2024-02-23 15:38:21 +01:00
e20c24d006 added required price, see #6 2024-02-23 15:36:37 +01:00
72952b9c7b finetuning in layout 2024-02-23 11:50:33 +01:00
8f69320505 show free beds, see #2 2024-02-23 01:24:53 +01:00
5a365b1a37 code cleanup 2024-02-10 11:50:37 +01:00
1d14a13aa6 code cleanup 2023-12-27 13:57:57 +01:00
8e790a7660 corrected privileges, see #11 2023-12-27 11:01:46 +01:00
0d476c6f91 hotfix: corrected consent url 2023-10-26 11:01:59 +02:00
11abda3575 register already known persons 2023-10-25 10:15:23 +02:00
453105419f register already known persons 2023-10-25 10:14:26 +02:00
d4ae63f975 german decimal separator forced 2023-10-21 21:51:26 +02:00
3dd39751af export optimization 2023-10-21 21:46:22 +02:00
e0e972cfe8 added download csv file feature 2023-10-21 18:53:14 +02:00
b3a089d6b3 corrected ant matchers 2023-10-21 13:37:59 +02:00
3147007632 display camplists 2023-10-21 01:24:52 +02:00
5f78b87a87 corrected password url 2023-10-07 11:12:21 +02:00
5f6d71890e corrected link url 2023-10-07 10:56:42 +02:00
88 changed files with 2621 additions and 384 deletions

View File

@ -25,6 +25,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>

View File

@ -1,2 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir= connection.project.dir=
eclipse.preferences.version=1 eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
override.workspace.settings=false
show.console.view=false
show.executions.view=false

View File

@ -0,0 +1,2 @@
boot.validation.initialized=true
eclipse.preferences.version=1

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '3.1.1' id 'org.springframework.boot' version '3.2.4'
id "io.spring.dependency-management" version "1.1.2" id "io.spring.dependency-management" version "1.1.4"
id 'java' id 'java'
id 'war' id 'war'
id 'eclipse' id 'eclipse'
@ -8,7 +8,7 @@ plugins {
} }
group = 'de.jottyfan.camporganizer' group = 'de.jottyfan.camporganizer'
version = '0.5.8' version = '0.8.5'
description = """CampOrganizer2""" description = """CampOrganizer2"""
@ -35,52 +35,53 @@ war {
"Implementation-Timestamp": new Date()) "Implementation-Timestamp": new Date())
} }
} }
baseName = project.name
version = version version = version
archiveName = 'CampOrganizer2.war' archiveFileName = 'CampOrganizer2.war'
} }
dependencies { dependencies {
implementation 'org.apache.logging.log4j:log4j-api:2.20.0' implementation 'org.jooq:jooq:3.19.6'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0' implementation 'de.jottyfan:COJooq:2024.03.16c'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.20.0'
implementation 'org.webjars:bootstrap:5.2.3' implementation 'org.apache.logging.log4j:log4j-api:2.23.1'
implementation 'org.webjars:font-awesome:5.15.4' implementation 'org.apache.logging.log4j:log4j-core:2.23.1'
implementation 'org.webjars:jquery:3.6.4' implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.23.1'
implementation 'org.webjars:popper.js:2.9.3'
implementation 'org.webjars:datatables:1.13.2' implementation 'org.webjars:bootstrap:5.3.2'
implementation 'org.webjars:font-awesome:6.5.1'
implementation 'org.webjars:jquery:3.7.1'
implementation 'org.webjars:popper.js:2.11.7'
implementation 'org.webjars:datatables:1.13.5'
implementation 'org.webjars:select2:4.0.13' implementation 'org.webjars:select2:4.0.13'
implementation 'net.sf.biweekly:biweekly:0.6.6' implementation 'net.sf.biweekly:biweekly:0.6.7'
// for using the keycloak rest interface // for using the keycloak rest interface
implementation 'org.keycloak:keycloak-server-spi:22.0.1' implementation 'org.keycloak:keycloak-server-spi:24.0.1'
implementation 'org.keycloak:keycloak-admin-client:22.0.0' implementation 'org.keycloak:keycloak-admin-client:24.0.1'
implementation 'org.jboss.resteasy:resteasy-client:6.2.4.Final' implementation 'org.jboss.resteasy:resteasy-client:6.2.6.Final'
// backward compatibility until the complete registration is converted to keycloak // backward compatibility until the complete registration is converted to keycloak
implementation 'org.jasypt:jasypt:1.9.3' implementation 'org.jasypt:jasypt:1.9.3'
// rss support // rss support
implementation 'com.rometools:rome:1.18.0' implementation 'com.rometools:rome:2.1.0'
// mail support // mail support
implementation 'commons-validator:commons-validator:1.7' implementation 'commons-validator:commons-validator:1.8.0'
implementation 'org.springframework.boot:spring-boot-starter-mail' implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-jooq' implementation 'org.springframework.boot:spring-boot-starter-jooq'
implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-security'
implementation "org.springframework.boot:spring-boot-starter-oauth2-client" implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
implementation 'org.springframework.security:spring-security-oauth2-authorization-server:1.1.1' implementation 'org.springframework.security:spring-security-oauth2-authorization-server:1.2.1'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'de.jottyfan:COJooq:2023.03' implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.0.0'
implementation 'commons-io:commons-io:2.13.0' implementation 'commons-io:commons-io:2.15.1'
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat' runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored
View File

@ -162,7 +162,7 @@ save () {
APP_ARGS=$(save "$@") APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS --illegal-access=permit $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'CampOrganizer2'

View File

@ -11,6 +11,7 @@ import org.springframework.security.oauth2.client.registration.InMemoryClientReg
import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy; import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy;
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
/** /**
* *
@ -34,7 +35,12 @@ public class SecurityConfiguration {
// @formatter:off // @formatter:off
.oauth2Login(o -> o.defaultSuccessUrl("/")) .oauth2Login(o -> o.defaultSuccessUrl("/"))
.logout(o -> o.logoutSuccessHandler(new OidcClientInitiatedLogoutSuccessHandler(crr))) .logout(o -> o.logoutSuccessHandler(new OidcClientInitiatedLogoutSuccessHandler(crr)))
.authorizeHttpRequests(o -> o.requestMatchers("/dashboard/**", "/business/**", "/confirmation/**", "/userlogin/**").authenticated() .authorizeHttpRequests(o -> o.requestMatchers(
AntPathRequestMatcher.antMatcher("/dashboard/**"),
AntPathRequestMatcher.antMatcher("/business/**"),
AntPathRequestMatcher.antMatcher("/confirmation/**"),
AntPathRequestMatcher.antMatcher("/userlogin/**")
).authenticated()
.anyRequest().permitAll()) .anyRequest().permitAll())
.oauth2ResourceServer(o -> o.jwt(Customizer.withDefaults())) .oauth2ResourceServer(o -> o.jwt(Customizer.withDefaults()))
.sessionManagement(o -> o.init(sec)); .sessionManagement(o -> o.init(sec));

View File

@ -74,7 +74,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/document/edit/{id}") @GetMapping("/admin/document/edit/{id}")
public String prepareAddDocument(@PathVariable Integer id, Model model, HttpServletRequest request) { public String prepareAddDocument(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
model.addAttribute("bean", service.getDocument(id)); model.addAttribute("bean", service.getDocument(id));
return "/admin/document_edit"; return "/admin/document_edit";
} }
@ -92,7 +92,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/document/delete/{id}") @GetMapping("/admin/document/delete/{id}")
public String deleteDocument(@PathVariable Integer id, Model model, HttpServletRequest request) { public String deleteDocument(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
service.deleteDocument(id); service.deleteDocument(id);
return "redirect:/admin/document"; return "redirect:/admin/document";
} }
@ -111,7 +111,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/location/edit/{id}") @GetMapping("/admin/location/edit/{id}")
public String prepareAddLocation(@PathVariable Integer id, Model model, HttpServletRequest request) { public String prepareAddLocation(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
model.addAttribute("bean", service.getLocation(id)); model.addAttribute("bean", service.getLocation(id));
model.addAttribute("documents", service.getLocationDocuments()); model.addAttribute("documents", service.getLocationDocuments());
return "/admin/location_edit"; return "/admin/location_edit";
@ -132,7 +132,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/location/delete/{id}") @GetMapping("/admin/location/delete/{id}")
public String deleteLocation(@PathVariable Integer id, Model model, HttpServletRequest request) { public String deleteLocation(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
service.deleteLocation(id); service.deleteLocation(id);
return "redirect:/admin/location"; return "redirect:/admin/location";
} }
@ -154,7 +154,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/camp/edit/{id}") @GetMapping("/admin/camp/edit/{id}")
public String prepareEditCamp(@PathVariable Integer id, Model model, HttpServletRequest request) { public String prepareEditCamp(@PathVariable("id") Integer id, Model model, HttpServletRequest request) {
model.addAttribute("bean", service.getCamp(id)); model.addAttribute("bean", service.getCamp(id));
model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("documents", service.getCampDocuments());
model.addAttribute("locations", service.getLocations()); model.addAttribute("locations", service.getLocations());
@ -186,7 +186,7 @@ public class AdminController extends CommonController {
} }
@GetMapping("/admin/camp/delete/{id}") @GetMapping("/admin/camp/delete/{id}")
public String deleteCamp(@PathVariable Integer id, Model model, HttpServletRequest request, public String deleteCamp(@PathVariable("id") Integer id, Model model, HttpServletRequest request,
RedirectAttributes redirect) { RedirectAttributes redirect) {
String error = service.deleteCamp(id); String error = service.deleteCamp(id);
redirect.addAttribute("error", error); redirect.addAttribute("error", error);

View File

@ -49,7 +49,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/rolebased/{role}") @GetMapping("/admin/privileges/rolebased/{role}")
public String getRolebased(@PathVariable String role, Model model) { public String getRolebased(@PathVariable("role") String role, Model model) {
model.addAttribute("list", service.getAllModules()); model.addAttribute("list", service.getAllModules());
model.addAttribute("selected", role); model.addAttribute("selected", role);
model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role))); model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role)));
@ -58,7 +58,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/campbased/{campid}") @GetMapping("/admin/privileges/campbased/{campid}")
public String getCampbased(@PathVariable Integer campid, Model model) { public String getCampbased(@PathVariable("campid") Integer campid, Model model) {
List<CampBean> list = service.getAllCamps(); List<CampBean> list = service.getAllCamps();
model.addAttribute("list", list); model.addAttribute("list", list);
String campname = "?"; String campname = "?";
@ -74,7 +74,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/userbased/{userid}") @GetMapping("/admin/privileges/userbased/{userid}")
public String getUserbased(@PathVariable Integer userid, Model model) { public String getUserbased(@PathVariable("userid") Integer userid, Model model) {
List<ProfileBean> list = service.getProfiles(); List<ProfileBean> list = service.getProfiles();
model.addAttribute("list", list); model.addAttribute("list", list);
String selected = "?"; String selected = "?";
@ -90,13 +90,13 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/delete/{id}/{pagedest}") @GetMapping("/admin/privileges/delete/{id}/{pagedest}")
public String deleteFromCampProfile(@PathVariable Integer id, @PathVariable String pagedest) { public String deleteFromCampProfile(@PathVariable("id") Integer id, @PathVariable("pagedest") String pagedest) {
service.deleteFromCampProfile(id); service.deleteFromCampProfile(id);
return "redirect:" + pagedest.replace("_", "/"); return "redirect:" + pagedest.replace("_", "/");
} }
@GetMapping("/admin/privileges/add/{pagedest}") @GetMapping("/admin/privileges/add/{pagedest}")
public String prepareAdd(Model model, @PathVariable String pagedest) { public String prepareAdd(Model model, @PathVariable("pagedest") String pagedest) {
model.addAttribute("pagedest", pagedest); model.addAttribute("pagedest", pagedest);
model.addAttribute("bean", new CampProfileBean()); model.addAttribute("bean", new CampProfileBean());
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
@ -106,7 +106,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@PostMapping("/admin/privileges/insert/{pagedest}") @PostMapping("/admin/privileges/insert/{pagedest}")
public String insertCampProfile(@Valid @ModelAttribute("bean") CampProfileBean bean, final BindingResult bindingResult, @PathVariable String pagedest, Model model) { public String insertCampProfile(@Valid @ModelAttribute("bean") CampProfileBean bean, final BindingResult bindingResult, @PathVariable("pagedest") String pagedest, Model model) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
model.addAttribute("pagedest", pagedest); model.addAttribute("pagedest", pagedest);
model.addAttribute("profiles", service.getProfiles()); model.addAttribute("profiles", service.getProfiles());
@ -119,7 +119,7 @@ public class AdminPrivilegesController extends CommonController {
} }
@GetMapping("/admin/privileges/abortinsert/{pagedest}") @GetMapping("/admin/privileges/abortinsert/{pagedest}")
public String abortInsert(@PathVariable String pagedest) { public String abortInsert(@PathVariable("pagedest") String pagedest) {
return "redirect:" + pagedest.replace("_", "/"); return "redirect:" + pagedest.replace("_", "/");
} }
} }

View File

@ -13,11 +13,10 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import jakarta.validation.Valid;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.jooq.Condition; import org.jooq.Condition;
@ -26,7 +25,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.InsertValuesStep11; import org.jooq.InsertValuesStep16;
import org.jooq.InsertValuesStep3; import org.jooq.InsertValuesStep3;
import org.jooq.Record4; import org.jooq.Record4;
import org.jooq.Record5; import org.jooq.Record5;
@ -60,6 +59,7 @@ import de.jottyfan.camporganizer.module.admin.model.LocationBean;
import de.jottyfan.camporganizer.module.admin.model.PrivilegesContainerBean; import de.jottyfan.camporganizer.module.admin.model.PrivilegesContainerBean;
import de.jottyfan.camporganizer.module.admin.model.ProfileBean; import de.jottyfan.camporganizer.module.admin.model.ProfileBean;
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper; import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
import jakarta.validation.Valid;
/** /**
* *
@ -131,7 +131,9 @@ public class AdminRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<DocumentBean> list = new ArrayList<>(); List<DocumentBean> list = new ArrayList<>();
for (Record5<Integer, String, EnumDocument, EnumFiletype, EnumCamprole[]> r : sql.fetch()) { Iterator<Record5<Integer, String, EnumDocument, EnumFiletype, EnumCamprole[]>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record5<Integer, String, EnumDocument, EnumFiletype, EnumCamprole[]> r = i.next();
DocumentBean bean = new DocumentBean(); DocumentBean bean = new DocumentBean();
bean.setPk(r.get(T_DOCUMENT.PK)); bean.setPk(r.get(T_DOCUMENT.PK));
bean.setName(r.get(T_DOCUMENT.NAME)); bean.setName(r.get(T_DOCUMENT.NAME));
@ -162,7 +164,9 @@ public class AdminRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<DocumentBean> list = new ArrayList<>(); List<DocumentBean> list = new ArrayList<>();
for (Record4<Integer, String, EnumDocument, EnumFiletype> r : sql.fetch()) { Iterator<Record4<Integer, String, EnumDocument, EnumFiletype>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, EnumDocument, EnumFiletype> r = i.next();
DocumentBean bean = new DocumentBean(); DocumentBean bean = new DocumentBean();
bean.setPk(r.get(T_DOCUMENT.PK)); bean.setPk(r.get(T_DOCUMENT.PK));
bean.setName(r.get(T_DOCUMENT.NAME)); bean.setName(r.get(T_DOCUMENT.NAME));
@ -431,10 +435,12 @@ public class AdminRepository {
jooq.transaction(t -> { jooq.transaction(t -> {
LocalDate arriveDate = bean.getArrive(); LocalDate arriveDate = bean.getArrive();
LocalDate departDate = bean.getDepart(); LocalDate departDate = bean.getDepart();
LocalDate startBookingDate = bean.getStartBooking();
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();
LocalDateTime startBooking = startBookingDate == null ? null : startBookingDate.atStartOfDay();
if (bean.getPk() == null) { if (bean.getPk() == null) {
InsertValuesStep11<TCampRecord, LocalDateTime, String, LocalDateTime, Integer, Integer, Integer, Boolean, Integer, Integer, String, String> sql = DSL InsertValuesStep16<TCampRecord, LocalDateTime, String, LocalDateTime, Integer, Integer, Integer, Boolean, Integer, Integer, String, String, Integer, Integer, Integer, Integer, LocalDateTime> sql = DSL
.using(t) .using(t)
// @formatter:off // @formatter:off
.insertInto(T_CAMP, .insertInto(T_CAMP,
@ -448,9 +454,15 @@ public class AdminRepository {
T_CAMP.MAX_AGE, T_CAMP.MAX_AGE,
T_CAMP.MIN_AGE, T_CAMP.MIN_AGE,
T_CAMP.NAME, T_CAMP.NAME,
T_CAMP.PRICE) T_CAMP.PRICE,
T_CAMP.BEDS_FEMALE,
T_CAMP.BEDS_MALE,
T_CAMP.BLOCKED_BEDS_FEMALE,
T_CAMP.BLOCKED_BEDS_MALE,
T_CAMP.START_BOOKING)
.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(), startBooking);
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
sql.execute(); sql.execute();
@ -469,6 +481,11 @@ public class AdminRepository {
.set(T_CAMP.MIN_AGE, bean.getMinAge()) .set(T_CAMP.MIN_AGE, bean.getMinAge())
.set(T_CAMP.NAME, bean.getName()) .set(T_CAMP.NAME, bean.getName())
.set(T_CAMP.PRICE, bean.getPrice()) .set(T_CAMP.PRICE, bean.getPrice())
.set(T_CAMP.BEDS_FEMALE, bean.getBedsFemale())
.set(T_CAMP.BEDS_MALE, bean.getBedsMale())
.set(T_CAMP.BLOCKED_BEDS_FEMALE, bean.getBlockedBedsFemale())
.set(T_CAMP.BLOCKED_BEDS_MALE, bean.getBlockedBedsMale())
.set(T_CAMP.START_BOOKING, startBooking)
.where(T_CAMP.PK.eq(bean.getPk())); .where(T_CAMP.PK.eq(bean.getPk()));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
@ -527,7 +544,9 @@ public class AdminRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
PrivilegesContainerBean pcb = new PrivilegesContainerBean(); PrivilegesContainerBean pcb = new PrivilegesContainerBean();
for (Record4<Integer, String, LocalDateTime, String> r : sql.fetch()) { Iterator<Record4<Integer, String, LocalDateTime, String>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, LocalDateTime, String> r = i.next();
Integer fkCampProfile = r.get(T_CAMPPROFILE.PK); Integer fkCampProfile = r.get(T_CAMPPROFILE.PK);
String username = r.get(T_PROFILE.USERNAME); String username = r.get(T_PROFILE.USERNAME);
String campname = r.get(T_CAMP.NAME); String campname = r.get(T_CAMP.NAME);
@ -562,7 +581,9 @@ public class AdminRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
PrivilegesContainerBean pcb = new PrivilegesContainerBean(); PrivilegesContainerBean pcb = new PrivilegesContainerBean();
for (Record4<Integer, String, LocalDateTime, EnumModule> r : sql.fetch()) { Iterator<Record4<Integer, String, LocalDateTime, EnumModule>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, LocalDateTime, EnumModule> r = i.next();
Integer fkCampProfile = r.get(T_CAMPPROFILE.PK); Integer fkCampProfile = r.get(T_CAMPPROFILE.PK);
EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE); EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE);
String module = moduleEnum == null ? null : moduleEnum.getLiteral(); String module = moduleEnum == null ? null : moduleEnum.getLiteral();
@ -599,7 +620,9 @@ public class AdminRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
PrivilegesContainerBean pcb = new PrivilegesContainerBean(); PrivilegesContainerBean pcb = new PrivilegesContainerBean();
for (Record4<Integer, String, String, EnumModule> r : sql.fetch()) { Iterator<Record4<Integer, String, String, EnumModule>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, String, EnumModule> r = i.next();
Integer fkCampProfile = r.get(T_CAMPPROFILE.PK); Integer fkCampProfile = r.get(T_CAMPPROFILE.PK);
EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE); EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE);
String forename = r.get(T_PROFILE.FORENAME); String forename = r.get(T_PROFILE.FORENAME);

View File

@ -7,12 +7,12 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
/** /**
* *
@ -45,6 +45,21 @@ public class CampBean implements Serializable {
private String countries; private String countries;
@NotNull @NotNull
private String price; private String price;
@NotNull
@Min(value = 0)
private Integer bedsFemale;
@NotNull
@Min(value = 0)
private Integer bedsMale;
@NotNull
@Min(value = 0)
private Integer blockedBedsFemale;
@NotNull
@Min(value = 0)
private Integer blockedBedsMale;
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startBooking;
/** /**
* generate a camp bean out of r * generate a camp bean out of r
@ -59,6 +74,7 @@ public class CampBean implements Serializable {
CampBean bean = new CampBean(); CampBean bean = new CampBean();
LocalDateTime arrive = r.getArrive(); LocalDateTime arrive = r.getArrive();
LocalDateTime depart = r.getDepart(); LocalDateTime depart = r.getDepart();
LocalDateTime startBooking = r.getStartBooking();
bean.setArrive(arrive == null ? null : arrive.toLocalDate()); bean.setArrive(arrive == null ? null : arrive.toLocalDate());
bean.setCountries(r.getCountries()); bean.setCountries(r.getCountries());
bean.setDepart(depart == null ? null : depart.toLocalDate()); bean.setDepart(depart == null ? null : depart.toLocalDate());
@ -71,6 +87,11 @@ public class CampBean implements Serializable {
bean.setName(r.getName()); bean.setName(r.getName());
bean.setPk(r.getPk()); bean.setPk(r.getPk());
bean.setPrice(r.getPrice()); bean.setPrice(r.getPrice());
bean.setBedsFemale(r.getBedsFemale());
bean.setBedsMale(r.getBedsMale());
bean.setBlockedBedsFemale(r.getBlockedBedsFemale());
bean.setBlockedBedsMale(r.getBlockedBedsMale());
bean.setStartBooking(startBooking == null ? null : startBooking.toLocalDate());
return bean; return bean;
} }
@ -272,4 +293,74 @@ public class CampBean implements Serializable {
} }
this.countries = buf.toString(); this.countries = buf.toString();
} }
/**
* @return the bedsFemale
*/
public Integer getBedsFemale() {
return bedsFemale;
}
/**
* @param bedsFemale the bedsFemale to set
*/
public void setBedsFemale(Integer bedsFemale) {
this.bedsFemale = bedsFemale;
}
/**
* @return the bedsMale
*/
public Integer getBedsMale() {
return bedsMale;
}
/**
* @param bedsMale the bedsMale to set
*/
public void setBedsMale(Integer bedsMale) {
this.bedsMale = bedsMale;
}
/**
* @return the blockedBedsFemale
*/
public Integer getBlockedBedsFemale() {
return blockedBedsFemale;
}
/**
* @param blockedBedsFemale the blockedBedsFemale to set
*/
public void setBlockedBedsFemale(Integer blockedBedsFemale) {
this.blockedBedsFemale = blockedBedsFemale;
}
/**
* @return the blockedBedsMale
*/
public Integer getBlockedBedsMale() {
return blockedBedsMale;
}
/**
* @param blockedBedsMale the blockedBedsMale to set
*/
public void setBlockedBedsMale(Integer blockedBedsMale) {
this.blockedBedsMale = blockedBedsMale;
}
/**
* @return the startBooking
*/
public LocalDate getStartBooking() {
return startBooking;
}
/**
* @param startBooking the startBooking to set
*/
public void setStartBooking(LocalDate startBooking) {
this.startBooking = startBooking;
}
} }

View File

@ -39,7 +39,7 @@ public class BookingsController extends CommonController {
@GetMapping("/business/bookings/{id}") @GetMapping("/business/bookings/{id}")
@RolesAllowed({"business_booking"}) @RolesAllowed({"business_booking"})
public String getBooking(Model model, @PathVariable Integer id) { public String getBooking(Model model, @PathVariable("id") Integer id) {
BookerBean bean = bookingsService.getBooker(id, getCurrentUser()); BookerBean bean = bookingsService.getBooker(id, getCurrentUser());
model.addAttribute("booker", bean); model.addAttribute("booker", bean);
model.addAttribute("addBean", new AddPaymentBean()); model.addAttribute("addBean", new AddPaymentBean());
@ -48,7 +48,7 @@ public class BookingsController extends CommonController {
@PostMapping("/business/bookings/payment/{id}") @PostMapping("/business/bookings/payment/{id}")
@RolesAllowed({"business_booking"}) @RolesAllowed({"business_booking"})
public String addPayment(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id) { public String addPayment(Model model, @ModelAttribute("bean") AddPaymentBean bean, @PathVariable("id") Integer id) {
Double payment = bean.getPayment(); Double payment = bean.getPayment();
bookingsService.addPayment(id, payment); bookingsService.addPayment(id, payment);
return getBooking(model, id); return getBooking(model, id);
@ -56,7 +56,7 @@ public class BookingsController extends CommonController {
@PostMapping("/business/bookings/listpayment/{id}") @PostMapping("/business/bookings/listpayment/{id}")
@RolesAllowed({"business_booking"}) @RolesAllowed({"business_booking"})
public String addListPayment(Model model, @ModelAttribute AddPaymentBean bean, @PathVariable Integer id, @RequestParam(defaultValue = "") String search) { public String addListPayment(Model model, @ModelAttribute("bean") AddPaymentBean bean, @PathVariable("id") Integer id, @RequestParam(defaultValue = "") String search) {
Double payment = bean.getPayment(); Double payment = bean.getPayment();
bookingsService.addPayment(id, payment); bookingsService.addPayment(id, payment);
LOGGER.debug("search is {}", search); LOGGER.debug("search is {}", search);

View File

@ -2,12 +2,13 @@ package de.jottyfan.camporganizer.module.business.bookings;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -25,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.EnumConverter; import de.jottyfan.camporganizer.db.EnumConverter;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean; import de.jottyfan.camporganizer.module.business.bookings.model.BookerBean;
@ -55,14 +57,16 @@ public class BookingsRepository {
.select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED, V_CAMP.NAME, V_CAMP.YEAR) .select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED, V_CAMP.NAME, V_CAMP.YEAR)
.from(T_PERSON) .from(T_PERSON)
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)) .where(T_PROFILE.USERNAME.eq(username))
.orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME); .orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME);
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<BookerBean> list = new ArrayList<>(); List<BookerBean> list = new ArrayList<>();
for (Record r : sql.fetch()) { Iterator<Record10<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, String, Double>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record10<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, String, Double> r = i.next();
String forename = r.get(T_PERSON.FORENAME); String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME); String surname = r.get(T_PERSON.SURNAME);
EnumCamprole role = r.get(T_PERSON.CAMPROLE); EnumCamprole role = r.get(T_PERSON.CAMPROLE);
@ -108,8 +112,8 @@ public class BookingsRepository {
V_CAMP.PK) V_CAMP.PK)
.from(T_PERSON) .from(T_PERSON)
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)) .where(T_PROFILE.USERNAME.eq(username))
.and(T_PERSON.PK.eq(id)); .and(T_PERSON.PK.eq(id));
// @formatter:on // @formatter:on

View File

@ -1,20 +1,22 @@
package de.jottyfan.camporganizer.module.business.business; package de.jottyfan.camporganizer.module.business.business;
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_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION; import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP_BUDGET; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP_BUDGET;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext; import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Record4; import org.jooq.Record4;
import org.jooq.Record9; import org.jooq.Record9;
import org.jooq.SelectConditionStep; import org.jooq.SelectConditionStep;
@ -24,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
import de.jottyfan.camporganizer.module.business.business.model.BusinessBean; import de.jottyfan.camporganizer.module.business.business.model.BusinessBean;
import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean; import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean;
@ -57,14 +60,16 @@ public class BusinessRepository {
V_CAMP_BUDGET.FK_CAMP) V_CAMP_BUDGET.FK_CAMP)
.from(V_CAMP_BUDGET) .from(V_CAMP_BUDGET)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(V_CAMP_BUDGET.FK_CAMP)) .leftJoin(T_CAMP).on(T_CAMP.PK.eq(V_CAMP_BUDGET.FK_CAMP))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP_BUDGET.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(V_CAMP_BUDGET.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)) .where(T_PROFILE.USERNAME.eq(username))
.orderBy(T_CAMP.ARRIVE); .orderBy(T_CAMP.ARRIVE);
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<CampBudgetBean> list = new ArrayList<>(); List<CampBudgetBean> list = new ArrayList<>();
for (Record4<BigDecimal, String, Double, Integer> r : sql.fetch()) { Iterator<Record4<BigDecimal, String, Double, Integer>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record r = i.next();
BigDecimal b = r.get(V_CAMP_BUDGET.BUDGET); BigDecimal b = r.get(V_CAMP_BUDGET.BUDGET);
String n = r.get(V_CAMP_BUDGET.CAMP_NAME); String n = r.get(V_CAMP_BUDGET.CAMP_NAME);
Double y = r.get(V_CAMP_BUDGET.YEAR); Double y = r.get(V_CAMP_BUDGET.YEAR);
@ -96,13 +101,15 @@ public class BusinessRepository {
.from(T_PERSON) .from(T_PERSON)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
.leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION)) .leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION))
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_CAMP.PK)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_CAMP.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username)); .where(T_PROFILE.USERNAME.eq(username));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<BusinessBean> list = new ArrayList<>(); List<BusinessBean> list = new ArrayList<>();
for (Record9<Integer, String, String, String, String, LocalDateTime, String, BigDecimal, BigDecimal> r : sql.fetch()) { Iterator<Record9<Integer, String, String, String, String, LocalDateTime, String, BigDecimal, BigDecimal>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record9<Integer, String, String, String, String, LocalDateTime, String, BigDecimal, BigDecimal> r = i.next();
Integer fkPerson = r.get(T_PERSON.PK); Integer fkPerson = r.get(T_PERSON.PK);
String forename = r.get(T_PERSON.FORENAME); String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME); String surname = r.get(T_PERSON.SURNAME);

View File

@ -22,7 +22,7 @@ public class CampController extends CommonController {
@GetMapping("/business/camp/{id}") @GetMapping("/business/camp/{id}")
@RolesAllowed({ "business" }) @RolesAllowed({ "business" })
public String getCamp(Model model, @PathVariable Integer id) { public String getCamp(Model model, @PathVariable("id") Integer id) {
String username = super.getCurrentUser(); String username = super.getCurrentUser();
model.addAttribute("currentUser", username); model.addAttribute("currentUser", username);
model.addAttribute("campId", id); model.addAttribute("campId", id);

View File

@ -1,19 +1,19 @@
package de.jottyfan.camporganizer.module.business.camp; package de.jottyfan.camporganizer.module.business.camp;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext; import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Record6; import org.jooq.Record6;
import org.jooq.Record8; import org.jooq.Record8;
import org.jooq.SelectConditionStep; import org.jooq.SelectConditionStep;
@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.EnumConverter; import de.jottyfan.camporganizer.db.EnumConverter;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.module.business.camp.model.CampBean; import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
import de.jottyfan.camporganizer.module.business.camp.model.PersonBean; import de.jottyfan.camporganizer.module.business.camp.model.PersonBean;
@ -54,14 +55,16 @@ public class CampRepository {
// @formatter:off // @formatter:off
.select(V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.ARRIVE, V_CAMP.DEPART, V_CAMP.LOCATION_NAME, V_CAMP.PRICE) .select(V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.ARRIVE, V_CAMP.DEPART, V_CAMP.LOCATION_NAME, V_CAMP.PRICE)
.from(V_CAMP) .from(V_CAMP)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP.PK)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(V_CAMP.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(V_CAMP.PK.eq(pk)) .where(V_CAMP.PK.eq(pk))
.and(T_PROFILE.USERNAME.eq(username)); .and(T_PROFILE.USERNAME.eq(username));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
CampBean bean = new CampBean(); CampBean bean = new CampBean();
for (Record6<String, Double, LocalDateTime, LocalDateTime, String, String> r : sql.fetch()) { Iterator<Record6<String, Double, LocalDateTime, LocalDateTime, String, String>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record6<String, Double, LocalDateTime, LocalDateTime, String, String> r = i.next();
bean.setName(r.get(V_CAMP.NAME)); bean.setName(r.get(V_CAMP.NAME));
bean.setYear(r.get(V_CAMP.YEAR)); bean.setYear(r.get(V_CAMP.YEAR));
bean.setArrive(r.get(V_CAMP.ARRIVE)); bean.setArrive(r.get(V_CAMP.ARRIVE));
@ -85,15 +88,17 @@ public class CampRepository {
// @formatter:off // @formatter:off
.select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED) .select(T_PERSON.PK, T_PERSON.ACCEPT, T_PERSON.PAID, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.CREATED)
.from(T_PERSON) .from(T_PERSON)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PERSON.FK_CAMP.eq(pk)) .where(T_PERSON.FK_CAMP.eq(pk))
.and(T_PROFILE.USERNAME.eq(username)) .and(T_PROFILE.USERNAME.eq(username))
.orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME); .orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME);
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<PersonBean> list = new ArrayList<>(); List<PersonBean> list = new ArrayList<>();
for (Record r : sql.fetch()) { Iterator<Record8<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record8<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime> r = i.next();
String forename = r.get(T_PERSON.FORENAME); String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME); String surname = r.get(T_PERSON.SURNAME);
EnumCamprole role = r.get(T_PERSON.CAMPROLE); EnumCamprole role = r.get(T_PERSON.CAMPROLE);

View File

@ -0,0 +1,66 @@
package de.jottyfan.camporganizer.module.business.outlay;
import java.security.Principal;
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.camporganizer.module.business.outlay.model.OutlayBean;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.annotation.security.RolesAllowed;
import jakarta.validation.Valid;
/**
*
* @author jotty
*
*/
@Controller
@RolesAllowed({ "business_outlay" })
public class OutlayController extends CommonController {
@Autowired
private OutlayService service;
@GetMapping("/business/outlay")
public String getOutlayDashboard(Model model, Principal principal) {
model.addAttribute("list", service.getListOfUser(super.getCurrentUser(principal)));
return "/business/outlay/list";
}
@GetMapping("/business/outlay/add")
public String loadAddMask(Model model, Principal principal) {
model.addAttribute("bean", new OutlayBean().withUser(super.getCurrentUser(principal)));
model.addAttribute("camps", service.getAllCamps());
return "/business/outlay/editor";
}
@GetMapping("/business/outlay/edit/{id}")
public String loadAddMask(@PathVariable("id") Integer id, Model model, Principal principal) {
model.addAttribute("bean", service.getBeanIfAllowedFor(super.getCurrentUser(principal), id));
model.addAttribute("camps", service.getAllCamps());
return "/business/outlay/editor";
}
@PostMapping("/business/outlay/save")
public String save(@Valid @ModelAttribute("bean") OutlayBean bean, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("camps", service.getAllCamps());
return "/business/outlay/editor";
}
service.save(bean);
return "redirect:/business/outlay";
}
@GetMapping("/business/outlay/delete/{id}")
public String delete(@PathVariable("id") Integer id, Principal principal) {
service.deleteIfAllowedFor(super.getCurrentUser(principal), id);
return "redirect:/business/outlay";
}
}

View File

@ -0,0 +1,191 @@
package de.jottyfan.camporganizer.module.business.outlay;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALES;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext;
import org.jooq.DeleteConditionStep;
import org.jooq.InsertValuesStep8;
import org.jooq.Record10;
import org.jooq.Record4;
import org.jooq.Record7;
import org.jooq.SelectConditionStep;
import org.jooq.SelectSeekStep1;
import org.jooq.UpdateConditionStep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.tables.records.TSalesRecord;
import de.jottyfan.camporganizer.module.business.outlay.model.CampBean;
import de.jottyfan.camporganizer.module.business.outlay.model.OutlayBean;
import jakarta.validation.Valid;
/**
*
* @author jotty
*
*/
@Repository
@Transactional(transactionManager = "transactionManager")
public class OutlayRepository {
private static final Logger LOGGER = LogManager.getLogger(OutlayRepository.class);
@Autowired
private DSLContext jooq;
/**
* get all camps from the database
*
* @return a list of camps; an empty list at least
*/
public List<CampBean> getAllCamps() {
SelectSeekStep1<Record4<Integer, String, LocalDateTime, String>, LocalDateTime> sql = jooq
// @formatter:off
.select(T_CAMP.PK, T_CAMP.NAME, T_CAMP.ARRIVE, T_LOCATION.NAME)
.from(T_CAMP)
.leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION))
.orderBy(T_CAMP.ARRIVE.desc());
// @formatter:on
LOGGER.trace(sql.toString());
List<CampBean> list = new ArrayList<>();
Iterator<Record4<Integer, String, LocalDateTime, String>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, LocalDateTime, String> r = i.next();
String name = String
.format("%s %s %d", r.get(T_CAMP.NAME), r.get(T_LOCATION.NAME), r.get(T_CAMP.ARRIVE).getYear()).trim();
list.add(CampBean.of(r.get(T_CAMP.PK)).withCampname(name));
}
return list;
}
public List<OutlayBean> getListOf(String username) {
SelectConditionStep<Record7<Integer, String, String, LocalDateTime, String, BigDecimal, LocalDateTime>> sql = jooq
// @formatter:off
.select(T_SALES.PK,
T_SALES.TRADER,
T_CAMP.NAME,
T_CAMP.ARRIVE,
T_LOCATION.NAME,
T_SALES.CASH,
T_SALES.BUYDATE)
.from(T_SALES)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_SALES.FK_CAMP))
.leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION))
.where(T_SALES.PROVIDER.eq(username));
// @formatter:on
LOGGER.trace(sql);
List<OutlayBean> list = new ArrayList<>();
Iterator<Record7<Integer, String, String, LocalDateTime, String, BigDecimal, LocalDateTime>> i = sql.fetch()
.iterator();
while (i.hasNext()) {
Record7<Integer, String, String, LocalDateTime, String, BigDecimal, LocalDateTime> r = i.next();
String campname = String
.format("%s %s %d", r.get(T_CAMP.NAME), r.get(T_LOCATION.NAME), r.get(T_CAMP.ARRIVE).getYear()).trim();
OutlayBean bean = new OutlayBean();
bean.setId(r.get(T_SALES.PK));
bean.setTrader(r.get(T_SALES.TRADER));
bean.setCampname(campname);
bean.setCash(r.get(T_SALES.CASH));
bean.setBuydate(r.get(T_SALES.BUYDATE));
list.add(bean);
}
return list;
}
public void addBean(@Valid OutlayBean bean) {
InsertValuesStep8<TSalesRecord, LocalDateTime, BigDecimal, Integer, String, String, String, String, String> sql = jooq
// @formatter:off
.insertInto(T_SALES,
T_SALES.BUYDATE,
T_SALES.CASH,
T_SALES.FK_CAMP,
T_SALES.INCREDIENTS,
T_SALES.PROVIDER,
T_SALES.RECIPENOTE,
T_SALES.RECIPENUMBER,
T_SALES.TRADER)
.values(bean.getBuydate(), bean.getCash(), bean.getFkCamp(), bean.getIngredients(), bean.getProvider(), bean.getRecipenote(), bean.getRecipenumber(), bean.getTrader());
// @formatter:on
LOGGER.trace(sql);
sql.execute();
}
public void updateBean(@Valid OutlayBean bean) {
UpdateConditionStep<TSalesRecord> sql = jooq
// @formatter:off
.update(T_SALES)
.set(T_SALES.BUYDATE, bean.getBuydate())
.set(T_SALES.CASH, bean.getCash())
.set(T_SALES.FK_CAMP, bean.getFkCamp())
.set(T_SALES.INCREDIENTS, bean.getIngredients())
.set(T_SALES.PROVIDER, bean.getProvider())
.set(T_SALES.RECIPENOTE, bean.getRecipenote())
.set(T_SALES.RECIPENUMBER, bean.getRecipenumber())
.set(T_SALES.TRADER, bean.getTrader())
.where(T_SALES.PK.eq(bean.getId()));
// @formatter:on
LOGGER.trace(sql);
sql.execute();
}
public OutlayBean getBeanIfAllowedFor(String username, Integer id) {
SelectConditionStep<Record10<Integer, String, Integer, BigDecimal, LocalDateTime, String, String, String, String, String>> sql = jooq
// @formatter:off
.select(T_SALES.PK,
T_SALES.TRADER,
T_SALES.FK_CAMP,
T_SALES.CASH,
T_SALES.BUYDATE,
T_SALES.INCREDIENTS,
T_SALES.PROVIDER,
T_SALES.RECIPENOTE,
T_SALES.RECIPENUMBER,
T_SALES.TRADER)
.from(T_SALES)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_SALES.FK_CAMP))
.leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION))
.where(T_SALES.PROVIDER.eq(username))
.and(T_SALES.PK.eq(id));
// @formatter:on
LOGGER.trace(sql);
Record10<Integer, String, Integer, BigDecimal, LocalDateTime, String, String, String, String, String> r = sql
.fetchOne();
if (r == null) {
return null;
} else {
OutlayBean bean = new OutlayBean();
bean.setId(r.get(T_SALES.PK));
bean.setBuydate(r.get(T_SALES.BUYDATE));
bean.setCash(r.get(T_SALES.CASH));
bean.setFkCamp(r.get(T_SALES.FK_CAMP));
bean.setIngredients(r.get(T_SALES.INCREDIENTS));
bean.setProvider(r.get(T_SALES.PROVIDER));
bean.setRecipenote(r.get(T_SALES.RECIPENOTE));
bean.setRecipenumber(r.get(T_SALES.RECIPENUMBER));
bean.setTrader(r.get(T_SALES.TRADER));
return bean;
}
}
public void deleteBeanIfAllowedFor(String username, Integer id) {
DeleteConditionStep<TSalesRecord> sql = jooq
// @formatter:off
.deleteFrom(T_SALES)
.where(T_SALES.PROVIDER.eq(username))
.and(T_SALES.PK.eq(id));
// @formatter:off
LOGGER.trace(sql);
sql.execute();
}
}

View File

@ -0,0 +1,46 @@
package de.jottyfan.camporganizer.module.business.outlay;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.module.business.outlay.model.CampBean;
import de.jottyfan.camporganizer.module.business.outlay.model.OutlayBean;
import jakarta.validation.Valid;
/**
*
* @author jotty
*
*/
@Service
public class OutlayService {
@Autowired
private OutlayRepository repository;
public List<OutlayBean> getListOfUser(String username) {
return repository.getListOf(username);
}
public List<CampBean> getAllCamps() {
return repository.getAllCamps();
}
public void save(@Valid OutlayBean bean) {
if (bean.getId() != null) {
repository.updateBean(bean);
} else {
repository.addBean(bean);
}
}
public OutlayBean getBeanIfAllowedFor(String username, Integer id) {
return repository.getBeanIfAllowedFor(username, id);
}
public void deleteIfAllowedFor(String username, Integer id) {
repository.deleteBeanIfAllowedFor(username, id);
}
}

View File

@ -0,0 +1,51 @@
package de.jottyfan.camporganizer.module.business.outlay.model;
import java.io.Serializable;
/**
*
* @author jotty
*
*/
public class CampBean implements Serializable {
private static final long serialVersionUID = 1L;
private final Integer id;
private String campname;
private CampBean(Integer id) {
super();
this.id = id;
}
public static final CampBean of(Integer id) {
return new CampBean(id);
}
public CampBean withCampname(String campname) {
this.campname = campname;
return this;
}
/**
* @return the campname
*/
public String getCampname() {
return campname;
}
/**
* @param campname the campname to set
*/
public void setCampname(String campname) {
this.campname = campname;
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
}

View File

@ -0,0 +1,180 @@
package de.jottyfan.camporganizer.module.business.outlay.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
/**
*
* @author jotty
*
*/
public class OutlayBean implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
@NotBlank
private String trader;
@NotNull
private Integer fkCamp;
private String campname;
private String provider;
@NotNull
private BigDecimal cash;
@DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss")
private LocalDateTime buydate;
private String recipenumber;
private String recipenote;
private String ingredients;
public OutlayBean withUser(String provider) {
this.provider = provider;
return this;
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the trader
*/
public String getTrader() {
return trader;
}
/**
* @param trader the trader to set
*/
public void setTrader(String trader) {
this.trader = trader;
}
/**
* @return the campname
*/
public String getCampname() {
return campname;
}
/**
* @param campname the campname to set
*/
public void setCampname(String campname) {
this.campname = campname;
}
/**
* @return the cash
*/
public BigDecimal getCash() {
return cash;
}
/**
* @param cash the cash to set
*/
public void setCash(BigDecimal cash) {
this.cash = cash;
}
/**
* @return the buydate
*/
public LocalDateTime getBuydate() {
return buydate;
}
/**
* @param buydate the buydate to set
*/
public void setBuydate(LocalDateTime buydate) {
this.buydate = buydate;
}
/**
* @return the provider
*/
public String getProvider() {
return provider;
}
/**
* @param provider the provider to set
*/
public void setProvider(String provider) {
this.provider = provider;
}
/**
* @return the recipenumber
*/
public String getRecipenumber() {
return recipenumber;
}
/**
* @param recipenumber the recipenumber to set
*/
public void setRecipenumber(String recipenumber) {
this.recipenumber = recipenumber;
}
/**
* @return the recipenote
*/
public String getRecipenote() {
return recipenote;
}
/**
* @param recipenote the recipenote to set
*/
public void setRecipenote(String recipenote) {
this.recipenote = recipenote;
}
/**
* @return the ingredients
*/
public String getIngredients() {
return ingredients;
}
/**
* @param ingredients the ingredients to set
*/
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
/**
* @return the fkCamp
*/
public Integer getFkCamp() {
return fkCamp;
}
/**
* @param fkCamp the fkCamp to set
*/
public void setFkCamp(Integer fkCamp) {
this.fkCamp = fkCamp;
}
}

View File

@ -0,0 +1,64 @@
package de.jottyfan.camporganizer.module.business.privileges;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.module.business.privileges.model.BusinessPrivilegesBean;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.annotation.security.RolesAllowed;
import jakarta.validation.Valid;
/**
*
* @author jotty
*
*/
@Controller
public class BusinessPrivilegesController extends CommonController {
@Autowired
private BusinessPrivilegesService service;
@GetMapping("/business/privileges")
@RolesAllowed({ "admin" })
public String getIndex(Model model) {
String username = super.getCurrentUser();
model.addAttribute("currentUser", username);
model.addAttribute("privileges", service.getPrivileges());
model.addAttribute("profiles", service.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
model.addAttribute("bean", new BusinessPrivilegesBean());
return "business/privileges";
}
@PostMapping("/business/privileges/add")
@RolesAllowed({ "admin" })
public String getAdd(@Valid @ModelAttribute("bean") BusinessPrivilegesBean bean, BindingResult br, Model model) {
if (br.hasErrors()) {
String username = super.getCurrentUser();
model.addAttribute("currentUser", username);
model.addAttribute("privileges", service.getPrivileges());
model.addAttribute("profiles", service.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
return "business/privileges";
}
service.add(bean);
return "redirect:/business/privileges";
}
@GetMapping("/business/privileges/delete")
@RolesAllowed({ "admin" })
public String getDelete(@RequestParam("fkCamp") Integer fkCamp, @RequestParam("fkProfile") Integer fkProfile,
Model model) {
BusinessPrivilegesBean bean = new BusinessPrivilegesBean();
bean.setFkCamp(fkCamp);
bean.setFkProfile(fkProfile);
service.remove(bean, super.getCurrentUser());
return "redirect:/business/privileges";
}
}

View File

@ -1,8 +1,8 @@
package de.jottyfan.camporganizer.module.business.privileges; package de.jottyfan.camporganizer.module.business.privileges;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP; import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -23,8 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.tables.records.TSalesprofileRecord; import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean; import de.jottyfan.camporganizer.db.jooq.tables.records.TCampprofileRecord;
import de.jottyfan.camporganizer.module.business.privileges.model.BusinessPrivilegesBean;
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean; import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
/** /**
@ -34,25 +35,25 @@ import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
*/ */
@Repository @Repository
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public class PrivilegesRepository { public class BusinessPrivilegesRepository {
private static final Logger LOGGER = LogManager.getLogger(PrivilegesRepository.class); private static final Logger LOGGER = LogManager.getLogger(BusinessPrivilegesRepository.class);
@Autowired @Autowired
private DSLContext jooq; private DSLContext jooq;
public List<PrivilegesBean> getPrivileges() { public List<BusinessPrivilegesBean> getPrivileges() {
SelectSeekStep3<Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double>, LocalDateTime, String, String> sql = jooq SelectSeekStep3<Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double>, LocalDateTime, String, String> sql = jooq
// @formatter:off // @formatter:off
.select(T_PROFILE.FORENAME, T_PROFILE.SURNAME, T_PROFILE.DUEDATE, T_PROFILE.USERNAME, T_PROFILE.PK, V_CAMP.PK, V_CAMP.NAME, V_CAMP.YEAR) .select(T_PROFILE.FORENAME, T_PROFILE.SURNAME, T_PROFILE.DUEDATE, T_PROFILE.USERNAME, T_PROFILE.PK, V_CAMP.PK, V_CAMP.NAME, V_CAMP.YEAR)
.from(V_CAMP) .from(V_CAMP)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP.PK)) .leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(V_CAMP.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.orderBy(V_CAMP.ARRIVE, T_PROFILE.SURNAME, T_PROFILE.FORENAME); .orderBy(V_CAMP.ARRIVE, T_PROFILE.SURNAME, T_PROFILE.FORENAME);
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<PrivilegesBean> list = new ArrayList<>(); List<BusinessPrivilegesBean> list = new ArrayList<>();
for (Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double> r : sql.fetch()) { for (Record8<String, String, LocalDateTime, String, Integer, Integer, String, Double> r : sql.fetch()) {
PrivilegesBean bean = new PrivilegesBean(); BusinessPrivilegesBean bean = new BusinessPrivilegesBean();
bean.setCampName(r.get(V_CAMP.NAME)); bean.setCampName(r.get(V_CAMP.NAME));
bean.setCampYear(r.get(V_CAMP.YEAR)); bean.setCampYear(r.get(V_CAMP.YEAR));
bean.setFkCamp(r.get(V_CAMP.PK)); bean.setFkCamp(r.get(V_CAMP.PK));
@ -93,25 +94,26 @@ public class PrivilegesRepository {
return list; return list;
} }
public Integer add(PrivilegesBean bean) { public Integer add(BusinessPrivilegesBean bean) {
InsertReturningStep<TSalesprofileRecord> sql = jooq InsertReturningStep<TCampprofileRecord> sql = jooq
// @formatter:off // @formatter:off
.insertInto(T_SALESPROFILE, T_SALESPROFILE.FK_CAMP, T_SALESPROFILE.FK_PROFILE) .insertInto(T_CAMPPROFILE, T_CAMPPROFILE.FK_CAMP, T_CAMPPROFILE.FK_PROFILE, T_CAMPPROFILE.MODULE)
.values(bean.getFkCamp(), bean.getFkProfile()) .values(bean.getFkCamp(), bean.getFkProfile(), EnumModule.business)
.onConflict(T_SALESPROFILE.FK_CAMP, T_SALESPROFILE.FK_PROFILE) .onConflict(T_CAMPPROFILE.FK_CAMP, T_CAMPPROFILE.FK_PROFILE, T_CAMPPROFILE.MODULE)
.doNothing(); .doNothing();
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
return sql.execute(); return sql.execute();
} }
public Integer remove(PrivilegesBean bean, String currentUser) { public Integer remove(BusinessPrivilegesBean bean, String currentUser) {
DeleteConditionStep<TSalesprofileRecord> sql = jooq DeleteConditionStep<TCampprofileRecord> sql = jooq
// @formatter:off // @formatter:off
.deleteFrom(T_SALESPROFILE) .deleteFrom(T_CAMPPROFILE)
.where(T_SALESPROFILE.FK_CAMP.eq(bean.getFkCamp())) .where(T_CAMPPROFILE.MODULE.eq(EnumModule.business))
.and(T_SALESPROFILE.FK_PROFILE.eq(bean.getFkProfile())) .and(T_CAMPPROFILE.FK_CAMP.eq(bean.getFkCamp()))
.and(T_SALESPROFILE.FK_PROFILE.notIn(jooq .and(T_CAMPPROFILE.FK_PROFILE.eq(bean.getFkProfile()))
.and(T_CAMPPROFILE.FK_PROFILE.notIn(jooq
.select(T_PROFILE.PK) .select(T_PROFILE.PK)
.from(T_PROFILE) .from(T_PROFILE)
.where(T_PROFILE.USERNAME.eq(currentUser)))); .where(T_PROFILE.USERNAME.eq(currentUser))));

View File

@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.module.business.camp.model.CampBean; import de.jottyfan.camporganizer.module.business.camp.model.CampBean;
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean; import de.jottyfan.camporganizer.module.business.privileges.model.BusinessPrivilegesBean;
import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean; import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
/** /**
@ -20,14 +20,14 @@ import de.jottyfan.camporganizer.module.business.privileges.model.ProfileBean;
* *
*/ */
@Service @Service
public class PrivilegesService { public class BusinessPrivilegesService {
@Autowired @Autowired
private PrivilegesRepository gateway; private BusinessPrivilegesRepository gateway;
public Map<Integer, CampBean> getPrivileges() { public Map<Integer, CampBean> getPrivileges() {
List<PrivilegesBean> list = gateway.getPrivileges(); List<BusinessPrivilegesBean> list = gateway.getPrivileges();
Map<Integer, CampBean> camps = new HashMap<>(); Map<Integer, CampBean> camps = new HashMap<>();
for (PrivilegesBean bean : list) { for (BusinessPrivilegesBean bean : list) {
CampBean campBean = camps.get(bean.getFkCamp()); CampBean campBean = camps.get(bean.getFkCamp());
if (campBean == null) { if (campBean == null) {
campBean = new CampBean(); campBean = new CampBean();
@ -55,11 +55,11 @@ public class PrivilegesService {
return gateway.getProfiles(allowed == null ? null : set); return gateway.getProfiles(allowed == null ? null : set);
} }
public void add(PrivilegesBean bean) { public void add(BusinessPrivilegesBean bean) {
gateway.add(bean); gateway.add(bean);
} }
public void remove(PrivilegesBean bean, String currentUser) { public void remove(BusinessPrivilegesBean bean, String currentUser) {
gateway.remove(bean, currentUser); gateway.remove(bean, currentUser);
} }
} }

View File

@ -1,55 +0,0 @@
package de.jottyfan.camporganizer.module.business.privileges;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.module.business.privileges.model.PrivilegesBean;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.annotation.security.RolesAllowed;
import jakarta.websocket.server.PathParam;
/**
*
* @author jotty
*
*/
@Controller
public class PrivilegesController extends CommonController {
@Autowired
private PrivilegesService privilegesService;
@GetMapping("/business/privileges")
@RolesAllowed({ "admin" })
public String getIndex(Model model) {
String username = super.getCurrentUser();
model.addAttribute("currentUser", username);
model.addAttribute("privileges", privilegesService.getPrivileges());
model.addAttribute("profiles", privilegesService.getProfiles(EnumCamprole.director, EnumCamprole.teacher));
model.addAttribute("bean", new PrivilegesBean());
return "business/privileges";
}
@PostMapping("/business/privileges/add")
@RolesAllowed({ "admin" })
public String getAdd(@ModelAttribute PrivilegesBean bean, Model model) {
privilegesService.add(bean);
return getIndex(model);
}
@GetMapping("/business/privileges/delete")
@RolesAllowed({ "admin" })
public String getDelete(@PathParam(value = "fkCamp") Integer fkCamp,
@PathParam(value = "fkProfile") Integer fkProfile, Model model) {
PrivilegesBean bean = new PrivilegesBean();
bean.setFkCamp(fkCamp);
bean.setFkProfile(fkProfile);
privilegesService.remove(bean, super.getCurrentUser());
return getIndex(model);
}
}

View File

@ -3,19 +3,23 @@ package de.jottyfan.camporganizer.module.business.privileges.model;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import jakarta.validation.constraints.NotNull;
/** /**
* *
* @author jotty * @author jotty
* *
*/ */
public class PrivilegesBean implements Serializable { public class BusinessPrivilegesBean implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String forename; private String forename;
private String surname; private String surname;
private String username; private String username;
private LocalDateTime duedate; private LocalDateTime duedate;
@NotNull
private Integer fkProfile; private Integer fkProfile;
@NotNull
private Integer fkCamp; private Integer fkCamp;
private String campName; private String campName;
private Double campYear; private Double campYear;

View File

@ -42,7 +42,7 @@ public class CamplistController extends CommonController {
} }
@PostMapping("/dashboard/update") @PostMapping("/dashboard/update")
public String updateBooking(Model model, @ModelAttribute BookingBean bean) { public String updateBooking(Model model, @ModelAttribute("b") BookingBean bean) {
service.update(bean); service.update(bean);
return dashboard(model); return dashboard(model);
} }

View File

@ -12,6 +12,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -45,8 +46,8 @@ import de.jottyfan.camporganizer.module.camplist.model.DocumentBean;
*/ */
@Repository @Repository
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public class CamplistGateway { public class CamplistRepository {
private static final Logger LOGGER = LogManager.getLogger(CamplistGateway.class); private static final Logger LOGGER = LogManager.getLogger(CamplistRepository.class);
@Autowired @Autowired
private DSLContext jooq; private DSLContext jooq;
@ -100,7 +101,9 @@ public class CamplistGateway {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<BookingBean> list = new ArrayList<>(); List<BookingBean> list = new ArrayList<>();
for (Record r : sql.fetch()) { Iterator<Record> i = sql.fetch().iterator();
while (i.hasNext()) {
Record r = i.next();
Integer fkCamp = r.get(T_PERSON.FK_CAMP); Integer fkCamp = r.get(T_PERSON.FK_CAMP);
BookingBean bean = new BookingBean(); BookingBean bean = new BookingBean();
bean.setPk(r.get(T_PERSON.PK)); bean.setPk(r.get(T_PERSON.PK));
@ -184,7 +187,9 @@ public class CamplistGateway {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
Map<Integer, String> map = new HashMap<>(); // no duplicate on using a map Map<Integer, String> map = new HashMap<>(); // no duplicate on using a map
for (Record r : sql.fetch()) { Iterator<Record2<String, Integer>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record2<String, Integer> r = i.next();
map.put(r.get(T_DOCUMENT.PK), r.get(T_DOCUMENT.NAME)); map.put(r.get(T_DOCUMENT.PK), r.get(T_DOCUMENT.NAME));
} }
List<DocumentBean> list = new ArrayList<>(); List<DocumentBean> list = new ArrayList<>();

View File

@ -25,7 +25,7 @@ import de.jottyfan.camporganizer.module.dashboard.DashboardRepository;
public class CamplistService { public class CamplistService {
@Autowired @Autowired
private CamplistGateway gateway; private CamplistRepository gateway;
@Autowired @Autowired
private DashboardRepository dashboardGateway; private DashboardRepository dashboardGateway;

View File

@ -75,6 +75,11 @@ public abstract class CommonController {
return keycloak.getUserClientUrl(); return keycloak.getUserClientUrl();
} }
@ModelAttribute("keycloakPasswordUrl")
public String getKeycloakPasswordUrl() {
return keycloak.getPasswordClientUrl();
}
/** /**
* return true if the user has a valid keycloak session token * return true if the user has a valid keycloak session token
* *

View File

@ -0,0 +1,52 @@
package de.jottyfan.camporganizer.module.confirmation.board;
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.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.servlet.http.HttpServletResponse;
/**
*
* @author jotty
*
*/
@Controller
public class ConfirmationBoardController extends CommonController {
@Autowired
private ConfirmationBoardService service;
@GetMapping("/confirmation/board")
public String getBoard(Model model, Principal principal) {
model.addAttribute("camps", service.loadCampList(super.getCurrentUser(principal)));
return "/confirmation/board";
}
@GetMapping("/confirmation/board/camp/{id}")
public String getCamplist(Model model, @PathVariable("id") Integer id, Principal principal) {
model.addAttribute("campId", id);
model.addAttribute("campStartDate", service.getCampStartDate(super.getCurrentUser(principal), id));
model.addAttribute("persons", service.loadPersonList(super.getCurrentUser(principal), id));
return "/confirmation/camplist";
}
@GetMapping("/confirmation/board/download/{id}")
public void getCsvOfAll(@PathVariable("id") Integer id, Principal principal, HttpServletResponse response)
throws IOException {
response.setContentType("text/csv");
String filename = String.format("camplist_%d_%s.csv", id,
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")));
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
response.getWriter().write(service.getDownloadCsvOfAll(super.getCurrentUser(principal), id));
response.flushBuffer();
}
}

View File

@ -0,0 +1,140 @@
package de.jottyfan.camporganizer.module.confirmation.board;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Record2;
import org.jooq.Record6;
import org.jooq.SelectConditionStep;
import org.jooq.SelectSeekStep1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.module.confirmation.board.model.CampBean;
import de.jottyfan.camporganizer.module.confirmation.board.model.PersonBean;
import de.jottyfan.camporganizer.module.confirmation.confirmation.ConfirmationRepository;
/**
*
* @author jotty
*
*/
@Repository
public class ConfirmationBoardRepository {
private static final Logger LOGGER = LogManager.getLogger(ConfirmationRepository.class);
@Autowired
private DSLContext jooq;
/**
* get a list of camps that the user has access to
*
* @param username the username
* @return the list of camps; might be an empty list
*/
public List<CampBean> getCamps(String username) {
SelectSeekStep1<Record6<String, Double, Boolean, String, Integer, LocalDateTime>, LocalDateTime> sql = jooq
// @formatter:off
.select(V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.IS_OVER, V_CAMP.LOCATION_NAME, V_CAMP.PK, V_CAMP.ARRIVE)
.from(T_PROFILE)
.leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_PROFILE.eq(T_PROFILE.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_CAMPPROFILE.FK_CAMP))
.where(T_PROFILE.USERNAME.eq(username))
.orderBy(V_CAMP.ARRIVE);
// @formatter:on
LOGGER.trace(sql);
List<CampBean> list = new ArrayList<>();
Iterator<Record6<String, Double, Boolean, String, Integer, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record6<String, Double, Boolean, String, Integer, LocalDateTime> r = i.next();
CampBean bean = new CampBean();
bean.setPkCamp(r.get(V_CAMP.PK));
bean.setName(r.get(V_CAMP.NAME));
bean.setYear(r.get(V_CAMP.YEAR));
bean.setLocationName(r.get(V_CAMP.LOCATION_NAME));
bean.setIsOver(r.get(V_CAMP.IS_OVER));
list.add(bean);
}
return list;
}
/**
* get the list of persons for this camp; restrict by the user privilege
*
* @param username the user that needs access to this data
* @param campId the ID of the camp
* @return the list of persons; an empty list at least
*/
public List<PersonBean> getPersons(String username, Integer campId) {
SelectConditionStep<Record> sql = jooq
// @formatter:off
.select(T_PERSON.fields())
.from(T_PERSON)
.innerJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
.innerJoin(T_PROFILE).on(T_PROFILE.USERNAME.eq(username)).and(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_PERSON.FK_CAMP.eq(campId));
// @formatter:on
LOGGER.trace(sql);
List<PersonBean> list = new ArrayList<>();
Iterator<Record> i = sql.fetch().iterator();
while (i.hasNext()) {
Record r = i.next();
PersonBean bean = new PersonBean();
bean.setAccept(r.get(T_PERSON.ACCEPT));
bean.setBirthDate(r.get(T_PERSON.BIRTHDATE));
bean.setCamprole(r.get(T_PERSON.CAMPROLE) == null ? null : r.get(T_PERSON.CAMPROLE).getLiteral());
bean.setCity(r.get(T_PERSON.CITY));
bean.setComment(r.get(T_PERSON.COMMENT));
bean.setConsentCatalogPhoto(r.get(T_PERSON.CONSENT_CATALOG_PHOTO));
bean.setCreated(r.get(T_PERSON.CREATED));
bean.setEmail(r.get(T_PERSON.EMAIL));
bean.setForename(r.get(T_PERSON.FORENAME));
bean.setPaid(r.get(T_PERSON.PAID) == null ? null : r.get(T_PERSON.PAID).doubleValue());
bean.setPhone(r.get(T_PERSON.PHONE));
bean.setSex(r.get(T_PERSON.SEX) == null ? null : (r.get(T_PERSON.SEX).equals(EnumSex.male) ? "männlich" : "weiblich"));
bean.setStreet(r.get(T_PERSON.STREET));
bean.setSurname(r.get(T_PERSON.SURNAME));
bean.setZip(r.get(T_PERSON.ZIP));
list.add(bean);
}
return list;
}
/**
* get the camp start date of campId if username is allowed to
*
* @param username the user
* @param campId the ID of the camp
* @return the camp start time or null
*/
public LocalDateTime getCampStartDate(String username, Integer campId) {
SelectConditionStep<Record2<String, LocalDateTime>> sql = jooq
// @formatter:off
.select(V_CAMP.NAME, V_CAMP.ARRIVE)
.from(T_PROFILE)
.leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_PROFILE.eq(T_PROFILE.PK)).and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_CAMPPROFILE.FK_CAMP))
.where(T_PROFILE.USERNAME.eq(username))
.and(V_CAMP.PK.eq(campId));
// @formatter:on
LOGGER.trace(sql);
Iterator<Record2<String, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
return i.next().get(V_CAMP.ARRIVE);
}
return null;
}
}

View File

@ -0,0 +1,41 @@
package de.jottyfan.camporganizer.module.confirmation.board;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.module.confirmation.board.model.CampBean;
import de.jottyfan.camporganizer.module.confirmation.board.model.PersonBean;
/**
*
* @author jotty
*
*/
@Service
public class ConfirmationBoardService {
@Autowired
private ConfirmationBoardRepository repository;
@Autowired
private List2CSVService csvService;
public List<CampBean> loadCampList(String username) {
return repository.getCamps(username);
}
public List<PersonBean> loadPersonList(String username, Integer campId) {
return repository.getPersons(username, campId);
}
public String getDownloadCsvOfAll(String username, Integer campId) {
List<PersonBean> list = repository.getPersons(username, campId);
return csvService.toCsv(list);
}
public Object getCampStartDate(String username, Integer campId) {
return repository.getCampStartDate(username, campId);
}
}

View File

@ -0,0 +1,73 @@
package de.jottyfan.camporganizer.module.confirmation.board;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Formatter;
import java.util.List;
import java.util.Locale;
import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.module.confirmation.board.model.PersonBean;
/**
*
* @author jotty
*
*/
@Service
public class List2CSVService {
private static final String QUOTE = "\"";
private static final String SEP = ";";
private StringBuilder append(StringBuilder buf, String s) {
return buf.append(s == null || s.isEmpty() ? SEP : String.format("%s%s%s%s", QUOTE, s, QUOTE, SEP));
}
private StringBuilder append(StringBuilder buf, Double d) {
return buf.append(d == null ? SEP : new Formatter(Locale.GERMAN).format("%.2f%s", d, SEP));
}
private StringBuilder append(StringBuilder buf, Boolean b) {
return buf.append(b == null ? SEP : String.format("%s%s%s%s", QUOTE, b ? "ja" : "nein", QUOTE, SEP));
}
private StringBuilder append(StringBuilder buf, LocalDateTime l) {
return buf.append(l == null ? SEP
: String.format("%s%s%s%s", QUOTE, l.format(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")), QUOTE, SEP));
}
private StringBuilder append(StringBuilder buf, LocalDate l) {
return buf.append(l == null ? SEP
: String.format("%s%s%s%s", QUOTE, l.format(DateTimeFormatter.ofPattern("dd.MM.yyyy")), QUOTE, SEP));
}
public String toCsv(List<PersonBean> list) {
StringBuilder buf = new StringBuilder();
String title = String.format(
"Bezahlt%sVorname%sNachname%sStrasse%sPLZ%sOrt%sTelefon%sEmail%sGeschlecht%sRolle%sGeburtsdatum%sAnmeldestatus%sAnmeldedatum%sFotoeinverständnis%sKommentar\n",
SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP);
buf.append(title);
for (PersonBean bean : list) {
append(buf, bean.getPaid());
append(buf, bean.getForename());
append(buf, bean.getSurname());
append(buf, bean.getStreet());
append(buf, bean.getZip());
append(buf, bean.getCity());
append(buf, bean.getPhone());
append(buf, bean.getEmail());
append(buf, bean.getSex());
append(buf, bean.getCamprolle());
append(buf, bean.getBirthDate());
append(buf, bean.getAccept());
append(buf, bean.getCreated());
append(buf, bean.getConsentCatalogPhoto());
append(buf, bean.getComment());
buf.append("\n");
}
return buf.toString();
}
}

View File

@ -0,0 +1,91 @@
package de.jottyfan.camporganizer.module.confirmation.board.model;
import java.io.Serializable;
/**
*
* @author jotty
*
*/
public class CampBean implements Serializable {
private static final long serialVersionUID = 1L;
private Integer pkCamp;
private String name;
private Double year;
private String locationName;
private Boolean isOver;
public String getTitle() {
return String.format("%s %4.0f", name, year);
}
/**
* @return the pkCamp
*/
public Integer getPkCamp() {
return pkCamp;
}
/**
* @param pkCamp the pkCamp to set
*/
public void setPkCamp(Integer pkCamp) {
this.pkCamp = pkCamp;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the year
*/
public Double getYear() {
return year;
}
/**
* @param year the year to set
*/
public void setYear(Double year) {
this.year = year;
}
/**
* @return the locationName
*/
public String getLocationName() {
return locationName;
}
/**
* @param locationName the locationName to set
*/
public void setLocationName(String locationName) {
this.locationName = locationName;
}
/**
* @return the isOver
*/
public Boolean getIsOver() {
return isOver;
}
/**
* @param isOver the isOver to set
*/
public void setIsOver(Boolean isOver) {
this.isOver = isOver;
}
}

View File

@ -0,0 +1,267 @@
package de.jottyfan.camporganizer.module.confirmation.board.model;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
/**
*
* @author jotty
*
*/
public class PersonBean implements Serializable {
private static final long serialVersionUID = 1L;
private String forename;
private String surname;
private String street;
private String zip;
private String city;
private String phone;
private String email;
private LocalDate birthDate;
private String camprole;
private Boolean accept;
private LocalDateTime created;
private String sex;
private Double paid;
private String comment;
private Boolean consentCatalogPhoto;
public String getAge(LocalDate relation) {
if (relation == null) {
return "?";
} else {
Period period = Period.between(birthDate, relation);
Integer years = period == null ? null : period.getYears();
return years == null ? "?" : years.toString();
}
}
public String getCamprolle() {
if ("student".equals(camprole)) {
return "Teilnehmer";
} else if ("teacher".equals(camprole)) {
return "Mitarbeiter";
} else if ("director".equals(camprole)) {
return "Leitung";
} else if ("feeder".equals(camprole)) {
return "Küche";
} else if ("observer".equals(camprole)) {
return "Mitarbeiterkind";
} else {
return null;
}
}
/**
* @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 street
*/
public String getStreet() {
return street;
}
/**
* @param street the street to set
*/
public void setStreet(String street) {
this.street = street;
}
/**
* @return the zip
*/
public String getZip() {
return zip;
}
/**
* @param zip the zip to set
*/
public void setZip(String zip) {
this.zip = zip;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
/**
* @return the phone
*/
public String getPhone() {
return phone;
}
/**
* @param phone the phone to set
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the birthDate
*/
public LocalDate getBirthDate() {
return birthDate;
}
/**
* @param birthDate the birthDate to set
*/
public void setBirthDate(LocalDate birthDate) {
this.birthDate = birthDate;
}
/**
* @return the camprole
*/
public String getCamprole() {
return camprole;
}
/**
* @param camprole the camprole to set
*/
public void setCamprole(String camprole) {
this.camprole = camprole;
}
/**
* @return the accept
*/
public Boolean getAccept() {
return accept;
}
/**
* @param accept the accept to set
*/
public void setAccept(Boolean accept) {
this.accept = accept;
}
/**
* @return the created
*/
public LocalDateTime getCreated() {
return created;
}
/**
* @param created the created to set
*/
public void setCreated(LocalDateTime created) {
this.created = created;
}
/**
* @return the sex
*/
public String getSex() {
return sex;
}
/**
* @param sex the sex to set
*/
public void setSex(String sex) {
this.sex = sex;
}
/**
* @return the paid
*/
public Double getPaid() {
return paid;
}
/**
* @param paid the paid to set
*/
public void setPaid(Double paid) {
this.paid = paid;
}
/**
* @return the comment
*/
public String getComment() {
return comment;
}
/**
* @param comment the comment to set
*/
public void setComment(String comment) {
this.comment = comment;
}
/**
* @return the consentCatalogPhoto
*/
public Boolean getConsentCatalogPhoto() {
return consentCatalogPhoto;
}
/**
* @param consentCatalogPhoto the consentCatalogPhoto to set
*/
public void setConsentCatalogPhoto(Boolean consentCatalogPhoto) {
this.consentCatalogPhoto = consentCatalogPhoto;
}
}

View File

@ -10,6 +10,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -71,7 +72,9 @@ public class ConfirmationRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
Map<LocalDateTime, CampOverviewBean> map = new HashMap<>(); Map<LocalDateTime, CampOverviewBean> map = new HashMap<>();
for (Record4<Integer, Boolean, String, LocalDateTime> r : sql.fetch()) { Iterator<Record4<Integer, Boolean, String, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, Boolean, String, LocalDateTime> r = i.next();
Integer count = r.get(COUNT, Integer.class); Integer count = r.get(COUNT, Integer.class);
Boolean accept = r.get(T_PERSON.ACCEPT); Boolean accept = r.get(T_PERSON.ACCEPT);
String campname = r.get(T_CAMP.NAME); String campname = r.get(T_CAMP.NAME);
@ -116,7 +119,9 @@ public class ConfirmationRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<BookingBean> list = new ArrayList<>(); List<BookingBean> list = new ArrayList<>();
for (Record7<Integer, String, String, String, LocalDateTime, EnumCamprole, LocalDateTime> r : sql.fetch()) { Iterator<Record7<Integer, String, String, String, LocalDateTime, EnumCamprole, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record7<Integer, String, String, String, LocalDateTime, EnumCamprole, LocalDateTime> r = i.next();
String forename = r.get(T_PERSON.FORENAME); String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME); String surname = r.get(T_PERSON.SURNAME);
String campname = r.get(T_CAMP.NAME); String campname = r.get(T_CAMP.NAME);
@ -192,7 +197,9 @@ public class ConfirmationRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<BookingBean> list = new ArrayList<>(); List<BookingBean> list = new ArrayList<>();
for (Record8<Integer, String, String, EnumCamprole, String, Double, String, Boolean> r : sql.fetch()) { Iterator<Record8<Integer, String, String, EnumCamprole, String, Double, String, Boolean>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record8<Integer, String, String, EnumCamprole, String, Double, String, Boolean> r = i.next();
Integer pkPerson = r.get(T_PERSON.PK); Integer pkPerson = r.get(T_PERSON.PK);
String forename = r.get(T_PERSON.FORENAME); String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME); String surname = r.get(T_PERSON.SURNAME);

View File

@ -2,10 +2,6 @@ package de.jottyfan.camporganizer.module.confirmation.confirmation;
import java.util.List; import java.util.List;
import jakarta.servlet.http.HttpServletRequest;
import org.jooq.exception.DataAccessException;
import org.keycloak.KeycloakSecurityContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@ -4,11 +4,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.websocket.server.PathParam;
/** /**
* *
@ -26,7 +26,7 @@ public class SearchController extends CommonController {
@GetMapping("/confirmation/search") @GetMapping("/confirmation/search")
@ResponseBody @ResponseBody
public String search(@PathParam(value = "needle") String needle, Model model) { public String search(@RequestParam("needle") String needle, Model model) {
return service.search(needle, request.getRequestURI().replace("search", "person"), super.getCurrentUser()); return service.search(needle, request.getRequestURI().replace("search", "person"), super.getCurrentUser());
} }
} }

View File

@ -3,15 +3,15 @@ package de.jottyfan.camporganizer.module.confirmation.person;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.camplist.CommonController;
import de.jottyfan.camporganizer.module.confirmation.confirmation.ConfirmationService;
import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean; import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean;
import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid;
/** /**
* *
@ -25,18 +25,26 @@ public class PersonController extends CommonController {
private PersonService personService; private PersonService personService;
@GetMapping("/confirmation/person/{pk}") @GetMapping("/confirmation/person/{pk}")
public String getIndex(Model model, @PathVariable Integer pk) { public String getIndex(Model model, @PathVariable("pk") Integer pk) {
String username = super.getCurrentUser(); String username = super.getCurrentUser();
model.addAttribute("currentUser", username); model.addAttribute("currentUser", username);
model.addAttribute("person", personService.getPerson(username, pk)); model.addAttribute("person", personService.getPerson(username, pk));
model.addAttribute("camps", personService.getCamps(username)); model.addAttribute("camps", personService.getCamps(username));
model.addAttribute("annotations", personService.getAnnotations(pk)); model.addAttribute("annotations", personService.getAnnotations(pk));
model.addAttribute("campPrice", personService.getCampPrice(pk));
return "confirmation/person"; return "confirmation/person";
} }
@PostMapping("/confirmation/person/update") @PostMapping("/confirmation/person/update")
public String doUpdate(@ModelAttribute PersonBean bean, Model model) { public String doUpdate(@Valid @ModelAttribute("person") PersonBean bean, BindingResult bindingResult, Model model) {
String username = super.getCurrentUser(); String username = super.getCurrentUser();
if (bindingResult.hasErrors()) {
model.addAttribute("currentUser", username);
model.addAttribute("camps", personService.getCamps(username));
model.addAttribute("annotations", personService.getAnnotations(bean.getPk()));
model.addAttribute("campPrice", personService.getCampPrice(bean.getPk()));
return "confirmation/person";
}
personService.updatePerson(bean, username); personService.updatePerson(bean, username);
return "redirect:/confirmation"; return "redirect:/confirmation";
} }

View File

@ -12,6 +12,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -19,6 +20,7 @@ import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext; import org.jooq.DSLContext;
import org.jooq.InsertValuesStep2; import org.jooq.InsertValuesStep2;
import org.jooq.Record; import org.jooq.Record;
import org.jooq.Record1;
import org.jooq.Record11; import org.jooq.Record11;
import org.jooq.Record4; import org.jooq.Record4;
import org.jooq.SelectConditionStep; import org.jooq.SelectConditionStep;
@ -78,7 +80,9 @@ public class PersonRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
List<CampBean> list = new ArrayList<>(); List<CampBean> list = new ArrayList<>();
for (Record r : sql.fetch()) { Iterator<Record4<Integer, String, LocalDateTime, String>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, LocalDateTime, String> r = i.next();
CampBean bean = new CampBean(); CampBean bean = new CampBean();
bean.setPk(r.get(T_CAMP.PK)); bean.setPk(r.get(T_CAMP.PK));
bean.setName(r.get(T_CAMP.NAME)); bean.setName(r.get(T_CAMP.NAME));
@ -109,7 +113,9 @@ public class PersonRepository {
.and(T_PROFILE.USERNAME.eq(username)); .and(T_PROFILE.USERNAME.eq(username));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
for (Record r : sql.fetch()) { Iterator<Record> i = sql.fetch().iterator();
while (i.hasNext()) {
Record r = i.next();
PersonBean bean = new PersonBean(); PersonBean bean = new PersonBean();
bean.setPk(pk); bean.setPk(pk);
bean.setAccept(r.get(T_PERSON.ACCEPT)); bean.setAccept(r.get(T_PERSON.ACCEPT));
@ -128,6 +134,7 @@ public class PersonRepository {
bean.setSex(r.get(T_PERSON.SEX)); bean.setSex(r.get(T_PERSON.SEX));
bean.setStreet(r.get(T_PERSON.STREET)); bean.setStreet(r.get(T_PERSON.STREET));
bean.setZip(r.get(T_PERSON.ZIP)); bean.setZip(r.get(T_PERSON.ZIP));
bean.setRequiredPrice(r.get(T_PERSON.REQUIRED_PRICE));
return bean; return bean;
} }
return null; return null;
@ -182,6 +189,7 @@ public class PersonRepository {
.set(T_PERSON.ACCEPT, bean.getAccept()) .set(T_PERSON.ACCEPT, bean.getAccept())
.set(T_PERSON.CAMPROLE, bean.getCamprole()) .set(T_PERSON.CAMPROLE, bean.getCamprole())
.set(T_PERSON.FK_REGISTRATOR, fkRegistrator) .set(T_PERSON.FK_REGISTRATOR, fkRegistrator)
.set(T_PERSON.REQUIRED_PRICE, bean.getRequiredPrice())
.where(T_PERSON.PK.eq(bean.getPk())); .where(T_PERSON.PK.eq(bean.getPk()));
// @formatter:on // @formatter:on
LOGGER.debug(sql3.toString()); LOGGER.debug(sql3.toString());
@ -295,7 +303,11 @@ public class PersonRepository {
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
for (Record r : sql.fetch()) { Iterator<Record11<LocalDate, LocalDateTime, EnumCamprole, LocalDateTime, LocalDateTime, Integer, Integer, String, String, String, String>> i = sql
.fetch().iterator();
while (i.hasNext()) {
Record11<LocalDate, LocalDateTime, EnumCamprole, LocalDateTime, LocalDateTime, Integer, Integer, String, String, String, String> r = i
.next();
LocalDate birthdate = r.get(T_PERSON.BIRTHDATE); LocalDate birthdate = r.get(T_PERSON.BIRTHDATE);
LocalDateTime arrive = r.get(T_CAMP.ARRIVE); LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
LocalDateTime depart = r.get(T_CAMP.DEPART); LocalDateTime depart = r.get(T_CAMP.DEPART);
@ -332,4 +344,22 @@ public class PersonRepository {
} }
return buf.toString(); return buf.toString();
} }
/**
* get the price information of the camp that the person is registered for
*
* @param pkPerson the ID of the person
* @return the camp price information
*/
public String getCampprice(Integer pkPerson) {
SelectConditionStep<Record1<String>> sql = jooq
// @formatter:off
.select(T_CAMP.PRICE)
.from(T_PERSON)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
.where(T_PERSON.PK.eq(pkPerson));
// @formatter:on
LOGGER.trace(sql);
return sql.fetchOne(T_CAMP.PRICE);
}
} }

View File

@ -33,4 +33,14 @@ public class PersonService {
public String getAnnotations(Integer pk) { public String getAnnotations(Integer pk) {
return gateway.getAnnotations(pk); return gateway.getAnnotations(pk);
} }
/**
* get the price of the camp
*
* @param pk the ID of the person, not the camp
* @return the camp price
*/
public String getCampPrice(Integer pk) {
return gateway.getCampprice(pk);
}
} }

View File

@ -1,6 +1,7 @@
package de.jottyfan.camporganizer.module.confirmation.person.model; package de.jottyfan.camporganizer.module.confirmation.person.model;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -8,6 +9,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import jakarta.validation.constraints.DecimalMin;
/** /**
* *
@ -15,7 +17,7 @@ import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
* *
*/ */
public class PersonBean implements Serializable { public class PersonBean implements Serializable {
private static final long serialVersionUID = 2L; private static final long serialVersionUID = 3L;
private Integer pk; private Integer pk;
private String forename; private String forename;
@ -35,6 +37,8 @@ public class PersonBean implements Serializable {
private EnumSex sex; private EnumSex sex;
private Integer fkRegistrator; private Integer fkRegistrator;
private String comment; private String comment;
@DecimalMin(value = "0")
private BigDecimal requiredPrice;
/** /**
* @return the forename * @return the forename
@ -273,4 +277,18 @@ public class PersonBean implements Serializable {
public void setPk(Integer pk) { public void setPk(Integer pk) {
this.pk = pk; this.pk = pk;
} }
/**
* @return the requiredPrice
*/
public BigDecimal getRequiredPrice() {
return requiredPrice;
}
/**
* @param requiredPrice the requiredPrice to set
*/
public void setRequiredPrice(BigDecimal requiredPrice) {
this.requiredPrice = requiredPrice;
}
} }

View File

@ -57,7 +57,7 @@ public class DashboardRepository {
.set(T_PERSON.COMMENT, bean.getComment()) .set(T_PERSON.COMMENT, bean.getComment())
.where(T_PERSON.PK.eq(bean.getPk())); .where(T_PERSON.PK.eq(bean.getPk()));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.trace(sql.toString());
return sql.execute(); return sql.execute();
} }

View File

@ -10,9 +10,8 @@ import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.camplist.CommonController;
@ -28,8 +27,8 @@ public class DocumentController extends CommonController {
@Autowired @Autowired
private DocumentService service; private DocumentService service;
@RequestMapping(path = "/document/{id}", method = RequestMethod.GET) @GetMapping("/document/{id}")
public ResponseEntity<Resource> getDocument(@PathVariable Integer id, HttpServletResponse response) { public ResponseEntity<Resource> getDocument(@PathVariable("id") Integer id, HttpServletResponse response) {
DownloadBean bean = service.getDocument(id); DownloadBean bean = service.getDocument(id);
if (bean != null) { if (bean != null) {
byte[] decoded = Base64.getDecoder().decode(bean.getContent()); byte[] decoded = Base64.getDecoder().decode(bean.getContent());

View File

@ -6,6 +6,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Date; import java.util.Date;
import java.util.Iterator;
import java.util.TimeZone; import java.util.TimeZone;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -56,7 +57,9 @@ public class ICalRepository {
LOGGER.debug(sql.toString()); LOGGER.debug(sql.toString());
ICalendar ical = new ICalendar(); ICalendar ical = new ICalendar();
ical.getTimezoneInfo().setDefaultTimezone(TimezoneAssignment.download(TimeZone.getTimeZone("Europe/Berlin"), false)); ical.getTimezoneInfo().setDefaultTimezone(TimezoneAssignment.download(TimeZone.getTimeZone("Europe/Berlin"), false));
for (Record5<String, LocalDateTime, LocalDateTime, String, String> r : sql.fetch()) { Iterator<Record5<String, LocalDateTime, LocalDateTime, String, String>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record5<String, LocalDateTime, LocalDateTime, String, String> r = i.next();
VEvent event = new VEvent(); VEvent event = new VEvent();
Summary summary = event.setSummary(r.get(T_CAMP.NAME)); Summary summary = event.setSummary(r.get(T_CAMP.NAME));
summary.setLanguage("de"); summary.setLanguage("de");

View File

@ -53,6 +53,15 @@ public class KeycloakRepository {
return String.format("%s/realms/%s/account/", url, keycloakRealm); return String.format("%s/realms/%s/account/", url, keycloakRealm);
} }
/**
* get the url of the user password client
*
* @return the url of the user password client
*/
public String getPasswordClientUrl() {
return String.format("%s%s", getUserClientUrl(), "#/security/signingin");
}
/** /**
* register the login in keycloak * register the login in keycloak
* *

View File

@ -1,11 +1,12 @@
package de.jottyfan.camporganizer.module.registration; package de.jottyfan.camporganizer.module.registration;
import jakarta.validation.Valid; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -15,6 +16,7 @@ import de.jottyfan.camporganizer.db.EnumConverter;
import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.camplist.CommonController;
import de.jottyfan.camporganizer.module.registration.model.CampBean; import de.jottyfan.camporganizer.module.registration.model.CampBean;
import de.jottyfan.camporganizer.module.registration.model.RegistrationBean; import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
import jakarta.validation.Valid;
/** /**
* *
@ -23,6 +25,7 @@ import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
*/ */
@Controller @Controller
public class RegistrationController extends CommonController { public class RegistrationController extends CommonController {
private static final Logger LOGGER = LogManager.getLogger(RegistrationController.class);
@Autowired @Autowired
private RegistrationService service; private RegistrationService service;
@ -38,6 +41,7 @@ public class RegistrationController extends CommonController {
model.addAttribute("bean", bean); model.addAttribute("bean", bean);
model.addAttribute("sexes", EnumConverter.getSexes()); model.addAttribute("sexes", EnumConverter.getSexes());
model.addAttribute("roles", EnumConverter.getRoles()); model.addAttribute("roles", EnumConverter.getRoles());
model.addAttribute("wellknown", service.getWellKnownRegistrations(getCurrentUser()));
return "/registration/registration"; return "/registration/registration";
} else { } else {
return "/registration/isover"; return "/registration/isover";
@ -60,30 +64,49 @@ public class RegistrationController extends CommonController {
public String register(@Valid @ModelAttribute("bean") RegistrationBean bean, final BindingResult bindingResult, public String register(@Valid @ModelAttribute("bean") RegistrationBean bean, final BindingResult bindingResult,
Model model) { Model model) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
for (ObjectError error : bindingResult.getAllErrors()) {
LOGGER.error("found {}", error);
}
CampBean campBean = service.getCamp(bean.getFkCamp()); CampBean campBean = service.getCamp(bean.getFkCamp());
model.addAttribute("camp", campBean); model.addAttribute("camp", campBean);
model.addAttribute("sexes", EnumConverter.getSexes()); model.addAttribute("sexes", EnumConverter.getSexes());
model.addAttribute("roles", EnumConverter.getRoles()); model.addAttribute("roles", EnumConverter.getRoles());
String currentUser = getCurrentUser();
if (currentUser != null) {
model.addAttribute("wellknown", service.getWellKnownRegistrations(currentUser));
}
return "/registration/registration"; return "/registration/registration";
} }
Boolean result = service.register(bean, getCurrentUser()); Integer result = service.register(bean, getCurrentUser());
return result ? "/registration/success" : "/error"; if (result < 1) {
LOGGER.error("added less than 1 row on registering {}", bean);
CampBean campBean = service.getCamp(bean.getFkCamp());
model.addAttribute("camp", campBean);
model.addAttribute("sexes", EnumConverter.getSexes());
model.addAttribute("roles", EnumConverter.getRoles());
String currentUser = getCurrentUser();
if (currentUser != null) {
model.addAttribute("wellknown", service.getWellKnownRegistrations(currentUser));
}
return "/registration/registration";
}
return "/registration/success";
} }
@GetMapping("/registration/cancel/{id}") @GetMapping("/registration/cancel/{id}")
public String cancellation(@PathVariable Integer id, final Model model) { public String cancellation(@PathVariable("id") Integer id, final Model model) {
model.addAttribute("bean", service.getBooking(id)); model.addAttribute("bean", service.getBooking(id));
return "/registration/cancellation"; return "/registration/cancellation";
} }
@GetMapping("/registration/remove/{id}") @GetMapping("/registration/remove/{id}")
public String remove(@PathVariable Integer id, final Model model) { public String remove(@PathVariable("id") Integer id, final Model model) {
service.removeBooking(id); service.removeBooking(id);
return "redirect:/dashboard"; return "redirect:/dashboard";
} }
@GetMapping("/registration/toggleconsent/{id}") @GetMapping("/registration/toggleconsent/{id}")
public String toggleConsent(@PathVariable Integer id, final Model model) { public String toggleConsent(@PathVariable("id") Integer id, final Model model) {
service.toggleConsent(id); service.toggleConsent(id);
return "redirect:/dashboard"; return "redirect:/dashboard";
} }

View File

@ -6,11 +6,15 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSONDOCUMENT;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILEROLE; import static de.jottyfan.camporganizer.db.jooq.Tables.T_PROFILEROLE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_RSS; import static de.jottyfan.camporganizer.db.jooq.Tables.T_RSS;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -19,14 +23,14 @@ import org.jasypt.util.password.StrongPasswordEncryptor;
import org.jooq.DSLContext; import org.jooq.DSLContext;
import org.jooq.DeleteConditionStep; import org.jooq.DeleteConditionStep;
import org.jooq.InsertResultStep; import org.jooq.InsertResultStep;
import org.jooq.InsertValuesStep12; import org.jooq.InsertReturningStep;
import org.jooq.InsertValuesStep13;
import org.jooq.InsertValuesStep2; import org.jooq.InsertValuesStep2;
import org.jooq.Record; import org.jooq.Record;
import org.jooq.Record1; import org.jooq.Record1;
import org.jooq.Record2; import org.jooq.Record2;
import org.jooq.Record5; import org.jooq.Record5;
import org.jooq.Record7; import org.jooq.Record7;
import org.jooq.Record9;
import org.jooq.SelectConditionStep; import org.jooq.SelectConditionStep;
import org.jooq.UpdateConditionStep; import org.jooq.UpdateConditionStep;
import org.jooq.exception.DataAccessException; import org.jooq.exception.DataAccessException;
@ -38,11 +42,11 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersondocumentRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TPersondocumentRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TProfileRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord; import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
import de.jottyfan.camporganizer.module.camplist.model.BookingBean; import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper; import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
import de.jottyfan.camporganizer.module.registration.model.CampBean; import de.jottyfan.camporganizer.module.registration.model.CampBean;
@ -69,15 +73,17 @@ public class RegistrationRepository {
* @return the camp bean or null * @return the camp bean or null
*/ */
public CampBean getCamp(Integer pk) { public CampBean getCamp(Integer pk) {
SelectConditionStep<TCampRecord> sql = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(pk)); SelectConditionStep<VCampRecord> sql = jooq.selectFrom(V_CAMP).where(V_CAMP.PK.eq(pk));
LOGGER.debug(sql.toString()); LOGGER.trace(sql.toString());
TCampRecord r = sql.fetchOne(); VCampRecord r = sql.fetchOne();
if (r != null) { if (r != null) {
CampBean bean = new CampBean(); CampBean bean = new CampBean();
bean.setPk(r.getPk()); bean.setPk(r.getPk());
bean.setName(r.getName()); bean.setName(r.getName());
LocalDateTime arrive = r.getArrive(); LocalDateTime arrive = r.getArrive();
bean.setYear(arrive == null ? null : arrive.getYear()); bean.setYear(arrive == null ? null : arrive.getYear());
bean.setBookingHasStarted(r.getBookingHasStarted());
bean.setStartBooking(r.getStartBooking());
return bean; return bean;
} else { } else {
return null; return null;
@ -96,7 +102,7 @@ public class RegistrationRepository {
.selectFrom(T_PROFILE) .selectFrom(T_PROFILE)
.where(DSL.lower(T_PROFILE.USERNAME).eq(login)); .where(DSL.lower(T_PROFILE.USERNAME).eq(login));
// @formatter:on // @formatter:on
LOGGER.debug(sql); LOGGER.trace(sql);
return sql.fetch().size() < 1; return sql.fetch().size() < 1;
} }
@ -105,14 +111,15 @@ public class RegistrationRepository {
* registerInKeycloak is true * registerInKeycloak is true
* *
* @param bean the bean * @param bean the bean
* @return true or false * @return number of data base rows; should be > 0
*/ */
public Boolean register(RegistrationBean bean) { public Integer register(RegistrationBean bean) {
LambdaResultWrapper lrw = new LambdaResultWrapper(); LambdaResultWrapper lrw = new LambdaResultWrapper();
jooq.transaction(t -> { jooq.transaction(t -> {
if (bean.getLogin() != null && !bean.getLogin().isEmpty()) { if (bean.getLogin() != null && !bean.getLogin().isEmpty()) {
Boolean loginNotYetInUse = isLoginNotYetInUse(bean.getLogin().toLowerCase()); Boolean loginNotYetInUse = isLoginNotYetInUse(bean.getLogin().toLowerCase());
if (bean.getRegisterInKeycloak() && !loginNotYetInUse) { if (bean.getRegisterInKeycloak() && !loginNotYetInUse) {
LOGGER.error("login already in use: {}", bean.getLogin().toLowerCase());
throw new DataAccessException("login already in use: " + bean.getLogin().toLowerCase()); throw new DataAccessException("login already in use: " + bean.getLogin().toLowerCase());
} }
Integer fkProfile = null; Integer fkProfile = null;
@ -130,7 +137,7 @@ public class RegistrationRepository {
.values(bean.getForename(), bean.getSurname(), bean.getLogin().toLowerCase(), oldPassword, LocalDateTime.now().plus(356, ChronoUnit.DAYS), UUID.nameUUIDFromBytes(bean.getLogin().getBytes()).toString()) .values(bean.getForename(), bean.getSurname(), bean.getLogin().toLowerCase(), oldPassword, LocalDateTime.now().plus(356, ChronoUnit.DAYS), UUID.nameUUIDFromBytes(bean.getLogin().getBytes()).toString())
.returning(T_PROFILE.PK); .returning(T_PROFILE.PK);
// @formatter:on // @formatter:on
LOGGER.debug(sql1.toString()); LOGGER.trace(sql1.toString());
fkProfile = sql1.fetchOne().getPk(); fkProfile = sql1.fetchOne().getPk();
InsertValuesStep2<TRssRecord, String, String> sql2 = jooq InsertValuesStep2<TRssRecord, String, String> sql2 = jooq
@ -149,12 +156,11 @@ public class RegistrationRepository {
.from(T_PROFILE) .from(T_PROFILE)
.where(DSL.lower(T_PROFILE.USERNAME).eq(bean.getLogin().toLowerCase())); .where(DSL.lower(T_PROFILE.USERNAME).eq(bean.getLogin().toLowerCase()));
// @formatter:on // @formatter:on
LOGGER.debug(sql1.toString()); LOGGER.trace(sql1.toString());
fkProfile = sql1.fetchOne().get(T_PROFILE.PK); fkProfile = sql1.fetchOne().get(T_PROFILE.PK);
} }
// register the person for camp participation // register the person for camp participation
InsertValuesStep13<TPersonRecord, String, String, EnumSex, LocalDate, String, String, String, String, String, EnumCamprole, Integer, String, Integer> sql2 = DSL InsertReturningStep<TPersonRecord> sql2 = DSL.using(t)
.using(t)
// @formatter:off // @formatter:off
.insertInto(T_PERSON, .insertInto(T_PERSON,
T_PERSON.FORENAME, T_PERSON.FORENAME,
@ -172,14 +178,15 @@ public class RegistrationRepository {
T_PERSON.FK_PROFILE) T_PERSON.FK_PROFILE)
.values(bean.getForename(), bean.getSurname(), bean.getSex(), .values(bean.getForename(), bean.getSurname(), bean.getSex(),
bean.getBirthDate(), bean.getStreet(), bean.getZip(), bean.getCity(), bean.getEmail(), bean.getBirthDate(), bean.getStreet(), bean.getZip(), bean.getCity(), bean.getEmail(),
bean.getPhone(), bean.getCampRole(), bean.getFkCamp(), bean.getComment(), fkProfile); bean.getPhone(), bean.getCampRole(), bean.getFkCamp(), bean.getComment(), fkProfile)
.onConflict(T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.BIRTHDATE, T_PERSON.FK_CAMP)
.doNothing();
// @formatter:on // @formatter:on
LOGGER.debug(sql2.toString()); LOGGER.trace(sql2.toString());
lrw.add(sql2.execute()); lrw.add(sql2.execute());
// register the login for the portal // register the login for the portal
} else { } else {
InsertValuesStep12<TPersonRecord, String, String, EnumSex, LocalDate, String, String, String, String, String, EnumCamprole, Integer, String> sql = DSL InsertReturningStep<TPersonRecord> sql = DSL.using(t)
.using(t)
// @formatter:off // @formatter:off
.insertInto(T_PERSON, .insertInto(T_PERSON,
T_PERSON.FORENAME, T_PERSON.FORENAME,
@ -196,13 +203,15 @@ public class RegistrationRepository {
T_PERSON.COMMENT) T_PERSON.COMMENT)
.values(bean.getForename(), bean.getSurname(), bean.getSex(), .values(bean.getForename(), bean.getSurname(), bean.getSex(),
bean.getBirthDate(), bean.getStreet(), bean.getZip(), bean.getCity(), bean.getEmail(), bean.getBirthDate(), bean.getStreet(), bean.getZip(), bean.getCity(), bean.getEmail(),
bean.getPhone(), bean.getCampRole(), bean.getFkCamp(), bean.getComment()); bean.getPhone(), bean.getCampRole(), bean.getFkCamp(), bean.getComment())
.onConflict(T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.BIRTHDATE, T_PERSON.FK_CAMP)
.doNothing();
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.trace(sql.toString());
lrw.add(sql.execute()); lrw.add(sql.execute());
} }
}); });
return lrw.getCounter() > 0; return lrw.getCounter();
} }
/** /**
@ -225,7 +234,7 @@ public class RegistrationRepository {
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP)) .leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
.where(T_PERSON.PK.eq(id)); .where(T_PERSON.PK.eq(id));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.trace(sql.toString());
Record7<Integer, String, String, EnumCamprole, String, LocalDateTime, LocalDateTime> r = sql.fetchOne(); Record7<Integer, String, String, EnumCamprole, String, LocalDateTime, LocalDateTime> r = sql.fetchOne();
if (r != null) { if (r != null) {
BookingBean bean = new BookingBean(); BookingBean bean = new BookingBean();
@ -258,7 +267,7 @@ public class RegistrationRepository {
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_PERSON.FK_PROFILE)) .leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_PERSON.FK_PROFILE))
.where(T_PERSON.PK.eq(id)); .where(T_PERSON.PK.eq(id));
// @formatter:on // @formatter:on
LOGGER.debug(sql0.toString()); LOGGER.trace(sql0.toString());
Record5<String, String, String, String, LocalDateTime> r = sql0.fetchOne(); Record5<String, String, String, String, LocalDateTime> r = sql0.fetchOne();
if (r == null) { if (r == null) {
throw new DataAccessException("no such entry in t_person with id = " + id); throw new DataAccessException("no such entry in t_person with id = " + id);
@ -279,11 +288,11 @@ public class RegistrationRepository {
DeleteConditionStep<TPersondocumentRecord> sql1 = DSL.using(t).deleteFrom(T_PERSONDOCUMENT) DeleteConditionStep<TPersondocumentRecord> sql1 = DSL.using(t).deleteFrom(T_PERSONDOCUMENT)
.where(T_PERSONDOCUMENT.FK_PERSON.eq(id)); .where(T_PERSONDOCUMENT.FK_PERSON.eq(id));
LOGGER.debug(sql1.toString()); LOGGER.trace(sql1.toString());
sql1.execute(); sql1.execute();
DeleteConditionStep<TPersonRecord> sql2 = DSL.using(t).deleteFrom(T_PERSON).where(T_PERSON.PK.eq(id)); DeleteConditionStep<TPersonRecord> sql2 = DSL.using(t).deleteFrom(T_PERSON).where(T_PERSON.PK.eq(id));
LOGGER.debug(sql2.toString()); LOGGER.trace(sql2.toString());
lrw.add(sql2.execute()); lrw.add(sql2.execute());
InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t) InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t)
@ -293,7 +302,7 @@ public class RegistrationRepository {
T_RSS.RECIPIENT) T_RSS.RECIPIENT)
.values(rssMessage.toString(), "registrator"); .values(rssMessage.toString(), "registrator");
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql3.toString()); LOGGER.trace("{}", sql3.toString());
sql3.execute(); sql3.execute();
}); });
return lrw.getCounter(); return lrw.getCounter();
@ -312,9 +321,10 @@ public class RegistrationRepository {
.from(T_CAMP) .from(T_CAMP)
.where(T_CAMP.PK.eq(fkCamp)); .where(T_CAMP.PK.eq(fkCamp));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.trace(sql.toString());
for (Record1<LocalDateTime> r : sql.fetch()) { Iterator<Record1<LocalDateTime>> i = sql.fetch().iterator();
LocalDateTime depart = r.get(T_CAMP.DEPART); while (i.hasNext()) {
LocalDateTime depart = i.next().get(T_CAMP.DEPART);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
return now.isBefore(depart); return now.isBefore(depart);
} }
@ -335,7 +345,7 @@ public class RegistrationRepository {
.set(T_PERSON.FK_PROFILE, (Integer) null) .set(T_PERSON.FK_PROFILE, (Integer) null)
.where(T_PERSON.FK_PROFILE.eq(bean.getPk())); .where(T_PERSON.FK_PROFILE.eq(bean.getPk()));
// @formatter:off // @formatter:off
LOGGER.debug("{}", sql.toString()); LOGGER.trace("{}", sql.toString());
sql.execute(); sql.execute();
DeleteConditionStep<?> sql1 = DSL.using(t) DeleteConditionStep<?> sql1 = DSL.using(t)
@ -348,7 +358,7 @@ public class RegistrationRepository {
.where(T_PROFILE.USERNAME.eq(bean.getUsername()) .where(T_PROFILE.USERNAME.eq(bean.getUsername())
))); )));
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql1.toString()); LOGGER.trace("{}", sql1.toString());
sql1.execute(); sql1.execute();
DeleteConditionStep<?> sql2 = DSL.using(t) DeleteConditionStep<?> sql2 = DSL.using(t)
@ -356,7 +366,7 @@ public class RegistrationRepository {
.deleteFrom(T_PROFILE) .deleteFrom(T_PROFILE)
.where(T_PROFILE.USERNAME.eq(bean.getUsername())); .where(T_PROFILE.USERNAME.eq(bean.getUsername()));
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql2.toString()); LOGGER.trace("{}", sql2.toString());
sql2.execute(); sql2.execute();
InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t) InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t)
@ -366,7 +376,7 @@ public class RegistrationRepository {
T_RSS.RECIPIENT) T_RSS.RECIPIENT)
.values(new StringBuilder(bean.getFullname()).append(" hat sich vom Portal CampOrganizer2 abgemeldet.").toString(), "admin"); .values(new StringBuilder(bean.getFullname()).append(" hat sich vom Portal CampOrganizer2 abgemeldet.").toString(), "admin");
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql3.toString()); LOGGER.trace("{}", sql3.toString());
sql3.execute(); sql3.execute();
}); });
} }
@ -385,7 +395,7 @@ public class RegistrationRepository {
.set(T_PERSON.CONSENT_CATALOG_PHOTO, consent) .set(T_PERSON.CONSENT_CATALOG_PHOTO, consent)
.where(T_PERSON.PK.eq(id)); .where(T_PERSON.PK.eq(id));
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql.toString()); LOGGER.trace("{}", sql.toString());
sql.execute(); sql.execute();
} }
@ -407,7 +417,7 @@ public class RegistrationRepository {
.from(T_CAMP) .from(T_CAMP)
.where(T_CAMP.PK.eq(fkCamp)); .where(T_CAMP.PK.eq(fkCamp));
// @formatter:on // @formatter:on
LOGGER.debug(sql.toString()); LOGGER.trace(sql.toString());
Record r = sql.fetchOne(); Record r = sql.fetchOne();
Integer minTeacherAge = r.get(T_CAMP.MAX_AGE) + 2; // by default, we need 2 years older teachers at least Integer minTeacherAge = r.get(T_CAMP.MAX_AGE) + 2; // by default, we need 2 years older teachers at least
DayToSecond currentTeacherAge = r.get("teacherAge", DayToSecond.class); DayToSecond currentTeacherAge = r.get("teacherAge", DayToSecond.class);
@ -418,4 +428,70 @@ public class RegistrationRepository {
return true; return true;
} }
} }
/**
* get the person information of already registered people
*
* @param currentUser the user that registered people
* @return the list of found registrations, may be an empty list; if currentUser is null, return null.
*/
public List<RegistrationBean> getRegistrations(String currentUser) {
SelectConditionStep<Record9<String, String, String, String, String, String, String, EnumSex, LocalDate>> sql = jooq
// @formatter:off
.selectDistinct(T_PERSON.FORENAME,
T_PERSON.SURNAME,
T_PERSON.STREET,
T_PERSON.ZIP,
T_PERSON.CITY,
T_PERSON.PHONE,
T_PERSON.EMAIL,
T_PERSON.SEX,
T_PERSON.BIRTHDATE)
.from(T_PERSON)
.innerJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_PERSON.FK_PROFILE))
.where(DSL.lower(T_PROFILE.USERNAME).eq(currentUser == null ? null : currentUser.toLowerCase()));
// @formatter:on
LOGGER.trace(sql);
List<RegistrationBean> list = new ArrayList<>();
Iterator<Record9<String, String, String, String, String, String, String, EnumSex, LocalDate>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record9<String, String, String, String, String, String, String, EnumSex, LocalDate> r = i.next();
RegistrationBean bean = new RegistrationBean();
bean.setForename(r.get(T_PERSON.FORENAME));
bean.setSurname(r.get(T_PERSON.SURNAME));
bean.setStreet(r.get(T_PERSON.STREET));
bean.setZip(r.get(T_PERSON.ZIP));
bean.setCity(r.get(T_PERSON.CITY));
bean.setPhone(r.get(T_PERSON.PHONE));
bean.setEmail(r.get(T_PERSON.EMAIL));
bean.setSex(r.get(T_PERSON.SEX));
bean.setBirthDate(r.get(T_PERSON.BIRTHDATE));
list.add(bean);
}
return list;
}
/**
* returns true if and only if this combination of registration has already been done
*
* @param forename the forename
* @param surname the surname
* @param birthDate the birth date
* @param campId the ID of the camp
* @return true or false
*/
public Boolean checkAlreadyRegistered(String forename, String surname, LocalDate birthDate, Integer campId) {
SelectConditionStep<Record1<Integer>> sql = jooq
// @formatter:off
.select(T_PERSON.PK)
.from(T_PERSON)
.where(T_PERSON.FORENAME.eq(forename))
.and(T_PERSON.SURNAME.eq(surname))
.and(T_PERSON.BIRTHDATE.eq(birthDate))
.and(T_PERSON.FK_CAMP.eq(campId));
// @formatter:on
LOGGER.trace(sql);
Iterator<Integer> i = sql.fetch(T_PERSON.PK).iterator();
return i.hasNext();
}
} }

View File

@ -1,9 +1,13 @@
package de.jottyfan.camporganizer.module.registration; package de.jottyfan.camporganizer.module.registration;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.module.camplist.model.BookingBean; import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
import de.jottyfan.camporganizer.module.registration.model.AlreadyKnownPersonBean;
import de.jottyfan.camporganizer.module.registration.model.CampBean; import de.jottyfan.camporganizer.module.registration.model.CampBean;
import de.jottyfan.camporganizer.module.registration.model.RegistrationBean; import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
@ -16,7 +20,7 @@ import de.jottyfan.camporganizer.module.registration.model.RegistrationBean;
public class RegistrationService { public class RegistrationService {
@Autowired @Autowired
private RegistrationRepository gateway; private RegistrationRepository repository;
@Autowired @Autowired
private KeycloakRepository keycloak; private KeycloakRepository keycloak;
@ -28,7 +32,7 @@ public class RegistrationService {
* @return true or false * @return true or false
*/ */
public Boolean campIsNotYetOver(Integer fkCamp) { public Boolean campIsNotYetOver(Integer fkCamp) {
return gateway.campIsNotYetOver(fkCamp); return repository.campIsNotYetOver(fkCamp);
} }
/** /**
@ -38,23 +42,24 @@ public class RegistrationService {
* @return the camp bean or null * @return the camp bean or null
*/ */
public CampBean getCamp(Integer fkCamp) { public CampBean getCamp(Integer fkCamp) {
return gateway.getCamp(fkCamp); return repository.getCamp(fkCamp);
} }
/** /**
* register the person for a camp; if registerInKeycloak, do so also * register the person for a camp; if registerInKeycloak, do so also
* *
* @param bean the bean * @param bean the bean
* @return true if successful, false otherwise * @return number of database rows; should be > 0
*/ */
public Boolean register(RegistrationBean bean, String currentUser) { public Integer register(RegistrationBean bean, String currentUser) {
if (currentUser != null) { if (currentUser != null) {
bean.setRegisterInKeycloak(false); // already registered bean.setRegisterInKeycloak(false); // already registered
bean.setLogin(currentUser); bean.setLogin(currentUser);
} }
Boolean result = gateway.register(bean); Integer result = repository.register(bean);
if (result && bean.getRegisterInKeycloak()) { if (result > 0 && bean.getRegisterInKeycloak()) {
keycloak.register(bean.getKcForename(), bean.getKcSurname(), bean.getLogin(), bean.getPassword(), bean.getKcEmail()); keycloak.register(bean.getKcForename(), bean.getKcSurname(), bean.getLogin(), bean.getPassword(),
bean.getKcEmail());
} }
return result; return result;
} }
@ -66,7 +71,7 @@ public class RegistrationService {
* @return the booking bean or null * @return the booking bean or null
*/ */
public BookingBean getBooking(Integer id) { public BookingBean getBooking(Integer id) {
return gateway.getBooking(id); return repository.getBooking(id);
} }
/** /**
@ -75,10 +80,37 @@ public class RegistrationService {
* @param id the id of the booking (t_person.pk) * @param id the id of the booking (t_person.pk)
*/ */
public Boolean removeBooking(Integer id) { public Boolean removeBooking(Integer id) {
return gateway.removeBooking(id) > 0; return repository.removeBooking(id) > 0;
} }
public void toggleConsent(Integer id) { public void toggleConsent(Integer id) {
gateway.toggleConsent(id); repository.toggleConsent(id);
}
/**
* get already registered entries from the database
*
* @param currentUser the name of the current user; may be null
* @return the list or null if current user is null
*/
public List<AlreadyKnownPersonBean> getWellKnownRegistrations(String currentUser) {
if (currentUser == null) {
return null;
} else {
List<RegistrationBean> r = repository.getRegistrations(currentUser);
if (r == null) {
return null;
} else {
List<AlreadyKnownPersonBean> list = new ArrayList<>();
for (RegistrationBean b : r) {
AlreadyKnownPersonBean bean = new AlreadyKnownPersonBean();
bean.setSource(b);
bean.setOption(String.format("%s %s, %s, %s %s, %s, %s", b.getForename(), b.getSurname(), b.getStreet(),
b.getZip(), b.getCity(), b.getEmail(), b.getPhone()));
list.add(bean);
}
return list;
}
}
} }
} }

View File

@ -0,0 +1,51 @@
package de.jottyfan.camporganizer.module.registration.model;
import java.io.Serializable;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import com.nimbusds.jose.shaded.gson.Gson;
/**
*
* @author jotty
*
*/
public class AlreadyKnownPersonBean implements Serializable {
private static final long serialVersionUID = 1L;
private String option;
private RegistrationBean source;
public String getJson() {
Map<String, String> map = new HashMap<>();
map.put("forename", source.getForename());
map.put("surname", source.getSurname());
map.put("street", source.getStreet());
map.put("zip", source.getZip());
map.put("city", source.getCity());
map.put("phone", source.getPhone());
map.put("email", source.getEmail());
map.put("sex", source.getSex() == null ? null : source.getSex().getLiteral());
map.put("birthDate",
source.getBirthDate() == null ? null : source.getBirthDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
return new Gson().toJson(map);
}
public String getOption() {
return option;
}
public void setOption(String json) {
this.option = json;
}
public RegistrationBean getSource() {
return source;
}
public void setSource(RegistrationBean source) {
this.source = source;
}
}

View File

@ -1,6 +1,7 @@
package de.jottyfan.camporganizer.module.registration.model; package de.jottyfan.camporganizer.module.registration.model;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* *
@ -13,6 +14,8 @@ public class CampBean implements Serializable {
private Integer pk; private Integer pk;
private String name; private String name;
private Integer year; private Integer year;
private LocalDateTime startBooking;
private Boolean bookingHasStarted;
/** /**
* @return the pk * @return the pk
@ -55,4 +58,32 @@ public class CampBean implements Serializable {
public void setYear(Integer year) { public void setYear(Integer year) {
this.year = year; this.year = year;
} }
/**
* @return the bookingHasStarted
*/
public Boolean getBookingHasStarted() {
return bookingHasStarted;
}
/**
* @param bookingHasStarted the bookingHasStarted to set
*/
public void setBookingHasStarted(Boolean bookingHasStarted) {
this.bookingHasStarted = bookingHasStarted;
}
/**
* @return the startBooking
*/
public LocalDateTime getStartBooking() {
return startBooking;
}
/**
* @param startBooking the startBooking to set
*/
public void setStartBooking(LocalDateTime startBooking) {
this.startBooking = startBooking;
}
} }

View File

@ -11,8 +11,10 @@ import org.springframework.format.annotation.DateTimeFormat;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole; import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex; import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.module.registration.validate.AlreadyRegisteredCheck;
import de.jottyfan.camporganizer.module.registration.validate.TeacherAgeCheck; import de.jottyfan.camporganizer.module.registration.validate.TeacherAgeCheck;
import de.jottyfan.camporganizer.module.registration.validate.UnusedUsername; import de.jottyfan.camporganizer.module.registration.validate.UnusedUsername;
import de.jottyfan.camporganizer.module.registration.validate.ValidUsername;
/** /**
* *
@ -21,9 +23,11 @@ import de.jottyfan.camporganizer.module.registration.validate.UnusedUsername;
*/ */
@UnusedUsername(field = "login", message = "Dieses Login ist leider bereits vergeben. Bitte wähle ein anderes.") @UnusedUsername(field = "login", message = "Dieses Login ist leider bereits vergeben. Bitte wähle ein anderes.")
@TeacherAgeCheck(field = "birthDate", fkCamp = "fkCamp", campRole = "campRole", message = "Als Mitarbeiter bist Du leider zu jung für diese Freizeit.") @TeacherAgeCheck(field = "birthDate", fkCamp = "fkCamp", campRole = "campRole", message = "Als Mitarbeiter bist Du leider zu jung für diese Freizeit.")
// TODO: registration completeness annotation; in case of registerInKeycloak == true, force login, password, kcForename, kcSurname and kcEmail not to be blank @AlreadyRegisteredCheck(field = "forename", surname = "surname", birthDate = "birthDate", fkCamp = "fkCamp", message = "Diese Anmeldung wurde bereits vorgenommen. Wenn Du sie in Deinem Profil nicht sehen kannst, wurde sie vielleicht von jemand Anderem durchgeführt. In Absprache mit der Freizeitleitung kannst Du die Anmeldung von einem Administrator Deinem Konto zuordnen lassen.")
@ValidUsername(field = "login", require = "registerInKeycloak", message = "Bitte überprüfe das Feld Login. Dort sind Leerzeichen nicht erlaubt.")
public class RegistrationBean implements Serializable { public class RegistrationBean implements Serializable {
private static final long serialVersionUID = 1L; //TODO: registration completeness annotation; in case of registerInKeycloak == true, force login, password, kcForename, kcSurname and kcEmail not to be blank
private static final long serialVersionUID = 2L;
@NotBlank(message = "Bitte gib deinen Vornamen an.") @NotBlank(message = "Bitte gib deinen Vornamen an.")
private String forename; private String forename;
@ -55,6 +59,31 @@ public class RegistrationBean implements Serializable {
private String kcSurname; private String kcSurname;
private String kcEmail; private String kcEmail;
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("RegistrationBean{forename=").append(forename);
buf.append(", surname=").append(surname);
buf.append(", sex=").append(sex);
buf.append(", birthDate=").append(birthDate);
buf.append(", street=").append(street);
buf.append(", zip=").append(zip);
buf.append(", city=").append(city);
buf.append(", email=").append(email);
buf.append(", phone=").append(phone);
buf.append(", comment=").append(comment);
buf.append(", fkCamp=").append(fkCamp);
buf.append(", campRole=").append(campRole);
buf.append(", registerInKeycloak=").append(registerInKeycloak);
buf.append(", login=").append(login);
buf.append(", password=********");
buf.append(", kcForename=").append(kcForename);
buf.append(", kcSurname=").append(kcSurname);
buf.append(", kcEmail=").append(kcEmail);
buf.append("}");
return buf.toString();
}
/** /**
* @return forename + surname, separated by a space * @return forename + surname, separated by a space
*/ */

View File

@ -0,0 +1,33 @@
package de.jottyfan.camporganizer.module.registration.validate;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
/**
*
* @author jotty
*
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = AlreadyRegisteredCheckValidator.class)
@Documented
public @interface AlreadyRegisteredCheck {
String message() default "already registered";
String field();
String surname();
String birthDate();
String fkCamp();
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}

View File

@ -0,0 +1,60 @@
package de.jottyfan.camporganizer.module.registration.validate;
import java.time.LocalDate;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import de.jottyfan.camporganizer.module.registration.RegistrationRepository;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
/**
*
* @author jotty
*
*/
public class AlreadyRegisteredCheckValidator implements ConstraintValidator<AlreadyRegisteredCheck, Object> {
private String field;
private String fkCamp;
private String surname;
private String birthDate;
private String message;
@Autowired
private RegistrationRepository gateway;
public void initialize(AlreadyRegisteredCheck arc) {
this.field = arc.field();
this.fkCamp = arc.fkCamp();
this.surname = arc.surname();
this.birthDate = arc.birthDate();
this.message = arc.message();
}
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
Object forename = new BeanWrapperImpl(value).getPropertyValue(field);
Object campId = new BeanWrapperImpl(value).getPropertyValue(fkCamp);
Object theSurname = new BeanWrapperImpl(value).getPropertyValue(surname);
Object theBirthDate = new BeanWrapperImpl(value).getPropertyValue(birthDate);
Boolean found = false;
if (theBirthDate != null) {
String fn = (String) forename;
Integer camp = (Integer) campId;
String sn = (String) theSurname;
LocalDate bd = (LocalDate) theBirthDate;
found = gateway.checkAlreadyRegistered(fn, sn, bd, camp);
if (found) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(message).addPropertyNode(fkCamp).addConstraintViolation();
context.buildConstraintViolationWithTemplate("s.o.").addPropertyNode(field).addConstraintViolation();
context.buildConstraintViolationWithTemplate("s.o.").addPropertyNode(surname).addConstraintViolation();
context.buildConstraintViolationWithTemplate("s.o.").addPropertyNode(birthDate).addConstraintViolation();
}
}
return !found;
}
}

View File

@ -0,0 +1,30 @@
package de.jottyfan.camporganizer.module.registration.validate;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
/**
*
* @author jotty
*
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = ValidUsernameValidator.class)
@Documented
public @interface ValidUsername {
String message() default "username is invalid";
String field();
String require();
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}

View File

@ -0,0 +1,43 @@
package de.jottyfan.camporganizer.module.registration.validate;
import org.springframework.beans.BeanWrapperImpl;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
/**
*
* @author jotty
*
*/
public class ValidUsernameValidator implements ConstraintValidator<ValidUsername, Object> {
private String field;
private String message;
private String require;
public void initialize(ValidUsername vu) {
this.field = vu.field();
this.message = vu.message();
this.require = vu.require();
}
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
Boolean forceCheck = (Boolean) new BeanWrapperImpl(value).getPropertyValue(require);
Boolean result = null;
if (forceCheck != null && forceCheck) {
Object login = new BeanWrapperImpl(value).getPropertyValue(field);
String loginString = String.valueOf(login);
result = login != null && !loginString.isBlank() && !loginString.contains(" ");
if (!result) {
context.buildConstraintViolationWithTemplate(message).addPropertyNode(field).addConstraintViolation()
.disableDefaultConstraintViolation();
}
} else {
result = true;
}
return result;
}
}

View File

@ -21,7 +21,7 @@ public class RssController extends CommonController {
private RssService service; private RssService service;
@GetMapping("/rss/{recipientCode}") @GetMapping("/rss/{recipientCode}")
public void toRssDirectly(@PathVariable String recipientCode, HttpServletResponse response) { public void toRssDirectly(@PathVariable("recipientCode") String recipientCode, HttpServletResponse response) {
service.getRss(recipientCode, response); service.getRss(recipientCode, response);
} }
} }

View File

@ -4,6 +4,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_RSS;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -30,9 +31,9 @@ import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
*/ */
@Repository @Repository
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public class RssGateway { public class RssRepository {
private static final Logger LOGGER = LogManager.getLogger(RssGateway.class); private static final Logger LOGGER = LogManager.getLogger(RssRepository.class);
@Autowired @Autowired
private DSLContext jooq; private DSLContext jooq;
@ -48,7 +49,9 @@ public class RssGateway {
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql.toString()); LOGGER.debug("{}", sql.toString());
List<RssBean> list = new ArrayList<>(); List<RssBean> list = new ArrayList<>();
for (Record3<Integer, String, LocalDateTime> r : sql.fetch()) { Iterator<Record3<Integer, String, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record3<Integer, String, LocalDateTime> r = i.next();
RssBean bean = new RssBean(r.get(T_RSS.PK)); RssBean bean = new RssBean(r.get(T_RSS.PK));
bean.setRecipient(recipientCode); bean.setRecipient(recipientCode);
bean.setMessage(r.get(T_RSS.MSG)); bean.setMessage(r.get(T_RSS.MSG));
@ -75,7 +78,9 @@ public class RssGateway {
// @formatter:on // @formatter:on
LOGGER.debug("{}", sql.toString()); LOGGER.debug("{}", sql.toString());
List<RssBean> list = new ArrayList<>(); List<RssBean> list = new ArrayList<>();
for (Record4<Integer, String, String, LocalDateTime> r : sql.fetch()) { Iterator<Record4<Integer, String, String, LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
Record4<Integer, String, String, LocalDateTime> r = i.next();
RssBean bean = new RssBean(r.get(T_RSS.PK)); RssBean bean = new RssBean(r.get(T_RSS.PK));
bean.setRecipient(r.get(T_RSS.RECIPIENT)); bean.setRecipient(r.get(T_RSS.RECIPIENT));
bean.setMessage(r.get(T_RSS.MSG)); bean.setMessage(r.get(T_RSS.MSG));

View File

@ -25,7 +25,7 @@ public class RssService {
private static final Logger LOGGER = LogManager.getLogger(RssService.class); private static final Logger LOGGER = LogManager.getLogger(RssService.class);
@Autowired @Autowired
private RssGateway repository; private RssRepository repository;
/** /**
* get the recipient's rss feed * get the recipient's rss feed

View File

@ -64,6 +64,16 @@ public class StaticPagesController extends CommonController {
return "/allgemeines"; return "/allgemeines";
} }
/**
* load the nachruf page
*
* @return the nachruf page
*/
@GetMapping("/nachruf")
public String getNachruf() {
return "/nachruf";
}
/** /**
* load the datenschutz page * load the datenschutz page
* *

View File

@ -1,5 +1,5 @@
# database credentials from defined config file # database credentials from defined config file
spring.config.import = /etc/CampOrganizer2/prod.properties spring.config.import = /etc/camporganizer.properties
# define overwriteable arguments # define overwriteable arguments
spring.datasource.driver-class-name = ${spring.datasource.driver-class-name:org.postgresql.Driver} spring.datasource.driver-class-name = ${spring.datasource.driver-class-name:org.postgresql.Driver}
@ -35,7 +35,3 @@ spring.mail.protocol = ${spring.mail.protocol}
spring.mail.test-connection = ${spring.mail.test-connection} spring.mail.test-connection = ${spring.mail.test-connection}
spring.mail.properties.mail.smtp.auth = ${spring.mail.properties.mail.smtp.auth} spring.mail.properties.mail.smtp.auth = ${spring.mail.properties.mail.smtp.auth}
spring.mail.properties.mail.smtp.starttls.enable = ${spring.mail.properties.mail.smtp.starttls.enable} spring.mail.properties.mail.smtp.starttls.enable = ${spring.mail.properties.mail.smtp.starttls.enable}
# for development only
server.port = 8081

View File

@ -65,6 +65,11 @@ div {
font-family: 'Cabin Sketch' !important; font-family: 'Cabin Sketch' !important;
} }
.titlefont {
font-family: 'Cabin Sketch' !important;
font-size: 40px;
}
.headlinefont { .headlinefont {
font-family: 'Cabin Sketch' !important; font-family: 'Cabin Sketch' !important;
font-size: xx-large; font-size: xx-large;
@ -442,3 +447,13 @@ div {
max-height: 80vh; max-height: 80vh;
overflow: auto; overflow: auto;
} }
.indexback {
background-image: url(/CampOrganizer2/images/indexback.jpg);
background-repeat: no-repeat;
background-size: cover;
min-width: 100vw;
height: 100vh;
margin: 0px !important;
padding: 100px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -105,8 +105,8 @@
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<label for="inputProfile" class="col-sm-2 col-form-label">Verantwortlicher</label> <label for="inputProfile" class="col-sm-2 col-form-label mb-2">Verantwortlicher</label>
<div class="col-sm-10"> <div class="col-sm-4 mb-2">
<span class="error" th:each="error : ${#fields.errors('fkProfile')}">[[${error}]]<br /></span> <select id="inputProfile" th:field="*{fkProfile}" <span class="error" th:each="error : ${#fields.errors('fkProfile')}">[[${error}]]<br /></span> <select id="inputProfile" th:field="*{fkProfile}"
th:class="${'form-select ' + (#fields.hasErrors('fkProfile') ? 'inputerror' : '')}"> th:class="${'form-select ' + (#fields.hasErrors('fkProfile') ? 'inputerror' : '')}">
<option value="">--- bitte wählen ---</option> <option value="">--- bitte wählen ---</option>
@ -118,6 +118,27 @@
}); });
</script> </script>
</div> </div>
<label for="startBooking" class="col-sm-2 col-form-label mb-2">Buchungsbeginn</label>
<div class="col-sm-4 mb-2">
<span class="error" th:each="error : ${#fields.errors('startBooking')}">[[${error}]]<br /></span> <input id="startBooking" type="date" th:field="*{startBooking}"
th:class="${'form-control ' + (#fields.hasErrors('startBooking') ? 'inputerror' : '')}" />
</div>
<label for="inputBedsFemale" class="col-sm-2 col-form-label mb-2">Anzahl Betten für Mädchen</label>
<div class="col-sm-4 mb-2">
<span class="error" th:each="error : ${#fields.errors('bedsFemale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{bedsFemale}" />
</div>
<label for="inputBedsMale" class="col-sm-2 col-form-label">Anzahl Betten für Jungen</label>
<div class="col-sm-4">
<span class="error" th:each="error : ${#fields.errors('bedsMale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{bedsMale}" />
</div>
<label for="inputBlockedBedsFemale" class="col-sm-2 col-form-label">Reservierte Betten für Mädchen</label>
<div class="col-sm-4">
<span class="error" th:each="error : ${#fields.errors('blockedBedsFemale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{blockedBedsFemale}" />
</div>
<label for="inputBlockedBedsMale" class="col-sm-2 col-form-label">Reservierte Betten für Jungen</label>
<div class="col-sm-4">
<span class="error" th:each="error : ${#fields.errors('blockedBedsMale')}">[[${error}]]<br /></span> <input type="number" class="form-control" th:field="*{blockedBedsMale}" />
</div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<label for="inputLockSales" class="col-sm-2 col-form-label">Kassenschluss</label> <label for="inputLockSales" class="col-sm-2 col-form-label">Kassenschluss</label>

View File

@ -10,13 +10,13 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="blocktext"> <div class="blocktext">
<h1>Statt Langeweile zu Hause Action auf einer Freizeit!</h1> <h1 class="titlefont">Statt Langeweile zu Hause Action auf einer Freizeit!</h1>
<p> <p>
Ferien sind cool! Das steht auf jeden Fall fest. Doch wenn die Freunde alle im Urlaub sind und du alleine zu Hause bleibst, Ferien sind cool! Das steht auf jeden Fall fest. Doch wenn die Freunde alle im Urlaub sind und du alleine zu Hause bleibst,
kommt schnell Langeweile auf. <strong>Warum also nicht einfach die Ferien mit vielen anderen Gleichaltrigen kommt schnell Langeweile auf. <strong>Warum also nicht einfach die Ferien mit vielen anderen Gleichaltrigen
verbringen und jede Menge Spaß erleben?</strong> Genau dafür stehen <strong>Onkel Werner Freizeiten!</strong> verbringen und jede Menge Spaß erleben?</strong> Genau dafür stehen <strong>Onkel Werner Freizeiten!</strong>
</p> </p>
<h2>Das sind Onkel Werner Freizeiten</h2> <h2 class="headlinefont">Das sind Onkel Werner Freizeiten</h2>
<p> <p>
<strong>Onkel Werner Freizeiten sind immer ein Erlebnis der besonderen Art.</strong> Je nach Freizeit verbringst du entweder <strong>Onkel Werner Freizeiten sind immer ein Erlebnis der besonderen Art.</strong> Je nach Freizeit verbringst du entweder
ein verlängertes Wochenende, eine Woche oder sogar zwei Wochen zusammen mit einer Hand voll Mitarbeitern und jeder Menge ein verlängertes Wochenende, eine Woche oder sogar zwei Wochen zusammen mit einer Hand voll Mitarbeitern und jeder Menge
@ -31,7 +31,7 @@
<p> <p>
<a th:href="@{/camplist}">Jetzt Freizeiten entdecken</a> <a th:href="@{/camplist}">Jetzt Freizeiten entdecken</a>
</p> </p>
<h2>Kinderfreizeiten in Olfen</h2> <h2 class="headlinefont">Kinderfreizeiten in Olfen</h2>
<p>Jede Menge Kinder in deinem Alter, viele coole Spiele, Sommerrodeln und spannende biblische Geschichten…</p> <p>Jede Menge Kinder in deinem Alter, viele coole Spiele, Sommerrodeln und spannende biblische Geschichten…</p>
<p>…das und noch viel mehr erwartet dich auf den Kinderfreizeiten in Olfen in den Oster- und Herbstferien. Olfen ist ein <p>…das und noch viel mehr erwartet dich auf den Kinderfreizeiten in Olfen in den Oster- und Herbstferien. Olfen ist ein
kleines Dorf in Hessen. Im großen Freizeitheim mit noch größerem Gelände drumherum erlebst du eine Woche voller Action, kleines Dorf in Hessen. Im großen Freizeitheim mit noch größerem Gelände drumherum erlebst du eine Woche voller Action,
@ -49,7 +49,7 @@
mit voller Geschwindigkeit zu fahren? Oder wer hat es lieber etwas langsamer und macht dabei ein entspanntes Gesicht auf dem mit voller Geschwindigkeit zu fahren? Oder wer hat es lieber etwas langsamer und macht dabei ein entspanntes Gesicht auf dem
Foto, das geschossen wird?</p> Foto, das geschossen wird?</p>
<p>Sei dabei und lerne neue Freunde kennen, die du bestimmt auch in der nächsten Freizeit wieder treffen wirst!</p> <p>Sei dabei und lerne neue Freunde kennen, die du bestimmt auch in der nächsten Freizeit wieder treffen wirst!</p>
<h2>Jugendfreizeit Grow Up</h2> <h2 class="headlinefont">Jugendfreizeit Grow Up</h2>
<p>Grow Up kann man mit heranwachsen übersetzen und genau darum geht es auf dieser Freizeit! Möchtest du im Glauben <p>Grow Up kann man mit heranwachsen übersetzen und genau darum geht es auf dieser Freizeit! Möchtest du im Glauben
heranwachsen, Gottes Wort begierig studieren und Gott noch tiefer erkennen? Dann bist du auf dieser Freizeit genau richtig!</p> heranwachsen, Gottes Wort begierig studieren und Gott noch tiefer erkennen? Dann bist du auf dieser Freizeit genau richtig!</p>
<p>Auf der Grow Up möchten wir dir unter anderem folgende Möglichkeiten bieten:</p> <p>Auf der Grow Up möchten wir dir unter anderem folgende Möglichkeiten bieten:</p>
@ -79,7 +79,7 @@
</p> </p>
<p>Du möchtest im Glauben herausgefordert werden, die Bibel und deinen Herrn besser kennenlernen und wirklich wachsen? <p>Du möchtest im Glauben herausgefordert werden, die Bibel und deinen Herrn besser kennenlernen und wirklich wachsen?
Dann komm zur Grow Up und sei bereit, dich von Gott verändern zu lassen!</p> Dann komm zur Grow Up und sei bereit, dich von Gott verändern zu lassen!</p>
<h2>Teeniefreizeit Schweiz</h2> <h2 class="headlinefont">Teeniefreizeit Schweiz</h2>
<p>Ab in die Berge zwei Wochen Schweiz: mit Bergen, Seen, Kühen und allem, was das Herz begehrt. Mit Sicherheit wirst du <p>Ab in die Berge zwei Wochen Schweiz: mit Bergen, Seen, Kühen und allem, was das Herz begehrt. Mit Sicherheit wirst du
dort eine ganze Menge erleben, denn das Programm ist vielfältig und voller Action!</p> dort eine ganze Menge erleben, denn das Programm ist vielfältig und voller Action!</p>
<p>Du wirst in diesen zwei Wochen die Möglichkeit haben, spannende Bibelarbeiten und gute Gemeinschaft mit Gott zu <p>Du wirst in diesen zwei Wochen die Möglichkeit haben, spannende Bibelarbeiten und gute Gemeinschaft mit Gott zu
@ -100,7 +100,7 @@
andere coole Dinge machen.</p> andere coole Dinge machen.</p>
<p>Bist du bereit, auf eine Woche voller Spaß und Action? Bist du bereit, dich verändern zu lassen? Bist du neugierig <p>Bist du bereit, auf eine Woche voller Spaß und Action? Bist du bereit, dich verändern zu lassen? Bist du neugierig
geworden? Dann sehen wir uns in der Schweiz!</p> geworden? Dann sehen wir uns in der Schweiz!</p>
<h2>Heimfreizeit für Kinder in Heilbronn</h2> <h2 class="headlinefont">Heimfreizeit für Kinder in Heilbronn</h2>
<p>Du hast noch zwei Wochen Sommerferien, wohnst in Heilbronn und hast noch nichts vor? Wie wäre es mit einem coolen und <p>Du hast noch zwei Wochen Sommerferien, wohnst in Heilbronn und hast noch nichts vor? Wie wäre es mit einem coolen und
abwechslungsreichen Tagesprogramm zusammen mit vielen anderen Kindern in deinem Alter?</p> abwechslungsreichen Tagesprogramm zusammen mit vielen anderen Kindern in deinem Alter?</p>
<p>Auf der Heimfreizeit hast du die Möglichkeit schon einmal ein bisschen hineinzuschnuppern, wie es sich anfühlt, auf <p>Auf der Heimfreizeit hast du die Möglichkeit schon einmal ein bisschen hineinzuschnuppern, wie es sich anfühlt, auf
@ -115,7 +115,7 @@
<p>Besondere Höhepunkte sind ein Besuch im Indoor-Spielplatz oder der Experimenta. Manchmal lässt Axel (Erlebnispädagoge) <p>Besondere Höhepunkte sind ein Besuch im Indoor-Spielplatz oder der Experimenta. Manchmal lässt Axel (Erlebnispädagoge)
sich auch etwas ganz Besonderes einfallen, wie zum Beispiel Flag-Football.</p> sich auch etwas ganz Besonderes einfallen, wie zum Beispiel Flag-Football.</p>
<p>Das klingt doch viel besser, als sich zu Hause zu langweilen, oder?</p> <p>Das klingt doch viel besser, als sich zu Hause zu langweilen, oder?</p>
<h2>Teeniefreizeit Hohenhaslach</h2> <h2 class="headlinefont">Teeniefreizeit Hohenhaslach</h2>
<p>Eine Woche Herbstferien und das hast keine Lust, sie zu verschwenden oder alleine zu Hause zu sitzen? Wie wärs mit <p>Eine Woche Herbstferien und das hast keine Lust, sie zu verschwenden oder alleine zu Hause zu sitzen? Wie wärs mit
einer herausfordernden Woche zusammen mit anderen Jugendlichen in den schönen Weinbergen von Baden-Württemberg?</p> einer herausfordernden Woche zusammen mit anderen Jugendlichen in den schönen Weinbergen von Baden-Württemberg?</p>
<p>Das Freizeitheim in Hohenhaslach liegt tatsächlich mitten in den Weinbergen, die natürlich im Herbst am schönsten <p>Das Freizeitheim in Hohenhaslach liegt tatsächlich mitten in den Weinbergen, die natürlich im Herbst am schönsten

View File

@ -43,6 +43,10 @@
<th>Freizeitpreis</th> <th>Freizeitpreis</th>
<td th:text="${booker.price}" /> <td th:text="${booker.price}" />
</tr> </tr>
<tr th:if="${booker.requiredPrice}">
<th>davon für <span th:text="${booker.name}"></span></th>
<td th:text="${#numbers.formatDecimal(booker.requiredPrice, 1, 2) + ' €'}"></td>
</tr>
<tr> <tr>
<th>Kontostand</th> <th>Kontostand</th>
<td><span th:text="${#numbers.formatDecimal(booker.paid, 1, 2) + ' €'}" th:if="${booker.paid != null}"></span></td> <td><span th:text="${#numbers.formatDecimal(booker.paid, 1, 2) + ' €'}" th:if="${booker.paid != null}"></span></td>

View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Business</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div class="mainpage">
<div class="container" style="max-width: 100%" sec:authorize="hasRole('business_outlay')">
<div class="alert alert-danger" th:unless="${bean}">Die Bearbeitung der Abrechnung ist nur dem Auslegenden erlaubt.</div>
<form th:action="@{/business/outlay/save}" th:object="${bean}" method="post" th:if="${bean}">
<input type="hidden" th:field="*{id}" />
<div class="row g-2">
<div class="col-lg-1 col-md-2 col-sm-12">Auslegender</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<input type="text" th:field="*{provider}" class="form-control" readonly="readonly" />
</div>
<div class="col-lg-1 col-md-2 col-sm-12">Händler / Shop</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<span class="error" th:each="error : ${#fields.errors('trader')}">[[${error}]]<br /></span> <input type="text" th:field="*{trader}" class="form-control" />
</div>
<div class="col-lg-1 col-md-2 col-sm-12">Freizeit</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<span class="error" th:each="error : ${#fields.errors('fkCamp')}">[[${error}]]<br /></span> <select id="inputCamp" th:field="*{fkCamp}"
th:class="${'form-select ' + (#fields.hasErrors('fkCamp') ? 'inputerror' : '')}">
<option value="">--- bitte wählen ---</option>
<option th:each="l : ${camps}" th:value="${l.id}" th:text="${l.campname}"></option>
</select>
<script type="text/javascript">
$(document).ready(function() {
$("#inputCamp").select2();
});
</script>
</div>
<div class="col-lg-1 col-md-2 col-sm-12">Betrag</div>
<div class="col-lg-10 col-md-9 col-sm-11">
<span class="error" th:each="error : ${#fields.errors('cash')}">[[${error}]]<br /></span> <input type="number" step="0.01" th:field="*{cash}" class="form-control" />
</div>
<div class="col-lg-1 col-md-1 col-sm-1 h3"></div>
<div class="col-lg-1 col-md-2 col-sm-12">Tag / Uhrzeit</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<input type="datetime-local" th:field="*{buydate}" class="form-control" step="1" />
</div>
<div class="col-lg-1 col-md-2 col-sm-12">Kassenzettelnummer</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<input type="text" th:field="*{recipenumber}" class="form-control" />
</div>
<div class="col-lg-1 col-md-2 col-sm-12">Kurzbeschreibung</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<textarea th:field="*{ingredients}" class="form-control"></textarea>
</div>
<div class="col-lg-1 col-md-2 col-sm-12">Bemerkungen</div>
<div class="col-lg-11 col-md-10 col-sm-12">
<textarea th:field="*{recipenote}" class="form-control"></textarea>
</div>
<div class="col-12 text-center">
<button type="submit" class="btn btn-success">Speichern</button>
<a th:href="@{/business/outlay}" class="btn btn-outline-secondary">Abbrechen</a>
<button type="button" class="btn btn-outline-danger" th:if="${bean.id}" data-bs-toggle="modal" data-bs-target="#deleteModal">Löschen</button>
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header alert alert-danger">
<h1 class="modal-title fs-5" id="deleteModalLabel">Löschen der Abrechnung</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Willst du wirklich diesen Eintrag mit einem Betrag von <span th:text="${#numbers.formatDecimal(bean.cash, 1, 2, 'COMMA')}"></span> € löschen? Diese Daten gehen dauerhaft verloren.
</div>
<div class="modal-footer">
<a th:href="@{/business/outlay/delete/{id}(id=${bean.id})}" class="btn btn-danger">endgültig löschen</a>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">abbrechen</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Business</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div class="mainpage">
<div class="container" style="max-width: 100%" sec:authorize="hasRole('business_outlay')">
<table id="table" class="table table-striped">
<thead>
<tr>
<th>Händler / Shop</th>
<th>Freizeit</th>
<th>Betrag</th>
<th>Tag / Uhrzeit</th>
</tr>
</thead>
<tbody>
<tr th:each="o : ${list}">
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${o.trader}"></a></td>
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${o.campname}"></a></td>
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${#numbers.formatDecimal(o.cash, 1, 2, 'COMMA')} + ' €'"></a></td>
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${#temporals.format(o.buydate, 'dd.MM.yyyy, HH:mm.ss')}"></a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4"><a th:href="@{/business/outlay/add}" class="btn btn-outline-primary form-control">neue Rechnung eintragen</a></td>
</tr>
</tfoot>
</table>
<script>
$(document).ready(function() {
$("#table").DataTable({
language : locale_de
});
});
</script>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -8,7 +8,12 @@
<th:block layout:fragment="content"> <th:block layout:fragment="content">
<div class="mainpage"> <div class="mainpage">
<div class="card"> <div class="card">
<div class="card-header">Nutzerverwaltung für die Abrechnung von Freizeiten</div> <div class="card-header">
<div>Nutzerverwaltung für die Abrechnung von Freizeiten</div>
<div class="alert alert-info">
Ist die gewünschte Person nicht in der Liste aller Personen enthalten, fehlt ihr vermutlich die passende Rolle in Keycloak.
</div>
</div>
<div class="card-body"> <div class="card-body">
<table id="privs" class="table table-striped"> <table id="privs" class="table table-striped">
<thead> <thead>
@ -45,6 +50,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-9"> <div class="col-sm-9">
<div th:if="${#fields.hasErrors('fkProfile')}" th:errorclass="error" th:errors="*{fkProfile}"></div>
<select th:id="${e.value.pk}" class="form-control select2-single" th:field="*{fkProfile}"> <select th:id="${e.value.pk}" class="form-control select2-single" th:field="*{fkProfile}">
<option value="">Auswählen</option> <option value="">Auswählen</option>
<th:block th:each="u : ${profiles}"> <th:block th:each="u : ${profiles}">

View File

@ -7,10 +7,6 @@
<body> <body>
<th:block layout:fragment="content"> <th:block layout:fragment="content">
<div class="mainpage"> <div class="mainpage">
<div class="alert alert-warning alert-dismissible fade show block660" role="alert">
<span>alte Zugangsdaten ins neue System </span><a th:href="@{/migration/login}">umziehen</a>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Schließen"></button>
</div>
<div th:replace="~{/fragments/camplist.html::camplist(camps=${camps})}"></div> <div th:replace="~{/fragments/camplist.html::camplist(camps=${camps})}"></div>
</div> </div>
</th:block> </th:block>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div class="container" sec:authorize="hasRole('registrator')">
<div class="row g-2">
<div class="col-sm-4" th:each="c : ${camps}">
<div class="card">
<div class="card-header"><span th:text="${c.title}" th:style="${c.isOver ? 'color: #555' : 'font-weight: bolder'}"></span></div>
<div class="card-body">
in <span th:text="${c.locationName}"></span><br />
<a th:href="@{/confirmation/board/camp/{id}(id=${c.pkCamp})}" class="btn btn-outline-primary">anzeigen</a>
</div>
</div>
</div>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div sec:authorize="hasRole('registrator')" style="margin: 8px">
<div class="btn-group" role="group">
<a class="btn btn-outline-primary" role="button" th:href="@{/confirmation/board/download/{id}(id=${campId})}"><i class="fas fa-download"></i>&nbsp;alles als CSV exportieren</a>
</div>
<br />
<table id="table" class="table table-striped">
<thead>
<tr>
<th>Bezahlt</th>
<th>Vorname</th>
<th>Nachname</th>
<th>Adresse</th>
<th>Kontakt</th>
<th>Gruppe</th>
<th>Geburtsdatum</th>
<th>Status</th>
<th>angemeldet</th>
<th>Foto</th>
<th>Kommentar</th>
</tr>
</thead>
<tbody>
<tr th:each="p : ${persons}">
<td th:text="${#strings.replace(#numbers.formatCurrency(p.paid), '¤', '€')}"></td>
<td th:text="${p.forename}"></td>
<td th:text="${p.surname}"></td>
<td><div th:text="${p.street}"></div> <span th:text="${p.zip}"></span>&nbsp;<span th:text="${p.city}"></span></td>
<td><div th:text="'Tel.: ' + ${p.phone}"></div>
<div th:text="${p.email}"></div></td>
<td><div th:text="${p.sex}"></div>
<div th:text="${p.camprolle}"></div></td>
<td><div th:text="${#temporals.format(p.birthDate, 'dd.MM.yyyy')}"></div>
<div th:text="${p.getAge(campStartDate)} + ' Jahre'"></div></td>
<td th:text="${p.accept}"></td>
<td th:text="${#temporals.format(p.created, 'dd.MM.yyyy HH:mm')}"></td>
<td><span th:text="${p.consentCatalogPhoto ? 'ja' : 'nein'}" th:if="${p.consentCatalogPhoto}"></span></td>
<td th:text="${p.comment}"></td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$("#table").DataTable({
language : locale_de
});
});
</script>
</div>
</th:block>
</body>
</html>

View File

@ -44,6 +44,7 @@
<div class="row mb-2"> <div class="row mb-2">
<label for="inputBirthdate" class="col-sm-2 col-form-label">Geburtstag</label> <label for="inputBirthdate" class="col-sm-2 col-form-label">Geburtstag</label>
<div class="col-sm-4"> <div class="col-sm-4">
<span class="error" th:each="error : ${#fields.errors('birthdate')}">[[${error}]]<br /></span>
<input type="date" th:field="*{birthdate}" class="inputBirthdate form-control" /> <input type="date" th:field="*{birthdate}" class="inputBirthdate form-control" />
</div> </div>
<label for="inputSex" class="col-sm-2 col-form-label">Geschlecht</label> <label for="inputSex" class="col-sm-2 col-form-label">Geschlecht</label>
@ -93,6 +94,16 @@
<textarea th:field="*{comment}" class="inputComment form-control"></textarea> <textarea th:field="*{comment}" class="inputComment form-control"></textarea>
</div> </div>
</div> </div>
<div class="row mb-2">
<label for="inputRequiredPrice" class="col-sm-2 col-form-label">individueller Preis</label>
<div class="col-sm-5">
<span class="error" th:each="error : ${#fields.errors('requiredPrice')}">[[${error}]]<br /></span>
<input type="number" th:field="*{requiredPrice}" class="inputRequiredPrice form-control" />
</div>
<div class="col-sm-5 d-flex align-items-center">
von offiziell&nbsp;<span th:utext="${campPrice}"></span>
</div>
</div>
<div class="row mb-2"> <div class="row mb-2">
<label for="outputAnno" class="col-sm-2 col-form-label">Anmerkungen</label> <label for="outputAnno" class="col-sm-2 col-form-label">Anmerkungen</label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -114,7 +125,7 @@
<label for="inputAccept" class="col-sm-2 col-form-label"></label> <label for="inputAccept" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10"> <div class="col-sm-10">
<button type="submit" class="btn btn-primary" onclick="progress.start()">Ok</button> <button type="submit" class="btn btn-primary" onclick="progress.start()">Ok</button>
<a th:href="@{/confirmation/}" class="btn btn-secondary">Abbrechen</a> <a th:href="@{/confirmation}" class="btn btn-secondary">Abbrechen</a>
</div> </div>
</div> </div>
</form> </form>

View File

@ -77,7 +77,7 @@
<div class="card"> <div class="card">
<div class="card-header">Teilnehmerdaten</div> <div class="card-header">Teilnehmerdaten</div>
<div class="card-body"> <div class="card-body">
<form th:action="@{/dashboard/update/}" th:object="${b}" method="post"> <form th:action="@{/dashboard/update}" th:object="${b}" method="post">
<input type="hidden" th:value="*{pk}" name="pk" /> <input type="hidden" th:value="*{pk}" name="pk" />
<div class="container"> <div class="container">
<div class="row mb-2"> <div class="row mb-2">
@ -126,8 +126,8 @@
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-sm-12">Foto-Einverständnis:&nbsp; <div class="col-sm-12">Foto-Einverständnis:&nbsp;
<a th:href="@{/registration/toggleconsent/{id}/(id=${b.pk})}" th:if="${!b.consentCatalogPhoto}"><i class="fas fa-ban framed framed-red" ></i></a> <a th:href="@{/registration/toggleconsent/{id}(id=${b.pk})}" th:if="${!b.consentCatalogPhoto}"><i class="fas fa-ban framed framed-red" ></i></a>
<a th:href="@{/registration/toggleconsent/{id}/(id=${b.pk})}" th:if="${b.consentCatalogPhoto}"><i class="fas fa-check framed framed-green" ></i></a> <a th:href="@{/registration/toggleconsent/{id}(id=${b.pk})}" th:if="${b.consentCatalogPhoto}"><i class="fas fa-check framed framed-green" ></i></a>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">

View File

@ -12,34 +12,46 @@
</h2> </h2>
<div th:id="'collapse' + ${c.pk}" class="accordion-collapse collapse" th:aria-labelledby="'heading' + ${c.pk}" data-bs-parent="#accordionExample"> <div th:id="'collapse' + ${c.pk}" class="accordion-collapse collapse" th:aria-labelledby="'heading' + ${c.pk}" data-bs-parent="#accordionExample">
<div class="accordion-body"> <div class="accordion-body">
<table style="width: 100%"> <div class="container">
<tr> <div class="row g-5">
<td rowspan="4"><img th:src="@{/images/Icon_Stern.svg}" width="36px" height="36px" style="margin-left: 24px" /></td> <div class="col-2 d-flex align-items-center">
<td rowspan="4"> <img th:src="@{/images/Icon_Stern.svg}" width="36px" height="36px" />
<div> </div>
<div class="col-4 d-flex align-items-center">
Biblische Geschichten<br /> Nachtwanderung<br /> Gruppenspiele<br /> Ausflüge<br /> Überraschungen Biblische Geschichten<br /> Nachtwanderung<br /> Gruppenspiele<br /> Ausflüge<br /> Überraschungen
</div> </div>
</td> <div class="col-6">
<td><span class="cabin">Ort</span></td> <div class="container">
<td><a th:href="${c.url}" th:text="${c.locationName}" target="_blank"></a></td> <div class="row g-3">
</tr> <div class="col-4 cabin">Ort</div>
<tr> <div class="col-8">
<td><img th:src="@{/images/Icon_Alter.svg}" width="36px" height="36px" style="margin-top: 24px" /></td> <a th:href="${c.url}" th:text="${c.locationName}" target="_blank"></a>
<td><div th:text="${c.minAge} + ' - ' + ${c.maxAge} + ' Jahre'" style="margin-top: 24px"></div></td> </div>
</tr> <div class="col-4"><img th:src="@{/images/Icon_Alter.svg}" width="36px" height="36px" /></div>
<tr> <div class="col-8" th:text="${c.minAge} + ' - ' + ${c.maxAge} + ' Jahre'"></div>
<td><img th:src="@{/images/Icon_Datum.svg}" width="36px" height="36px" style="margin-top: 24px" /></td> <div class="col-4"><img th:src="@{/images/Icon_Datum.svg}" width="36px" height="36px" /></div>
<td><div th:text="${#temporals.format(c.arrive, 'dd.MM.')} + ' - ' + ${#temporals.format(c.depart, 'dd.MM.yyyy')}" th:if="${c.arrive != null&& c.depart != null}" <div class="col-8"><span th:text="${#temporals.format(c.arrive, 'dd.MM.')} + ' - ' + ${#temporals.format(c.depart, 'dd.MM.yyyy')}" th:if="${c.arrive != null && c.depart != null}"></span></div>
style="margin-top: 24px"></div></td> <div class="col-4"><img th:src="@{/images/Icon_Preis.svg}" width="36px" height="36px" /></div>
</tr> <div class="col-8"><p th:text="${c.price}"></p></div>
<tr> </div>
<td><img th:src="@{/images/Icon_Preis.svg}" width="36px" height="36px" style="margin-top: 24px" /></td> </div>
<td><div style="margin-top: 24px"> </div>
<p th:text="${c.price}"></p> </div>
</div></td> <div class="row g-5" th:if="${c.bedsFemale + c.bedsMale > 0 and c.bookingHasStarted}">
</tr> <div class="col-2"><img th:src="@{/images/Icon_Bett.svg}" width="48px" height="48px" /></div>
</table> <div class="col-10 d-flex align-items-center" th:text="${'es sind nur noch ' + (c.bedsFemale - c.blockedBedsFemale - c.usedBedsFemale) + ' Mädchen- und ' + (c.bedsMale - c.blockedBedsMale - c.usedBedsMale) + ' Jungs- von ' + (c.bedsFemale + c.bedsMale) + ' Betten frei'}"></div>
<div style="text-align: center; margin-top: 64px"> <div class="col-12 alert alert-info alert-dismissible fade show" role="alert">
Sollten alle Betten bereits belegt sein, wird Deine Anmeldung auf die Warteliste gesetzt.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Schließen"></button>
</div>
</div>
<div class="row g-5" th:unless="${c.bookingHasStarted}">
<div class="col-12 alert alert-info" role="alert">
Die Anmeldung wird erst am <span th:text="${#temporals.format(c.startBooking, 'dd.MM.yyyy')}"></span> freigeschaltet.
</div>
</div>
</div>
<div style="text-align: center; margin-top: 48px" th:if="${c.bookingHasStarted}">
<a class="btn btn-linda buttonfont" th:href="@{/registration/{id}(id=${c.pk})}">jetzt anmelden</a> <a class="btn btn-linda buttonfont" th:href="@{/registration/{id}(id=${c.pk})}">jetzt anmelden</a>
</div> </div>
</div> </div>

View File

@ -6,17 +6,9 @@
</head> </head>
<body> <body>
<th:block layout:fragment="content"> <th:block layout:fragment="content">
<div class="container"> <div class="container indexback">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h1>Nachruf Onkel Werner</h1>
<img th:src="@{/images/ow-311x450.jpg}" alt="ow" width="200" align="left" class="leftimage rounded" />
<p>Am 11. März 2023 hat der Herr Jesus Christus unseren hochgeschätzten „Onkel Werner“ zu sich in den Himmel geholt sein wahres Zuhause, wie er immer wieder betont hatte. Nachdem er in den letzten Wochen körperlich immer schwächer geworden war, darf er nun ohne jegliche Schmerzen und Traurigkeit den sehen, für den er sein Leben investiert hat.</p>
<p>Wir sind wirklich dankbar für sein Vorbild in treuem Dienst bis ins hohe Alter, im Gebet und in der tiefen und herzlichen Liebe zu Gott und Menschen insbesondere zu Kindern und Jugendlichen! Es war sein größter Wunsch, dass möglichst viele Kinder vom Evangelium der rettenden Botschaft hören und ebenfalls ihr Leben in der Nachfolge des Herrn Jesus führen.</p>
<p>Dafür hat er mit Gottes Hilfe in den letzten 60 Jahren die heute bestehende Freizeitarbeit aufgebaut und dabei besonderen Wert darauf gelegt, dass Gott und sein Wort im Mittelpunkt stehen. Wie viele schöne Stunden durften wir miteinander erleben! Und wie viel unermesslicher Segen ist durch diese Freizeiten entstanden! Wir sind uns sicher, dass durch seine Kinderstunden, die Freizeiten und sein persönliches Vorbild hunderte (wenn nicht sogar tausende) junge Leute geprägt und verändert wurden.</p>
<p>Einen Tag vor seinem Tod sagte er dazu: „Ich will mir dafür nicht auf die Schulter klopfen. Es ist Gottes Werk.“</p>
<p>Wir dürfen dankbar sein, für das, was er durch Gottes Gnade aufgebaut hat und bitten euch herzlich um Gebet, um diese große Arbeit der Freizeiten so weiterzuführen, wie es dem Herrn gefällt und wie es sich auch Onkel Werner gewünscht hat. Er sagte, dass er sich wünscht und dafür betet, dass wir noch doppelt so viel Segen erleben dürften, ähnlich wie Elisa, der sich das doppelte des Geistes Elias erbat.</p>
<p>Onkel Werner wird uns fehlen, aber wir freuen uns, dass er nach einem erfüllten Leben sein Ziel erreichen durfte!</p>
<!-- <!--
<img class="img-fluid rounded" th:src="@{/images/start-banner-2019.jpg}" alt=""><br /> <img class="img-fluid rounded" th:src="@{/images/start-banner-2019.jpg}" alt=""><br />
<br /> <br />
@ -34,6 +26,15 @@
</p> </p>
</div> </div>
--> -->
<h2 class="headlinefont center">Willkommen bei den</h2>
<h1 class="titlefont center">MITTELPUNKT-FREIZEITEN</h1>
<br />
<br />
<div class="blocktext">
Du willst nicht einfach deine Zeit totschlagen, sondern etwas erleben?<br />
<br />
Dann bist du hier genau richtig! Bei den Mittelpunktfreizeiten geht es um Freundschaften, Spaß und vor allem Gottes Wort.
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -13,7 +13,7 @@
<strong>Onkel Werner Freizeiten e.V.</strong><br>Holger Zimmermann<br>Friedhofstraße 5<br>74189 Weinsberg <strong>Onkel Werner Freizeiten e.V.</strong><br>Holger Zimmermann<br>Friedhofstraße 5<br>74189 Weinsberg
</p> </p>
<p> <p>
<strong>E-Mail:</strong>&nbsp;<a href="mailto:info@jungscharfreizeiten.de">info@jungscharfreizeiten.de</a> <strong>E-Mail:</strong>&nbsp;<a href="mailto:info@mittelpunktfreizeiten.de">info@mittelpunktfreizeiten.de</a>
</p> </p>
</div> </div>
</div> </div>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div class="container">
<div class="row">
<div class="col">
<h1 class="titlefont">Nachruf Onkel Werner</h1>
<img th:src="@{/images/ow-311x450.jpg}" alt="ow" width="200" align="left" class="leftimage rounded" />
<p>Am 11. März 2023 hat der Herr Jesus Christus unseren hochgeschätzten „Onkel Werner“ zu sich in den Himmel geholt sein wahres Zuhause, wie er immer wieder betont hatte. Nachdem er in den letzten Wochen körperlich immer schwächer geworden war, darf er nun ohne jegliche Schmerzen und Traurigkeit den sehen, für den er sein Leben investiert hat.</p>
<p>Wir sind wirklich dankbar für sein Vorbild in treuem Dienst bis ins hohe Alter, im Gebet und in der tiefen und herzlichen Liebe zu Gott und Menschen insbesondere zu Kindern und Jugendlichen! Es war sein größter Wunsch, dass möglichst viele Kinder vom Evangelium der rettenden Botschaft hören und ebenfalls ihr Leben in der Nachfolge des Herrn Jesus führen.</p>
<p>Dafür hat er mit Gottes Hilfe in den letzten 60 Jahren die heute bestehende Freizeitarbeit aufgebaut und dabei besonderen Wert darauf gelegt, dass Gott und sein Wort im Mittelpunkt stehen. Wie viele schöne Stunden durften wir miteinander erleben! Und wie viel unermesslicher Segen ist durch diese Freizeiten entstanden! Wir sind uns sicher, dass durch seine Kinderstunden, die Freizeiten und sein persönliches Vorbild hunderte (wenn nicht sogar tausende) junge Leute geprägt und verändert wurden.</p>
<p>Einen Tag vor seinem Tod sagte er dazu: „Ich will mir dafür nicht auf die Schulter klopfen. Es ist Gottes Werk.“</p>
<p>Wir dürfen dankbar sein, für das, was er durch Gottes Gnade aufgebaut hat und bitten euch herzlich um Gebet, um diese große Arbeit der Freizeiten so weiterzuführen, wie es dem Herrn gefällt und wie es sich auch Onkel Werner gewünscht hat. Er sagte, dass er sich wünscht und dafür betet, dass wir noch doppelt so viel Segen erleben dürften, ähnlich wie Elisa, der sich das doppelte des Geistes Elias erbat.</p>
<p>Onkel Werner wird uns fehlen, aber wir freuen uns, dass er nach einem erfüllten Leben sein Ziel erreichen durfte!</p>
<!--
<img class="img-fluid rounded" th:src="@{/images/start-banner-2019.jpg}" alt=""><br />
<br />
<div class="blocktext">
<h1 style="text-align: left">Ferien, die in Erinnerung bleiben persönlich, echt, erlebnisreich</h1>
<p style="text-align: left">Du willst nicht einfach deine Zeit totschlagen, sondern Ferien erleben, die dein Leben prägen,
sinnvoll sind und dazu Spaß machen? Dann bist du hier genau richtig! Bei den Freizeiten geht es um Freundschaften, Spaß und
vor allem Gottes Wort. Genau dafür stehen Onkel Werner Freizeiten!</p>
<p></p>
<h2 style="text-align: left">Unsere Freizeiten</h2>
<h4 style="text-align: left">Erfahre hier, welche Freizeiten wir anbieten und was da so abgeht.</h4>
<p style="text-align: left">Preise, Termine und weitere Infos findest du in unserem Buchungsportal.</p>
<p style="text-align: left">
<a th:href="@{/camplist}">Jetzt Freizeiten entdecken</a>
</p>
</div>
-->
</div>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -9,7 +9,10 @@
<div class="mainpage"> <div class="mainpage">
<h1 class="centered cabin">Anmeldung</h1> <h1 class="centered cabin">Anmeldung</h1>
<h3 class="centered cabin" th:text="'zur ' + ${camp.name} + ' ' + ${camp.year}"></h3> <h3 class="centered cabin" th:text="'zur ' + ${camp.name} + ' ' + ${camp.year}"></h3>
<div class="card centered-card lindaborders" style="max-width: 48rem"> <div class="alert alert-warning" style="margin: auto; max-width: 450px" th:unless="${camp.bookingHasStarted}">
Die Anmeldung wird erst am <span th:text="${#temporals.format(camp.startBooking, 'dd.MM.yyyy')}"></span> freigeschaltet.
</div>
<div class="card centered-card lindaborders" style="max-width: 48rem" th:if="${camp.bookingHasStarted}">
<div class="card-body"> <div class="card-body">
<h1 class="centered cabin">Teilnehmeranmeldung</h1> <h1 class="centered cabin">Teilnehmeranmeldung</h1>
<form th:action="@{/registration/register}" th:object="${bean}" method="post"> <form th:action="@{/registration/register}" th:object="${bean}" method="post">
@ -17,6 +20,16 @@
<input type="hidden" th:field="*{fkCamp}" /> <input type="hidden" th:field="*{fkCamp}" />
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-12 rowdist" th:if="${wellknown}">
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle form-control" type="button" data-bs-toggle="dropdown" aria-expanded="false">
aus bisherigen Anmeldungen vorbefüllen
</button>
<ul class="dropdown-menu">
<li th:each="w : ${wellknown}"><a class="dropdown-item" href="#" th:attr="onclick=|useexisting('${w.json}')|"><span
th:text="${w.option}"></span></a></li>
</ul>
</div> </div>
<div class="col-sm-6 rowdist"> <div class="col-sm-6 rowdist">
<div>Vorname</div> <div>Vorname</div>
<input type="text" th:field="*{forename}" th:class="${'form-control ' + (#fields.hasErrors('forename') ? 'inputerror' : '')}" /> <input type="text" th:field="*{forename}" th:class="${'form-control ' + (#fields.hasErrors('forename') ? 'inputerror' : '')}" />
@ -122,6 +135,20 @@
</div> </div>
</div> </div>
</form> </form>
<script type="text/javascript">
function useexisting(o) {
j = JSON.parse(o);
$("#forename").val(j.forename);
$("#surname").val(j.surname);
$("#street").val(j.street);
$("#zip").val(j.zip);
$("#city").val(j.city);
$("#phone").val(j.phone);
$("#email").val(j.email);
$("#sex").val(j.sex);
$("#birthDate").val(j.birthDate);
}
</script>
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,15 +4,15 @@
<title>Camp Organizer 2</title> <title>Camp Organizer 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap/5.2.3/css/bootstrap.min.css} " /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/bootstrap/5.3.2/css/bootstrap.min.css} " />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/font-awesome/5.15.4/css/all.css} " /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/font-awesome/6.5.1/css/all.min.css} " />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/datatables/1.13.2/css/jquery.dataTables.min.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/datatables/1.13.5/css/jquery.dataTables.min.css}" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/select2/4.0.13/css/select2.min.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/webjars/select2/4.0.13/css/select2.min.css}" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/css/style.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/css/style.css}" />
<link th:rel="stylesheet" type="text/css" media="all" th:href="@{/css/select2-bootstrap-5-theme.min.css}" /> <link th:rel="stylesheet" type="text/css" media="all" th:href="@{/css/select2-bootstrap-5-theme.min.css}" />
<script th:src="@{/webjars/jquery/3.6.4/jquery.min.js}"></script> <script th:src="@{/webjars/jquery/3.7.1/jquery.min.js}"></script>
<script th:src="@{/webjars/bootstrap/5.2.3/js/bootstrap.bundle.min.js}"></script> <script th:src="@{/webjars/bootstrap/5.3.2/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/webjars/datatables/1.13.2/js/jquery.dataTables.min.js}"></script> <script th:src="@{/webjars/datatables/1.13.5/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/webjars/select2/4.0.13/js/select2.full.min.js}"></script> <script th:src="@{/webjars/select2/4.0.13/js/select2.full.min.js}"></script>
<script th:src="@{/js/dataTables.de.js}"></script> <script th:src="@{/js/dataTables.de.js}"></script>
<script th:src="@{/js/mytoggle.js}"></script> <script th:src="@{/js/mytoggle.js}"></script>
@ -22,9 +22,6 @@
<body> <body>
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light headerlayout navbar-background"> <nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light headerlayout navbar-background">
<span class="navbar-brand"><img th:src="@{/images/logo.png}" width="128px" style="margin-left: 8px" /></span> <span class="navbar-brand"><img th:src="@{/images/logo.png}" width="128px" style="margin-left: 8px" /></span>
<!-- remove? -->
<!-- <div class="container-fluid">
<!-- -->
<button class="navbar-toggler" style="margin-right: 40px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" <button class="navbar-toggler" style="margin-right: 40px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false"> aria-expanded="false">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
@ -33,6 +30,7 @@
<ul class="navbar-nav mb-2 mb-lg-0"> <ul class="navbar-nav mb-2 mb-lg-0">
<li class="nav-item"><a th:href="@{/ical}" class="btn btn-secondary btn-icon-silent" target="_blank" title="Freizeitdaten als ical herunterladen"><i class="far fa-calendar-alt"></i></a></li> <li class="nav-item"><a th:href="@{/ical}" class="btn btn-secondary btn-icon-silent" target="_blank" title="Freizeitdaten als ical herunterladen"><i class="far fa-calendar-alt"></i></a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/}">Startseite</a></li> <li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/}">Startseite</a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/nachruf}">Nachruf</a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/allgemeines}">Allgemeines</a></li> <li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/allgemeines}">Allgemeines</a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/camplist}">Freizeiten</a></li> <li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/camplist}">Freizeiten</a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/verein}">Verein</a></li> <li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/verein}">Verein</a></li>
@ -77,6 +75,7 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a th:href="@{/business}" class="dropdown-item menufont">Freizeitübersicht</a></li> <li><a th:href="@{/business}" class="dropdown-item menufont">Freizeitübersicht</a></li>
<li><a th:href="@{/business/bookings}" class="dropdown-item menufont" sec:authorize="hasRole('business_booking')">Buchungsübersicht</a></li> <li><a th:href="@{/business/bookings}" class="dropdown-item menufont" sec:authorize="hasRole('business_booking')">Buchungsübersicht</a></li>
<li><a th:href="@{/business/outlay}" class="dropdown-item menufont" sec:authorize="hasRole('business_outlay')">Auslagen / Rechnungen</a>
<li><a th:href="@{/business/privileges}" class="dropdown-item menufont" sec:authorize="hasRole('admin')">Nutzerverwaltung</a></li> <li><a th:href="@{/business/privileges}" class="dropdown-item menufont" sec:authorize="hasRole('admin')">Nutzerverwaltung</a></li>
</ul> </ul>
</div> </div>
@ -89,6 +88,7 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a th:href="@{/rss/registrator}" class="dropdown-item menufont"><i class="fas fa-rss"></i>&nbsp;RSS-Link</a></li> <li><a th:href="@{/rss/registrator}" class="dropdown-item menufont"><i class="fas fa-rss"></i>&nbsp;RSS-Link</a></li>
<li><a th:href="@{/confirmation}" class="dropdown-item menufont">Anmeldungsübersicht</a></li> <li><a th:href="@{/confirmation}" class="dropdown-item menufont">Anmeldungsübersicht</a></li>
<li><a th:href="@{/confirmation/board}" class="dropdown-item menufont">Listenübersicht</a></li>
</ul> </ul>
</div> </div>
</li> </li>
@ -136,7 +136,7 @@
</ul> </ul>
<ul class="dropdown-menu dropdown-menu-end" th:unless="${#strings.isEmpty(currentUser)}"> <ul class="dropdown-menu dropdown-menu-end" th:unless="${#strings.isEmpty(currentUser)}">
<li><a class="dropdown-item" th:href="@{${keycloakProfileUrl}}" target="_blank">Benutzername ändern</a></li> <li><a class="dropdown-item" th:href="@{${keycloakProfileUrl}}" target="_blank">Benutzername ändern</a></li>
<li><a class="dropdown-item" th:href="@{${keycloakProfileUrl} + '/password'}" target="_blank">Password ändern</a></li> <li><a class="dropdown-item" th:href="@{${keycloakPasswordUrl}}" target="_blank">Password ändern</a></li>
<li><hr /></li> <li><hr /></li>
<li><a class="dropdown-item" th:href="@{/logout}"><b th:inline="text">[[${currentUser}]]</b> ausloggen</a></li> <li><a class="dropdown-item" th:href="@{/logout}"><b th:inline="text">[[${currentUser}]]</b> ausloggen</a></li>
</ul> </ul>
@ -144,14 +144,13 @@
</li> </li>
</ul> </ul>
</div> </div>
<!-- </div> -->
</nav> </nav>
<div layout:fragment="content">content</div> <div layout:fragment="content">content</div>
<br /> <br />
<div class="container" style="margin-bottom: 24px"> <div class="container" style="margin-bottom: 24px">
<div class="row"> <div class="row">
<div class="col-md-10"> <div class="col-md-10">
<span> Copyright © 2022 <a class="text-light" href="https://www.onkelwernerfreizeiten.de/">Onkel Werner Freizeiten</a> All rights reserved. <span> Copyright © 2024 <a class="text-light" href="https://www.onkelwernerfreizeiten.de/">Onkel Werner Freizeiten</a> All rights reserved.
</span> </span>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">

View File

@ -8,35 +8,73 @@
<th:block layout:fragment="content"> <th:block layout:fragment="content">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col"> <div class="col-12">
<h2>Was ist der Onkel Werner Freizeiten Verein?</h2> <h2 class="headlinefont">Was ist der Onkel Werner Freizeiten Verein?</h2>
<p>Der Verein „Onkel Werner Freizeiten e.V.“ ist ein christliches Kinder- und Jugendwerk.</p> <p>Der Verein „Onkel Werner Freizeiten e.V.“ ist ein christliches Kinder- und Jugendwerk.</p>
<p>Seit unserer Gründung führen wir Ferienfreizeiten für Kinder und Jugendliche an verschiedenen Orten in Deutschland und <p>Seit unserer Gründung führen wir Ferienfreizeiten für Kinder und Jugendliche an verschiedenen Orten in Deutschland und der Schweiz durch. Diese ziehen jährlich bis zu 400 junge
der Schweiz durch. Diese ziehen jährlich bis zu 400 junge Menschen im Alter von 6 bis 17 Jahren aus ganz Deutschland an.</p> Menschen im Alter von 6 bis 17 Jahren aus ganz Deutschland an.</p>
<p>Wir sind vom Finanzamt Heilbronn als gemeinnützig und mildtätig anerkannt. Unser Name leitet sich vom Gründer der <p>Wir sind vom Finanzamt Heilbronn als gemeinnützig und mildtätig anerkannt. Unser Name leitet sich vom Gründer der Freizeitarbeit, Werner Blödtner, ab, der von vielen schlicht
Freizeitarbeit, Werner Blödtner, ab, der von vielen schlicht „Onkel Werner“ genannt wird.</p> „Onkel Werner“ genannt wird.</p>
<h2>Wie ist der Verein entstanden?</h2> <h2 class="headlinefont">Wie ist der Verein entstanden?</h2>
<p>Unser Verein wurde offiziell im November 2013 gegründet, um dem sozialen Engagement für Kinder und Jugendliche in der <p>Unser Verein wurde offiziell im November 2013 gegründet, um dem sozialen Engagement für Kinder und Jugendliche in der christlichen Freizeitarbeit einen Rahmen zu geben.</p>
christlichen Freizeitarbeit einen Rahmen zu geben.</p> <h3 class="headlinefont">Wie alles anfing</h3>
<h3>Wie alles anfing</h3> <p>Doch unsere Geschichte beginnt eigentlich schon vor mehr als fünf Jahrzehnten mit einem jungen Mann, der seine Liebe zu Jesus Christus fand und diese teilen wollte. Werner Blödtner
<p>Doch unsere Geschichte beginnt eigentlich schon vor mehr als fünf Jahrzehnten mit einem jungen Mann, der seine Liebe zu (später schlicht Onkel Werner genannt) hatte bereits zahlreiche Stunden in Sonntagsschule und Jungschar einer christlichen Gemeinde gestaltet, als er 1963 angefragt wird, eine mehrtägige
Jesus Christus fand und diese teilen wollte. Werner Blödtner (später schlicht Onkel Werner genannt) hatte bereits zahlreiche Freizeit in den Schulferien durchzuführen. Er lässt sich auf das Abenteuer ein und übernimmt 1978 die überregionale Kinder- und Teeniearbeit der Barmer Zeltmission.</p>
Stunden in Sonntagsschule und Jungschar einer christlichen Gemeinde gestaltet, als er 1963 angefragt wird, eine mehrtägige <h4 class="headlinefont">Die Bedingung</h4>
Freizeit in den Schulferien durchzuführen. Er lässt sich auf das Abenteuer ein und übernimmt 1978 die überregionale Kinder- <p>Allerdings nur unter folgender Vereinbarung mit Gott: Sollte sich kein Kind für den Herrn Jesus entscheiden, würde er mit der Arbeit wieder aufhören. Zu einer Kinderwoche im
und Teeniearbeit der Barmer Zeltmission.</p> Odenwald an Ostern kommen ca. 100 Kinder aus dem Ort und umliegenden Dörfern. Onkel Werner selbst sagt: „Das war für mich eine große Herausforderung. Wie würde Gott antworten? Ich war
<h4>Die Bedingung</h4> sehr erstaunt, dass nach und nach fünf Kinder den Wunsch äußerten, den Herrn Jesus in ihr Herz und Leben einzuladen.“</p>
<p>Allerdings nur unter folgender Vereinbarung mit Gott: Sollte sich kein Kind für den Herrn Jesus entscheiden, würde er <h4 class="headlinefont">Unterwegs für Jesus</h4>
mit der Arbeit wieder aufhören. Zu einer Kinderwoche im Odenwald an Ostern kommen ca. 100 Kinder aus dem Ort und umliegenden <p>Seither ist Onkel Werner also für Jesus Christus unterwegs. Neben den Kinderstundenwochen entwickelte sich nach und nach die Freizeitarbeit als Angebot in den Ferien der Kinder und
Dörfern. Onkel Werner selbst sagt: „Das war für mich eine große Herausforderung. Wie würde Gott antworten? Ich war sehr Teenies.</p>
erstaunt, dass nach und nach fünf Kinder den Wunsch äußerten, den Herrn Jesus in ihr Herz und Leben einzuladen.“</p> <h3 class="headlinefont">Der Verein</h3>
<h4>Unterwegs für Jesus</h4> <p>Und unser Verein? Der ist eben aus genau diesen Kindern und Jugendlichen entstanden, die selbst Onkel Werners Freizeiten besucht haben und später dort Mitarbeiter geworden sind.
<p>Seither ist Onkel Werner also für Jesus Christus unterwegs. Neben den Kinderstundenwochen entwickelte sich nach und Wir möchten, dass seine Arbeit weitergeführt wird. Aber vor allem wollen wir, dass noch viele Kinder und Jugendliche den Herrn Jesus kennen lernen können und mit ihm leben wollen.</p>
nach die Freizeitarbeit als Angebot in den Ferien der Kinder und Teenies.</p>
<h3>Der Verein</h3>
<p>Und unser Verein? Der ist eben aus genau diesen Kindern und Jugendlichen entstanden, die selbst Onkel Werners
Freizeiten besucht haben und später dort Mitarbeiter geworden sind. Wir möchten, dass seine Arbeit weitergeführt wird. Aber
vor allem wollen wir, dass noch viele Kinder und Jugendliche den Herrn Jesus kennen lernen können und mit ihm leben wollen.</p>
<p> <p>
<h3 class="headlinefont">Die Vereinsmitglieder</h3>
<p>In unserem Verein arbeiten verschiedene Freizeitbegeisterte mit, von denen sich hier ein paar vorstellen:</p>
</div>
<div class="col-sm-12 col-md-6">
<img th:src="@{/images/simeon.velleuer.jpg}" align="left" class="rounded" style="margin-right: 8px" /> Simeon Velleuer, 41 Jahre, verheiratet mit Anja und Vater von zwei wunderbaren
Kindern, Sophie und Kaleb. Für alle „Süddeutschen“ meine Heimat liegt „im Norden“ in Mettmann.<br /> <br /> Ich darf mittlerweile auf eine über zwanzigjährige Zeit in der Mitarbeit
mit Kids und Teens zurückblicken und bin unserem gnädigen Gott und Vater dafür sehr dankbar. Er hat mich errettet und aus der Finsternis in sein wunderbares Licht berufen (1.Petr. 2,9).
Diese Botschaft möchte ich gerne weitergeben - auf Freizeiten durch die froh machende Botschaft der Bibel und durch das ganz praktische und tägliche Leben.<br /> <br /> Ich erhoffe mir
von den Freizeiten, dass wir auf ein Leben mit Gott aufmerksam machen können. Das ist spannend und herausfordernd zugleich. Durch zahlreiche Erfahrungen in meinem Leben habe ich
feststellen können, dass Gott immer den richtigen Plan für jeden ganz persönlich längst fertig hat. Wir dürfen uns ihm ganz anvertrauen.<br /> <br /> (Es ist schon ein paar Jahre her,
als ich selber noch Teilnehmer auf der wunderschönen Griesalp war. Heutzutage fahren wir ins Kiental. Großartig gelegen inmitten der faszinierenden Bergwelt des Schweizer Berner
Oberlandes. Die Kombination aus Wanderungen und Andachten ist genau das Richtige für mich...und mit Sicherheit auch für dich.)<br />
<hr />
</div>
<div class="col-sm-12 col-md-6">
<img th:src="@{/images/joerg.henke.jpg}" align="left" class="rounded" style="margin-right: 8px" /> Jörg Henke, Vater von zwei atemberaubenden Töchtern. Aus Dresden unterstütze ich die
Freizeitarbeit v.a. im Bereich der Homepage und den Abrechnungen. Wenn ich es mal wieder schaffe, auch an einer Freizeit teilzunehmen, spiele ich gerne Gitarre und singe viele Lieder mit
den Teilnehmern.<br /> <br /> Als einer von Onkel Werners "Erben" darf ich mich an meine Bekehrung erinnern, die ich am 31.10.1993 erlebt habe. Details dazu gibt es auch hier: <a
href="https://www.jottyfan.de/bekehrung/" target="_blank">https://www.jottyfan.de/bekehrung/</a>.<br /> <br /> Gerade deswegen ist es mir wichtig, dass unsere Freizeiten stattfinden,
offen für finanziell schwächere Familien sind und wir durch die uns anvertrauten Spenden unterstützen können. Jedes Kind / jeder Teenie soll die rettende Botschaft vom Kreuz hören: dass
Jesus Christus gerade für dich gestorben und auferstanden ist, um dich von deinen Sünden zu befreien und dir damit ewiges Leben in der Gemeinschaft mit Gott schenkt. Sehr wertvoll finde
ich daher auch die Abendandachten, die es ermöglichen, genau diese Wahrheit zu verdeutlichen.<br />
<hr />
</div>
<div class="col-sm-12 col-md-6">
<img th:src="@{/images/anna.weiser.png}" align="left" class="rounded" style="margin-right: 8px" /> Mein Name ist Anna Weiser, ich bin Ehefrau und Mutter und arbeite seit ich 18 Jahre alt
bin auf den Freizeiten mit. Schnell habe ich gemerkt, dass der Herr mir das Anliegen für die Freizeitarbeit stärker aufs Herz legt und so habe ich mit der Zeit mehr Verantwortung übernehmen
und in den Verein eintreten dürfen.<br /><br />Mir liegt es stark am Herzen, Kindern, Jugendlichen und jungen Erwachsenen vom Evangelium zu erzählen, ihnen das Gottes Wort groß zu machen,
sie in der Nachfolge von Jesus Christus zu fördern und ihnen auch über die Freizeiten hinaus in ihrem Glaubensleben und ihrer Charakterentwicklung zu helfen.<br /><br />
Seit 2020 darf ich mit einem Minijob im Verein angestellt sein und übernehme neben der Freizeitarbeit (Schwerpunkt Teenie- und Jugendfreizeiten) vor allem Aufgaben im organisatorischen
Bereich und in der Nacharbeit mit Mädels und jungen Frauen.
<br />
<hr />
</div>
<div class="col-sm-12 col-md-6">
<img th:src="@{/images/linda.lang.png}" align="left" class="rounded" style="margin-right: 8px" /> Ich bin Linda und 22 Jahre alt. In meiner Freizeit fahre ich Inliner, reise und habe gerne
eine Kamera in der Hand. Schon als Kind durfte ich die Onkel Werner Freizeiten (vor allem die Heimfreizeiten) besuchen und auch da immer mehr über Gottes Wort lernen und nach meiner Bekehrung
weiter erkennen. Nachdem die Teilnehmer-Zeit vorbei war, durfte ich auch als Mitarbeiter auf Freizeiten unterstützen, bin aber im Verein hauptsächlich im Bereich der Website und Design tätig.<br /><br />
Das Besondere an den Onkel Werner Freizeiten ist, dass Kinder und Jugendliche nicht nur gemeinsam Spiel und Spaß haben, sondern auch hören und sehen, wie das Wort Gottes im Alltag angewandt
und erlebt werden kann. Der Mittelpunkt der Freizeiten ist Jesus Christus, der jedes einzelne Kind liebt und zu sich ruft, egal aus welchen Umständen es kommt. Wir möchten diese Gelegenheit
deshalb nutzen und sein Evangelium in den Freizeiten weitergeben.
<br />
<hr />
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,26 +0,0 @@
package de.jottyfan.camporganizer.module.registration;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.UserRepresentation;
/**
*
* @author jotty
*
*/
public class TestKeycloakRepository {
/**
* test registration
*/
@Test
public void testRegister() {
KeycloakRepository repository = new KeycloakRepository();
UserRepresentation user = repository.getUserRepresentation("Hans", "Dampf", "hans", "password", "hans@dampf.org");
UsersResource resource = repository.getUsersResource("http://localhost:8080", "ow", "owadmin", "password", "biblecamp");
assertTrue(repository.register(resource, user));
}
}