Compare commits
55 Commits
12a325ee03
...
main
Author | SHA1 | Date | |
---|---|---|---|
27c1669ed3 | |||
3bb68aff1f | |||
4c32a12d2d | |||
485a222be4 | |||
82ce501f39 | |||
d3389e4813 | |||
bdfe54a148 | |||
1d67aefa4d | |||
a801d3178a | |||
15a4388490 | |||
5a891c085d | |||
8cf1857c24 | |||
890d46dcdd | |||
b26b014225 | |||
2b2246f2de | |||
92970d8c63 | |||
be4b75eef4 | |||
31727e23ac | |||
2abb937725 | |||
b5403ae20c | |||
ae9e2018a8 | |||
32ef8a67d9 | |||
b10765fe89 | |||
8522def65c | |||
81d6f79857 | |||
fbfccd0dfc | |||
0e57c57ccc | |||
f0d30ec6ed | |||
7ab500e510 | |||
a373f5e758 | |||
f577164781 | |||
03eb781a98 | |||
ce819f80de | |||
1c226caa48 | |||
1580369794 | |||
39805aec20 | |||
0eb90092e7 | |||
fe8100c59e | |||
e20c24d006 | |||
72952b9c7b | |||
8f69320505 | |||
5a365b1a37 | |||
1d14a13aa6 | |||
8e790a7660 | |||
0d476c6f91 | |||
11abda3575 | |||
453105419f | |||
d4ae63f975 | |||
3dd39751af | |||
e0e972cfe8 | |||
b3a089d6b3 | |||
3147007632 | |||
5f78b87a87 | |||
5f6d71890e | |||
f21c7584bd |
@ -6,13 +6,6 @@
|
|||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="main"/>
|
<attribute name="gradle_scope" value="main"/>
|
||||||
|
7
.project
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>camporganizer2</name>
|
<name>CampOrganizer2</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
@ -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>
|
||||||
|
@ -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
|
||||||
|
2
.settings/org.springframework.ide.eclipse.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
boot.validation.initialized=true
|
||||||
|
eclipse.preferences.version=1
|
48
build.gradle
@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'org.springframework.boot' version '3.1.1'
|
id 'org.springframework.boot' version '3.3.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.7'
|
version = '0.9.7'
|
||||||
|
|
||||||
description = """CampOrganizer2"""
|
description = """CampOrganizer2"""
|
||||||
|
|
||||||
@ -35,52 +35,54 @@ 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.14'
|
||||||
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
|
implementation 'de.jottyfan:COJooq:2024.10.24'
|
||||||
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.24.1'
|
||||||
implementation 'org.webjars:font-awesome:5.15.4'
|
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
|
||||||
implementation 'org.webjars:jquery:3.6.4'
|
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.1'
|
||||||
implementation 'org.webjars:popper.js:2.9.3'
|
|
||||||
implementation 'org.webjars:datatables:1.13.2'
|
implementation 'org.webjars:bootstrap:5.3.3'
|
||||||
|
implementation 'org.webjars:font-awesome:6.5.2'
|
||||||
|
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 'org.webjars.npm:fancyapps__fancybox:3.5.7'
|
||||||
|
|
||||||
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.3.3'
|
||||||
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.4.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'
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
@ -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
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'CampOrganizer2'
|
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
public class Main extends SpringBootServletInitializer {
|
public class Main extends SpringBootServletInitializer {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(Main.class);
|
public static final Logger LOGGER = LogManager.getLogger(Main.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
@ -31,7 +31,7 @@ public class Main extends SpringBootServletInitializer {
|
|||||||
Path path = Paths.get("");
|
Path path = Paths.get("");
|
||||||
String p = path.toAbsolutePath().toString();
|
String p = path.toAbsolutePath().toString();
|
||||||
p = p.substring(p.lastIndexOf("/") + 1);
|
p = p.substring(p.lastIndexOf("/") + 1);
|
||||||
LOGGER.info("running in {}", p);
|
LOGGER.debug("running in {}", p);
|
||||||
// TODO: put p + "properties" somehow into consideration to load the application.properties
|
// TODO: put p + "properties" somehow into consideration to load the application.properties
|
||||||
SpringApplication.run(Main.class, args);
|
SpringApplication.run(Main.class, args);
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
|
@ -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);
|
||||||
|
@ -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("_", "/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -96,7 +96,7 @@ public class AdminRepository {
|
|||||||
.groupBy(T_DOCUMENT.PK, T_DOCUMENT.NAME, T_DOCUMENT.DOCTYPE, T_DOCUMENT.FILETYPE)
|
.groupBy(T_DOCUMENT.PK, T_DOCUMENT.NAME, T_DOCUMENT.DOCTYPE, T_DOCUMENT.FILETYPE)
|
||||||
.orderBy(T_DOCUMENT.PK);
|
.orderBy(T_DOCUMENT.PK);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
Record5<Integer, String, EnumDocument, EnumFiletype, EnumCamprole[]> r = sql.fetchOne();
|
Record5<Integer, String, EnumDocument, EnumFiletype, EnumCamprole[]> r = sql.fetchOne();
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
DocumentBean bean = new DocumentBean();
|
DocumentBean bean = new DocumentBean();
|
||||||
@ -129,9 +129,11 @@ public class AdminRepository {
|
|||||||
.groupBy(T_DOCUMENT.PK, T_DOCUMENT.NAME, T_DOCUMENT.DOCTYPE, T_DOCUMENT.FILETYPE)
|
.groupBy(T_DOCUMENT.PK, T_DOCUMENT.NAME, T_DOCUMENT.DOCTYPE, T_DOCUMENT.FILETYPE)
|
||||||
.orderBy(T_DOCUMENT.PK);
|
.orderBy(T_DOCUMENT.PK);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(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));
|
||||||
@ -160,9 +162,11 @@ public class AdminRepository {
|
|||||||
.from(T_DOCUMENT)
|
.from(T_DOCUMENT)
|
||||||
.where(condition);
|
.where(condition);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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));
|
||||||
@ -198,7 +202,7 @@ public class AdminRepository {
|
|||||||
.set(T_DOCUMENT.FILETYPE, bean.getFiletype())
|
.set(T_DOCUMENT.FILETYPE, bean.getFiletype())
|
||||||
.where(T_DOCUMENT.PK.eq(bean.getPk()));
|
.where(T_DOCUMENT.PK.eq(bean.getPk()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
} else {
|
} else {
|
||||||
InsertResultStep<TDocumentRecord> sql = DSL.using(c)
|
InsertResultStep<TDocumentRecord> sql = DSL.using(c)
|
||||||
@ -211,7 +215,7 @@ public class AdminRepository {
|
|||||||
.values(bean.getName(), bean.getDoctype(), bean.getDocument(), bean.getFiletype())
|
.values(bean.getName(), bean.getDoctype(), bean.getDocument(), bean.getFiletype())
|
||||||
.returning(T_DOCUMENT.PK);
|
.returning(T_DOCUMENT.PK);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
pk = sql.fetchOne().get(T_DOCUMENT.PK);
|
pk = sql.fetchOne().get(T_DOCUMENT.PK);
|
||||||
lrw.add(1);
|
lrw.add(1);
|
||||||
}
|
}
|
||||||
@ -229,7 +233,7 @@ public class AdminRepository {
|
|||||||
.onConflict(T_DOCUMENTROLE.FK_DOCUMENT, T_DOCUMENTROLE.CAMPROLE)
|
.onConflict(T_DOCUMENTROLE.FK_DOCUMENT, T_DOCUMENTROLE.CAMPROLE)
|
||||||
.doNothing();
|
.doNothing();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
removeCandidates.remove(role);
|
removeCandidates.remove(role);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -242,7 +246,7 @@ public class AdminRepository {
|
|||||||
.where(T_DOCUMENTROLE.FK_DOCUMENT.eq(pk))
|
.where(T_DOCUMENTROLE.FK_DOCUMENT.eq(pk))
|
||||||
.and(T_DOCUMENTROLE.CAMPROLE.in(removeCandidates));
|
.and(T_DOCUMENTROLE.CAMPROLE.in(removeCandidates));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
});
|
});
|
||||||
return lrw.getCounter();
|
return lrw.getCounter();
|
||||||
@ -264,7 +268,7 @@ public class AdminRepository {
|
|||||||
.set(T_CAMP.FK_DOCUMENT, (Integer) null)
|
.set(T_CAMP.FK_DOCUMENT, (Integer) null)
|
||||||
.where(T_CAMP.FK_DOCUMENT.eq(pk));
|
.where(T_CAMP.FK_DOCUMENT.eq(pk));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
|
|
||||||
UpdateConditionStep<TLocationRecord> sql1 = DSL.using(t)
|
UpdateConditionStep<TLocationRecord> sql1 = DSL.using(t)
|
||||||
@ -273,7 +277,7 @@ public class AdminRepository {
|
|||||||
.set(T_LOCATION.FK_DOCUMENT, (Integer) null)
|
.set(T_LOCATION.FK_DOCUMENT, (Integer) null)
|
||||||
.where(T_LOCATION.FK_DOCUMENT.eq(pk));
|
.where(T_LOCATION.FK_DOCUMENT.eq(pk));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql1.toString());
|
LOGGER.trace(sql1);
|
||||||
lrw.add(sql1.execute());
|
lrw.add(sql1.execute());
|
||||||
|
|
||||||
DeleteConditionStep<TDocumentroleRecord> sql2 = DSL.using(t)
|
DeleteConditionStep<TDocumentroleRecord> sql2 = DSL.using(t)
|
||||||
@ -281,7 +285,7 @@ public class AdminRepository {
|
|||||||
.deleteFrom(T_DOCUMENTROLE)
|
.deleteFrom(T_DOCUMENTROLE)
|
||||||
.where(T_DOCUMENTROLE.FK_DOCUMENT.eq(pk));
|
.where(T_DOCUMENTROLE.FK_DOCUMENT.eq(pk));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql2.toString());
|
LOGGER.trace(sql2);
|
||||||
lrw.add(sql2.execute());
|
lrw.add(sql2.execute());
|
||||||
|
|
||||||
DeleteConditionStep<TDocumentRecord> sql3 = DSL.using(t)
|
DeleteConditionStep<TDocumentRecord> sql3 = DSL.using(t)
|
||||||
@ -289,7 +293,7 @@ public class AdminRepository {
|
|||||||
.deleteFrom(T_DOCUMENT)
|
.deleteFrom(T_DOCUMENT)
|
||||||
.where(T_DOCUMENT.PK.eq(pk));
|
.where(T_DOCUMENT.PK.eq(pk));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql3.toString());
|
LOGGER.trace(sql3);
|
||||||
lrw.add(sql3.execute());
|
lrw.add(sql3.execute());
|
||||||
});
|
});
|
||||||
return lrw.getCounter();
|
return lrw.getCounter();
|
||||||
@ -302,7 +306,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public List<LocationBean> getLocations() {
|
public List<LocationBean> getLocations() {
|
||||||
SelectWhereStep<TLocationRecord> sql = jooq.selectFrom(T_LOCATION);
|
SelectWhereStep<TLocationRecord> sql = jooq.selectFrom(T_LOCATION);
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
List<LocationBean> list = new ArrayList<>();
|
List<LocationBean> list = new ArrayList<>();
|
||||||
for (TLocationRecord r : sql.fetch()) {
|
for (TLocationRecord r : sql.fetch()) {
|
||||||
list.add(LocationBean.of(r));
|
list.add(LocationBean.of(r));
|
||||||
@ -318,7 +322,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public LocationBean getLocation(Integer id) {
|
public LocationBean getLocation(Integer id) {
|
||||||
SelectConditionStep<TLocationRecord> sql = jooq.selectFrom(T_LOCATION).where(T_LOCATION.PK.eq(id));
|
SelectConditionStep<TLocationRecord> sql = jooq.selectFrom(T_LOCATION).where(T_LOCATION.PK.eq(id));
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return LocationBean.of(sql.fetchOne());
|
return LocationBean.of(sql.fetchOne());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +334,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public Integer deleteLocation(Integer id) {
|
public Integer deleteLocation(Integer id) {
|
||||||
DeleteConditionStep<TLocationRecord> sql = jooq.deleteFrom(T_LOCATION).where(T_LOCATION.PK.eq(id));
|
DeleteConditionStep<TLocationRecord> sql = jooq.deleteFrom(T_LOCATION).where(T_LOCATION.PK.eq(id));
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return sql.execute();
|
return sql.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +356,7 @@ public class AdminRepository {
|
|||||||
T_LOCATION.URL)
|
T_LOCATION.URL)
|
||||||
.values(bean.getName(), bean.getFkDocument(), bean.getUrl());
|
.values(bean.getName(), bean.getFkDocument(), bean.getUrl());
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
} else {
|
} else {
|
||||||
UpdateConditionStep<TLocationRecord> sql = DSL.using(t)
|
UpdateConditionStep<TLocationRecord> sql = DSL.using(t)
|
||||||
@ -363,7 +367,7 @@ public class AdminRepository {
|
|||||||
.set(T_LOCATION.URL, bean.getUrl())
|
.set(T_LOCATION.URL, bean.getUrl())
|
||||||
.where(T_LOCATION.PK.eq(bean.getPk()));
|
.where(T_LOCATION.PK.eq(bean.getPk()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -377,7 +381,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public List<CampBean> getAllCamps() {
|
public List<CampBean> getAllCamps() {
|
||||||
SelectWhereStep<TCampRecord> sql = jooq.selectFrom(T_CAMP);
|
SelectWhereStep<TCampRecord> sql = jooq.selectFrom(T_CAMP);
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
List<CampBean> list = new ArrayList<>();
|
List<CampBean> list = new ArrayList<>();
|
||||||
for (TCampRecord r : sql.fetch()) {
|
for (TCampRecord r : sql.fetch()) {
|
||||||
list.add(CampBean.of(r));
|
list.add(CampBean.of(r));
|
||||||
@ -393,7 +397,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public CampBean getCamp(Integer id) {
|
public CampBean getCamp(Integer id) {
|
||||||
SelectConditionStep<TCampRecord> sql = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(id));
|
SelectConditionStep<TCampRecord> sql = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(id));
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return CampBean.of(sql.fetchOne());
|
return CampBean.of(sql.fetchOne());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,11 +411,11 @@ public class AdminRepository {
|
|||||||
LambdaResultWrapper lrw = new LambdaResultWrapper();
|
LambdaResultWrapper lrw = new LambdaResultWrapper();
|
||||||
jooq.transaction(t -> {
|
jooq.transaction(t -> {
|
||||||
SelectConditionStep<TPersonRecord> sql1 = DSL.using(t).selectFrom(T_PERSON).where(T_PERSON.FK_CAMP.eq(id));
|
SelectConditionStep<TPersonRecord> sql1 = DSL.using(t).selectFrom(T_PERSON).where(T_PERSON.FK_CAMP.eq(id));
|
||||||
LOGGER.debug(sql1.toString());
|
LOGGER.trace(sql1);
|
||||||
Integer registrations = sql1.fetch().size();
|
Integer registrations = sql1.fetch().size();
|
||||||
if (registrations < 1) {
|
if (registrations < 1) {
|
||||||
DeleteConditionStep<TCampRecord> sql2 = DSL.using(t).deleteFrom(T_CAMP).where(T_CAMP.PK.eq(id));
|
DeleteConditionStep<TCampRecord> sql2 = DSL.using(t).deleteFrom(T_CAMP).where(T_CAMP.PK.eq(id));
|
||||||
LOGGER.debug(sql2.toString());
|
LOGGER.trace(sql2);
|
||||||
sql2.execute();
|
sql2.execute();
|
||||||
} else {
|
} else {
|
||||||
lrw.putString("error", String
|
lrw.putString("error", String
|
||||||
@ -434,7 +438,7 @@ public class AdminRepository {
|
|||||||
LocalDateTime arrive = arriveDate == null ? null : arriveDate.atStartOfDay();
|
LocalDateTime arrive = arriveDate == null ? null : arriveDate.atStartOfDay();
|
||||||
LocalDateTime depart = departDate == null ? null : departDate.atStartOfDay();
|
LocalDateTime depart = departDate == null ? null : departDate.atStartOfDay();
|
||||||
if (bean.getPk() == null) {
|
if (bean.getPk() == null) {
|
||||||
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,11 +452,17 @@ 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(), bean.getStartBooking());
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
} else {
|
} else {
|
||||||
UpdateConditionStep<TCampRecord> sql = DSL.using(t)
|
UpdateConditionStep<TCampRecord> sql = DSL.using(t)
|
||||||
@ -469,9 +479,14 @@ 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, bean.getStartBooking())
|
||||||
.where(T_CAMP.PK.eq(bean.getPk()));
|
.where(T_CAMP.PK.eq(bean.getPk()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -485,7 +500,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public List<ProfileBean> getProfiles() {
|
public List<ProfileBean> getProfiles() {
|
||||||
SelectWhereStep<TProfileRecord> sql = jooq.selectFrom(T_PROFILE);
|
SelectWhereStep<TProfileRecord> sql = jooq.selectFrom(T_PROFILE);
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
List<ProfileBean> list = new ArrayList<>();
|
List<ProfileBean> list = new ArrayList<>();
|
||||||
for (TProfileRecord r : sql.fetch()) {
|
for (TProfileRecord r : sql.fetch()) {
|
||||||
list.add(ProfileBean.of(r));
|
list.add(ProfileBean.of(r));
|
||||||
@ -525,9 +540,11 @@ public class AdminRepository {
|
|||||||
.where(T_CAMPPROFILE.MODULE.eq(module))
|
.where(T_CAMPPROFILE.MODULE.eq(module))
|
||||||
.orderBy(T_CAMP.ARRIVE, T_PROFILE.PK);
|
.orderBy(T_CAMP.ARRIVE, T_PROFILE.PK);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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);
|
||||||
@ -560,9 +577,11 @@ public class AdminRepository {
|
|||||||
.where(T_CAMPPROFILE.FK_PROFILE.eq(user))
|
.where(T_CAMPPROFILE.FK_PROFILE.eq(user))
|
||||||
.orderBy(T_CAMP.ARRIVE);
|
.orderBy(T_CAMP.ARRIVE);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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();
|
||||||
@ -597,9 +616,11 @@ public class AdminRepository {
|
|||||||
.where(T_CAMPPROFILE.FK_CAMP.eq(camp))
|
.where(T_CAMPPROFILE.FK_CAMP.eq(camp))
|
||||||
.orderBy(T_PROFILE.SURNAME, T_PROFILE.FORENAME);
|
.orderBy(T_PROFILE.SURNAME, T_PROFILE.FORENAME);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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);
|
||||||
@ -621,7 +642,7 @@ public class AdminRepository {
|
|||||||
*/
|
*/
|
||||||
public void deleteFromCampProfile(Integer id) {
|
public void deleteFromCampProfile(Integer id) {
|
||||||
DeleteConditionStep<TCampprofileRecord> sql = jooq.deleteFrom(T_CAMPPROFILE).where(T_CAMPPROFILE.PK.eq(id));
|
DeleteConditionStep<TCampprofileRecord> sql = jooq.deleteFrom(T_CAMPPROFILE).where(T_CAMPPROFILE.PK.eq(id));
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +666,7 @@ public class AdminRepository {
|
|||||||
T_CAMPPROFILE.MODULE)
|
T_CAMPPROFILE.MODULE)
|
||||||
.doNothing();
|
.doNothing();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(iso = DateTimeFormat.ISO.DATE_TIME)
|
||||||
|
private LocalDateTime startBooking;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate a camp bean out of r
|
* generate a camp bean out of r
|
||||||
@ -71,6 +86,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(r.getStartBooking());
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,4 +292,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 LocalDateTime getStartBooking() {
|
||||||
|
return startBooking;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param startBooking the startBooking to set
|
||||||
|
*/
|
||||||
|
public void setStartBooking(LocalDateTime startBooking) {
|
||||||
|
this.startBooking = startBooking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package de.jottyfan.camporganizer.module.business.bookings;
|
package de.jottyfan.camporganizer.module.business.bookings;
|
||||||
|
|
||||||
|
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;
|
||||||
@ -25,6 +26,8 @@ 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.EnumProgress;
|
||||||
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;
|
||||||
@ -50,23 +53,26 @@ public class BookingsRepository {
|
|||||||
* @return a list of bookings; an empty one at least
|
* @return a list of bookings; an empty one at least
|
||||||
*/
|
*/
|
||||||
public List<BookerBean> getBookings(String username) {
|
public List<BookerBean> getBookings(String username) {
|
||||||
SelectSeekStep4<Record10<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, String, Double>, EnumCamprole, EnumSex, String, String> sql = jooq
|
SelectSeekStep4<Record10<Integer, EnumProgress, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, String, Double>, EnumCamprole, EnumSex, String, String> sql = jooq
|
||||||
// @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, V_CAMP.NAME, V_CAMP.YEAR)
|
.select(T_PERSON.PK, T_PERSON.PROGRESS, 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.trace(sql);
|
||||||
List<BookerBean> list = new ArrayList<>();
|
List<BookerBean> list = new ArrayList<>();
|
||||||
for (Record r : sql.fetch()) {
|
Iterator<Record10<Integer, EnumProgress, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, String, Double>> i = sql.fetch().iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
Record10<Integer, EnumProgress, 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);
|
||||||
EnumSex sex = r.get(T_PERSON.SEX);
|
EnumSex sex = r.get(T_PERSON.SEX);
|
||||||
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
String campName = r.get(V_CAMP.NAME);
|
String campName = r.get(V_CAMP.NAME);
|
||||||
Double campYear = r.get(V_CAMP.YEAR);
|
Double campYear = r.get(V_CAMP.YEAR);
|
||||||
BookerBean bean = new BookerBean();
|
BookerBean bean = new BookerBean();
|
||||||
@ -75,7 +81,7 @@ public class BookingsRepository {
|
|||||||
bean.setRole(EnumConverter.role2GermanNames(role));
|
bean.setRole(EnumConverter.role2GermanNames(role));
|
||||||
bean.setSex(EnumConverter.sex2GermanNames(sex));
|
bean.setSex(EnumConverter.sex2GermanNames(sex));
|
||||||
bean.setBookingDate(r.get(T_PERSON.CREATED));
|
bean.setBookingDate(r.get(T_PERSON.CREATED));
|
||||||
bean.setAccept(r.get(T_PERSON.ACCEPT));
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
bean.setPaid(r.get(T_PERSON.PAID));
|
bean.setPaid(r.get(T_PERSON.PAID));
|
||||||
bean.setCamp(String.format("%s %4.0f", campName, campYear));
|
bean.setCamp(String.format("%s %4.0f", campName, campYear));
|
||||||
list.add(bean);
|
list.add(bean);
|
||||||
@ -91,10 +97,10 @@ public class BookingsRepository {
|
|||||||
* @return the booker bean or null
|
* @return the booker bean or null
|
||||||
*/
|
*/
|
||||||
public BookerBean getBooking(Integer id, String username) {
|
public BookerBean getBooking(Integer id, String username) {
|
||||||
SelectConditionStep<Record13<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, BigDecimal, String, Double, String, Integer>> sql = jooq
|
SelectConditionStep<Record13<Integer, EnumProgress, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime, BigDecimal, String, Double, String, Integer>> sql = jooq
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
.select(T_PERSON.PK,
|
.select(T_PERSON.PK,
|
||||||
T_PERSON.ACCEPT,
|
T_PERSON.PROGRESS,
|
||||||
T_PERSON.PAID,
|
T_PERSON.PAID,
|
||||||
T_PERSON.FORENAME,
|
T_PERSON.FORENAME,
|
||||||
T_PERSON.SURNAME,
|
T_PERSON.SURNAME,
|
||||||
@ -108,12 +114,12 @@ 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
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
Record r = sql.fetchOne();
|
Record r = sql.fetchOne();
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -122,6 +128,7 @@ public class BookingsRepository {
|
|||||||
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);
|
||||||
EnumSex sex = r.get(T_PERSON.SEX);
|
EnumSex sex = r.get(T_PERSON.SEX);
|
||||||
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
BigDecimal requiredPrice = r.get(T_PERSON.REQUIRED_PRICE);
|
BigDecimal requiredPrice = r.get(T_PERSON.REQUIRED_PRICE);
|
||||||
String campName = r.get(V_CAMP.NAME);
|
String campName = r.get(V_CAMP.NAME);
|
||||||
Double campYear = r.get(V_CAMP.YEAR);
|
Double campYear = r.get(V_CAMP.YEAR);
|
||||||
@ -132,7 +139,7 @@ public class BookingsRepository {
|
|||||||
bean.setRole(EnumConverter.role2GermanNames(role));
|
bean.setRole(EnumConverter.role2GermanNames(role));
|
||||||
bean.setSex(EnumConverter.sex2GermanNames(sex));
|
bean.setSex(EnumConverter.sex2GermanNames(sex));
|
||||||
bean.setBookingDate(r.get(T_PERSON.CREATED));
|
bean.setBookingDate(r.get(T_PERSON.CREATED));
|
||||||
bean.setAccept(r.get(T_PERSON.ACCEPT));
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
bean.setPaid(r.get(T_PERSON.PAID));
|
bean.setPaid(r.get(T_PERSON.PAID));
|
||||||
bean.setCamp(String.format("%s %4.0f", campName, campYear));
|
bean.setCamp(String.format("%s %4.0f", campName, campYear));
|
||||||
bean.setCampId(campId);
|
bean.setCampId(campId);
|
||||||
@ -158,7 +165,7 @@ public class BookingsRepository {
|
|||||||
.set(T_PERSON.PAID, value)
|
.set(T_PERSON.PAID, value)
|
||||||
.where(T_PERSON.PK.eq(pk));
|
.where(T_PERSON.PK.eq(pk));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return sql.execute();
|
return sql.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ import java.time.LocalDateTime;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class BookerBean implements Serializable {
|
public class BookerBean implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 2L;
|
||||||
|
|
||||||
private Integer pk;
|
private Integer pk;
|
||||||
private String name;
|
private String name;
|
||||||
private String role;
|
private String role;
|
||||||
private String sex;
|
private String sex;
|
||||||
private Boolean accept;
|
private String progress;
|
||||||
private LocalDateTime bookingDate;
|
private LocalDateTime bookingDate;
|
||||||
private BigDecimal paid;
|
private BigDecimal paid;
|
||||||
private String camp;
|
private String camp;
|
||||||
@ -24,20 +24,6 @@ public class BookerBean implements Serializable {
|
|||||||
private Integer campId;
|
private Integer campId;
|
||||||
private BigDecimal requiredPrice;
|
private BigDecimal requiredPrice;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the accept
|
|
||||||
*/
|
|
||||||
public Boolean getAccept() {
|
|
||||||
return accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param accept the accept to set
|
|
||||||
*/
|
|
||||||
public void setAccept(Boolean accept) {
|
|
||||||
this.accept = accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the paid
|
* @return the paid
|
||||||
*/
|
*/
|
||||||
@ -141,4 +127,18 @@ public class BookerBean implements Serializable {
|
|||||||
public void setRequiredPrice(BigDecimal requiredPrice) {
|
public void setRequiredPrice(BigDecimal requiredPrice) {
|
||||||
this.requiredPrice = requiredPrice;
|
this.requiredPrice = requiredPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the progress
|
||||||
|
*/
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param progress the progress to set
|
||||||
|
*/
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.trace(sql);
|
||||||
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.trace(sql);
|
||||||
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);
|
||||||
@ -133,7 +140,7 @@ public class BusinessRepository {
|
|||||||
.set(T_PERSON.PAID, bean.getPaid())
|
.set(T_PERSON.PAID, bean.getPaid())
|
||||||
.where(T_PERSON.PK.eq(bean.getFkPerson()));
|
.where(T_PERSON.PK.eq(bean.getFkPerson()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
count += sql.execute();
|
count += sql.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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,8 @@ 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.EnumProgress;
|
||||||
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 +56,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.trace(sql);
|
||||||
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));
|
||||||
@ -81,30 +85,33 @@ public class CampRepository {
|
|||||||
* @return a list of bookings; an empty one at least
|
* @return a list of bookings; an empty one at least
|
||||||
*/
|
*/
|
||||||
public List<PersonBean> getBookings(Integer pk, String username) {
|
public List<PersonBean> getBookings(Integer pk, String username) {
|
||||||
SelectSeekStep4<Record8<Integer, Boolean, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime>, EnumCamprole, EnumSex, String, String> sql = jooq
|
SelectSeekStep4<Record8<Integer, EnumProgress, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime>, EnumCamprole, EnumSex, String, String> sql = jooq
|
||||||
// @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.PROGRESS, 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.trace(sql);
|
||||||
List<PersonBean> list = new ArrayList<>();
|
List<PersonBean> list = new ArrayList<>();
|
||||||
for (Record r : sql.fetch()) {
|
Iterator<Record8<Integer, EnumProgress, BigDecimal, String, String, EnumCamprole, EnumSex, LocalDateTime>> i = sql.fetch().iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
Record8<Integer, EnumProgress, 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);
|
||||||
EnumSex sex = r.get(T_PERSON.SEX);
|
EnumSex sex = r.get(T_PERSON.SEX);
|
||||||
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
PersonBean bean = new PersonBean();
|
PersonBean bean = new PersonBean();
|
||||||
bean.setPk(r.get(T_PERSON.PK));
|
bean.setPk(r.get(T_PERSON.PK));
|
||||||
bean.setName(String.format("%s %s", forename, surname));
|
bean.setName(String.format("%s %s", forename, surname));
|
||||||
bean.setRole(EnumConverter.role2GermanNames(role));
|
bean.setRole(EnumConverter.role2GermanNames(role));
|
||||||
bean.setSex(EnumConverter.sex2GermanNames(sex));
|
bean.setSex(EnumConverter.sex2GermanNames(sex));
|
||||||
bean.setBookingDate(r.get(T_PERSON.CREATED));
|
bean.setBookingDate(r.get(T_PERSON.CREATED));
|
||||||
bean.setAccept(r.get(T_PERSON.ACCEPT));
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
bean.setPaid(r.get(T_PERSON.PAID));
|
bean.setPaid(r.get(T_PERSON.PAID));
|
||||||
list.add(bean);
|
list.add(bean);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ 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.db.jooq.enums.EnumProgress;
|
||||||
import de.jottyfan.camporganizer.module.business.camp.model.BookingBean;
|
import de.jottyfan.camporganizer.module.business.camp.model.BookingBean;
|
||||||
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;
|
||||||
@ -31,12 +32,12 @@ public class CampService {
|
|||||||
Integer rejected = 0;
|
Integer rejected = 0;
|
||||||
BigDecimal paid = new BigDecimal(0);
|
BigDecimal paid = new BigDecimal(0);
|
||||||
for (PersonBean p : campGateway.getBookings(id, username)) {
|
for (PersonBean p : campGateway.getBookings(id, username)) {
|
||||||
Boolean acceptence = p.getAccept();
|
String progress = p.getProgress();
|
||||||
if (acceptence == null) {
|
if (EnumProgress.requested.getLiteral().equals(progress)) {
|
||||||
open += 1;
|
open += 1;
|
||||||
} else if (acceptence) {
|
} else if (EnumProgress.approved.getLiteral().equals(progress)) {
|
||||||
approved += 1;
|
approved += 1;
|
||||||
} else {
|
} else if (EnumProgress.rejected.getLiteral().equals(progress)) {
|
||||||
rejected += 1;
|
rejected += 1;
|
||||||
}
|
}
|
||||||
paid = paid.add(p.getPaid() == null ? new BigDecimal(0) : p.getPaid());
|
paid = paid.add(p.getPaid() == null ? new BigDecimal(0) : p.getPaid());
|
||||||
|
@ -16,24 +16,10 @@ public class PersonBean implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
private String role;
|
private String role;
|
||||||
private String sex;
|
private String sex;
|
||||||
private Boolean accept;
|
private String progress;
|
||||||
private LocalDateTime bookingDate;
|
private LocalDateTime bookingDate;
|
||||||
private BigDecimal paid;
|
private BigDecimal paid;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the accept
|
|
||||||
*/
|
|
||||||
public Boolean getAccept() {
|
|
||||||
return accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param accept the accept to set
|
|
||||||
*/
|
|
||||||
public void setAccept(Boolean accept) {
|
|
||||||
this.accept = accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the paid
|
* @return the paid
|
||||||
*/
|
*/
|
||||||
@ -99,4 +85,18 @@ public class PersonBean implements Serializable {
|
|||||||
public void setBookingDate(LocalDateTime bookingDate) {
|
public void setBookingDate(LocalDateTime bookingDate) {
|
||||||
this.bookingDate = bookingDate;
|
this.bookingDate = bookingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the progress
|
||||||
|
*/
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param progress the progress to set
|
||||||
|
*/
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
package de.jottyfan.camporganizer.module.business.outlay;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.InputStreamResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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;
|
||||||
|
import jakarta.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @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.getListOf(super.getCurrentUser(principal), null));
|
||||||
|
model.addAttribute("camps", service.getAllCamps());
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/business/outlay/summary/{campid}")
|
||||||
|
public String getSummaryOfCamp(@PathVariable("campid") Integer campId, Model model, Principal principal) {
|
||||||
|
model.addAttribute("campid", campId);
|
||||||
|
model.addAttribute("list", service.getListOf(null, campId));
|
||||||
|
return "/business/outlay/summary";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/business/outlay/download/{campid}")
|
||||||
|
public ResponseEntity<Resource> generateCsv(@PathVariable("campid") Integer campId) {
|
||||||
|
String filename = String.format("rechnung_camp_%d.csv", campId);
|
||||||
|
InputStreamResource file = new InputStreamResource(service.getCsv(campId));
|
||||||
|
return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + filename)
|
||||||
|
.contentType(MediaType.parseMediaType("application/csv")).body(file);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,201 @@
|
|||||||
|
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.Record11;
|
||||||
|
import org.jooq.Record4;
|
||||||
|
import org.jooq.SelectConditionStep;
|
||||||
|
import org.jooq.SelectSeekStep1;
|
||||||
|
import org.jooq.UpdateConditionStep;
|
||||||
|
import org.jooq.impl.DSL;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import 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, Integer campId) {
|
||||||
|
SelectConditionStep<Record11<Integer, String, String, LocalDateTime, String, BigDecimal, LocalDateTime, String, String, String, String>> 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,
|
||||||
|
T_SALES.PROVIDER,
|
||||||
|
T_SALES.RECIPENUMBER,
|
||||||
|
T_SALES.INCREDIENTS,
|
||||||
|
T_SALES.RECIPENOTE)
|
||||||
|
.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(username == null ? DSL.trueCondition() : T_SALES.PROVIDER.eq(username))
|
||||||
|
.and(campId == null ? DSL.trueCondition() : T_SALES.FK_CAMP.eq(campId));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql);
|
||||||
|
List<OutlayBean> list = new ArrayList<>();
|
||||||
|
Iterator<Record11<Integer, String, String, LocalDateTime, String, BigDecimal, LocalDateTime, String, String, String, String>> i = sql.fetch()
|
||||||
|
.iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
Record11<Integer, String, String, LocalDateTime, String, BigDecimal, LocalDateTime, String, String, String, String> 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.setProvider(r.get(T_SALES.PROVIDER));
|
||||||
|
bean.setCash(r.get(T_SALES.CASH));
|
||||||
|
bean.setBuydate(r.get(T_SALES.BUYDATE));
|
||||||
|
bean.setRecipenumber(r.get(T_SALES.RECIPENUMBER));
|
||||||
|
bean.setIngredients(r.get(T_SALES.INCREDIENTS));
|
||||||
|
bean.setRecipenote(r.get(T_SALES.RECIPENOTE));
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package de.jottyfan.camporganizer.module.business.outlay;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
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> getListOf(String username, Integer campId) {
|
||||||
|
return repository.getListOf(username, campId);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InputStream getCsv(Integer campId) {
|
||||||
|
List<OutlayBean> list = repository.getListOf(null, campId);
|
||||||
|
StringBuilder buf = new StringBuilder("Beleg-Nummer;Einkauf bei;Freizeit;bezahlt von;Betrag;Bestandteile;Rechnungsdatum\n");
|
||||||
|
for (OutlayBean bean : list) {
|
||||||
|
buf.append(bean.toCsvLine());
|
||||||
|
}
|
||||||
|
return new ByteArrayInputStream(buf.toString().getBytes());
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,202 @@
|
|||||||
|
package de.jottyfan.camporganizer.module.business.outlay.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String quoted(String s) {
|
||||||
|
return s == null ? "" : String.format("\"%s\"", s.replace("\"", "'"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String cashed(BigDecimal money) {
|
||||||
|
return money == null ? "" : String.format("%s €", NumberFormat.getNumberInstance(Locale.GERMAN).format(money));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toCsvLine() {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.append(recipenumber).append(";");
|
||||||
|
buf.append(quoted(trader)).append(";");
|
||||||
|
buf.append(quoted(campname)).append(";");
|
||||||
|
buf.append(quoted(provider)).append(";");
|
||||||
|
buf.append(cashed(cash)).append(";");
|
||||||
|
buf.append(quoted(ingredients)).append(";");
|
||||||
|
buf.append(buydate).append("\n");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
}
|
@ -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";
|
||||||
|
}
|
||||||
|
}
|
@ -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.trace(sql);
|
||||||
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));
|
||||||
@ -79,7 +80,7 @@ public class PrivilegesRepository {
|
|||||||
.where((allowed == null || allowed.size() < 1) ? DSL.trueCondition() : T_PERSON.CAMPROLE.in(allowed))
|
.where((allowed == null || allowed.size() < 1) ? DSL.trueCondition() : T_PERSON.CAMPROLE.in(allowed))
|
||||||
.orderBy(T_PROFILE.SURNAME, T_PROFILE.FORENAME, T_PROFILE.DUEDATE);
|
.orderBy(T_PROFILE.SURNAME, T_PROFILE.FORENAME, T_PROFILE.DUEDATE);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
List<ProfileBean> list = new ArrayList<>();
|
List<ProfileBean> list = new ArrayList<>();
|
||||||
for (Record5<Integer, String, String, LocalDateTime, String> r : sql.fetch()) {
|
for (Record5<Integer, String, String, LocalDateTime, String> r : sql.fetch()) {
|
||||||
ProfileBean bean = new ProfileBean();
|
ProfileBean bean = new ProfileBean();
|
||||||
@ -93,30 +94,31 @@ 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.trace(sql);
|
||||||
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))));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return sql.execute();
|
return sql.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -33,6 +34,7 @@ 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.EnumDocument;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
|
||||||
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumProgress;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
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;
|
||||||
@ -45,15 +47,15 @@ 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;
|
||||||
|
|
||||||
public Stream<VCampRecord> getAllCamps(Condition condition) {
|
public Stream<VCampRecord> getAllCamps(Condition condition) {
|
||||||
SelectSeekStep1<VCampRecord, LocalDateTime> sql = jooq.selectFrom(V_CAMP).where(condition).orderBy(V_CAMP.ARRIVE);
|
SelectSeekStep1<VCampRecord, LocalDateTime> sql = jooq.selectFrom(V_CAMP).where(condition).orderBy(V_CAMP.ARRIVE);
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return sql.fetchStream();
|
return sql.fetchStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +77,7 @@ public class CamplistGateway {
|
|||||||
T_PERSON.CREATED,
|
T_PERSON.CREATED,
|
||||||
T_PERSON.EMAIL,
|
T_PERSON.EMAIL,
|
||||||
T_PERSON.SEX,
|
T_PERSON.SEX,
|
||||||
T_PERSON.ACCEPT,
|
T_PERSON.PROGRESS,
|
||||||
T_PERSON.FK_CAMP,
|
T_PERSON.FK_CAMP,
|
||||||
T_PROFILE.FORENAME,
|
T_PROFILE.FORENAME,
|
||||||
T_PROFILE.SURNAME,
|
T_PROFILE.SURNAME,
|
||||||
@ -98,11 +100,15 @@ public class CamplistGateway {
|
|||||||
.and(T_PERSON.PK.isNotNull())
|
.and(T_PERSON.PK.isNotNull())
|
||||||
.orderBy(V_CAMP.ARRIVE.desc(), T_PERSON.CREATED);
|
.orderBy(V_CAMP.ARRIVE.desc(), T_PERSON.CREATED);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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();
|
||||||
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
bean.setPk(r.get(T_PERSON.PK));
|
bean.setPk(r.get(T_PERSON.PK));
|
||||||
bean.setForename(r.get(T_PERSON.FORENAME));
|
bean.setForename(r.get(T_PERSON.FORENAME));
|
||||||
bean.setSurname(r.get(T_PERSON.SURNAME));
|
bean.setSurname(r.get(T_PERSON.SURNAME));
|
||||||
@ -126,7 +132,6 @@ public class CamplistGateway {
|
|||||||
bean.setUrl(r.get(V_CAMP.URL));
|
bean.setUrl(r.get(V_CAMP.URL));
|
||||||
bean.setIsOver(r.get(V_CAMP.IS_OVER));
|
bean.setIsOver(r.get(V_CAMP.IS_OVER));
|
||||||
bean.setCampName(r.get(V_CAMP.NAME));
|
bean.setCampName(r.get(V_CAMP.NAME));
|
||||||
bean.setAccept(r.get(T_PERSON.ACCEPT));
|
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
String forename = r.get(REGISTRATOR.FORENAME);
|
String forename = r.get(REGISTRATOR.FORENAME);
|
||||||
String surname = r.get(REGISTRATOR.SURNAME);
|
String surname = r.get(REGISTRATOR.SURNAME);
|
||||||
@ -182,9 +187,11 @@ public class CamplistGateway {
|
|||||||
.from(T_DOCUMENT)
|
.from(T_DOCUMENT)
|
||||||
.where(T_DOCUMENT.DOCTYPE.eq(EnumDocument.camppass)));
|
.where(T_DOCUMENT.DOCTYPE.eq(EnumDocument.camppass)));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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<>();
|
@ -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;
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
|
@ -41,7 +41,7 @@ public class BookingBean implements Serializable {
|
|||||||
private Boolean isOver;
|
private Boolean isOver;
|
||||||
private String campName;
|
private String campName;
|
||||||
private String registrator;
|
private String registrator;
|
||||||
private Boolean accept;
|
private String progress;
|
||||||
private String subscriber;
|
private String subscriber;
|
||||||
|
|
||||||
private List<DocumentBean> documents;
|
private List<DocumentBean> documents;
|
||||||
@ -396,14 +396,6 @@ public class BookingBean implements Serializable {
|
|||||||
this.registrator = registrator;
|
this.registrator = registrator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getAccept() {
|
|
||||||
return accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccept(Boolean accept) {
|
|
||||||
this.accept = accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubscriber() {
|
public String getSubscriber() {
|
||||||
return subscriber;
|
return subscriber;
|
||||||
}
|
}
|
||||||
@ -416,4 +408,18 @@ public class BookingBean implements Serializable {
|
|||||||
return documents;
|
return documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the progress
|
||||||
|
*/
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param progress the progress to set
|
||||||
|
*/
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
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.EnumProgress;
|
||||||
|
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();
|
||||||
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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.getProgress());
|
||||||
|
append(buf, bean.getCreated());
|
||||||
|
append(buf, bean.getConsentCatalogPhoto());
|
||||||
|
append(buf, bean.getComment());
|
||||||
|
buf.append("\n");
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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 String progress;
|
||||||
|
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 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the progress
|
||||||
|
*/
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param progress the progress to set
|
||||||
|
*/
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ 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.PathVariable;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
import de.jottyfan.camporganizer.module.camplist.CommonController;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
||||||
@ -20,22 +21,32 @@ import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOver
|
|||||||
public class ConfirmationController extends CommonController {
|
public class ConfirmationController extends CommonController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfirmationService indexService;
|
private ConfirmationService service;
|
||||||
|
|
||||||
@GetMapping("/confirmation")
|
@GetMapping("/confirmation")
|
||||||
public String getIndex(Model model) {
|
public String getIndex(Model model) {
|
||||||
List<CampOverviewBean> campoverview = indexService.getCampOverview(super.getCurrentUser());
|
List<CampOverviewBean> campoverview = service.getCampOverview(super.getCurrentUser());
|
||||||
CampOverviewBean campoverviewsummary = new CampOverviewBean(LocalDate.now(), "summary");
|
CampOverviewBean campoverviewsummary = new CampOverviewBean(LocalDate.now(), "summary");
|
||||||
for (CampOverviewBean bean : campoverview) {
|
for (CampOverviewBean bean : campoverview) {
|
||||||
campoverviewsummary.setApproved(bean.getApproved() + campoverviewsummary.getApproved());
|
campoverviewsummary.setApproved(bean.getApproved() + campoverviewsummary.getApproved());
|
||||||
campoverviewsummary.setRejected(bean.getRejected() + campoverviewsummary.getRejected());
|
campoverviewsummary.setRejected(bean.getRejected() + campoverviewsummary.getRejected());
|
||||||
campoverviewsummary.setUntouched(bean.getUntouched() + campoverviewsummary.getUntouched());
|
campoverviewsummary.setUntouched(bean.getUntouched() + campoverviewsummary.getUntouched());
|
||||||
|
campoverviewsummary.setRevoked(bean.getRevoked() + campoverviewsummary.getRevoked());
|
||||||
}
|
}
|
||||||
model.addAttribute("campoverview", campoverview);
|
model.addAttribute("campoverview", campoverview);
|
||||||
model.addAttribute("campoverviewsummary", campoverviewsummary);
|
model.addAttribute("campoverviewsummary", campoverviewsummary);
|
||||||
model.addAttribute("untouched", indexService.getUntouched(super.getCurrentUser()));
|
model.addAttribute("untouched", service.getUntouched(super.getCurrentUser()));
|
||||||
model.addAttribute("approved", indexService.getApproved(super.getCurrentUser()));
|
model.addAttribute("approved", service.getApproved(super.getCurrentUser()));
|
||||||
model.addAttribute("rejected", indexService.getRejected(super.getCurrentUser()));
|
model.addAttribute("rejected", service.getRejected(super.getCurrentUser()));
|
||||||
|
model.addAttribute("revoked", service.getRevoked(super.getCurrentUser()));
|
||||||
return "confirmation/confirmation";
|
return "confirmation/confirmation";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/registration/remove/{id}")
|
||||||
|
public String revoke(@PathVariable("id") Integer id, final Model model) {
|
||||||
|
service.removeBooking(id);
|
||||||
|
return "redirect:/confirmation";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,17 @@ package de.jottyfan.camporganizer.module.confirmation.confirmation;
|
|||||||
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_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_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_RSS;
|
||||||
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;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
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;
|
||||||
|
|
||||||
@ -17,12 +21,17 @@ 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;
|
||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
|
import org.jooq.DeleteConditionStep;
|
||||||
|
import org.jooq.InsertValuesStep2;
|
||||||
import org.jooq.Name;
|
import org.jooq.Name;
|
||||||
import org.jooq.Record4;
|
import org.jooq.Record4;
|
||||||
|
import org.jooq.Record5;
|
||||||
import org.jooq.Record7;
|
import org.jooq.Record7;
|
||||||
import org.jooq.Record8;
|
import org.jooq.Record8;
|
||||||
|
import org.jooq.SelectConditionStep;
|
||||||
import org.jooq.SelectHavingStep;
|
import org.jooq.SelectHavingStep;
|
||||||
import org.jooq.SelectSeekStep1;
|
import org.jooq.SelectSeekStep1;
|
||||||
|
import org.jooq.exception.DataAccessException;
|
||||||
import org.jooq.impl.DSL;
|
import org.jooq.impl.DSL;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -30,6 +39,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.EnumModule;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
||||||
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumProgress;
|
||||||
|
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.TRssRecord;
|
||||||
|
import de.jottyfan.camporganizer.module.camplist.model.LambdaResultWrapper;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.BookingBean;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.BookingBean;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
||||||
|
|
||||||
@ -54,10 +68,10 @@ public class ConfirmationRepository {
|
|||||||
*/
|
*/
|
||||||
public List<CampOverviewBean> getCampOverviewBeans(String currentUser) {
|
public List<CampOverviewBean> getCampOverviewBeans(String currentUser) {
|
||||||
Name COUNT = DSL.name("count");
|
Name COUNT = DSL.name("count");
|
||||||
SelectHavingStep<Record4<Integer, Boolean, String, LocalDateTime>> sql = jooq
|
SelectHavingStep<Record4<Integer, EnumProgress, String, LocalDateTime>> sql = jooq
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
.select(DSL.count(T_PERSON.PK).as(COUNT),
|
.select(DSL.count(T_PERSON.PK).as(COUNT),
|
||||||
T_PERSON.ACCEPT,
|
T_PERSON.PROGRESS,
|
||||||
T_CAMP.NAME,
|
T_CAMP.NAME,
|
||||||
T_CAMP.ARRIVE)
|
T_CAMP.ARRIVE)
|
||||||
.from(T_PERSON)
|
.from(T_PERSON)
|
||||||
@ -67,13 +81,15 @@ public class ConfirmationRepository {
|
|||||||
.where(T_CAMP.ARRIVE.isNotNull())
|
.where(T_CAMP.ARRIVE.isNotNull())
|
||||||
.and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
|
.and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
|
||||||
.and(T_PROFILE.USERNAME.eq(currentUser))
|
.and(T_PROFILE.USERNAME.eq(currentUser))
|
||||||
.groupBy(T_CAMP.NAME, T_CAMP.ARRIVE, T_PERSON.ACCEPT);
|
.groupBy(T_CAMP.NAME, T_CAMP.ARRIVE, T_PERSON.PROGRESS);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
Map<LocalDateTime, CampOverviewBean> map = new HashMap<>();
|
Map<LocalDateTime, CampOverviewBean> map = new HashMap<>();
|
||||||
for (Record4<Integer, Boolean, String, LocalDateTime> r : sql.fetch()) {
|
Iterator<Record4<Integer, EnumProgress, String, LocalDateTime>> i = sql.fetch().iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
Record4<Integer, EnumProgress, 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);
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
String campname = r.get(T_CAMP.NAME);
|
String campname = r.get(T_CAMP.NAME);
|
||||||
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
|
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
|
||||||
CampOverviewBean bean = map.get(arrive);
|
CampOverviewBean bean = map.get(arrive);
|
||||||
@ -81,12 +97,14 @@ public class ConfirmationRepository {
|
|||||||
bean = new CampOverviewBean(arrive.toLocalDate(), campname);
|
bean = new CampOverviewBean(arrive.toLocalDate(), campname);
|
||||||
map.put(arrive, bean);
|
map.put(arrive, bean);
|
||||||
}
|
}
|
||||||
if (accept == null) {
|
if (progress == null || EnumProgress.requested.equals(progress)) {
|
||||||
bean.setUntouched(count);
|
bean.setUntouched(count);
|
||||||
} else if (accept) {
|
} else if (EnumProgress.approved.equals(progress)) {
|
||||||
bean.setApproved(count);
|
bean.setApproved(count);
|
||||||
} else {
|
} else if (EnumProgress.rejected.equals(progress)) {
|
||||||
bean.setRejected(count);
|
bean.setRejected(count);
|
||||||
|
} else if (EnumProgress.revoked.equals(progress)) {
|
||||||
|
bean.setRevoked(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<CampOverviewBean> list = new ArrayList<>(map.values());
|
List<CampOverviewBean> list = new ArrayList<>(map.values());
|
||||||
@ -114,9 +132,11 @@ public class ConfirmationRepository {
|
|||||||
.and(T_PROFILE.USERNAME.eq(currentUser))
|
.and(T_PROFILE.USERNAME.eq(currentUser))
|
||||||
.orderBy(T_PERSON.CREATED.desc());
|
.orderBy(T_PERSON.CREATED.desc());
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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);
|
||||||
@ -140,7 +160,7 @@ public class ConfirmationRepository {
|
|||||||
* @return a list of booking beans; an empty one at least
|
* @return a list of booking beans; an empty one at least
|
||||||
*/
|
*/
|
||||||
public List<BookingBean> getUntouched(String currentUser) {
|
public List<BookingBean> getUntouched(String currentUser) {
|
||||||
return getListWithCondition(currentUser, T_PERSON.ACCEPT.isNull());
|
return getListWithCondition(currentUser, T_PERSON.PROGRESS.eq(EnumProgress.requested));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,7 +170,7 @@ public class ConfirmationRepository {
|
|||||||
* @return a list of booking beans; an empty one at least
|
* @return a list of booking beans; an empty one at least
|
||||||
*/
|
*/
|
||||||
public List<BookingBean> getApproved(String currentUser) {
|
public List<BookingBean> getApproved(String currentUser) {
|
||||||
return getListWithCondition(currentUser, T_PERSON.ACCEPT.isTrue());
|
return getListWithCondition(currentUser, T_PERSON.PROGRESS.eq(EnumProgress.approved));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +180,17 @@ public class ConfirmationRepository {
|
|||||||
* @return a list of booking beans; an empty one at least
|
* @return a list of booking beans; an empty one at least
|
||||||
*/
|
*/
|
||||||
public List<BookingBean> getRejected(String currentUser) {
|
public List<BookingBean> getRejected(String currentUser) {
|
||||||
return getListWithCondition(currentUser, T_PERSON.ACCEPT.isFalse());
|
return getListWithCondition(currentUser, T_PERSON.PROGRESS.eq(EnumProgress.rejected));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get all revoked bookings that this user can manage
|
||||||
|
*
|
||||||
|
* @param currentUser the current user
|
||||||
|
* @return a list of booking beans; an empty one at least
|
||||||
|
*/
|
||||||
|
public List<BookingBean> getRevoked(String currentUser) {
|
||||||
|
return getListWithCondition(currentUser, T_PERSON.PROGRESS.eq(EnumProgress.revoked));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,9 +208,9 @@ public class ConfirmationRepository {
|
|||||||
.or(V_CAMP.YEAR.cast(String.class).containsIgnoreCase(needle));
|
.or(V_CAMP.YEAR.cast(String.class).containsIgnoreCase(needle));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
SelectSeekStep1<Record8<Integer, String, String, EnumCamprole, String, Double, String, Boolean>, LocalDateTime> sql = jooq
|
SelectSeekStep1<Record8<Integer, String, String, EnumCamprole, String, Double, String, EnumProgress>, LocalDateTime> sql = jooq
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
.select(T_PERSON.PK, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.LOCATION_NAME, T_PERSON.ACCEPT)
|
.select(T_PERSON.PK, T_PERSON.FORENAME, T_PERSON.SURNAME, T_PERSON.CAMPROLE, V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.LOCATION_NAME, T_PERSON.PROGRESS)
|
||||||
.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_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP))
|
.leftJoin(T_CAMPPROFILE).on(T_CAMPPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP))
|
||||||
@ -190,22 +220,82 @@ public class ConfirmationRepository {
|
|||||||
.and(T_PROFILE.USERNAME.eq(currentUser))
|
.and(T_PROFILE.USERNAME.eq(currentUser))
|
||||||
.orderBy(T_PERSON.CREATED.desc());
|
.orderBy(T_PERSON.CREATED.desc());
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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, EnumProgress>> i = sql.fetch().iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
Record8<Integer, String, String, EnumCamprole, String, Double, String, EnumProgress> 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);
|
||||||
EnumCamprole role = r.get(T_PERSON.CAMPROLE);
|
EnumCamprole role = r.get(T_PERSON.CAMPROLE);
|
||||||
String campname = r.get(V_CAMP.NAME);
|
String campname = r.get(V_CAMP.NAME);
|
||||||
Double year = r.get(V_CAMP.YEAR);
|
Double year = r.get(V_CAMP.YEAR);
|
||||||
Boolean accept = r.get(T_PERSON.ACCEPT);
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
BookingBean bean = new BookingBean(pkPerson, null, String.format("%s %4.0f", campname, year));
|
BookingBean bean = new BookingBean(pkPerson, null, String.format("%s %4.0f", campname, year));
|
||||||
bean.setRole(role == null ? null : role.getLiteral());
|
bean.setRole(role == null ? null : role.getLiteral());
|
||||||
bean.setFullname(new StringBuilder().append(forename).append(" ").append(surname).toString());
|
bean.setFullname(new StringBuilder().append(forename).append(" ").append(surname).toString());
|
||||||
bean.setAccept(accept);
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
list.add(bean);
|
list.add(bean);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove the booking and all of its dependencies
|
||||||
|
*
|
||||||
|
* @param id the pk of t_person
|
||||||
|
* @return number of affected database rows, should be 1
|
||||||
|
*/
|
||||||
|
public Integer removeBooking(Integer id) {
|
||||||
|
LambdaResultWrapper lrw = new LambdaResultWrapper();
|
||||||
|
jooq.transaction(t -> {
|
||||||
|
SelectConditionStep<Record5<String, String, String, String, LocalDateTime>> sql0 = DSL.using(t)
|
||||||
|
// @formatter:off
|
||||||
|
.select(T_PROFILE.USERNAME, T_PERSON.FORENAME, T_PERSON.SURNAME, T_CAMP.NAME, T_CAMP.ARRIVE)
|
||||||
|
.from(T_PERSON)
|
||||||
|
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
|
||||||
|
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_PERSON.FK_PROFILE))
|
||||||
|
.where(T_PERSON.PK.eq(id));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql0.toString());
|
||||||
|
Record5<String, String, String, String, LocalDateTime> r = sql0.fetchOne();
|
||||||
|
if (r == null) {
|
||||||
|
throw new DataAccessException("no such entry in t_person with id = " + id);
|
||||||
|
}
|
||||||
|
String username = r.get(T_PROFILE.USERNAME);
|
||||||
|
String forename = r.get(T_PERSON.FORENAME);
|
||||||
|
String surname = r.get(T_PERSON.SURNAME);
|
||||||
|
String campname = r.get(T_CAMP.NAME);
|
||||||
|
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
|
||||||
|
|
||||||
|
StringBuilder rssMessage = new StringBuilder(username);
|
||||||
|
rssMessage.append(" hat die Stornierung der Buchung von ");
|
||||||
|
rssMessage.append(forename).append(" ").append(surname);
|
||||||
|
rssMessage.append(" an ");
|
||||||
|
rssMessage.append(campname).append(" ")
|
||||||
|
.append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
|
||||||
|
rssMessage.append(" bestätigt und den Datensatz gelöscht.");
|
||||||
|
|
||||||
|
DeleteConditionStep<TPersondocumentRecord> sql1 = DSL.using(t).deleteFrom(T_PERSONDOCUMENT)
|
||||||
|
.where(T_PERSONDOCUMENT.FK_PERSON.eq(id));
|
||||||
|
LOGGER.trace(sql1.toString());
|
||||||
|
sql1.execute();
|
||||||
|
|
||||||
|
DeleteConditionStep<TPersonRecord> sql2 = DSL.using(t).deleteFrom(T_PERSON).where(T_PERSON.PK.eq(id));
|
||||||
|
LOGGER.trace(sql2.toString());
|
||||||
|
lrw.add(sql2.execute());
|
||||||
|
|
||||||
|
InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t)
|
||||||
|
// @formatter:off
|
||||||
|
.insertInto(T_RSS,
|
||||||
|
T_RSS.MSG,
|
||||||
|
T_RSS.RECIPIENT)
|
||||||
|
.values(rssMessage.toString(), "registrator");
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace("{}", sql3.toString());
|
||||||
|
sql3.execute();
|
||||||
|
});
|
||||||
|
return lrw.getCounter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,10 @@ 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;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumProgress;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.BookingBean;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.BookingBean;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOverviewBean;
|
||||||
|
|
||||||
@ -20,35 +17,41 @@ import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOver
|
|||||||
@Service
|
@Service
|
||||||
public class ConfirmationService {
|
public class ConfirmationService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfirmationRepository gateway;
|
private ConfirmationRepository repository;
|
||||||
|
|
||||||
public List<CampOverviewBean> getCampOverview(String currentUser) {
|
public List<CampOverviewBean> getCampOverview(String currentUser) {
|
||||||
return gateway.getCampOverviewBeans(currentUser);
|
return repository.getCampOverviewBeans(currentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BookingBean> getUntouched(String currentUser) {
|
public List<BookingBean> getUntouched(String currentUser) {
|
||||||
return gateway.getUntouched(currentUser);
|
return repository.getUntouched(currentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BookingBean> getApproved(String currentUser) {
|
public List<BookingBean> getApproved(String currentUser) {
|
||||||
return gateway.getApproved(currentUser);
|
return repository.getApproved(currentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BookingBean> getRejected(String currentUser) {
|
public List<BookingBean> getRejected(String currentUser) {
|
||||||
return gateway.getRejected(currentUser);
|
return repository.getRejected(currentUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BookingBean> getRevoked(String currentUser) {
|
||||||
|
return repository.getRevoked(currentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String search(String needle, String linkURL, String currentUser) {
|
public String search(String needle, String linkURL, String currentUser) {
|
||||||
StringBuilder buf = new StringBuilder(
|
StringBuilder buf = new StringBuilder(
|
||||||
"<table class=\"table table-striped\"><thead><tr><th>Dabei</th><th>Name</th><th>Freizeit</th><th>Rolle</th></tr><tbody>");
|
"<table class=\"table table-striped\"><thead><tr><th>Dabei</th><th>Name</th><th>Freizeit</th><th>Rolle</th></tr><tbody>");
|
||||||
for (BookingBean bean : gateway.getSearchResult(needle, currentUser)) {
|
for (BookingBean bean : repository.getSearchResult(needle, currentUser)) {
|
||||||
String acceptHtml = "";
|
String acceptHtml = "";
|
||||||
if (bean.getAccept() == null) {
|
if (EnumProgress.requested.equals(bean.getProgress())) {
|
||||||
acceptHtml = "<i class=\"fas fa-question framed framed-orange\"></i>";
|
acceptHtml = "<i class=\"fas fa-question framed framed-orange\"></i>";
|
||||||
} else if (bean.getAccept()) {
|
} else if (EnumProgress.approved.equals(bean.getProgress())) {
|
||||||
acceptHtml = "<i class=\"fas fa-check framed framed-green\"></i>";
|
acceptHtml = "<i class=\"fas fa-check framed framed-green\"></i>";
|
||||||
} else {
|
} else if (EnumProgress.rejected.equals(bean.getProgress())) {
|
||||||
acceptHtml = "<i class=\"fas fa-ban framed framed-red\"></i>";
|
acceptHtml = "<i class=\"fas fa-ban framed framed-red\"></i>";
|
||||||
|
} else if (EnumProgress.revoked.equals(bean.getProgress())) {
|
||||||
|
acceptHtml = "<i class=\"fas fa-skull framed framed-pink\"></i>";
|
||||||
}
|
}
|
||||||
buf.append(String.format("<tr><td>%s</td><td><a href=\"%s/%d\">%s</a></td><td>%s</td><td>%s</td></tr>",
|
buf.append(String.format("<tr><td>%s</td><td><a href=\"%s/%d\">%s</a></td><td>%s</td><td>%s</td></tr>",
|
||||||
acceptHtml, linkURL, bean.getPkPerson(), bean.getFullname(), bean.getCamp(), bean.getRolename()));
|
acceptHtml, linkURL, bean.getPkPerson(), bean.getFullname(), bean.getCamp(), bean.getRolename()));
|
||||||
@ -56,4 +59,14 @@ public class ConfirmationService {
|
|||||||
buf.append("</tbody></table>");
|
buf.append("</tbody></table>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove the booking and all of its dependencies
|
||||||
|
*
|
||||||
|
* @param id the id of the booking (t_person.pk)
|
||||||
|
*/
|
||||||
|
public Boolean removeBooking(Integer id) {
|
||||||
|
return repository.removeBooking(id) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class BookingBean implements Serializable, Comparable<BookingBean> {
|
|||||||
private String fullname;
|
private String fullname;
|
||||||
private String role;
|
private String role;
|
||||||
private LocalDateTime registered;
|
private LocalDateTime registered;
|
||||||
private Boolean accept;
|
private String progress;
|
||||||
|
|
||||||
public BookingBean(Integer pkPerson, LocalDate date, String camp) {
|
public BookingBean(Integer pkPerson, LocalDate date, String camp) {
|
||||||
this.pkPerson = pkPerson;
|
this.pkPerson = pkPerson;
|
||||||
@ -114,11 +114,17 @@ public class BookingBean implements Serializable, Comparable<BookingBean> {
|
|||||||
return pkPerson;
|
return pkPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getAccept() {
|
/**
|
||||||
return accept;
|
* @return the progress
|
||||||
|
*/
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccept(Boolean accept) {
|
/**
|
||||||
this.accept = accept;
|
* @param progress the progress to set
|
||||||
|
*/
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ public class CampOverviewBean implements Serializable, Comparable<CampOverviewBe
|
|||||||
private Integer approved;
|
private Integer approved;
|
||||||
private Integer rejected;
|
private Integer rejected;
|
||||||
private Integer untouched;
|
private Integer untouched;
|
||||||
|
private Integer revoked;
|
||||||
|
|
||||||
public CampOverviewBean(LocalDate date, String camp) {
|
public CampOverviewBean(LocalDate date, String camp) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
@ -23,6 +24,7 @@ public class CampOverviewBean implements Serializable, Comparable<CampOverviewBe
|
|||||||
this.approved = 0;
|
this.approved = 0;
|
||||||
this.rejected = 0;
|
this.rejected = 0;
|
||||||
this.untouched = 0;
|
this.untouched = 0;
|
||||||
|
this.revoked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,4 +87,18 @@ public class CampOverviewBean implements Serializable, Comparable<CampOverviewBe
|
|||||||
public LocalDate getDate() {
|
public LocalDate getDate() {
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the revoked
|
||||||
|
*/
|
||||||
|
public Integer getRevoked() {
|
||||||
|
return revoked;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param revoked the revoked to set
|
||||||
|
*/
|
||||||
|
public void setRevoked(Integer revoked) {
|
||||||
|
this.revoked = revoked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,28 @@ 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));
|
||||||
|
model.addAttribute("progresses", personService.getProgresses());
|
||||||
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()));
|
||||||
|
model.addAttribute("progresses", personService.getProgresses());
|
||||||
|
return "confirmation/person";
|
||||||
|
}
|
||||||
personService.updatePerson(bean, username);
|
personService.updatePerson(bean, username);
|
||||||
return "redirect:/confirmation";
|
return "redirect:/confirmation";
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -31,6 +33,7 @@ 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.EnumModule;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
||||||
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumProgress;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
@ -76,9 +79,11 @@ public class PersonRepository {
|
|||||||
.and(T_PROFILE.USERNAME.eq(username))
|
.and(T_PROFILE.USERNAME.eq(username))
|
||||||
.orderBy(T_CAMP.ARRIVE.desc());
|
.orderBy(T_CAMP.ARRIVE.desc());
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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));
|
||||||
@ -108,11 +113,14 @@ public class PersonRepository {
|
|||||||
.and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
|
.and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
|
||||||
.and(T_PROFILE.USERNAME.eq(username));
|
.and(T_PROFILE.USERNAME.eq(username));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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));
|
EnumProgress progress = r.get(T_PERSON.PROGRESS);
|
||||||
|
bean.setProgress(progress == null ? null : progress.getLiteral());
|
||||||
bean.setBirthdate(r.get(T_PERSON.BIRTHDATE));
|
bean.setBirthdate(r.get(T_PERSON.BIRTHDATE));
|
||||||
bean.setCamprole(r.get(T_PERSON.CAMPROLE));
|
bean.setCamprole(r.get(T_PERSON.CAMPROLE));
|
||||||
bean.setCity(r.get(T_PERSON.CITY));
|
bean.setCity(r.get(T_PERSON.CITY));
|
||||||
@ -128,6 +136,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;
|
||||||
@ -144,21 +153,21 @@ public class PersonRepository {
|
|||||||
jooq.transaction(t -> {
|
jooq.transaction(t -> {
|
||||||
|
|
||||||
SelectConditionStep<TProfileRecord> sql0 = jooq.selectFrom(T_PROFILE).where(T_PROFILE.USERNAME.eq(registrator));
|
SelectConditionStep<TProfileRecord> sql0 = jooq.selectFrom(T_PROFILE).where(T_PROFILE.USERNAME.eq(registrator));
|
||||||
LOGGER.debug(sql0.toString());
|
LOGGER.trace(sql0);
|
||||||
Integer fkRegistrator = sql0.fetchOne(T_PROFILE.PK);
|
Integer fkRegistrator = sql0.fetchOne(T_PROFILE.PK);
|
||||||
|
|
||||||
// get old accept value for comparison
|
// get old accept value for comparison
|
||||||
SelectConditionStep<TPersonRecord> sql1 = jooq.selectFrom(T_PERSON).where(T_PERSON.PK.eq(bean.getPk()));
|
SelectConditionStep<TPersonRecord> sql1 = jooq.selectFrom(T_PERSON).where(T_PERSON.PK.eq(bean.getPk()));
|
||||||
LOGGER.debug(sql1.toString());
|
LOGGER.trace(sql1);
|
||||||
TPersonRecord r = sql1.fetchOne();
|
TPersonRecord r = sql1.fetchOne();
|
||||||
lrw.putBoolean("acceptOld", r == null ? null : r.getAccept());
|
lrw.putBoolean("acceptOld", r == null ? null : EnumProgress.approved.equals(r.getProgress()));
|
||||||
lrw.putBoolean("acceptNew", bean.getAccept());
|
lrw.putBoolean("acceptNew", EnumProgress.approved.getLiteral().equals(bean.getProgress()));
|
||||||
Integer fkCamp = r == null ? null : r.getFkCamp();
|
Integer fkCamp = r == null ? null : r.getFkCamp();
|
||||||
String email = r.getEmail(); // use the old one, too
|
String email = r.getEmail(); // use the old one, too
|
||||||
lrw.putString("oldEmail", email);
|
lrw.putString("oldEmail", email);
|
||||||
|
|
||||||
SelectConditionStep<TCampRecord> sql2 = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(fkCamp));
|
SelectConditionStep<TCampRecord> sql2 = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(fkCamp));
|
||||||
LOGGER.debug(sql2.toString());
|
LOGGER.trace(sql2);
|
||||||
TCampRecord rc = sql2.fetchOne();
|
TCampRecord rc = sql2.fetchOne();
|
||||||
String campName = rc == null ? null : rc.getName();
|
String campName = rc == null ? null : rc.getName();
|
||||||
LocalDateTime arrive = rc == null ? null : rc.getArrive();
|
LocalDateTime arrive = rc == null ? null : rc.getArrive();
|
||||||
@ -179,12 +188,13 @@ public class PersonRepository {
|
|||||||
.set(T_PERSON.PHONE, bean.getPhone())
|
.set(T_PERSON.PHONE, bean.getPhone())
|
||||||
.set(T_PERSON.EMAIL, bean.getEmail())
|
.set(T_PERSON.EMAIL, bean.getEmail())
|
||||||
.set(T_PERSON.COMMENT, bean.getComment())
|
.set(T_PERSON.COMMENT, bean.getComment())
|
||||||
.set(T_PERSON.ACCEPT, bean.getAccept())
|
.set(T_PERSON.PROGRESS, EnumProgress.lookupLiteral(bean.getProgress()))
|
||||||
.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.trace(sql3);
|
||||||
lrw.add(sql3.execute());
|
lrw.add(sql3.execute());
|
||||||
|
|
||||||
// always
|
// always
|
||||||
@ -200,7 +210,7 @@ public class PersonRepository {
|
|||||||
T_RSS.RECIPIENT)
|
T_RSS.RECIPIENT)
|
||||||
.values(buf.toString(), "registrator");
|
.values(buf.toString(), "registrator");
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql4.toString());
|
LOGGER.trace(sql4);
|
||||||
sql4.execute();
|
sql4.execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -293,9 +303,13 @@ public class PersonRepository {
|
|||||||
.leftJoin(REGISTRATOR).on(REGISTRATOR.PK.eq(T_PERSON.FK_REGISTRATOR))
|
.leftJoin(REGISTRATOR).on(REGISTRATOR.PK.eq(T_PERSON.FK_REGISTRATOR))
|
||||||
.where(T_PERSON.PK.eq(pk));
|
.where(T_PERSON.PK.eq(pk));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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);
|
||||||
@ -311,7 +325,7 @@ public class PersonRepository {
|
|||||||
if (bookerForename == null && bookerSurname == null) {
|
if (bookerForename == null && bookerSurname == null) {
|
||||||
buf.append(String.format("angemeldet ohne Registrierung am %s\n", createdString));
|
buf.append(String.format("angemeldet ohne Registrierung am %s\n", createdString));
|
||||||
} else {
|
} else {
|
||||||
buf.append(String.format("angemeldet von %s %s am %s\n", bookerForename, bookerSurname, createdString));
|
buf.append(String.format("angemeldet von %s %s am %s\n", bookerForename, bookerSurname, createdString));
|
||||||
}
|
}
|
||||||
if (registratorForename != null || registratorSurname != null) {
|
if (registratorForename != null || registratorSurname != null) {
|
||||||
buf.append(String.format("bearbeitet von %s %s\n", registratorForename, registratorSurname));
|
buf.append(String.format("bearbeitet von %s %s\n", registratorForename, registratorSurname));
|
||||||
@ -332,4 +346,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package de.jottyfan.camporganizer.module.confirmation.person;
|
package de.jottyfan.camporganizer.module.confirmation.person;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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.db.jooq.enums.EnumProgress;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.person.model.CampBean;
|
import de.jottyfan.camporganizer.module.confirmation.person.model.CampBean;
|
||||||
import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean;
|
import de.jottyfan.camporganizer.module.confirmation.person.model.PersonBean;
|
||||||
|
|
||||||
@ -33,4 +35,22 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getProgresses() {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
for (EnumProgress p : EnumProgress.values()) {
|
||||||
|
list.add(p.getLiteral());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -30,11 +32,13 @@ public class PersonBean implements Serializable {
|
|||||||
private String email;
|
private String email;
|
||||||
private Integer fkCamp;
|
private Integer fkCamp;
|
||||||
private Integer fkProfile;
|
private Integer fkProfile;
|
||||||
private Boolean accept;
|
private String progress;
|
||||||
private LocalDateTime created;
|
private LocalDateTime created;
|
||||||
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
|
||||||
@ -190,20 +194,6 @@ public class PersonBean implements Serializable {
|
|||||||
this.fkProfile = fkProfile;
|
this.fkProfile = fkProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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
|
* @return the created
|
||||||
*/
|
*/
|
||||||
@ -273,4 +263,32 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the progress
|
||||||
|
*/
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param progress the progress to set
|
||||||
|
*/
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class DashboardRepository {
|
|||||||
.deleteFrom(T_PERSONDOCUMENT)
|
.deleteFrom(T_PERSONDOCUMENT)
|
||||||
.where(T_PERSONDOCUMENT.PK.eq(bean.getPk()));
|
.where(T_PERSONDOCUMENT.PK.eq(bean.getPk()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
lrw.add(sql.execute());
|
lrw.add(sql.execute());
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder("Dokument ");
|
StringBuilder buf = new StringBuilder("Dokument ");
|
||||||
@ -92,7 +92,7 @@ public class DashboardRepository {
|
|||||||
T_RSS.RECIPIENT)
|
T_RSS.RECIPIENT)
|
||||||
.values(buf.toString(), "registrator");
|
.values(buf.toString(), "registrator");
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql2.toString());
|
LOGGER.trace(sql);
|
||||||
sql2.execute();
|
sql2.execute();
|
||||||
});
|
});
|
||||||
return lrw.getCounter();
|
return lrw.getCounter();
|
||||||
@ -117,7 +117,7 @@ public class DashboardRepository {
|
|||||||
)
|
)
|
||||||
.values(bean.getName(), bean.getFiletype(), bean.getFkPerson(), bean.getDocument());
|
.values(bean.getName(), bean.getFiletype(), bean.getFkPerson(), bean.getDocument());
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder("Dokument ");
|
StringBuilder buf = new StringBuilder("Dokument ");
|
||||||
@ -130,7 +130,7 @@ public class DashboardRepository {
|
|||||||
T_RSS.RECIPIENT)
|
T_RSS.RECIPIENT)
|
||||||
.values(buf.toString(), "registrator");
|
.values(buf.toString(), "registrator");
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql2.toString());
|
LOGGER.trace(sql2);
|
||||||
sql2.execute();
|
sql2.execute();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
@ -37,7 +37,7 @@ public class DocumentRepository {
|
|||||||
.selectFrom(T_DOCUMENT)
|
.selectFrom(T_DOCUMENT)
|
||||||
.where(T_DOCUMENT.PK.eq(id));
|
.where(T_DOCUMENT.PK.eq(id));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
TDocumentRecord r = sql.fetchOne();
|
TDocumentRecord r = sql.fetchOne();
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -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;
|
||||||
@ -53,10 +54,12 @@ public class ICalRepository {
|
|||||||
.from(T_CAMP)
|
.from(T_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));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
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");
|
||||||
|
@ -37,7 +37,7 @@ public class MigrationRepository {
|
|||||||
.from(T_PROFILE)
|
.from(T_PROFILE)
|
||||||
.where(T_PROFILE.USERNAME.eq(username));
|
.where(T_PROFILE.USERNAME.eq(username));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return sql.fetchOne(T_PROFILE.PASSWORD);
|
return sql.fetchOne(T_PROFILE.PASSWORD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
@ -110,7 +119,7 @@ public class KeycloakRepository {
|
|||||||
Response response = resource.create(user);
|
Response response = resource.create(user);
|
||||||
Boolean success = Status.CREATED.equals(response.getStatusInfo());
|
Boolean success = Status.CREATED.equals(response.getStatusInfo());
|
||||||
if (success) {
|
if (success) {
|
||||||
LOGGER.info("created new keycloak user {}", user.getUsername());
|
LOGGER.debug("created new keycloak user {}", user.getUsername());
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("error on creating keycloak user {}: {}", user.getUsername(), response.getStatus());
|
LOGGER.error("error on creating keycloak user {}: {}", user.getUsername(), response.getStatus());
|
||||||
}
|
}
|
||||||
|
@ -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,55 @@ 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/revoke/{id}")
|
||||||
public String remove(@PathVariable Integer id, final Model model) {
|
public String revoke(@PathVariable("id") Integer id, final Model model) {
|
||||||
service.removeBooking(id);
|
service.revokeBooking(id, true);
|
||||||
|
return "redirect:/dashboard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/registration/unrevoke/{id}")
|
||||||
|
public String unrevoke(@PathVariable("id") Integer id, final Model model) {
|
||||||
|
service.revokeBooking(id, false);
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,18 @@ package de.jottyfan.camporganizer.module.registration;
|
|||||||
|
|
||||||
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_PERSON;
|
import static de.jottyfan.camporganizer.db.jooq.Tables.T_PERSON;
|
||||||
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 +22,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;
|
||||||
@ -37,12 +40,12 @@ import org.springframework.stereotype.Repository;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
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.EnumProgress;
|
||||||
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.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 +72,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 +101,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 +110,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 +136,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
|
||||||
@ -140,7 +146,7 @@ public class RegistrationRepository {
|
|||||||
T_RSS.RECIPIENT)
|
T_RSS.RECIPIENT)
|
||||||
.values(new StringBuilder(bean.getFullname()).append(" hat sich als Nutzer im CampOrganizer2 registriert.").toString(), "admin");
|
.values(new StringBuilder(bean.getFullname()).append(" hat sich als Nutzer im CampOrganizer2 registriert.").toString(), "admin");
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql2.toString());
|
LOGGER.trace(sql2);
|
||||||
sql2.execute();
|
sql2.execute();
|
||||||
} else {
|
} else {
|
||||||
SelectConditionStep<Record1<Integer>> sql1 = DSL.using(t)
|
SelectConditionStep<Record1<Integer>> sql1 = DSL.using(t)
|
||||||
@ -149,13 +155,12 @@ 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,
|
||||||
T_PERSON.SURNAME,
|
T_PERSON.SURNAME,
|
||||||
@ -172,15 +177,16 @@ 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,
|
||||||
T_PERSON.SURNAME,
|
T_PERSON.SURNAME,
|
||||||
@ -196,13 +202,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 +233,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();
|
||||||
@ -242,13 +250,11 @@ public class RegistrationRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove the booking and all of its dependencies
|
* set the revoke state of a booking
|
||||||
*
|
*
|
||||||
* @param id the pk of t_person
|
* @param id the ID of the booking
|
||||||
* @return number of affected database rows, should be 1
|
|
||||||
*/
|
*/
|
||||||
public Integer removeBooking(Integer id) {
|
public void revokeBooking(Integer id) {
|
||||||
LambdaResultWrapper lrw = new LambdaResultWrapper();
|
|
||||||
jooq.transaction(t -> {
|
jooq.transaction(t -> {
|
||||||
SelectConditionStep<Record5<String, String, String, String, LocalDateTime>> sql0 = DSL.using(t)
|
SelectConditionStep<Record5<String, String, String, String, LocalDateTime>> sql0 = DSL.using(t)
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@ -258,7 +264,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);
|
||||||
@ -270,33 +276,32 @@ public class RegistrationRepository {
|
|||||||
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
|
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
|
||||||
|
|
||||||
StringBuilder rssMessage = new StringBuilder(username);
|
StringBuilder rssMessage = new StringBuilder(username);
|
||||||
rssMessage.append(" hat die Buchung von ");
|
rssMessage.append(" hat die Stornierung der Buchung von ");
|
||||||
rssMessage.append(forename).append(" ").append(surname);
|
rssMessage.append(forename).append(" ").append(surname);
|
||||||
rssMessage.append(" an ");
|
rssMessage.append(" an ");
|
||||||
rssMessage.append(campname).append(" ")
|
rssMessage.append(campname).append(" ")
|
||||||
.append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
|
.append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
|
||||||
rssMessage.append(" storniert.");
|
rssMessage.append(" ausgelöst.");
|
||||||
|
|
||||||
DeleteConditionStep<TPersondocumentRecord> sql1 = DSL.using(t).deleteFrom(T_PERSONDOCUMENT)
|
UpdateConditionStep<TPersonRecord> sql1 = jooq
|
||||||
.where(T_PERSONDOCUMENT.FK_PERSON.eq(id));
|
// @formatter:off
|
||||||
LOGGER.debug(sql1.toString());
|
.update(T_PERSON)
|
||||||
|
.set(T_PERSON.PROGRESS, EnumProgress.revoked)
|
||||||
|
.where(T_PERSON.PK.eq(id));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql1);
|
||||||
sql1.execute();
|
sql1.execute();
|
||||||
|
|
||||||
DeleteConditionStep<TPersonRecord> sql2 = DSL.using(t).deleteFrom(T_PERSON).where(T_PERSON.PK.eq(id));
|
InsertValuesStep2<TRssRecord, String, String> sql2 = DSL.using(t)
|
||||||
LOGGER.debug(sql2.toString());
|
|
||||||
lrw.add(sql2.execute());
|
|
||||||
|
|
||||||
InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t)
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
.insertInto(T_RSS,
|
.insertInto(T_RSS,
|
||||||
T_RSS.MSG,
|
T_RSS.MSG,
|
||||||
T_RSS.RECIPIENT)
|
T_RSS.RECIPIENT)
|
||||||
.values(rssMessage.toString(), "registrator");
|
.values(rssMessage.toString(), "registrator");
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql3.toString());
|
LOGGER.trace("{}", sql2.toString());
|
||||||
sql3.execute();
|
sql2.execute();
|
||||||
});
|
});
|
||||||
return lrw.getCounter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -312,9 +317,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 +341,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 +354,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 +362,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 +372,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 +391,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 +413,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 +424,125 @@ 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* turn back the revocation and set state to requested
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void unrevokeBooking(Integer id) {
|
||||||
|
jooq.transaction(t -> {
|
||||||
|
SelectConditionStep<Record5<String, String, String, String, LocalDateTime>> sql0 = DSL.using(t)
|
||||||
|
// @formatter:off
|
||||||
|
.select(T_PROFILE.USERNAME, T_PERSON.FORENAME, T_PERSON.SURNAME, T_CAMP.NAME, T_CAMP.ARRIVE)
|
||||||
|
.from(T_PERSON)
|
||||||
|
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
|
||||||
|
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_PERSON.FK_PROFILE))
|
||||||
|
.where(T_PERSON.PK.eq(id));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql0.toString());
|
||||||
|
Record5<String, String, String, String, LocalDateTime> r = sql0.fetchOne();
|
||||||
|
if (r == null) {
|
||||||
|
throw new DataAccessException("no such entry in t_person with id = " + id);
|
||||||
|
}
|
||||||
|
String username = r.get(T_PROFILE.USERNAME);
|
||||||
|
String forename = r.get(T_PERSON.FORENAME);
|
||||||
|
String surname = r.get(T_PERSON.SURNAME);
|
||||||
|
String campname = r.get(T_CAMP.NAME);
|
||||||
|
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
|
||||||
|
|
||||||
|
StringBuilder rssMessage = new StringBuilder(username);
|
||||||
|
rssMessage.append(" hat die Stornierung der Buchung von ");
|
||||||
|
rssMessage.append(forename).append(" ").append(surname);
|
||||||
|
rssMessage.append(" an ");
|
||||||
|
rssMessage.append(campname).append(" ")
|
||||||
|
.append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
|
||||||
|
rssMessage.append(" rückgängig gemacht.");
|
||||||
|
|
||||||
|
UpdateConditionStep<TPersonRecord> sql1 = jooq
|
||||||
|
// @formatter:off
|
||||||
|
.update(T_PERSON)
|
||||||
|
.set(T_PERSON.PROGRESS, EnumProgress.requested)
|
||||||
|
.where(T_PERSON.PK.eq(id));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql1);
|
||||||
|
sql1.execute();
|
||||||
|
|
||||||
|
InsertValuesStep2<TRssRecord, String, String> sql2 = DSL.using(t)
|
||||||
|
// @formatter:off
|
||||||
|
.insertInto(T_RSS,
|
||||||
|
T_RSS.MSG,
|
||||||
|
T_RSS.RECIPIENT)
|
||||||
|
.values(rssMessage.toString(), "registrator");
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace("{}", sql2.toString());
|
||||||
|
sql2.execute();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,19 +71,52 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove the booking and all of its dependencies
|
* revoke a booking
|
||||||
*
|
*
|
||||||
* @param id the id of the booking (t_person.pk)
|
* @param id the ID of the booking
|
||||||
|
* @parem doRevoke if true, revoke the booking; if false, unrevoke and set it to
|
||||||
|
* requested again
|
||||||
*/
|
*/
|
||||||
public Boolean removeBooking(Integer id) {
|
public void revokeBooking(Integer id, Boolean doRevoke) {
|
||||||
return gateway.removeBooking(id) > 0;
|
if (doRevoke) {
|
||||||
|
repository.revokeBooking(id);
|
||||||
|
} else {
|
||||||
|
repository.unrevokeBooking(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
@ -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 {};
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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 {};
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -46,9 +47,11 @@ public class RssGateway {
|
|||||||
.from(T_RSS)
|
.from(T_RSS)
|
||||||
.where(T_RSS.RECIPIENT.eq(recipientCode));
|
.where(T_RSS.RECIPIENT.eq(recipientCode));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
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));
|
||||||
@ -60,7 +63,7 @@ public class RssGateway {
|
|||||||
|
|
||||||
public List<String> getAllFeeds() {
|
public List<String> getAllFeeds() {
|
||||||
SelectJoinStep<Record1<String>> sql = jooq.selectDistinct(T_RSS.RECIPIENT).from(T_RSS);
|
SelectJoinStep<Record1<String>> sql = jooq.selectDistinct(T_RSS.RECIPIENT).from(T_RSS);
|
||||||
LOGGER.debug(sql.toString());
|
LOGGER.trace(sql);
|
||||||
return sql.fetch(T_RSS.RECIPIENT);
|
return sql.fetch(T_RSS.RECIPIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +76,11 @@ public class RssGateway {
|
|||||||
T_RSS.REGDATE)
|
T_RSS.REGDATE)
|
||||||
.from(T_RSS);
|
.from(T_RSS);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
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));
|
||||||
@ -91,7 +96,7 @@ public class RssGateway {
|
|||||||
.deleteFrom(T_RSS)
|
.deleteFrom(T_RSS)
|
||||||
.where(T_RSS.PK.eq(bean.getPk()));
|
.where(T_RSS.PK.eq(bean.getPk()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +107,7 @@ public class RssGateway {
|
|||||||
.set(T_RSS.MSG, bean.getMessage())
|
.set(T_RSS.MSG, bean.getMessage())
|
||||||
.where(T_RSS.PK.eq(bean.getPk()));
|
.where(T_RSS.PK.eq(bean.getPk()));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.debug("{}", sql.toString());
|
LOGGER.trace(sql);
|
||||||
sql.execute();
|
sql.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package de.jottyfan.camporganizer.module.staticpages;
|
package de.jottyfan.camporganizer.module.staticpages;
|
||||||
|
|
||||||
|
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.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
@ -14,6 +16,9 @@ import de.jottyfan.camporganizer.module.camplist.CommonController;
|
|||||||
@Controller
|
@Controller
|
||||||
public class StaticPagesController extends CommonController {
|
public class StaticPagesController extends CommonController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StaticPagesService service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load the index page
|
* load the index page
|
||||||
*
|
*
|
||||||
@ -21,7 +26,7 @@ public class StaticPagesController extends CommonController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String getIndex() {
|
public String getIndex() {
|
||||||
return "/index";
|
return "redirect:/allgemeines";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,6 +49,16 @@ public class StaticPagesController extends CommonController {
|
|||||||
return "/verein";
|
return "/verein";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* load the vereinsmitglieder page
|
||||||
|
*
|
||||||
|
* @return the vereinsmitglieder page
|
||||||
|
*/
|
||||||
|
@GetMapping("/vereinsmitglieder")
|
||||||
|
public String getVereinsmitglieder() {
|
||||||
|
return "/vereinsmitglieder";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load the kontakt page
|
* load the kontakt page
|
||||||
*
|
*
|
||||||
@ -60,10 +75,21 @@ public class StaticPagesController extends CommonController {
|
|||||||
* @return the allgemeines page
|
* @return the allgemeines page
|
||||||
*/
|
*/
|
||||||
@GetMapping("/allgemeines")
|
@GetMapping("/allgemeines")
|
||||||
public String getAllgemeines() {
|
public String getAllgemeines(final Model model) {
|
||||||
|
model.addAttribute("title", service.getStockDescription());
|
||||||
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
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package de.jottyfan.camporganizer.module.staticpages;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.core.io.ResourceLoader;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import de.jottyfan.camporganizer.Main;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jotty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StaticPagesService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceLoader resourceLoader;
|
||||||
|
|
||||||
|
public Properties getStockDescription() {
|
||||||
|
Resource resource = resourceLoader.getResource(
|
||||||
|
"classpath:/static/images/stock.properties"
|
||||||
|
);
|
||||||
|
Properties properties = new Properties();
|
||||||
|
try {
|
||||||
|
properties.load(resource.getInputStream());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Main.LOGGER.error(e.getMessage());
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
|
||||||
|
|
||||||
|
@ -49,6 +49,48 @@ body {
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
width: 128px;
|
||||||
|
height: 55px;
|
||||||
|
background-size: 128px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-image: url('../images/logo.png');
|
||||||
|
margin-left: 8px;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-image: url('../images/logo_hover.png');
|
||||||
|
background-size: cover;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo:hover::before {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon_profile {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
background-size: 32px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-image: url('../images/Icon_Profil.svg');
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon_profile:hover {
|
||||||
|
background-image: url('../images/Icon_Profil_hover.svg');
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
font-family: 'Fira Sans';
|
font-family: 'Fira Sans';
|
||||||
}
|
}
|
||||||
@ -65,6 +107,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;
|
||||||
@ -116,19 +163,20 @@ div {
|
|||||||
!important;
|
!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acc_true {
|
.acc_approved {
|
||||||
background-image: linear-gradient(to bottom right, #cfc, #afa)
|
background: #aaffaa !important;
|
||||||
!important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.acc_false {
|
.acc_rejected {
|
||||||
background-image: linear-gradient(to bottom right, #fcc, #faa)
|
background: #ffaaaa !important;
|
||||||
!important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.acc_null {
|
.acc_revoked {
|
||||||
background-image: linear-gradient(to bottom right, #fdb, #fca)
|
background: rgb(220, 138, 221) !important;
|
||||||
!important;
|
}
|
||||||
|
|
||||||
|
.acc_requested {
|
||||||
|
background: rgb(255, 190, 111) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-dist {
|
.right-dist {
|
||||||
@ -298,6 +346,17 @@ div {
|
|||||||
margin: 0px 2px 0px 2px;
|
margin: 0px 2px 0px 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badgeerror {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid black;
|
||||||
|
color: white;
|
||||||
|
font-weight: bolder;
|
||||||
|
background-image: linear-gradient(to right bottom, rgb(246, 97, 81),
|
||||||
|
rgb(165, 29, 45));
|
||||||
|
padding: 2px 4px 2px 4px;
|
||||||
|
margin: 0px 2px 0px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.dist8 {
|
.dist8 {
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
@ -328,19 +387,19 @@ div {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.framed-green {
|
.framed-green {
|
||||||
background: linear-gradient(to bottom right, lime, darkgreen);
|
background: linear-gradient(to bottom right, darkgreen, lime);
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid green;
|
border: 1px solid green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.framed-red {
|
.framed-red {
|
||||||
background: linear-gradient(to bottom right, red, darkred);
|
background: linear-gradient(to bottom right, darkred, red);
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.framed-orange {
|
.framed-orange {
|
||||||
background: linear-gradient(to bottom right, orange, #bf6c06);
|
background: linear-gradient(to bottom right, #bf6c06, orange);
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid orange;
|
border: 1px solid orange;
|
||||||
}
|
}
|
||||||
@ -351,6 +410,12 @@ div {
|
|||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.framed-pink {
|
||||||
|
background: linear-gradient(to bottom right, #3b115b, #d18be8);
|
||||||
|
color: #f8effb;
|
||||||
|
border: 1px solid #4a0084;
|
||||||
|
}
|
||||||
|
|
||||||
.nomaxwidth {
|
.nomaxwidth {
|
||||||
max-width: none !important;
|
max-width: none !important;
|
||||||
}
|
}
|
||||||
@ -442,3 +507,35 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoverlink {
|
||||||
|
color: #333333;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoverlink:hover {
|
||||||
|
color: #0d6efd;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumbswipe {
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
max-height: 100px;
|
||||||
|
overflow-x: scroll;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumbswipe::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@ -147,4 +147,14 @@ h4 {
|
|||||||
|
|
||||||
h5 {
|
h5 {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preview-content {
|
||||||
|
min-height: 200px;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-collapse:not(.show) {
|
||||||
|
height: 200px !important;
|
||||||
|
}
|
||||||
|
42
src/main/resources/static/images/Icon_Profil_hover.svg
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Ebene_2" data-name="Ebene 2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 71.44 71.44">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-width: .5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-1, .cls-2 {
|
||||||
|
stroke: #008b8b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-1, .cls-2, .cls-3 {
|
||||||
|
fill: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
clip-path: url(#clippath);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
stroke-miterlimit: 10;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<clipPath id="clippath">
|
||||||
|
<circle class="cls-3" cx="35.72" cy="35.72" r="35.22"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<g id="Ebene_1-2" data-name="Ebene 1">
|
||||||
|
<circle class="cls-2" cx="35.72" cy="35.72" r="35.22"/>
|
||||||
|
<g class="cls-4">
|
||||||
|
<g>
|
||||||
|
<path class="cls-1" d="m26.52,40.74c.1.18,2.36-1.36,2.36-1.36.7,1.22-8.38,7.81-7.67,9.05,1.64,2.84,16.71-10.45,17.06-9.85,0,0-19.7,11.6-17.8,14.89,1.1,1.91,23.09-13.33,23.09-13.33.64,1.11-24.96,17.34-24.23,18.61l27.74-16.02c1.97,3.41-28.1,17.71-26.74,20.06,1.11,1.92,28.55-18.65,29.48-17.02l-29.78,21.81,31.45-18.16c1.78,3.08-31.55,21.22-30.85,22.43.13.22,31.02-17.91,31.02-17.91,2.48,4.3-28.57,20.86-28.46,21.05l27.99-16.16c1.06,1.84-18.76,15.45-18.76,15.45.49.85,18.85-10.88,18.85-10.88l-10.45,10.65s9.95-7.97,10.91-6.3c.39.68-4.82,5.99-4.21,7.05.28.48,3.6-2.08,3.6-2.08"/>
|
||||||
|
<path class="cls-1" d="m27.35,10.64c.22.37,2.8-2.3,3.09-1.79l-9.63,10.18c.69,1.2,18.44-11.86,18.96-10.95,0,0-19,13.93-18.28,15.17.99,1.71,20.42-16.02,22.25-12.85,1.25,2.16-24.58,13.41-22.24,17.46,2.06,3.57,26.29-15.18,26.29-15.18,2.08,3.6-27.69,14.43-25.02,19.06l25.92-14.96s-23.11,17.33-22.84,17.8c2.55,4.41,24.69-14.25,24.69-14.25,0,0-19.83,14.92-19.34,15.78.46.79,18.25-14.34,19.9-11.49,0,0-15.86,10.69-14.52,13l11.54-6.66"/>
|
||||||
|
<path class="cls-2" d="m35.72,37.67h0c8.62,0,15.61,6.99,15.61,15.61v21.27h-31.22v-21.27c0-8.62,6.99-15.61,15.61-15.61Z"/>
|
||||||
|
<circle class="cls-2" cx="35.72" cy="22.8" r="14.87"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/main/resources/static/images/anna.weiser.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
src/main/resources/static/images/indexback.jpg
Normal file
After Width: | Height: | Size: 837 KiB |
BIN
src/main/resources/static/images/joerg.henke.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
src/main/resources/static/images/lars.dell.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
src/main/resources/static/images/linda.lang.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
src/main/resources/static/images/logo_hover.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
src/main/resources/static/images/simeon.velleuer.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
10
src/main/resources/static/images/stock.properties
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
stock02 = Heimfreizeit - Spiele im Wertwiesenpark
|
||||||
|
stock25 = Olfen - Gutes Essen
|
||||||
|
stock27 = Olfen - Miniaturdorf im Wald
|
||||||
|
stock29 = Olfen - Die Frohe Stunde am Morgen
|
||||||
|
stock52 = Rehe 2 - Kreative Ideen
|
||||||
|
stock63 = Schweiz - Blaue Bergseen
|
||||||
|
stock71 = Heimfreizeit - Kreuzkirche ECG Heilbronn
|
||||||
|
stock83 = Schweiz - Aufstieg in die Berge
|
||||||
|
stock84 = Hohenhaslach - Mitten in den Weinbergen
|
||||||
|
stock85 = Rehe 2 - Gemeinsame Andacht
|
@ -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,28 @@
|
|||||||
});
|
});
|
||||||
</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="datetime-local" 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>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<span class="error" th:each="error : ${#fields.errors('fkCamp')}">[[${error}]]<br /></span> <select id="inputCamp" th:field="*{fkCamp}"
|
<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' : '')}">
|
th:class="${'form-select ' + (#fields.hasErrors('fkCamp') ? 'inputerror' : '')}">
|
||||||
<option value="">--- bitte wählen ---</option>
|
<option value="">--- bitte wählen ---</option>
|
||||||
<option th:each="l : ${camps}" th:value="${l.pk}" th:text="${l.name}"></option>
|
<option th:each="l : ${camps}" th:value="${l.pk}" th:text="${l.name + ' ' + #temporals.format(l.arrive, 'yyyy')}"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -7,140 +7,174 @@
|
|||||||
<body>
|
<body>
|
||||||
<th:block layout:fragment="content">
|
<th:block layout:fragment="content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div id="welcomeblock" class="row displayblock">
|
||||||
<div class="col">
|
<div class="col-12">
|
||||||
<div class="blocktext">
|
<h2 class="headlinefont center">Willkommen bei den</h2>
|
||||||
<h1>Statt Langeweile zu Hause – Action auf einer Freizeit!</h1>
|
<h1 class="titlefont center">Mittelpunkt<br />Freizeiten</h1>
|
||||||
<p>
|
</div>
|
||||||
Ferien sind cool! Das steht auf jeden Fall fest. Doch wenn die Freunde alle im Urlaub sind und du alleine zu Hause bleibst,
|
<div class="col-12 center">
|
||||||
kommt schnell Langeweile auf. <strong>Warum also nicht einfach die Ferien mit vielen anderen Gleichaltrigen
|
<a th:href="@{/camplist}" class="btn btn-outline-danger">zur Anmeldung</a>
|
||||||
verbringen und jede Menge Spaß erleben?</strong> Genau dafür stehen <strong>Onkel Werner Freizeiten!</strong>
|
</div>
|
||||||
</p>
|
<div class="col-12 center mt-3">
|
||||||
<h2>Das sind Onkel Werner Freizeiten</h2>
|
<a href="#" onclick="$('#welcomeblock').slideUp('slow'); $('#fotoblock').fadeIn(1000);" class="btn btn-outline-secondary"><i class="fas fa-arrow-down"></i> weitere Informationen</a>
|
||||||
<p>
|
</div>
|
||||||
<strong>Onkel Werner Freizeiten sind immer ein Erlebnis der besonderen Art.</strong> Je nach Freizeit verbringst du entweder
|
</div>
|
||||||
ein verlängertes Wochenende, eine Woche oder sogar zwei Wochen zusammen mit einer Hand voll Mitarbeitern und jeder Menge
|
<div id="fotoblock" class="row displayblock" style="display: none">
|
||||||
Kindern oder Teenies.
|
<div class="col-12 center mb-3">
|
||||||
</p>
|
<a href="#" onclick="$('#fotoblock').fadeOut(1000); $('#welcomeblock').slideDown('slow');" class="btn btn-outline-secondary"><i class="fas fa-arrow-up"></i> Startseite</a>
|
||||||
<p>Im Freizeitheim angekommen, wirst du erst einmal ordentlich begrüßt und beziehst zusammen mit deinen (neuen) Freunden
|
</div>
|
||||||
dein Zimmer. Und dann kann die Freizeit auch schon starten. Hier erlebst du jede Menge Spaß, knüpfst neue Freundschaften,
|
<div class="col-12 thumbswipe">
|
||||||
bekommst ein tolles Programm geboten, hörst spannende Geschichten aus der Bibel und noch viel mehr.</p>
|
<div style="min-width: 13000px"><!-- omits line break -->
|
||||||
<p>
|
<th:block th:each="n : ${#numbers.sequence(1, 85)}" th:with="i=${#strings.toString(n < 10 ? '0' + n : n)}">
|
||||||
<strong>Preise, Termine und weitere Infos findest du in unserem Buchungsportal.</strong>
|
<a th:href="'https://www.onkelwernerfreizeiten.de/stock/stock' + ${i} + '.jpg'" data-fancybox="gallery" th:data-caption="${title['stock' + i]}"><img th:src="'https://www.onkelwernerfreizeiten.de/stock/thumb_stock' + ${i} + '.jpg'" height="96px" class="m-1" th:title="${title['stock' + i]}" /></a>
|
||||||
</p>
|
</th:block>
|
||||||
<p>
|
</div>
|
||||||
<a th:href="@{/camplist}">Jetzt Freizeiten entdecken</a>
|
<script th:inline="javascript">
|
||||||
</p>
|
Fancybox.bind('[data-fancybox="gallery"]', {
|
||||||
<h2>Kinderfreizeiten in Olfen</h2>
|
});
|
||||||
<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
|
function selectCamp(name) {
|
||||||
kleines Dorf in Hessen. Im großen Freizeitheim mit noch größerem Gelände drumherum erlebst du eine Woche voller Action,
|
$('#fotoblock').slideUp('slow');
|
||||||
Zusammenhalt und Gottes Wort.</p>
|
$('#infoblock').fadeIn(1000);
|
||||||
<p>Der Tag startet mit einer Stillen Zeit zusammen mit deiner Zimmergruppe und einem Mitarbeiter. Gemeinsam nehmt ihr
|
$('.description').hide();
|
||||||
Abschnitte aus der Bibel unter die Lupe.</p>
|
$('.campbtn').removeClass('btn-secondary').removeClass('text-white').addClass("btn-secondary-outline");
|
||||||
<p>Nach dem Frühstück kannst du in der “Frohen Stunde” Lieder singen, eine spannende Geschichte aus der Bibel hören und
|
$('#camp_' + name).show();
|
||||||
Bibelverse lernen. Das kann dir in deinem Leben eine große Hilfe sein.</p>
|
$('#btn_' + name).addClass('btn-secondary').removeClass("btn-secondary-outline").addClass('text-white');
|
||||||
<p>Am Nachmittag gibt es immer etwas zu Erleben. Zum Beispiel bei Geländespielen, in verschiedenen AG’s oder Spielen im
|
}
|
||||||
Dorf. Mit Sicherheit ist auch etwas Interessantes für dich dabei! Würdest du zum Beispiel verkleidete Mitarbeiter im Dorf
|
</script>
|
||||||
direkt erkennen? Bist du bereit, dich den Aufgaben zu stellen?</p>
|
</div>
|
||||||
<p>Am Abend erwarten dich Spiele- oder Themenabende, tolle Filme oder auch mal ein spannender Bericht von einem Missionar.
|
<div class="col-12 center">
|
||||||
Und ja, manchmal sind wir sogar nachts unterwegs…auf Nachtwanderungen oder bei aufregenden Geländespielen im Dunkeln.</p>
|
<h2 class="headlinefont">Unsere Freizeiten</h2>
|
||||||
<p>Ein besonderer Höhepunkt ist die Wanderung zur Sommerrodelbahn. Und natürlich das anschließende Rodeln! Wer traut sich,
|
</div>
|
||||||
mit voller Geschwindigkeit zu fahren? Oder wer hat es lieber etwas langsamer und macht dabei ein entspanntes Gesicht auf dem
|
<div class="col-12 center">
|
||||||
Foto, das geschossen wird?</p>
|
<!-- waiting for content from Jan
|
||||||
<p>Sei dabei und lerne neue Freunde kennen, die du bestimmt auch in der nächsten Freizeit wieder treffen wirst!</p>
|
<button class="btn btn-outline-secondary" onclick="selectCamp('rehe')">Rehe</button>
|
||||||
<h2>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
|
<button class="btn btn-outline-secondary" onclick="selectCamp('olfen')">Olfen</button>
|
||||||
heranwachsen, Gottes Wort begierig studieren und Gott noch tiefer erkennen? Dann bist du auf dieser Freizeit genau richtig!</p>
|
<button class="btn btn-outline-secondary" onclick="selectCamp('growup')">Grow Up</button>
|
||||||
<p>Auf der Grow Up möchten wir dir unter anderem folgende Möglichkeiten bieten:</p>
|
<button class="btn btn-outline-secondary" onclick="selectCamp('schweiz')">Schweiz</button>
|
||||||
<ul>
|
<button class="btn btn-outline-secondary" onclick="selectCamp('heimfreizeit')">Heimfreizeit</button>
|
||||||
<li>Selbstständiges Arbeiten mit deiner Bibel</li>
|
<button class="btn btn-outline-secondary" onclick="selectCamp('hohenhaslach')">Hohenhaslach</button>
|
||||||
<li>Austausch mit anderen Teilnehmern und Mitarbeitern</li>
|
</div>
|
||||||
<li>Jede Menge Gedanken, um im Glauben zu wachsen</li>
|
<div class="col-12 center mt-3">
|
||||||
</ul>
|
<a th:href="@{/camplist}" class="btn btn-outline-danger">zur Anmeldung</a>
|
||||||
<p>Und natürlich Jugendliche und junge Erwachsene kennenzulernen, die das gleiche Anliegen haben wie du. Nämlich Jesus
|
</div>
|
||||||
Christus immer ähnlicher zu werden und ein treuer Nachfolger zu sein.</p>
|
</div>
|
||||||
<p>Den Tag startest du erstmal ganz alleine mit Gott, deiner Bibel und deinem Freizeit-Heft. Hier geht es um ein Bibelbuch
|
<div id="infoblock" class="row displayblock" style="display: none">
|
||||||
oder biblisches Thema, das du anhand von Fragen tiefergehend studieren kannst.</p>
|
<div class="col-12 center mb-3">
|
||||||
<p>Nach dem Frühstück treffen wir uns in kleinen Gruppen. Hier kannst du dich über die Dinge austauschen, die du im
|
<a href="#" onclick="$('#infoblock').fadeOut(1000); $('#fotoblock').slideDown('slow');" class="btn btn-outline-secondary"><i class="fas fa-arrow-up"></i> Bilder</a>
|
||||||
Bibeltext gelernt hast. Welche Fragen sind bei dir aufgetaucht? Was verstehst du überhaupt nicht? Was ist dir besonders
|
</div>
|
||||||
wichtig geworden? Und wie kannst du es im Alltag anwenden? Der Austausch bereichert dich durch Gedanken von Anderen, auf die
|
<div class="col-12 center">
|
||||||
du selber vielleicht gar nicht gekommen wärst.</p>
|
<h2 class="headlinefont">Unsere Freizeiten</h2>
|
||||||
<p>Am Nachmittag erwarten dich interessante Seminare zu relevanten Themen, Workshops, Geländespiele. Aber auch besondere
|
</div>
|
||||||
Aktionen, wie ein Missionseinsatz oder ein stiller Nachmittag.</p>
|
<div class="col-12 center">
|
||||||
<p>Abends kannst du dich auf Vorträge freuen, die dich in deinem Glaubensleben herausfordern und zum Wachstum anspornen
|
<!-- waiting for content from Jan
|
||||||
sollen. Oder wir verbringen gemütliche Zeiten am Lagerfeuer und führen interessante Gespräche bei einer Nachtwanderung. Denn
|
<button id="btn_rehe" class="btn btn-outline-secondary campbtn" onclick="selectCamp('rehe')">Rehe</button>
|
||||||
neben der intensiver Beschäftigung mit Gottes Wort wirst du auf der Grow Up auch die Möglichkeit haben, intensive
|
-->
|
||||||
Freundschaften zu starten oder von Anderen zu lernen.</p>
|
<button id="btn_olfen" class="btn btn-outline-secondary campbtn" onclick="selectCamp('olfen')">Olfen</button>
|
||||||
<p>
|
<button id="btn_growup" class="btn btn-outline-secondary campbtn" onclick="selectCamp('growup')">Grow Up</button>
|
||||||
Zwischen den Programmpunkten bleibt viel Zeit, um sich kennenzulernen, zusammen <em>Nacht in Palermo</em>, Volleyball oder <em>Capture
|
<button id="btn_schweiz" class="btn btn-outline-secondary campbtn" onclick="selectCamp('schweiz')">Schweiz</button>
|
||||||
the Flag </em>zu spielen oder auch ein Gespräch mit einem Mitarbeiter zu suchen, wenn dich etwas total beschäftigt oder du
|
<button id="btn_heimfreizeit" class="btn btn-outline-secondary campbtn" onclick="selectCamp('heimfreizeit')">Heimfreizeit</button>
|
||||||
Hilfe und Rat brauchst.
|
<button id="btn_hohenhaslach" class="btn btn-outline-secondary campbtn" onclick="selectCamp('hohenhaslach')">Hohenhaslach</button>
|
||||||
</p>
|
</div>
|
||||||
<p>Du möchtest im Glauben herausgefordert werden, die Bibel und deinen Herrn besser kennenlernen und wirklich wachsen?
|
<div id="camp_rehe" class="col-12 description" style="display: none">
|
||||||
Dann komm zur Grow Up und sei bereit, dich von Gott verändern zu lassen!</p>
|
<h2 class="headlinefont">Wochenendfreizeit in Rehe</h2>
|
||||||
<h2>Teeniefreizeit Schweiz</h2>
|
<p>TODO: Jan & Melanie</p>
|
||||||
<p>Ab in die Berge – zwei Wochen Schweiz: mit Bergen, Seen, Kühen und allem, was das Herz begehrt. Mit Sicherheit wirst du
|
</div>
|
||||||
dort eine ganze Menge erleben, denn das Programm ist vielfältig und voller Action!</p>
|
<div id="camp_olfen" class="col-12 description" style="display: none">
|
||||||
<p>Du wirst in diesen zwei Wochen die Möglichkeit haben, spannende Bibelarbeiten und gute Gemeinschaft mit Gott zu
|
<h2 class="headlinefont">Kinderfreizeiten in Olfen</h2>
|
||||||
erleben. Wir beginnen jeden Morgen in kleinen Gruppen mit gemeinsamer Stillen Zeit – das bedeutet, dass wir über
|
<p>Jede Menge Kinder in deinem Alter, viele coole Spiele, Sommerrodeln und spannende biblische Geschichten…</p>
|
||||||
verschiedene Bibelstellen nachdenken und uns über unsere Leben und die Erfahrungen, die wir mit Gott gemacht haben,
|
<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
|
||||||
austauschen.</p>
|
größerem Gelände drumherum erlebst du eine Woche voller Action, Zusammenhalt und Gottes Wort.</p>
|
||||||
<p>Nach dem Frühstück folgt die „Frohe Stunde“ mit einer Bibelarbeit. In dieser Zeit konzentrieren wir uns gemeinsam
|
<p>Der Tag startet mit einer Stillen Zeit zusammen mit deiner Zimmergruppe und einem Mitarbeiter. Gemeinsam nehmt ihr Abschnitte aus der Bibel unter die Lupe.</p>
|
||||||
darauf, was uns verschiedene Mitarbeiter über Gott und die Bibel mitteilen werden. Es gibt viel zu lernen.</p>
|
<p>Nach dem Frühstück kannst du in der “Frohen Stunde” Lieder singen, eine spannende Geschichte aus der Bibel hören und Bibelverse lernen. Das kann dir in deinem Leben eine große
|
||||||
<p>In einer langen Mittagspause hast du Zeit für Fußball und Volleyball, Halli Galli oder andere Gesellschaftsspiele.</p>
|
Hilfe sein.</p>
|
||||||
<p>Später am Nachmittag gibt es ein abwechslungsreiches Programm, beispielsweise Geländespiele vor Ort oder im Wald,
|
<p>Am Nachmittag gibt es immer etwas zu Erleben. Zum Beispiel bei Geländespielen, in verschiedenen AG’s oder Spielen im Dorf. Mit Sicherheit ist auch etwas Interessantes für dich
|
||||||
Wasserspiele, Workshops und verschiedene AG's.</p>
|
dabei! Würdest du zum Beispiel verkleidete Mitarbeiter im Dorf direkt erkennen? Bist du bereit, dich den Aufgaben zu stellen?</p>
|
||||||
<p>Den Abend verbringen wir mit coolen kreativen Spielen wie z.B. einem Kochduell, Kiental sucht die Superband, Wetten
|
<p>Am Abend erwarten dich Spiele- oder Themenabende, tolle Filme oder auch mal ein spannender Bericht von einem Missionar. Und ja, manchmal sind wir sogar nachts unterwegs…auf
|
||||||
Dass…?, und Die perfekte Minute. Oder aber wir sehen uns nach einem anstrengenden Tag ganz entspannt einen Film an und
|
Nachtwanderungen oder bei aufregenden Geländespielen im Dunkeln.</p>
|
||||||
lassen den Abend mit angeregten Gesprächen ausklingen.</p>
|
<p>Ein besonderer Höhepunkt ist die Wanderung zur Sommerrodelbahn. Und natürlich das anschließende Rodeln! Wer traut sich, mit voller Geschwindigkeit zu fahren? Oder wer hat es lieber
|
||||||
<p>Außerdem gibt es noch etwas ganz Besonderes: Unse Tagestouren! Die Mitarbeiter wecken dich bereits im frühen
|
etwas langsamer und macht dabei ein entspanntes Gesicht auf dem Foto, das geschossen wird?</p>
|
||||||
Morgengrauen und dann wird der Gipfel auf 2820 Metern Höhe gestürmt. Oder wir fahren an den wunderschönen Thunersee. Hier
|
<p>Sei dabei und lerne neue Freunde kennen, die du bestimmt auch in der nächsten Freizeit wieder treffen wirst!</p>
|
||||||
kannst du nicht nur Schwimmen, sondern auch aus zehn Metern Höhe ins Wasser springen, Beachvolleyball spielen und viele
|
</div>
|
||||||
andere coole Dinge machen.</p>
|
<div id="camp_growup" class="col-12 description" style="display: none">
|
||||||
<p>Bist du bereit, auf eine Woche voller Spaß und Action? Bist du bereit, dich verändern zu lassen? Bist du neugierig
|
<h2 class="headlinefont">Jugendfreizeit Grow Up</h2>
|
||||||
geworden? Dann sehen wir uns in der Schweiz!</p>
|
<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
|
||||||
<h2>Heimfreizeit für Kinder in Heilbronn</h2>
|
tiefer erkennen? Dann bist du auf dieser Freizeit genau richtig!</p>
|
||||||
<p>Du hast noch zwei Wochen Sommerferien, wohnst in Heilbronn und hast noch nichts vor? Wie wäre es mit einem coolen und
|
<p>Auf der Grow Up möchten wir dir unter anderem folgende Möglichkeiten bieten:</p>
|
||||||
abwechslungsreichen Tagesprogramm zusammen mit vielen anderen Kindern in deinem Alter?</p>
|
<ul>
|
||||||
<p>Auf der Heimfreizeit hast du die Möglichkeit schon einmal ein bisschen hineinzuschnuppern, wie es sich anfühlt, auf
|
<li>Selbstständiges Arbeiten mit deiner Bibel</li>
|
||||||
einer Freizeit dabei zu sein. Denn du übernachtest zwar zu Hause, aber zwei Wochen lang verbringst du den Tag mit vielen
|
<li>Austausch mit anderen Teilnehmern und Mitarbeitern</li>
|
||||||
anderen Kindern und Mitarbeitern bei einem tollen Programm.</p>
|
<li>Jede Menge Gedanken, um im Glauben zu wachsen</li>
|
||||||
<p>Wir starten mit Liedern und einer spannenden Geschichte aus der Bibel in den Tag. Natürlich gibt’s auch gemeinsames
|
</ul>
|
||||||
Mittagessen. Auch Zeit zum spielen gibt es genug. Zum Beispiel auf dem Spielplatz oder beim Völkerball auf dem Alten
|
<p>Und natürlich Jugendliche und junge Erwachsene kennenzulernen, die das gleiche Anliegen haben wie du. Nämlich Jesus Christus immer ähnlicher zu werden und ein treuer Nachfolger zu
|
||||||
Friedhof. Nachmittags erwarten dich viele coole Aktionen. Wie wäre es zum Beispiel mit einer Schnitzeljagd? Oder einer
|
sein.</p>
|
||||||
kleinen Wanderung auf den Wartberg? Mit vielen tollen Spielen im Pfühlpark? Oder mit einer schönen Abkühlung und viel Spaß
|
<p>Den Tag startest du erstmal ganz alleine mit Gott, deiner Bibel und deinem Freizeit-Heft. Hier geht es um ein Bibelbuch oder biblisches Thema, das du anhand von Fragen tiefergehend
|
||||||
im Freibad?</p>
|
studieren kannst.</p>
|
||||||
<p>Nach einem kleinen Nachmittagssnack verabschieden wir uns bis zum nächsten Morgen.</p>
|
<p>Nach dem Frühstück treffen wir uns in kleinen Gruppen. Hier kannst du dich über die Dinge austauschen, die du im Bibeltext gelernt hast. Welche Fragen sind bei dir
|
||||||
<p>Besondere Höhepunkte sind ein Besuch im Indoor-Spielplatz oder der Experimenta. Manchmal lässt Axel (Erlebnispädagoge)
|
aufgetaucht? Was verstehst du überhaupt nicht? Was ist dir besonders wichtig geworden? Und wie kannst du es im Alltag anwenden? Der Austausch bereichert dich durch Gedanken von Anderen,
|
||||||
sich auch etwas ganz Besonderes einfallen, wie zum Beispiel Flag-Football.</p>
|
auf die du selber vielleicht gar nicht gekommen wärst.</p>
|
||||||
<p>Das klingt doch viel besser, als sich zu Hause zu langweilen, oder?</p>
|
<p>Am Nachmittag erwarten dich interessante Seminare zu relevanten Themen, Workshops, Geländespiele. Aber auch besondere Aktionen, wie ein Missionseinsatz oder ein stiller Nachmittag.</p>
|
||||||
<h2>Teeniefreizeit Hohenhaslach</h2>
|
<p>Abends kannst du dich auf Vorträge freuen, die dich in deinem Glaubensleben herausfordern und zum Wachstum anspornen sollen. Oder wir verbringen gemütliche Zeiten am Lagerfeuer und
|
||||||
<p>Eine Woche Herbstferien und das hast keine Lust, sie zu verschwenden oder alleine zu Hause zu sitzen? Wie wärs mit
|
führen interessante Gespräche bei einer Nachtwanderung. Denn neben der intensiver Beschäftigung mit Gottes Wort wirst du auf der Grow Up auch die Möglichkeit haben, intensive
|
||||||
einer herausfordernden Woche zusammen mit anderen Jugendlichen in den schönen Weinbergen von Baden-Württemberg?</p>
|
Freundschaften zu starten oder von Anderen zu lernen.</p>
|
||||||
<p>Das Freizeitheim in Hohenhaslach liegt tatsächlich mitten in den Weinbergen, die natürlich im Herbst am schönsten
|
<p>
|
||||||
aussehen. Hier lassen sich wunderbar Geländespiele oder Spaziergänge erleben.</p>
|
Zwischen den Programmpunkten bleibt viel Zeit, um sich kennenzulernen, zusammen <em>Nacht in Palermo</em>, Volleyball oder <em>Capture the Flag </em>zu spielen oder auch ein Gespräch mit
|
||||||
<p>Aber nicht die schöne Landschaft allein macht die gute Atmosphäre aus. In dieser Woche hast du die Möglichkeit, Leute
|
einem Mitarbeiter zu suchen, wenn dich etwas total beschäftigt oder du Hilfe und Rat brauchst.
|
||||||
in deinem Alter kennenzulernen, die mit Jesus leben wollen und dir zu guten Freunden werden können. Außerdem kannst du durch
|
</p>
|
||||||
tiefgehende Bibelarbeiten und Stille Zeiten mit deiner Zimmergruppe und einem Mitarbeiter auch Gott besser kennenlernen oder
|
<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
|
||||||
Fragen stellen, die du dir schon lange gestellt hast.</p>
|
lassen!</p>
|
||||||
<p>Der Morgen ist gefüllt mit der Beschäftigung mit Gottes Wort, was es uns für unser Leben zu sagen hat und wie wir für
|
</div>
|
||||||
Gott leben können. Du wirst herausgefordert, ganz persönlich darüber nachzudenken, wo du in Bezug auf Gott stehst und was du
|
<div id="camp_schweiz" class="col-12 description" style="display: none">
|
||||||
gerne ändern oder auch fördern möchtest. Durch das Lernen von wichtigen Bibelversen bekommst du einen guten Schutz, wenn du
|
<h2 class="headlinefont">Teeniefreizeit Schweiz</h2>
|
||||||
im Alltag mit Problemen zu kämpfen hast.</p>
|
<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
|
||||||
<p>Am Nachmittag bleibt viel Zeit für tolle Spiele, Herausforderungen beim Sport, Taktieren im Geländespiel oder Erkunden
|
vielfältig und voller Action!</p>
|
||||||
des Dorfes und der Weinberge.</p>
|
<p>Du wirst in diesen zwei Wochen die Möglichkeit haben, spannende Bibelarbeiten und gute Gemeinschaft mit Gott zu erleben. Wir beginnen jeden Morgen in kleinen Gruppen mit
|
||||||
<p>Abends erwarten dich Gameshows, ein Film oder auch mal ein gemütliches Dinner. Auch nachts sind die Weinberge nicht
|
gemeinsamer Stillen Zeit – das bedeutet, dass wir über verschiedene Bibelstellen nachdenken und uns über unsere Leben und die Erfahrungen, die wir mit Gott gemacht haben, austauschen.</p>
|
||||||
immer sicher vor uns, egal ob es sich um eine Nachtwanderung oder ein spannendes Nachtspiel handelt.</p>
|
<p>Nach dem Frühstück folgt die „Frohe Stunde“ mit einer Bibelarbeit. In dieser Zeit konzentrieren wir uns gemeinsam darauf, was uns verschiedene Mitarbeiter über Gott und die Bibel
|
||||||
<p>Gemeinschaft und Spaß kommen auf jeden Fall nicht zu kurz und auch im Glauben bietet dir die Hohenhaslach-Freizeit
|
mitteilen werden. Es gibt viel zu lernen.</p>
|
||||||
Herausforderung, wenn du dazu bereit bist!</p>
|
<p>In einer langen Mittagspause hast du Zeit für Fußball und Volleyball, Halli Galli oder andere Gesellschaftsspiele.</p>
|
||||||
<p>
|
<p>Später am Nachmittag gibt es ein abwechslungsreiches Programm, beispielsweise Geländespiele vor Ort oder im Wald, Wasserspiele, Workshops und verschiedene AG's.</p>
|
||||||
<strong>Preise, Termine und weitere Infos findest du in unserem Buchungsportal.</strong>
|
<p>Den Abend verbringen wir mit coolen kreativen Spielen wie z.B. einem Kochduell, Kiental sucht die Superband, Wetten Dass…?, und Die perfekte Minute. Oder aber wir sehen uns nach
|
||||||
</p>
|
einem anstrengenden Tag ganz entspannt einen Film an und lassen den Abend mit angeregten Gesprächen ausklingen.</p>
|
||||||
<p>
|
<p>Außerdem gibt es noch etwas ganz Besonderes: Unse Tagestouren! Die Mitarbeiter wecken dich bereits im frühen Morgengrauen und dann wird der Gipfel auf 2820 Metern Höhe gestürmt.
|
||||||
<a th:href="@{/camplist}">Jetzt Freizeiten entdecken</a>
|
Oder wir fahren an den wunderschönen Thunersee. Hier kannst du nicht nur Schwimmen, sondern auch aus zehn Metern Höhe ins Wasser springen, Beachvolleyball spielen und viele andere coole
|
||||||
</p>
|
Dinge machen.</p>
|
||||||
</div>
|
<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>
|
||||||
|
</div>
|
||||||
|
<div id="camp_heimfreizeit" class="col-12 description" style="display: none">
|
||||||
|
<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 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 einer Freizeit dabei zu sein. Denn du übernachtest zwar zu Hause,
|
||||||
|
aber zwei Wochen lang verbringst du den Tag mit vielen anderen Kindern und Mitarbeitern bei einem tollen Programm.</p>
|
||||||
|
<p>Wir starten mit Liedern und einer spannenden Geschichte aus der Bibel in den Tag. Natürlich gibt’s auch gemeinsames Mittagessen. Auch Zeit zum spielen gibt es genug. Zum Beispiel
|
||||||
|
auf dem Spielplatz oder beim Völkerball auf dem Alten Friedhof. Nachmittags erwarten dich viele coole Aktionen. Wie wäre es zum Beispiel mit einer Schnitzeljagd? Oder einer kleinen
|
||||||
|
Wanderung auf den Wartberg? Mit vielen tollen Spielen im Pfühlpark? Oder mit einer schönen Abkühlung und viel Spaß im Freibad?</p>
|
||||||
|
<p>Nach einem kleinen Nachmittagssnack verabschieden wir uns bis zum nächsten Morgen.</p>
|
||||||
|
<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>
|
||||||
|
<p>Das klingt doch viel besser, als sich zu Hause zu langweilen, oder?</p>
|
||||||
|
</div>
|
||||||
|
<div id="camp_hohenhaslach" class="col-12 description" style="display: none">
|
||||||
|
<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 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 aussehen. Hier lassen sich wunderbar Geländespiele oder
|
||||||
|
Spaziergänge erleben.</p>
|
||||||
|
<p>Aber nicht die schöne Landschaft allein macht die gute Atmosphäre aus. In dieser Woche hast du die Möglichkeit, Leute in deinem Alter kennenzulernen, die mit Jesus leben wollen und
|
||||||
|
dir zu guten Freunden werden können. Außerdem kannst du durch tiefgehende Bibelarbeiten und Stille Zeiten mit deiner Zimmergruppe und einem Mitarbeiter auch Gott besser kennenlernen oder
|
||||||
|
Fragen stellen, die du dir schon lange gestellt hast.</p>
|
||||||
|
<p>Der Morgen ist gefüllt mit der Beschäftigung mit Gottes Wort, was es uns für unser Leben zu sagen hat und wie wir für Gott leben können. Du wirst herausgefordert, ganz persönlich
|
||||||
|
darüber nachzudenken, wo du in Bezug auf Gott stehst und was du gerne ändern oder auch fördern möchtest. Durch das Lernen von wichtigen Bibelversen bekommst du einen guten Schutz, wenn du
|
||||||
|
im Alltag mit Problemen zu kämpfen hast.</p>
|
||||||
|
<p>Am Nachmittag bleibt viel Zeit für tolle Spiele, Herausforderungen beim Sport, Taktieren im Geländespiel oder Erkunden des Dorfes und der Weinberge.</p>
|
||||||
|
<p>Abends erwarten dich Gameshows, ein Film oder auch mal ein gemütliches Dinner. Auch nachts sind die Weinberge nicht immer sicher vor uns, egal ob es sich um eine Nachtwanderung oder
|
||||||
|
ein spannendes Nachtspiel handelt.</p>
|
||||||
|
<p>Gemeinschaft und Spaß kommen auf jeden Fall nicht zu kurz und auch im Glauben bietet dir die Hohenhaslach-Freizeit Herausforderung, wenn du dazu bereit bist!</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 center mt-3">
|
||||||
|
<a th:href="@{/camplist}" class="btn btn-outline-danger">zur Anmeldung</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,13 +36,17 @@
|
|||||||
<td th:text="${#temporals.format(booker.bookingDate, 'dd.MM.yyyy')}"></td>
|
<td th:text="${#temporals.format(booker.bookingDate, 'dd.MM.yyyy')}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Bestätigt</th>
|
<th>Status</th>
|
||||||
<td th:text="${booker.accept == null ? '' : (booker.accept ? 'Ja' : 'abgelehnt')}"></td>
|
<td th:text="${booker.progress}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<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>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<th>Freizeit</th>
|
<th>Freizeit</th>
|
||||||
<th>Rolle</th>
|
<th>Rolle</th>
|
||||||
<th>Kontostand</th>
|
<th>Kontostand</th>
|
||||||
<th>Angemeldet</th>
|
<th>Status</th>
|
||||||
<th>Bestätigt</th>
|
<th>Bestätigt</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td class="middled" th:text="${#temporals.format(b.bookingDate, 'dd.MM.yyyy')}"></td>
|
<td class="middled" th:text="${#temporals.format(b.bookingDate, 'dd.MM.yyyy')}"></td>
|
||||||
<td class="middled" th:text="${b.accept == null ? '' : (b.accept ? 'Ja' : 'abgelehnt')}"></td>
|
<td class="middled" th:text="${b.progress}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</th:block>
|
</th:block>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
<th>Geschlecht</th>
|
<th>Geschlecht</th>
|
||||||
<th>Rolle</th>
|
<th>Rolle</th>
|
||||||
<th>Kontostand</th>
|
<th>Kontostand</th>
|
||||||
<th>Angemeldet</th>
|
<th>Status</th>
|
||||||
<th>Bestätigt</th>
|
<th>Bestätigt</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
<td th:text="${b.role}"></td>
|
<td th:text="${b.role}"></td>
|
||||||
<td><span th:text="${#numbers.formatDecimal(b.paid, 1, 2) + ' €'}" th:if="${b.paid != null}"></span></td>
|
<td><span th:text="${#numbers.formatDecimal(b.paid, 1, 2) + ' €'}" th:if="${b.paid != null}"></span></td>
|
||||||
<td th:text="${#temporals.format(b.bookingDate, 'dd.MM.yyyy')}"></td>
|
<td th:text="${#temporals.format(b.bookingDate, 'dd.MM.yyyy')}"></td>
|
||||||
<td th:text="${b.accept == null ? '' : (b.accept ? 'Ja' : 'abgelehnt')}"></td>
|
<td th:text="${b.progress}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</th:block>
|
</th:block>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
85
src/main/resources/templates/business/outlay/editor.html
Normal 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>
|
50
src/main/resources/templates/business/outlay/list.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<!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>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col" th:each="c : ${camps}">
|
||||||
|
<a th:href="@{/business/outlay/summary/{id}(id=${c.id})}" class="btn btn-outline-primary" th:text="${c.campname}"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#table").DataTable({
|
||||||
|
language : locale_de
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</body>
|
||||||
|
</html>
|
53
src/main/resources/templates/business/outlay/summary.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!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>Kassenzettelnummer</th>
|
||||||
|
<th>Händler / Shop</th>
|
||||||
|
<th>Freizeit</th>
|
||||||
|
<th>Auslegender</th>
|
||||||
|
<th>Betrag</th>
|
||||||
|
<th>Tag / Uhrzeit</th>
|
||||||
|
<th>Kurzbeschreibung</th>
|
||||||
|
<th>Bemerkungen</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="o : ${list}">
|
||||||
|
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${o.recipenumber}"></a></td>
|
||||||
|
<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="${o.provider}"></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>
|
||||||
|
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${o.ingredients}"></a></td>
|
||||||
|
<td><a th:href="@{/business/outlay/edit/{id}(id=${o.id})}" th:text="${o.recipenote}"></a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="8"><a th:href="@{/business/outlay/download/{campid}(campid=${campid})}" class="btn btn-outline-primary form-control">herunterladen</a></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#table").DataTable({
|
||||||
|
language : locale_de
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -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}">
|
||||||
|
@ -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>
|
||||||
|
24
src/main/resources/templates/confirmation/board.html
Normal 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>
|
59
src/main/resources/templates/confirmation/camplist.html
Normal 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> 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> <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.progress}"></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>
|
@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="accordion-item">
|
<div class="accordion-item">
|
||||||
<h2 class="accordion-header" id="approvedpanel">
|
<h2 class="accordion-header" id="approvedpanel">
|
||||||
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#approveddiv" aria-expanded="true" aria-control="approveddiv">kürzlich bestätigte
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#approveddiv" aria-expanded="true" aria-control="approveddiv">bestätigte
|
||||||
Anmeldungen</button>
|
Anmeldungen</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div id="approveddiv" class="accordion-collapse collapse dist8" aria-labelled="approvedpanel" data-bs-parent="#mainacc">
|
<div id="approveddiv" class="accordion-collapse collapse dist8" aria-labelled="approvedpanel" data-bs-parent="#mainacc">
|
||||||
@ -79,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="accordion-item">
|
<div class="accordion-item">
|
||||||
<h2 class="accordion-header" id="rejectedpanel">
|
<h2 class="accordion-header" id="rejectedpanel">
|
||||||
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#rejecteddiv" aria-expanded="true" aria-control="rejecteddiv">kürzlich abgelehnte
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#rejecteddiv" aria-expanded="true" aria-control="rejecteddiv">abgelehnte
|
||||||
Anmeldungen</button>
|
Anmeldungen</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div id="rejecteddiv" class="accordion-collapse collapse dist8" aria-labelled="rejectedpanel" data-bs-parent="#mainacc">
|
<div id="rejecteddiv" class="accordion-collapse collapse dist8" aria-labelled="rejectedpanel" data-bs-parent="#mainacc">
|
||||||
@ -112,6 +112,41 @@
|
|||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="accordion-item">
|
||||||
|
<h2 class="accordion-header" id="revokedpanel">
|
||||||
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#revokeddiv" aria-expanded="true" aria-control="revokeddiv">stornierte
|
||||||
|
Anmeldungen</button>
|
||||||
|
</h2>
|
||||||
|
<div id="revokeddiv" class="accordion-collapse collapse dist8" aria-labelled="revokedpanel" data-bs-parent="#mainacc">
|
||||||
|
<table id="revoked">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Freizeit</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Rolle</th>
|
||||||
|
<th>Anmeldedatum</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="u : ${revoked}">
|
||||||
|
<td><a th:href="@{'/confirmation/person/' + ${u.pkPerson}}" th:text="${u.camp} + ' ' + ${#temporals.format(u.date, 'yyyy')}"></a></td>
|
||||||
|
<td><a th:href="@{'/confirmation/person/' + ${u.pkPerson}}" th:text="${u.fullname}"></a></td>
|
||||||
|
<td><a th:href="@{'/confirmation/person/' + ${u.pkPerson}}" th:text="${u.rolename}"></a></td>
|
||||||
|
<td><a th:href="@{'/confirmation/person/' + ${u.pkPerson}}" th:text="${#temporals.format(u.registered, 'yyyy-MM-dd')}"></a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#revoked").DataTable({
|
||||||
|
language : locale_de,
|
||||||
|
pageLength : 5,
|
||||||
|
lengthMenu : [ [ 5, 25, 50, -1 ], [ 5, 25, 50, "Alle" ] ]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="accordion-item">
|
<div class="accordion-item">
|
||||||
<h2 class="accordion-header" id="overviewpanel">
|
<h2 class="accordion-header" id="overviewpanel">
|
||||||
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#overviewdiv" aria-expanded="true" aria-control="overviewdiv">Freizeitenübersicht</button>
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#overviewdiv" aria-expanded="true" aria-control="overviewdiv">Freizeitenübersicht</button>
|
||||||
@ -127,14 +162,14 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr th:each="o : ${campoverview}">
|
<tr th:each="o : ${campoverview}">
|
||||||
<td th:text="${o.camp} + ' ' + ${#temporals.format(o.date, 'yyyy')}"></td>
|
<td th:text="${o.camp} + ' ' + ${#temporals.format(o.date, 'yyyy')}"></td>
|
||||||
<td><span th:text="${o.untouched}" class="badgetodo"></span> / <span th:text="${o.rejected}" class="badgewarn"></span> / <span th:text="${o.approved}" class="badgeinfo"></span></td>
|
<td><span th:text="${o.untouched}" class="badgetodo"></span> / <span th:text="${o.rejected}" class="badgewarn"></span> / <span th:text="${o.approved}" class="badgeinfo"></span> / <span th:text="${o.revoked}" class="badgeerror"></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Zusammenfassung</td>
|
<td>Zusammenfassung</td>
|
||||||
<td><span th:text="${campoverviewsummary.untouched}" class="badgetodo"></span> / <span th:text="${campoverviewsummary.rejected}" class="badgewarn"></span> / <span
|
<td><span th:text="${campoverviewsummary.untouched}" class="badgetodo"></span> / <span th:text="${campoverviewsummary.rejected}" class="badgewarn"></span> / <span
|
||||||
th:text="${campoverviewsummary.approved}" class="badgeinfo"></span></td>
|
th:text="${campoverviewsummary.approved}" class="badgeinfo"></span> / <span th:text="${campoverviewsummary.revoked}" class="badgeerror"></span></td>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -146,7 +181,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<span>Legende:</span><span class="badgetodo">unbearbeitet</span><span class="badgewarn">abgelehnt</span><span class="badgeinfo">bestätigt</span>
|
<span>Legende:</span><span class="badgetodo">unbearbeitet</span><span class="badgewarn">abgelehnt</span><span class="badgeinfo">bestätigt</span><span class="badgeerror">storniert</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="accordion-item">
|
<div class="accordion-item">
|
||||||
|