37 Commits

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
plugins {
id 'org.springframework.boot' version '3.1.1'
id "io.spring.dependency-management" version "1.1.2"
id 'org.springframework.boot' version '3.3.4'
id "io.spring.dependency-management" version "1.1.4"
id 'java'
id 'war'
id 'eclipse'
@ -8,7 +8,7 @@ plugins {
}
group = 'de.jottyfan.camporganizer'
version = '0.5.8'
version = '0.8.7'
description = """CampOrganizer2"""
@ -35,52 +35,53 @@ war {
"Implementation-Timestamp": new Date())
}
}
baseName = project.name
version = version
archiveName = 'CampOrganizer2.war'
archiveFileName = 'CampOrganizer2.war'
}
dependencies {
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.20.0'
implementation 'org.jooq:jooq:3.19.14'
implementation 'de.jottyfan:COJooq:2024.10.24'
implementation 'org.webjars:bootstrap:5.2.3'
implementation 'org.webjars:font-awesome:5.15.4'
implementation 'org.webjars:jquery:3.6.4'
implementation 'org.webjars:popper.js:2.9.3'
implementation 'org.webjars:datatables:1.13.2'
implementation 'org.apache.logging.log4j:log4j-api:2.24.1'
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.1'
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 'net.sf.biweekly:biweekly:0.6.6'
implementation 'net.sf.biweekly:biweekly:0.6.7'
// for using the keycloak rest interface
implementation 'org.keycloak:keycloak-server-spi:22.0.1'
implementation 'org.keycloak:keycloak-admin-client:22.0.0'
implementation 'org.jboss.resteasy:resteasy-client:6.2.4.Final'
implementation 'org.keycloak:keycloak-server-spi:24.0.1'
implementation 'org.keycloak:keycloak-admin-client:24.0.1'
implementation 'org.jboss.resteasy:resteasy-client:6.2.6.Final'
// backward compatibility until the complete registration is converted to keycloak
implementation 'org.jasypt:jasypt:1.9.3'
// rss support
implementation 'com.rometools:rome:1.18.0'
implementation 'com.rometools:rome:2.1.0'
// 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-jooq'
implementation 'org.springframework.boot:spring-boot-starter-security'
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-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'de.jottyfan:COJooq:2023.03'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.0.0'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.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'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

2
gradlew vendored
View File

@ -162,7 +162,7 @@ save () {
APP_ARGS=$(save "$@")
# 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
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then

1
settings.gradle Normal file
View File

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

View File

@ -31,7 +31,7 @@ public class Main extends SpringBootServletInitializer {
Path path = Paths.get("");
String p = path.toAbsolutePath().toString();
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
SpringApplication.run(Main.class, args);
}

View File

@ -11,6 +11,7 @@ import org.springframework.security.oauth2.client.registration.InMemoryClientReg
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy;
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
.oauth2Login(o -> o.defaultSuccessUrl("/"))
.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())
.oauth2ResourceServer(o -> o.jwt(Customizer.withDefaults()))
.sessionManagement(o -> o.init(sec));

View File

@ -74,7 +74,7 @@ public class AdminController extends CommonController {
}
@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));
return "/admin/document_edit";
}
@ -92,7 +92,7 @@ public class AdminController extends CommonController {
}
@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);
return "redirect:/admin/document";
}
@ -111,7 +111,7 @@ public class AdminController extends CommonController {
}
@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("documents", service.getLocationDocuments());
return "/admin/location_edit";
@ -132,7 +132,7 @@ public class AdminController extends CommonController {
}
@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);
return "redirect:/admin/location";
}
@ -154,7 +154,7 @@ public class AdminController extends CommonController {
}
@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("documents", service.getCampDocuments());
model.addAttribute("locations", service.getLocations());
@ -186,7 +186,7 @@ public class AdminController extends CommonController {
}
@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) {
String error = service.deleteCamp(id);
redirect.addAttribute("error", error);

View File

@ -49,7 +49,7 @@ public class AdminPrivilegesController extends CommonController {
}
@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("selected", role);
model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role)));
@ -58,7 +58,7 @@ public class AdminPrivilegesController extends CommonController {
}
@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();
model.addAttribute("list", list);
String campname = "?";
@ -74,7 +74,7 @@ public class AdminPrivilegesController extends CommonController {
}
@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();
model.addAttribute("list", list);
String selected = "?";
@ -90,13 +90,13 @@ public class AdminPrivilegesController extends CommonController {
}
@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);
return "redirect:" + pagedest.replace("_", "/");
}
@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("bean", new CampProfileBean());
model.addAttribute("profiles", service.getProfiles());
@ -106,7 +106,7 @@ public class AdminPrivilegesController extends CommonController {
}
@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()) {
model.addAttribute("pagedest", pagedest);
model.addAttribute("profiles", service.getProfiles());
@ -119,7 +119,7 @@ public class AdminPrivilegesController extends CommonController {
}
@GetMapping("/admin/privileges/abortinsert/{pagedest}")
public String abortInsert(@PathVariable String pagedest) {
public String abortInsert(@PathVariable("pagedest") String pagedest) {
return "redirect:" + pagedest.replace("_", "/");
}
}

View File

@ -13,11 +13,10 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import jakarta.validation.Valid;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jooq.Condition;
@ -26,7 +25,7 @@ import org.jooq.DeleteConditionStep;
import org.jooq.Field;
import org.jooq.InsertResultStep;
import org.jooq.InsertReturningStep;
import org.jooq.InsertValuesStep11;
import org.jooq.InsertValuesStep16;
import org.jooq.InsertValuesStep3;
import org.jooq.Record4;
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.ProfileBean;
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)
.orderBy(T_DOCUMENT.PK);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
Record5<Integer, String, EnumDocument, EnumFiletype, EnumCamprole[]> r = sql.fetchOne();
if (r != null) {
DocumentBean bean = new DocumentBean();
@ -129,9 +129,11 @@ public class AdminRepository {
.groupBy(T_DOCUMENT.PK, T_DOCUMENT.NAME, T_DOCUMENT.DOCTYPE, T_DOCUMENT.FILETYPE)
.orderBy(T_DOCUMENT.PK);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql.toString());
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();
bean.setPk(r.get(T_DOCUMENT.PK));
bean.setName(r.get(T_DOCUMENT.NAME));
@ -160,9 +162,11 @@ public class AdminRepository {
.from(T_DOCUMENT)
.where(condition);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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();
bean.setPk(r.get(T_DOCUMENT.PK));
bean.setName(r.get(T_DOCUMENT.NAME));
@ -198,7 +202,7 @@ public class AdminRepository {
.set(T_DOCUMENT.FILETYPE, bean.getFiletype())
.where(T_DOCUMENT.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
} else {
InsertResultStep<TDocumentRecord> sql = DSL.using(c)
@ -211,7 +215,7 @@ public class AdminRepository {
.values(bean.getName(), bean.getDoctype(), bean.getDocument(), bean.getFiletype())
.returning(T_DOCUMENT.PK);
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
pk = sql.fetchOne().get(T_DOCUMENT.PK);
lrw.add(1);
}
@ -229,7 +233,7 @@ public class AdminRepository {
.onConflict(T_DOCUMENTROLE.FK_DOCUMENT, T_DOCUMENTROLE.CAMPROLE)
.doNothing();
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
removeCandidates.remove(role);
} catch (IllegalArgumentException e) {
@ -242,7 +246,7 @@ public class AdminRepository {
.where(T_DOCUMENTROLE.FK_DOCUMENT.eq(pk))
.and(T_DOCUMENTROLE.CAMPROLE.in(removeCandidates));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
});
return lrw.getCounter();
@ -264,7 +268,7 @@ public class AdminRepository {
.set(T_CAMP.FK_DOCUMENT, (Integer) null)
.where(T_CAMP.FK_DOCUMENT.eq(pk));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
UpdateConditionStep<TLocationRecord> sql1 = DSL.using(t)
@ -273,7 +277,7 @@ public class AdminRepository {
.set(T_LOCATION.FK_DOCUMENT, (Integer) null)
.where(T_LOCATION.FK_DOCUMENT.eq(pk));
// @formatter:on
LOGGER.debug("{}", sql1.toString());
LOGGER.trace(sql1);
lrw.add(sql1.execute());
DeleteConditionStep<TDocumentroleRecord> sql2 = DSL.using(t)
@ -281,7 +285,7 @@ public class AdminRepository {
.deleteFrom(T_DOCUMENTROLE)
.where(T_DOCUMENTROLE.FK_DOCUMENT.eq(pk));
// @formatter:on
LOGGER.debug("{}", sql2.toString());
LOGGER.trace(sql2);
lrw.add(sql2.execute());
DeleteConditionStep<TDocumentRecord> sql3 = DSL.using(t)
@ -289,7 +293,7 @@ public class AdminRepository {
.deleteFrom(T_DOCUMENT)
.where(T_DOCUMENT.PK.eq(pk));
// @formatter:on
LOGGER.debug("{}", sql3.toString());
LOGGER.trace(sql3);
lrw.add(sql3.execute());
});
return lrw.getCounter();
@ -302,7 +306,7 @@ public class AdminRepository {
*/
public List<LocationBean> getLocations() {
SelectWhereStep<TLocationRecord> sql = jooq.selectFrom(T_LOCATION);
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
List<LocationBean> list = new ArrayList<>();
for (TLocationRecord r : sql.fetch()) {
list.add(LocationBean.of(r));
@ -318,7 +322,7 @@ public class AdminRepository {
*/
public LocationBean getLocation(Integer 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());
}
@ -330,7 +334,7 @@ public class AdminRepository {
*/
public Integer deleteLocation(Integer id) {
DeleteConditionStep<TLocationRecord> sql = jooq.deleteFrom(T_LOCATION).where(T_LOCATION.PK.eq(id));
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
return sql.execute();
}
@ -352,7 +356,7 @@ public class AdminRepository {
T_LOCATION.URL)
.values(bean.getName(), bean.getFkDocument(), bean.getUrl());
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
} else {
UpdateConditionStep<TLocationRecord> sql = DSL.using(t)
@ -363,7 +367,7 @@ public class AdminRepository {
.set(T_LOCATION.URL, bean.getUrl())
.where(T_LOCATION.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
}
});
@ -377,7 +381,7 @@ public class AdminRepository {
*/
public List<CampBean> getAllCamps() {
SelectWhereStep<TCampRecord> sql = jooq.selectFrom(T_CAMP);
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
List<CampBean> list = new ArrayList<>();
for (TCampRecord r : sql.fetch()) {
list.add(CampBean.of(r));
@ -393,7 +397,7 @@ public class AdminRepository {
*/
public CampBean getCamp(Integer 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());
}
@ -407,11 +411,11 @@ public class AdminRepository {
LambdaResultWrapper lrw = new LambdaResultWrapper();
jooq.transaction(t -> {
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();
if (registrations < 1) {
DeleteConditionStep<TCampRecord> sql2 = DSL.using(t).deleteFrom(T_CAMP).where(T_CAMP.PK.eq(id));
LOGGER.debug(sql2.toString());
LOGGER.trace(sql2);
sql2.execute();
} else {
lrw.putString("error", String
@ -431,10 +435,12 @@ public class AdminRepository {
jooq.transaction(t -> {
LocalDate arriveDate = bean.getArrive();
LocalDate departDate = bean.getDepart();
LocalDate startBookingDate = bean.getStartBooking();
LocalDateTime arrive = arriveDate == null ? null : arriveDate.atStartOfDay();
LocalDateTime depart = departDate == null ? null : departDate.atStartOfDay();
LocalDateTime startBooking = startBookingDate == null ? null : startBookingDate.atStartOfDay();
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)
// @formatter:off
.insertInto(T_CAMP,
@ -448,11 +454,17 @@ public class AdminRepository {
T_CAMP.MAX_AGE,
T_CAMP.MIN_AGE,
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(),
bean.getLockSales() != null ? bean.getLockSales() : false, bean.getMaxAge(), bean.getMinAge(), bean.getName(), bean.getPrice());
bean.getLockSales() != null ? bean.getLockSales() : false, bean.getMaxAge(), bean.getMinAge(), bean.getName(), bean.getPrice(),
bean.getBedsFemale(), bean.getBedsMale(), bean.getBlockedBedsFemale(), bean.getBlockedBedsMale(), startBooking);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
sql.execute();
} else {
UpdateConditionStep<TCampRecord> sql = DSL.using(t)
@ -469,9 +481,14 @@ public class AdminRepository {
.set(T_CAMP.MIN_AGE, bean.getMinAge())
.set(T_CAMP.NAME, bean.getName())
.set(T_CAMP.PRICE, bean.getPrice())
.set(T_CAMP.BEDS_FEMALE, bean.getBedsFemale())
.set(T_CAMP.BEDS_MALE, bean.getBedsMale())
.set(T_CAMP.BLOCKED_BEDS_FEMALE, bean.getBlockedBedsFemale())
.set(T_CAMP.BLOCKED_BEDS_MALE, bean.getBlockedBedsMale())
.set(T_CAMP.START_BOOKING, startBooking)
.where(T_CAMP.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
sql.execute();
}
});
@ -485,7 +502,7 @@ public class AdminRepository {
*/
public List<ProfileBean> getProfiles() {
SelectWhereStep<TProfileRecord> sql = jooq.selectFrom(T_PROFILE);
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
List<ProfileBean> list = new ArrayList<>();
for (TProfileRecord r : sql.fetch()) {
list.add(ProfileBean.of(r));
@ -525,9 +542,11 @@ public class AdminRepository {
.where(T_CAMPPROFILE.MODULE.eq(module))
.orderBy(T_CAMP.ARRIVE, T_PROFILE.PK);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
String username = r.get(T_PROFILE.USERNAME);
String campname = r.get(T_CAMP.NAME);
@ -560,9 +579,11 @@ public class AdminRepository {
.where(T_CAMPPROFILE.FK_PROFILE.eq(user))
.orderBy(T_CAMP.ARRIVE);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE);
String module = moduleEnum == null ? null : moduleEnum.getLiteral();
@ -597,9 +618,11 @@ public class AdminRepository {
.where(T_CAMPPROFILE.FK_CAMP.eq(camp))
.orderBy(T_PROFILE.SURNAME, T_PROFILE.FORENAME);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE);
String forename = r.get(T_PROFILE.FORENAME);
@ -621,7 +644,7 @@ public class AdminRepository {
*/
public void deleteFromCampProfile(Integer id) {
DeleteConditionStep<TCampprofileRecord> sql = jooq.deleteFrom(T_CAMPPROFILE).where(T_CAMPPROFILE.PK.eq(id));
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
sql.execute();
}
@ -645,7 +668,7 @@ public class AdminRepository {
T_CAMPPROFILE.MODULE)
.doNothing();
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
sql.execute();
}
}

View File

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

View File

@ -39,7 +39,7 @@ public class BookingsController extends CommonController {
@GetMapping("/business/bookings/{id}")
@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());
model.addAttribute("booker", bean);
model.addAttribute("addBean", new AddPaymentBean());
@ -48,7 +48,7 @@ public class BookingsController extends CommonController {
@PostMapping("/business/bookings/payment/{id}")
@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();
bookingsService.addPayment(id, payment);
return getBooking(model, id);
@ -56,7 +56,7 @@ public class BookingsController extends CommonController {
@PostMapping("/business/bookings/listpayment/{id}")
@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();
bookingsService.addPayment(id, payment);
LOGGER.debug("search is {}", search);

View File

@ -1,13 +1,14 @@
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_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
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;
@ -25,6 +26,8 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.EnumConverter;
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.tables.records.TPersonRecord;
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
*/
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
.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)
.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_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE))
.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_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username))
.orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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 surname = r.get(T_PERSON.SURNAME);
EnumCamprole role = r.get(T_PERSON.CAMPROLE);
EnumSex sex = r.get(T_PERSON.SEX);
EnumProgress progress = r.get(T_PERSON.PROGRESS);
String campName = r.get(V_CAMP.NAME);
Double campYear = r.get(V_CAMP.YEAR);
BookerBean bean = new BookerBean();
@ -75,7 +81,7 @@ public class BookingsRepository {
bean.setRole(EnumConverter.role2GermanNames(role));
bean.setSex(EnumConverter.sex2GermanNames(sex));
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.setCamp(String.format("%s %4.0f", campName, campYear));
list.add(bean);
@ -91,10 +97,10 @@ public class BookingsRepository {
* @return the booker bean or null
*/
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
.select(T_PERSON.PK,
T_PERSON.ACCEPT,
T_PERSON.PROGRESS,
T_PERSON.PAID,
T_PERSON.FORENAME,
T_PERSON.SURNAME,
@ -108,12 +114,12 @@ public class BookingsRepository {
V_CAMP.PK)
.from(T_PERSON)
.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_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE))
.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_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username))
.and(T_PERSON.PK.eq(id));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
Record r = sql.fetchOne();
if (r == null) {
return null;
@ -122,6 +128,7 @@ public class BookingsRepository {
String surname = r.get(T_PERSON.SURNAME);
EnumCamprole role = r.get(T_PERSON.CAMPROLE);
EnumSex sex = r.get(T_PERSON.SEX);
EnumProgress progress = r.get(T_PERSON.PROGRESS);
BigDecimal requiredPrice = r.get(T_PERSON.REQUIRED_PRICE);
String campName = r.get(V_CAMP.NAME);
Double campYear = r.get(V_CAMP.YEAR);
@ -132,7 +139,7 @@ public class BookingsRepository {
bean.setRole(EnumConverter.role2GermanNames(role));
bean.setSex(EnumConverter.sex2GermanNames(sex));
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.setCamp(String.format("%s %4.0f", campName, campYear));
bean.setCampId(campId);
@ -158,7 +165,7 @@ public class BookingsRepository {
.set(T_PERSON.PAID, value)
.where(T_PERSON.PK.eq(pk));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
return sql.execute();
}
}

View File

@ -10,13 +10,13 @@ import java.time.LocalDateTime;
*
*/
public class BookerBean implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 2L;
private Integer pk;
private String name;
private String role;
private String sex;
private Boolean accept;
private String progress;
private LocalDateTime bookingDate;
private BigDecimal paid;
private String camp;
@ -24,20 +24,6 @@ public class BookerBean implements Serializable {
private Integer campId;
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
*/
@ -141,4 +127,18 @@ public class BookerBean implements Serializable {
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;
}
}

View File

@ -1,20 +1,22 @@
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_CAMPPROFILE;
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_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP_BUDGET;
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.Record;
import org.jooq.Record4;
import org.jooq.Record9;
import org.jooq.SelectConditionStep;
@ -24,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
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.module.business.business.model.BusinessBean;
import de.jottyfan.camporganizer.module.business.business.model.CampBudgetBean;
@ -57,14 +60,16 @@ public class BusinessRepository {
V_CAMP_BUDGET.FK_CAMP)
.from(V_CAMP_BUDGET)
.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_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE))
.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_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username))
.orderBy(T_CAMP.ARRIVE);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
String n = r.get(V_CAMP_BUDGET.CAMP_NAME);
Double y = r.get(V_CAMP_BUDGET.YEAR);
@ -96,13 +101,15 @@ public class BusinessRepository {
.from(T_PERSON)
.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_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_CAMP.PK))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE))
.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_CAMPPROFILE.FK_PROFILE))
.where(T_PROFILE.USERNAME.eq(username));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME);
@ -133,7 +140,7 @@ public class BusinessRepository {
.set(T_PERSON.PAID, bean.getPaid())
.where(T_PERSON.PK.eq(bean.getFkPerson()));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
count += sql.execute();
}
}

View File

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

View File

@ -1,19 +1,19 @@
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_PROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_SALESPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
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.Record;
import org.jooq.Record6;
import org.jooq.Record8;
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.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.module.business.camp.model.CampBean;
import de.jottyfan.camporganizer.module.business.camp.model.PersonBean;
@ -54,14 +56,16 @@ public class CampRepository {
// @formatter:off
.select(V_CAMP.NAME, V_CAMP.YEAR, V_CAMP.ARRIVE, V_CAMP.DEPART, V_CAMP.LOCATION_NAME, V_CAMP.PRICE)
.from(V_CAMP)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(V_CAMP.PK))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE))
.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_CAMPPROFILE.FK_PROFILE))
.where(V_CAMP.PK.eq(pk))
.and(T_PROFILE.USERNAME.eq(username));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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.setYear(r.get(V_CAMP.YEAR));
bean.setArrive(r.get(V_CAMP.ARRIVE));
@ -81,30 +85,33 @@ public class CampRepository {
* @return a list of bookings; an empty one at least
*/
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
.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)
.leftJoin(T_SALESPROFILE).on(T_SALESPROFILE.FK_CAMP.eq(T_PERSON.FK_CAMP))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_SALESPROFILE.FK_PROFILE))
.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_CAMPPROFILE.FK_PROFILE))
.where(T_PERSON.FK_CAMP.eq(pk))
.and(T_PROFILE.USERNAME.eq(username))
.orderBy(T_PERSON.CAMPROLE, T_PERSON.SEX, T_PERSON.SURNAME, T_PERSON.FORENAME);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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 surname = r.get(T_PERSON.SURNAME);
EnumCamprole role = r.get(T_PERSON.CAMPROLE);
EnumSex sex = r.get(T_PERSON.SEX);
EnumProgress progress = r.get(T_PERSON.PROGRESS);
PersonBean bean = new PersonBean();
bean.setPk(r.get(T_PERSON.PK));
bean.setName(String.format("%s %s", forename, surname));
bean.setRole(EnumConverter.role2GermanNames(role));
bean.setSex(EnumConverter.sex2GermanNames(sex));
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));
list.add(bean);
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
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.CampBean;
import de.jottyfan.camporganizer.module.business.camp.model.PersonBean;
@ -31,12 +32,12 @@ public class CampService {
Integer rejected = 0;
BigDecimal paid = new BigDecimal(0);
for (PersonBean p : campGateway.getBookings(id, username)) {
Boolean acceptence = p.getAccept();
if (acceptence == null) {
String progress = p.getProgress();
if (EnumProgress.requested.getLiteral().equals(progress)) {
open += 1;
} else if (acceptence) {
} else if (EnumProgress.approved.getLiteral().equals(progress)) {
approved += 1;
} else {
} else if (EnumProgress.rejected.getLiteral().equals(progress)) {
rejected += 1;
}
paid = paid.add(p.getPaid() == null ? new BigDecimal(0) : p.getPaid());

View File

@ -16,24 +16,10 @@ public class PersonBean implements Serializable {
private String name;
private String role;
private String sex;
private Boolean accept;
private String progress;
private LocalDateTime bookingDate;
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
*/
@ -99,4 +85,18 @@ public class PersonBean implements Serializable {
public void setBookingDate(LocalDateTime 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;
}
}

View File

@ -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);
}
}

View 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();
}
}

View File

@ -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());
}
}

View File

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

View File

@ -0,0 +1,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;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,6 +12,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
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.EnumDocument;
import de.jottyfan.camporganizer.db.jooq.enums.EnumProgress;
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
import de.jottyfan.camporganizer.module.camplist.model.BookingBean;
@ -45,15 +47,15 @@ import de.jottyfan.camporganizer.module.camplist.model.DocumentBean;
*/
@Repository
@Transactional(transactionManager = "transactionManager")
public class CamplistGateway {
private static final Logger LOGGER = LogManager.getLogger(CamplistGateway.class);
public class CamplistRepository {
private static final Logger LOGGER = LogManager.getLogger(CamplistRepository.class);
@Autowired
private DSLContext jooq;
public Stream<VCampRecord> getAllCamps(Condition condition) {
SelectSeekStep1<VCampRecord, LocalDateTime> sql = jooq.selectFrom(V_CAMP).where(condition).orderBy(V_CAMP.ARRIVE);
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
return sql.fetchStream();
}
@ -75,7 +77,7 @@ public class CamplistGateway {
T_PERSON.CREATED,
T_PERSON.EMAIL,
T_PERSON.SEX,
T_PERSON.ACCEPT,
T_PERSON.PROGRESS,
T_PERSON.FK_CAMP,
T_PROFILE.FORENAME,
T_PROFILE.SURNAME,
@ -98,11 +100,15 @@ public class CamplistGateway {
.and(T_PERSON.PK.isNotNull())
.orderBy(V_CAMP.ARRIVE.desc(), T_PERSON.CREATED);
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
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.setForename(r.get(T_PERSON.FORENAME));
bean.setSurname(r.get(T_PERSON.SURNAME));
@ -126,7 +132,6 @@ public class CamplistGateway {
bean.setUrl(r.get(V_CAMP.URL));
bean.setIsOver(r.get(V_CAMP.IS_OVER));
bean.setCampName(r.get(V_CAMP.NAME));
bean.setAccept(r.get(T_PERSON.ACCEPT));
StringBuilder buf = new StringBuilder();
String forename = r.get(REGISTRATOR.FORENAME);
String surname = r.get(REGISTRATOR.SURNAME);
@ -182,9 +187,11 @@ public class CamplistGateway {
.from(T_DOCUMENT)
.where(T_DOCUMENT.DOCTYPE.eq(EnumDocument.camppass)));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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));
}
List<DocumentBean> list = new ArrayList<>();

View File

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

View File

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

View File

@ -41,7 +41,7 @@ public class BookingBean implements Serializable {
private Boolean isOver;
private String campName;
private String registrator;
private Boolean accept;
private String progress;
private String subscriber;
private List<DocumentBean> documents;
@ -396,14 +396,6 @@ public class BookingBean implements Serializable {
this.registrator = registrator;
}
public Boolean getAccept() {
return accept;
}
public void setAccept(Boolean accept) {
this.accept = accept;
}
public String getSubscriber() {
return subscriber;
}
@ -416,4 +408,18 @@ public class BookingBean implements Serializable {
return documents;
}
/**
* @return the progress
*/
public String getProgress() {
return progress;
}
/**
* @param progress the progress to set
*/
public void setProgress(String progress) {
this.progress = progress;
}
}

View File

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

View File

@ -0,0 +1,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;
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,267 @@
package de.jottyfan.camporganizer.module.confirmation.board.model;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
/**
*
* @author jotty
*
*/
public class PersonBean implements Serializable {
private static final long serialVersionUID = 1L;
private String forename;
private String surname;
private String street;
private String zip;
private String city;
private String phone;
private String email;
private LocalDate birthDate;
private String camprole;
private 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;
}
}

View File

@ -7,6 +7,7 @@ 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 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 {
@Autowired
private ConfirmationService indexService;
private ConfirmationService service;
@GetMapping("/confirmation")
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");
for (CampOverviewBean bean : campoverview) {
campoverviewsummary.setApproved(bean.getApproved() + campoverviewsummary.getApproved());
campoverviewsummary.setRejected(bean.getRejected() + campoverviewsummary.getRejected());
campoverviewsummary.setUntouched(bean.getUntouched() + campoverviewsummary.getUntouched());
campoverviewsummary.setRevoked(bean.getRevoked() + campoverviewsummary.getRevoked());
}
model.addAttribute("campoverview", campoverview);
model.addAttribute("campoverviewsummary", campoverviewsummary);
model.addAttribute("untouched", indexService.getUntouched(super.getCurrentUser()));
model.addAttribute("approved", indexService.getApproved(super.getCurrentUser()));
model.addAttribute("rejected", indexService.getRejected(super.getCurrentUser()));
model.addAttribute("untouched", service.getUntouched(super.getCurrentUser()));
model.addAttribute("approved", service.getApproved(super.getCurrentUser()));
model.addAttribute("rejected", service.getRejected(super.getCurrentUser()));
model.addAttribute("revoked", service.getRevoked(super.getCurrentUser()));
return "confirmation/confirmation";
}
@GetMapping("/registration/remove/{id}")
public String revoke(@PathVariable("id") Integer id, final Model model) {
service.removeBooking(id);
return "redirect:/confirmation";
}
}

View File

@ -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_CAMPPROFILE;
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_RSS;
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -17,12 +21,17 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.jooq.DeleteConditionStep;
import org.jooq.InsertValuesStep2;
import org.jooq.Name;
import org.jooq.Record4;
import org.jooq.Record5;
import org.jooq.Record7;
import org.jooq.Record8;
import org.jooq.SelectConditionStep;
import org.jooq.SelectHavingStep;
import org.jooq.SelectSeekStep1;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.DSL;
import org.springframework.beans.factory.annotation.Autowired;
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.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.CampOverviewBean;
@ -54,10 +68,10 @@ public class ConfirmationRepository {
*/
public List<CampOverviewBean> getCampOverviewBeans(String currentUser) {
Name COUNT = DSL.name("count");
SelectHavingStep<Record4<Integer, Boolean, String, LocalDateTime>> sql = jooq
SelectHavingStep<Record4<Integer, EnumProgress, String, LocalDateTime>> sql = jooq
// @formatter:off
.select(DSL.count(T_PERSON.PK).as(COUNT),
T_PERSON.ACCEPT,
T_PERSON.PROGRESS,
T_CAMP.NAME,
T_CAMP.ARRIVE)
.from(T_PERSON)
@ -67,13 +81,15 @@ public class ConfirmationRepository {
.where(T_CAMP.ARRIVE.isNotNull())
.and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
.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
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
Boolean accept = r.get(T_PERSON.ACCEPT);
EnumProgress progress = r.get(T_PERSON.PROGRESS);
String campname = r.get(T_CAMP.NAME);
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
CampOverviewBean bean = map.get(arrive);
@ -81,12 +97,14 @@ public class ConfirmationRepository {
bean = new CampOverviewBean(arrive.toLocalDate(), campname);
map.put(arrive, bean);
}
if (accept == null) {
if (progress == null || EnumProgress.requested.equals(progress)) {
bean.setUntouched(count);
} else if (accept) {
} else if (EnumProgress.approved.equals(progress)) {
bean.setApproved(count);
} else {
} else if (EnumProgress.rejected.equals(progress)) {
bean.setRejected(count);
} else if (EnumProgress.revoked.equals(progress)) {
bean.setRevoked(count);
}
}
List<CampOverviewBean> list = new ArrayList<>(map.values());
@ -114,9 +132,11 @@ public class ConfirmationRepository {
.and(T_PROFILE.USERNAME.eq(currentUser))
.orderBy(T_PERSON.CREATED.desc());
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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 surname = r.get(T_PERSON.SURNAME);
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
*/
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
*/
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
*/
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));
// @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
.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)
.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))
@ -190,22 +220,82 @@ public class ConfirmationRepository {
.and(T_PROFILE.USERNAME.eq(currentUser))
.orderBy(T_PERSON.CREATED.desc());
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
String forename = r.get(T_PERSON.FORENAME);
String surname = r.get(T_PERSON.SURNAME);
EnumCamprole role = r.get(T_PERSON.CAMPROLE);
String campname = r.get(V_CAMP.NAME);
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));
bean.setRole(role == null ? null : role.getLiteral());
bean.setFullname(new StringBuilder().append(forename).append(" ").append(surname).toString());
bean.setAccept(accept);
bean.setProgress(progress == null ? null : progress.getLiteral());
list.add(bean);
}
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();
}
}

View File

@ -2,13 +2,10 @@ package de.jottyfan.camporganizer.module.confirmation.confirmation;
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.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.CampOverviewBean;
@ -20,35 +17,41 @@ import de.jottyfan.camporganizer.module.confirmation.confirmation.model.CampOver
@Service
public class ConfirmationService {
@Autowired
private ConfirmationRepository gateway;
private ConfirmationRepository repository;
public List<CampOverviewBean> getCampOverview(String currentUser) {
return gateway.getCampOverviewBeans(currentUser);
return repository.getCampOverviewBeans(currentUser);
}
public List<BookingBean> getUntouched(String currentUser) {
return gateway.getUntouched(currentUser);
return repository.getUntouched(currentUser);
}
public List<BookingBean> getApproved(String currentUser) {
return gateway.getApproved(currentUser);
return repository.getApproved(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) {
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>");
for (BookingBean bean : gateway.getSearchResult(needle, currentUser)) {
for (BookingBean bean : repository.getSearchResult(needle, currentUser)) {
String acceptHtml = "";
if (bean.getAccept() == null) {
if (EnumProgress.requested.equals(bean.getProgress())) {
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>";
} else {
} else if (EnumProgress.rejected.equals(bean.getProgress())) {
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>",
acceptHtml, linkURL, bean.getPkPerson(), bean.getFullname(), bean.getCamp(), bean.getRolename()));
@ -56,4 +59,14 @@ public class ConfirmationService {
buf.append("</tbody></table>");
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;
}
}

View File

@ -4,11 +4,11 @@ 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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.websocket.server.PathParam;
/**
*
@ -26,7 +26,7 @@ public class SearchController extends CommonController {
@GetMapping("/confirmation/search")
@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());
}
}

View File

@ -20,7 +20,7 @@ public class BookingBean implements Serializable, Comparable<BookingBean> {
private String fullname;
private String role;
private LocalDateTime registered;
private Boolean accept;
private String progress;
public BookingBean(Integer pkPerson, LocalDate date, String camp) {
this.pkPerson = pkPerson;
@ -114,11 +114,17 @@ public class BookingBean implements Serializable, Comparable<BookingBean> {
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;
}
}

View File

@ -16,6 +16,7 @@ public class CampOverviewBean implements Serializable, Comparable<CampOverviewBe
private Integer approved;
private Integer rejected;
private Integer untouched;
private Integer revoked;
public CampOverviewBean(LocalDate date, String camp) {
this.date = date;
@ -23,6 +24,7 @@ public class CampOverviewBean implements Serializable, Comparable<CampOverviewBe
this.approved = 0;
this.rejected = 0;
this.untouched = 0;
this.revoked = 0;
}
@Override
@ -85,4 +87,18 @@ public class CampOverviewBean implements Serializable, Comparable<CampOverviewBe
public LocalDate getDate() {
return date;
}
/**
* @return the revoked
*/
public Integer getRevoked() {
return revoked;
}
/**
* @param revoked the revoked to set
*/
public void setRevoked(Integer revoked) {
this.revoked = revoked;
}
}

View File

@ -3,15 +3,15 @@ package de.jottyfan.camporganizer.module.confirmation.person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.camporganizer.module.camplist.CommonController;
import de.jottyfan.camporganizer.module.confirmation.confirmation.ConfirmationService;
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;
@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();
model.addAttribute("currentUser", username);
model.addAttribute("person", personService.getPerson(username, pk));
model.addAttribute("camps", personService.getCamps(username));
model.addAttribute("annotations", personService.getAnnotations(pk));
model.addAttribute("campPrice", personService.getCampPrice(pk));
model.addAttribute("progresses", personService.getProgresses());
return "confirmation/person";
}
@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();
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);
return "redirect:/confirmation";
}

View File

@ -12,6 +12,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
@ -19,6 +20,7 @@ import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext;
import org.jooq.InsertValuesStep2;
import org.jooq.Record;
import org.jooq.Record1;
import org.jooq.Record11;
import org.jooq.Record4;
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.EnumModule;
import de.jottyfan.camporganizer.db.jooq.enums.EnumProgress;
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.TPersonRecord;
@ -76,9 +79,11 @@ public class PersonRepository {
.and(T_PROFILE.USERNAME.eq(username))
.orderBy(T_CAMP.ARRIVE.desc());
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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();
bean.setPk(r.get(T_CAMP.PK));
bean.setName(r.get(T_CAMP.NAME));
@ -108,11 +113,14 @@ public class PersonRepository {
.and(T_CAMPPROFILE.MODULE.eq(EnumModule.registration))
.and(T_PROFILE.USERNAME.eq(username));
// @formatter:on
LOGGER.debug(sql.toString());
for (Record r : sql.fetch()) {
LOGGER.trace(sql);
Iterator<Record> i = sql.fetch().iterator();
while (i.hasNext()) {
Record r = i.next();
PersonBean bean = new PersonBean();
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.setCamprole(r.get(T_PERSON.CAMPROLE));
bean.setCity(r.get(T_PERSON.CITY));
@ -128,6 +136,7 @@ public class PersonRepository {
bean.setSex(r.get(T_PERSON.SEX));
bean.setStreet(r.get(T_PERSON.STREET));
bean.setZip(r.get(T_PERSON.ZIP));
bean.setRequiredPrice(r.get(T_PERSON.REQUIRED_PRICE));
return bean;
}
return null;
@ -144,21 +153,21 @@ public class PersonRepository {
jooq.transaction(t -> {
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);
// get old accept value for comparison
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();
lrw.putBoolean("acceptOld", r == null ? null : r.getAccept());
lrw.putBoolean("acceptNew", bean.getAccept());
lrw.putBoolean("acceptOld", r == null ? null : EnumProgress.approved.equals(r.getProgress()));
lrw.putBoolean("acceptNew", EnumProgress.approved.getLiteral().equals(bean.getProgress()));
Integer fkCamp = r == null ? null : r.getFkCamp();
String email = r.getEmail(); // use the old one, too
lrw.putString("oldEmail", email);
SelectConditionStep<TCampRecord> sql2 = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(fkCamp));
LOGGER.debug(sql2.toString());
LOGGER.trace(sql2);
TCampRecord rc = sql2.fetchOne();
String campName = rc == null ? null : rc.getName();
LocalDateTime arrive = rc == null ? null : rc.getArrive();
@ -179,12 +188,13 @@ public class PersonRepository {
.set(T_PERSON.PHONE, bean.getPhone())
.set(T_PERSON.EMAIL, bean.getEmail())
.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.FK_REGISTRATOR, fkRegistrator)
.set(T_PERSON.REQUIRED_PRICE, bean.getRequiredPrice())
.where(T_PERSON.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug(sql3.toString());
LOGGER.trace(sql3);
lrw.add(sql3.execute());
// always
@ -200,7 +210,7 @@ public class PersonRepository {
T_RSS.RECIPIENT)
.values(buf.toString(), "registrator");
// @formatter:on
LOGGER.debug("{}", sql4.toString());
LOGGER.trace(sql4);
sql4.execute();
});
@ -293,9 +303,13 @@ public class PersonRepository {
.leftJoin(REGISTRATOR).on(REGISTRATOR.PK.eq(T_PERSON.FK_REGISTRATOR))
.where(T_PERSON.PK.eq(pk));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
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);
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
LocalDateTime depart = r.get(T_CAMP.DEPART);
@ -311,7 +325,7 @@ public class PersonRepository {
if (bookerForename == null && bookerSurname == null) {
buf.append(String.format("angemeldet ohne Registrierung am %s\n", createdString));
} 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) {
buf.append(String.format("bearbeitet von %s %s\n", registratorForename, registratorSurname));
@ -332,4 +346,22 @@ public class PersonRepository {
}
return buf.toString();
}
/**
* get the price information of the camp that the person is registered for
*
* @param pkPerson the ID of the person
* @return the camp price information
*/
public String getCampprice(Integer pkPerson) {
SelectConditionStep<Record1<String>> sql = jooq
// @formatter:off
.select(T_CAMP.PRICE)
.from(T_PERSON)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_PERSON.FK_CAMP))
.where(T_PERSON.PK.eq(pkPerson));
// @formatter:on
LOGGER.trace(sql);
return sql.fetchOne(T_CAMP.PRICE);
}
}

View File

@ -1,10 +1,12 @@
package de.jottyfan.camporganizer.module.confirmation.person;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
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.PersonBean;
@ -33,4 +35,22 @@ public class PersonService {
public String getAnnotations(Integer 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;
}
}

View File

@ -1,6 +1,7 @@
package de.jottyfan.camporganizer.module.confirmation.person.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
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.EnumSex;
import jakarta.validation.constraints.DecimalMin;
/**
*
@ -15,7 +17,7 @@ import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
*
*/
public class PersonBean implements Serializable {
private static final long serialVersionUID = 2L;
private static final long serialVersionUID = 3L;
private Integer pk;
private String forename;
@ -30,11 +32,13 @@ public class PersonBean implements Serializable {
private String email;
private Integer fkCamp;
private Integer fkProfile;
private Boolean accept;
private String progress;
private LocalDateTime created;
private EnumSex sex;
private Integer fkRegistrator;
private String comment;
@DecimalMin(value = "0")
private BigDecimal requiredPrice;
/**
* @return the forename
@ -190,20 +194,6 @@ public class PersonBean implements Serializable {
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
*/
@ -273,4 +263,32 @@ public class PersonBean implements Serializable {
public void setPk(Integer 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;
}
}

View File

@ -57,7 +57,7 @@ public class DashboardRepository {
.set(T_PERSON.COMMENT, bean.getComment())
.where(T_PERSON.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql.toString());
return sql.execute();
}
@ -79,7 +79,7 @@ public class DashboardRepository {
.deleteFrom(T_PERSONDOCUMENT)
.where(T_PERSONDOCUMENT.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
lrw.add(sql.execute());
StringBuilder buf = new StringBuilder("Dokument ");
@ -92,7 +92,7 @@ public class DashboardRepository {
T_RSS.RECIPIENT)
.values(buf.toString(), "registrator");
// @formatter:on
LOGGER.debug("{}", sql2.toString());
LOGGER.trace(sql);
sql2.execute();
});
return lrw.getCounter();
@ -117,7 +117,7 @@ public class DashboardRepository {
)
.values(bean.getName(), bean.getFiletype(), bean.getFkPerson(), bean.getDocument());
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
sql.execute();
StringBuilder buf = new StringBuilder("Dokument ");
@ -130,7 +130,7 @@ public class DashboardRepository {
T_RSS.RECIPIENT)
.values(buf.toString(), "registrator");
// @formatter:on
LOGGER.debug("{}", sql2.toString());
LOGGER.trace(sql2);
sql2.execute();
});
}

View File

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

View File

@ -37,7 +37,7 @@ public class DocumentRepository {
.selectFrom(T_DOCUMENT)
.where(T_DOCUMENT.PK.eq(id));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
TDocumentRecord r = sql.fetchOne();
if (r == null) {
return null;

View File

@ -6,6 +6,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.Iterator;
import java.util.TimeZone;
import org.apache.logging.log4j.LogManager;
@ -53,10 +54,12 @@ public class ICalRepository {
.from(T_CAMP)
.leftJoin(T_LOCATION).on(T_LOCATION.PK.eq(T_CAMP.FK_LOCATION));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
ICalendar ical = new ICalendar();
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();
Summary summary = event.setSummary(r.get(T_CAMP.NAME));
summary.setLanguage("de");

View File

@ -37,7 +37,7 @@ public class MigrationRepository {
.from(T_PROFILE)
.where(T_PROFILE.USERNAME.eq(username));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql);
return sql.fetchOne(T_PROFILE.PASSWORD);
}
}

View File

@ -53,6 +53,15 @@ public class KeycloakRepository {
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
*
@ -110,7 +119,7 @@ public class KeycloakRepository {
Response response = resource.create(user);
Boolean success = Status.CREATED.equals(response.getStatusInfo());
if (success) {
LOGGER.info("created new keycloak user {}", user.getUsername());
LOGGER.debug("created new keycloak user {}", user.getUsername());
} else {
LOGGER.error("error on creating keycloak user {}: {}", user.getUsername(), response.getStatus());
}

View File

@ -1,11 +1,12 @@
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.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
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.registration.model.CampBean;
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
public class RegistrationController extends CommonController {
private static final Logger LOGGER = LogManager.getLogger(RegistrationController.class);
@Autowired
private RegistrationService service;
@ -38,6 +41,7 @@ public class RegistrationController extends CommonController {
model.addAttribute("bean", bean);
model.addAttribute("sexes", EnumConverter.getSexes());
model.addAttribute("roles", EnumConverter.getRoles());
model.addAttribute("wellknown", service.getWellKnownRegistrations(getCurrentUser()));
return "/registration/registration";
} else {
return "/registration/isover";
@ -60,30 +64,55 @@ public class RegistrationController extends CommonController {
public String register(@Valid @ModelAttribute("bean") RegistrationBean bean, final BindingResult bindingResult,
Model model) {
if (bindingResult.hasErrors()) {
for (ObjectError error : bindingResult.getAllErrors()) {
LOGGER.error("found {}", error);
}
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";
}
Boolean result = service.register(bean, getCurrentUser());
return result ? "/registration/success" : "/error";
Integer result = service.register(bean, getCurrentUser());
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}")
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));
return "/registration/cancellation";
}
@GetMapping("/registration/remove/{id}")
public String remove(@PathVariable Integer id, final Model model) {
service.removeBooking(id);
@GetMapping("/registration/revoke/{id}")
public String revoke(@PathVariable("id") Integer id, final Model model) {
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";
}
@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);
return "redirect:/dashboard";
}

View File

@ -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_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_PROFILEROLE;
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.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
@ -19,14 +22,14 @@ import org.jasypt.util.password.StrongPasswordEncryptor;
import org.jooq.DSLContext;
import org.jooq.DeleteConditionStep;
import org.jooq.InsertResultStep;
import org.jooq.InsertValuesStep12;
import org.jooq.InsertValuesStep13;
import org.jooq.InsertReturningStep;
import org.jooq.InsertValuesStep2;
import org.jooq.Record;
import org.jooq.Record1;
import org.jooq.Record2;
import org.jooq.Record5;
import org.jooq.Record7;
import org.jooq.Record9;
import org.jooq.SelectConditionStep;
import org.jooq.UpdateConditionStep;
import org.jooq.exception.DataAccessException;
@ -37,12 +40,12 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
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.tables.records.TCampRecord;
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.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.LambdaResultWrapper;
import de.jottyfan.camporganizer.module.registration.model.CampBean;
@ -69,15 +72,17 @@ public class RegistrationRepository {
* @return the camp bean or null
*/
public CampBean getCamp(Integer pk) {
SelectConditionStep<TCampRecord> sql = jooq.selectFrom(T_CAMP).where(T_CAMP.PK.eq(pk));
LOGGER.debug(sql.toString());
TCampRecord r = sql.fetchOne();
SelectConditionStep<VCampRecord> sql = jooq.selectFrom(V_CAMP).where(V_CAMP.PK.eq(pk));
LOGGER.trace(sql.toString());
VCampRecord r = sql.fetchOne();
if (r != null) {
CampBean bean = new CampBean();
bean.setPk(r.getPk());
bean.setName(r.getName());
LocalDateTime arrive = r.getArrive();
bean.setYear(arrive == null ? null : arrive.getYear());
bean.setBookingHasStarted(r.getBookingHasStarted());
bean.setStartBooking(r.getStartBooking());
return bean;
} else {
return null;
@ -96,7 +101,7 @@ public class RegistrationRepository {
.selectFrom(T_PROFILE)
.where(DSL.lower(T_PROFILE.USERNAME).eq(login));
// @formatter:on
LOGGER.debug(sql);
LOGGER.trace(sql);
return sql.fetch().size() < 1;
}
@ -105,14 +110,15 @@ public class RegistrationRepository {
* registerInKeycloak is true
*
* @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();
jooq.transaction(t -> {
if (bean.getLogin() != null && !bean.getLogin().isEmpty()) {
Boolean loginNotYetInUse = isLoginNotYetInUse(bean.getLogin().toLowerCase());
if (bean.getRegisterInKeycloak() && !loginNotYetInUse) {
LOGGER.error("login already in use: {}", bean.getLogin().toLowerCase());
throw new DataAccessException("login already in use: " + bean.getLogin().toLowerCase());
}
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())
.returning(T_PROFILE.PK);
// @formatter:on
LOGGER.debug(sql1.toString());
LOGGER.trace(sql1.toString());
fkProfile = sql1.fetchOne().getPk();
InsertValuesStep2<TRssRecord, String, String> sql2 = jooq
@ -140,7 +146,7 @@ public class RegistrationRepository {
T_RSS.RECIPIENT)
.values(new StringBuilder(bean.getFullname()).append(" hat sich als Nutzer im CampOrganizer2 registriert.").toString(), "admin");
// @formatter:on
LOGGER.debug("{}", sql2.toString());
LOGGER.trace(sql2);
sql2.execute();
} else {
SelectConditionStep<Record1<Integer>> sql1 = DSL.using(t)
@ -149,13 +155,12 @@ public class RegistrationRepository {
.from(T_PROFILE)
.where(DSL.lower(T_PROFILE.USERNAME).eq(bean.getLogin().toLowerCase()));
// @formatter:on
LOGGER.debug(sql1.toString());
LOGGER.trace(sql1.toString());
fkProfile = sql1.fetchOne().get(T_PROFILE.PK);
}
// register the person for camp participation
InsertValuesStep13<TPersonRecord, String, String, EnumSex, LocalDate, String, String, String, String, String, EnumCamprole, Integer, String, Integer> sql2 = DSL
.using(t)
// @formatter:off
InsertReturningStep<TPersonRecord> sql2 = DSL.using(t)
// @formatter:off
.insertInto(T_PERSON,
T_PERSON.FORENAME,
T_PERSON.SURNAME,
@ -172,15 +177,16 @@ public class RegistrationRepository {
T_PERSON.FK_PROFILE)
.values(bean.getForename(), bean.getSurname(), bean.getSex(),
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
LOGGER.debug(sql2.toString());
LOGGER.trace(sql2.toString());
lrw.add(sql2.execute());
// register the login for the portal
} else {
InsertValuesStep12<TPersonRecord, String, String, EnumSex, LocalDate, String, String, String, String, String, EnumCamprole, Integer, String> sql = DSL
.using(t)
// @formatter:off
InsertReturningStep<TPersonRecord> sql = DSL.using(t)
// @formatter:off
.insertInto(T_PERSON,
T_PERSON.FORENAME,
T_PERSON.SURNAME,
@ -196,13 +202,15 @@ public class RegistrationRepository {
T_PERSON.COMMENT)
.values(bean.getForename(), bean.getSurname(), bean.getSex(),
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
LOGGER.debug(sql.toString());
LOGGER.trace(sql.toString());
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))
.where(T_PERSON.PK.eq(id));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql.toString());
Record7<Integer, String, String, EnumCamprole, String, LocalDateTime, LocalDateTime> r = sql.fetchOne();
if (r != null) {
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
* @return number of affected database rows, should be 1
* @param id the ID of the booking
*/
public Integer removeBooking(Integer id) {
LambdaResultWrapper lrw = new LambdaResultWrapper();
public void revokeBooking(Integer id) {
jooq.transaction(t -> {
SelectConditionStep<Record5<String, String, String, String, LocalDateTime>> sql0 = DSL.using(t)
// @formatter:off
@ -258,7 +264,7 @@ public class RegistrationRepository {
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_PERSON.FK_PROFILE))
.where(T_PERSON.PK.eq(id));
// @formatter:on
LOGGER.debug(sql0.toString());
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);
@ -270,33 +276,32 @@ public class RegistrationRepository {
LocalDateTime arrive = r.get(T_CAMP.ARRIVE);
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(" an ");
rssMessage.append(campname).append(" ")
.append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
rssMessage.append(" storniert.");
rssMessage.append(" ausgelöst.");
DeleteConditionStep<TPersondocumentRecord> sql1 = DSL.using(t).deleteFrom(T_PERSONDOCUMENT)
.where(T_PERSONDOCUMENT.FK_PERSON.eq(id));
LOGGER.debug(sql1.toString());
UpdateConditionStep<TPersonRecord> sql1 = jooq
// @formatter:off
.update(T_PERSON)
.set(T_PERSON.PROGRESS, EnumProgress.revoked)
.where(T_PERSON.PK.eq(id));
// @formatter:on
LOGGER.trace(sql1);
sql1.execute();
DeleteConditionStep<TPersonRecord> sql2 = DSL.using(t).deleteFrom(T_PERSON).where(T_PERSON.PK.eq(id));
LOGGER.debug(sql2.toString());
lrw.add(sql2.execute());
InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t)
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.debug("{}", sql3.toString());
sql3.execute();
LOGGER.trace("{}", sql2.toString());
sql2.execute();
});
return lrw.getCounter();
}
/**
@ -312,9 +317,10 @@ public class RegistrationRepository {
.from(T_CAMP)
.where(T_CAMP.PK.eq(fkCamp));
// @formatter:on
LOGGER.debug(sql.toString());
for (Record1<LocalDateTime> r : sql.fetch()) {
LocalDateTime depart = r.get(T_CAMP.DEPART);
LOGGER.trace(sql.toString());
Iterator<Record1<LocalDateTime>> i = sql.fetch().iterator();
while (i.hasNext()) {
LocalDateTime depart = i.next().get(T_CAMP.DEPART);
LocalDateTime now = LocalDateTime.now();
return now.isBefore(depart);
}
@ -335,7 +341,7 @@ public class RegistrationRepository {
.set(T_PERSON.FK_PROFILE, (Integer) null)
.where(T_PERSON.FK_PROFILE.eq(bean.getPk()));
// @formatter:off
LOGGER.debug("{}", sql.toString());
LOGGER.trace("{}", sql.toString());
sql.execute();
DeleteConditionStep<?> sql1 = DSL.using(t)
@ -348,7 +354,7 @@ public class RegistrationRepository {
.where(T_PROFILE.USERNAME.eq(bean.getUsername())
)));
// @formatter:on
LOGGER.debug("{}", sql1.toString());
LOGGER.trace("{}", sql1.toString());
sql1.execute();
DeleteConditionStep<?> sql2 = DSL.using(t)
@ -356,7 +362,7 @@ public class RegistrationRepository {
.deleteFrom(T_PROFILE)
.where(T_PROFILE.USERNAME.eq(bean.getUsername()));
// @formatter:on
LOGGER.debug("{}", sql2.toString());
LOGGER.trace("{}", sql2.toString());
sql2.execute();
InsertValuesStep2<TRssRecord, String, String> sql3 = DSL.using(t)
@ -366,7 +372,7 @@ public class RegistrationRepository {
T_RSS.RECIPIENT)
.values(new StringBuilder(bean.getFullname()).append(" hat sich vom Portal CampOrganizer2 abgemeldet.").toString(), "admin");
// @formatter:on
LOGGER.debug("{}", sql3.toString());
LOGGER.trace("{}", sql3.toString());
sql3.execute();
});
}
@ -385,7 +391,7 @@ public class RegistrationRepository {
.set(T_PERSON.CONSENT_CATALOG_PHOTO, consent)
.where(T_PERSON.PK.eq(id));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace("{}", sql.toString());
sql.execute();
}
@ -407,7 +413,7 @@ public class RegistrationRepository {
.from(T_CAMP)
.where(T_CAMP.PK.eq(fkCamp));
// @formatter:on
LOGGER.debug(sql.toString());
LOGGER.trace(sql.toString());
Record r = sql.fetchOne();
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);
@ -418,4 +424,125 @@ public class RegistrationRepository {
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();
});
}
}

View File

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

View File

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

View File

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

View File

@ -11,8 +11,10 @@ import org.springframework.format.annotation.DateTimeFormat;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
import de.jottyfan.camporganizer.module.registration.validate.AlreadyRegisteredCheck;
import de.jottyfan.camporganizer.module.registration.validate.TeacherAgeCheck;
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.")
@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 {
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.")
private String forename;
@ -55,6 +59,31 @@ public class RegistrationBean implements Serializable {
private String kcSurname;
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
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import static de.jottyfan.camporganizer.db.jooq.Tables.T_RSS;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.logging.log4j.LogManager;
@ -30,9 +31,9 @@ import de.jottyfan.camporganizer.db.jooq.tables.records.TRssRecord;
*/
@Repository
@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
private DSLContext jooq;
@ -46,9 +47,11 @@ public class RssGateway {
.from(T_RSS)
.where(T_RSS.RECIPIENT.eq(recipientCode));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
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));
bean.setRecipient(recipientCode);
bean.setMessage(r.get(T_RSS.MSG));
@ -60,7 +63,7 @@ public class RssGateway {
public List<String> getAllFeeds() {
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);
}
@ -73,9 +76,11 @@ public class RssGateway {
T_RSS.REGDATE)
.from(T_RSS);
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
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));
bean.setRecipient(r.get(T_RSS.RECIPIENT));
bean.setMessage(r.get(T_RSS.MSG));
@ -91,7 +96,7 @@ public class RssGateway {
.deleteFrom(T_RSS)
.where(T_RSS.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
sql.execute();
}
@ -102,7 +107,7 @@ public class RssGateway {
.set(T_RSS.MSG, bean.getMessage())
.where(T_RSS.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug("{}", sql.toString());
LOGGER.trace(sql);
sql.execute();
}
}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# database credentials from defined config file
spring.config.import = /etc/CampOrganizer2/prod.properties
spring.config.import = /etc/camporganizer.properties
# define overwriteable arguments
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.properties.mail.smtp.auth = ${spring.mail.properties.mail.smtp.auth}
spring.mail.properties.mail.smtp.starttls.enable = ${spring.mail.properties.mail.smtp.starttls.enable}
# for development only
server.port = 8081

View File

@ -65,6 +65,11 @@ div {
font-family: 'Cabin Sketch' !important;
}
.titlefont {
font-family: 'Cabin Sketch' !important;
font-size: 40px;
}
.headlinefont {
font-family: 'Cabin Sketch' !important;
font-size: xx-large;
@ -116,19 +121,20 @@ div {
!important;
}
.acc_true {
background-image: linear-gradient(to bottom right, #cfc, #afa)
!important;
.acc_approved {
background: #aaffaa !important;
}
.acc_false {
background-image: linear-gradient(to bottom right, #fcc, #faa)
!important;
.acc_rejected {
background: #ffaaaa !important;
}
.acc_null {
background-image: linear-gradient(to bottom right, #fdb, #fca)
!important;
.acc_revoked {
background: rgb(220, 138, 221) !important;
}
.acc_requested {
background: rgb(255, 190, 111) !important;
}
.right-dist {
@ -298,6 +304,17 @@ div {
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 {
margin: 8px;
}
@ -328,19 +345,19 @@ div {
}
.framed-green {
background: linear-gradient(to bottom right, lime, darkgreen);
background: linear-gradient(to bottom right, darkgreen, lime);
color: white;
border: 1px solid green;
}
.framed-red {
background: linear-gradient(to bottom right, red, darkred);
background: linear-gradient(to bottom right, darkred, red);
color: white;
border: 1px solid red;
}
.framed-orange {
background: linear-gradient(to bottom right, orange, #bf6c06);
background: linear-gradient(to bottom right, #bf6c06, orange);
color: white;
border: 1px solid orange;
}
@ -351,6 +368,12 @@ div {
border: 1px solid black;
}
.framed-pink {
background: linear-gradient(to bottom right, #3b115b, #d18be8);
color: #f8effb;
border: 1px solid #4a0084;
}
.nomaxwidth {
max-width: none !important;
}
@ -442,3 +465,13 @@ div {
max-height: 80vh;
overflow: auto;
}
.indexback {
background-image: url(/CampOrganizer2/images/indexback.jpg);
background-repeat: no-repeat;
background-size: cover;
min-width: 100vw;
height: 100vh;
margin: 0px !important;
padding: 100px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

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

View File

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

View File

@ -36,13 +36,17 @@
<td th:text="${#temporals.format(booker.bookingDate, 'dd.MM.yyyy')}"></td>
</tr>
<tr>
<th>Bestätigt</th>
<td th:text="${booker.accept == null ? '' : (booker.accept ? 'Ja' : 'abgelehnt')}"></td>
<th>Status</th>
<td th:text="${booker.progress}"></td>
</tr>
<tr>
<th>Freizeitpreis</th>
<td th:text="${booker.price}" />
</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>
<th>Kontostand</th>
<td><span th:text="${#numbers.formatDecimal(booker.paid, 1, 2) + ' €'}" th:if="${booker.paid != null}"></span></td>

View File

@ -18,7 +18,7 @@
<th>Freizeit</th>
<th>Rolle</th>
<th>Kontostand</th>
<th>Angemeldet</th>
<th>Status</th>
<th>Bestätigt</th>
</tr>
</thead>
@ -48,7 +48,7 @@
</form>
</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>
</th:block>
</tbody>

View File

@ -63,7 +63,7 @@
<th>Geschlecht</th>
<th>Rolle</th>
<th>Kontostand</th>
<th>Angemeldet</th>
<th>Status</th>
<th>Bestätigt</th>
</tr>
</thead>
@ -75,7 +75,7 @@
<td th:text="${b.role}"></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="${b.accept == null ? '' : (b.accept ? 'Ja' : 'abgelehnt')}"></td>
<td th:text="${b.progress}"></td>
</tr>
</th:block>
</tbody>

View File

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

View File

@ -0,0 +1,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>

View 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>

View File

@ -8,7 +8,12 @@
<th:block layout:fragment="content">
<div class="mainpage">
<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">
<table id="privs" class="table table-striped">
<thead>
@ -45,6 +50,7 @@
<div class="container">
<div class="row">
<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}">
<option value="">Auswählen</option>
<th:block th:each="u : ${profiles}">

View File

@ -7,10 +7,6 @@
<body>
<th:block layout:fragment="content">
<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:block>

View File

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

View File

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

View File

@ -44,7 +44,7 @@
</div>
<div class="accordion-item">
<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>
</h2>
<div id="approveddiv" class="accordion-collapse collapse dist8" aria-labelled="approvedpanel" data-bs-parent="#mainacc">
@ -79,7 +79,7 @@
</div>
<div class="accordion-item">
<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>
</h2>
<div id="rejecteddiv" class="accordion-collapse collapse dist8" aria-labelled="rejectedpanel" data-bs-parent="#mainacc">
@ -112,6 +112,41 @@
</script>
</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">
<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>
@ -127,14 +162,14 @@
<tbody>
<tr th:each="o : ${campoverview}">
<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>
</tbody>
<tfoot>
<tr>
<td>Zusammenfassung</td>
<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>
</table>
<script type="text/javascript">
@ -146,7 +181,7 @@
});
});
</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 class="accordion-item">

View File

@ -8,7 +8,7 @@
<th:block layout:fragment="content">
<div class="mainpage">
<div class="container" style="max-width: 100%" sec:authorize="hasRole('registrator')">
<form action="#" th:action="@{/confirmation/person/update}" th:object="${person}" method="post" th:if="${person != null}">
<form id="form" action="#" th:action="@{/confirmation/person/update}" th:object="${person}" method="post" th:if="${person != null}">
<div class="row mb-2">
<label for="outputPk" class="col-sm-2 col-form-label">ID</label>
<div class="col-sm-10">
@ -44,6 +44,7 @@
<div class="row mb-2">
<label for="inputBirthdate" class="col-sm-2 col-form-label">Geburtstag</label>
<div class="col-sm-4">
<span class="error" th:each="error : ${#fields.errors('birthdate')}">[[${error}]]<br /></span>
<input type="date" th:field="*{birthdate}" class="inputBirthdate form-control" />
</div>
<label for="inputSex" class="col-sm-2 col-form-label">Geschlecht</label>
@ -93,6 +94,16 @@
<textarea th:field="*{comment}" class="inputComment form-control"></textarea>
</div>
</div>
<div class="row mb-2">
<label for="inputRequiredPrice" class="col-sm-2 col-form-label">individueller Preis</label>
<div class="col-sm-5">
<span class="error" th:each="error : ${#fields.errors('requiredPrice')}">[[${error}]]<br /></span>
<input type="number" th:field="*{requiredPrice}" class="inputRequiredPrice form-control" />
</div>
<div class="col-sm-5 d-flex align-items-center">
von offiziell&nbsp;<span th:utext="${campPrice}"></span>
</div>
</div>
<div class="row mb-2">
<label for="outputAnno" class="col-sm-2 col-form-label">Anmerkungen</label>
<div class="col-sm-10">
@ -101,26 +112,65 @@
</div>
<div class="row mb-2">
<label for="inputAccept" class="col-sm-2 col-form-label">Status</label>
<div class="col-sm-10">
<div class="form-group">
<input type="radio" class="btn-check" id="accept1" name="accept1" value="" th:field="*{accept}" /> <label class="btn btn-outline-primary" for="accept1"><i
class="fas fa-question"></i>&nbsp;offen</label> <input type="radio" class="btn-check" id="accept2" name="accept2" value="true" th:field="*{accept}" /> <label class="btn btn-outline-success"
for="accept2"><i class="fas fa-check"></i>&nbsp;bestätigt</label> <input type="radio" class="btn-check" id="accept3" name="accept3" value="false" th:field="*{accept}" /> <label
class="btn btn-outline-danger" for="accept3"><i class="fas fa-ban"></i>&nbsp;abgelehnt</label>
</div>
<span class="col-sm-2 btn btn-outline-warning" th:if="${person.progress} == 'requested'">offen</span>
<span class="col-sm-2 btn btn-outline-success" th:if="${person.progress} == 'approved'">bestätigt</span>
<span class="col-sm-2 btn btn-outline-danger" th:if="${person.progress} == 'rejected'">abgelehnt</span>
<span class="col-sm-2 btn btn-outline-secondary" th:if="${person.progress} == 'revoked'">storniert</span>
<div class="col-sm-8" th:if="${#lists.contains({'requested', 'approved', 'rejected'}, person.progress)}">
<select th:field="*{progress}" class="form-select">
<option value="requested">offen</option>
<option value="approved">bestätigt</option>
<option value="rejected">abgelehnt</option>
</select>
</div>
<div class="col-sm-8" th:if="${person.progress} == 'revoked'">
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">
<i class="fas fa-trash"></i>&nbsp;endgültig löschen
</button>
</div>
</div>
<div class="row mb-2">
<label for="inputAccept" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10">
<button type="submit" class="btn btn-primary" onclick="progress.start()">Ok</button>
<a th:href="@{/confirmation/}" class="btn btn-secondary">Abbrechen</a>
<button type="submit" class="btn btn-primary" onclick="progress.start()" th:if="${person.progress} != 'revoked'">Ok</button>
<a th:href="@{/confirmation}" class="btn btn-secondary">Abbrechen</a>
</div>
</div>
</form>
<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 bg-danger">
<h1 class="modal-title fs-5" id="deleteModalLabel">Löschen der Anmeldung</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Willst du wirklich die Anmeldung von <span th:text="${person.forename}" class="text-danger"></span>&nbsp;<span th:text="${person.surname}" class="text-danger"></span> an der Freizeit
<select class="form-select locked" th:field="${person.fkCamp}" disabled="disabled">
<option th:each="c : ${camps}" th:value="${c.pk}" th:text="${c.name} + ' ' + ${#temporals.format(c.arrive, 'yyyy')} + ' in ' + ${c.location}"></option>
</select> löschen? Sie geht damit unwiederbringlich verloren.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Abbrechen</button>
<a th:href="@{/registration/remove/{id}(id=${person.pk})}" class="btn btn-danger">ja, wirklich löschen</a>
</div>
</div>
</div>
</div>
<div th:if="${person == null}" class="error">In der Datenbank wurde keine Person mit entsprechender ID gefunden.</div>
</div>
</div>
</th:block>
<script type="text/javascript">
/**
* forbid enter in form to allow disabling the ok button for revoked bookings
*/
$(document).on('keyup keypress', 'form', function(e) {
if (e.keyCode == 13) {
e.preventDefault();
return false;
}
});
</script>
</th:block>
</body>
</html>

View File

@ -32,11 +32,13 @@
<div class="accordion" id="acc" th:if="${mybookings.size() > 0}" style="max-width: 800px; margin-left: auto; margin-right: auto">
<div class="accordion-item" th:each="b : ${mybookings}">
<h2 class="accordion-header" th:id="'acc-head-' + ${b.pk}" th:if="${b.pk}">
<button th:class="'accordion-button collapsed acc_' + ${b.isOver ? 'over' : b.accept}" type="button" data-bs-toggle="collapse" th:data-bs-target="'#acc-body-' + ${b.pk}"
<button th:class="'accordion-button collapsed acc_' + ${b.isOver ? 'over' : b.progress}" type="button" data-bs-toggle="collapse" th:data-bs-target="'#acc-body-' + ${b.pk}"
aria-expanded="true" th:aria-controls="'#acc-body-' + ${b.pk}">
<i class="fas fa-check framed framed-green" th:if="${b.accept}"></i> <i class="fas fa-ban framed framed-red" th:if="${b.accept} == false"></i> <i
class="fas fa-question framed framed-orange" th:if="${b.accept} == null"></i>
<span th:text="${b.forename + ' ' + b.surname + ' für ' + b.campName + ' ' + #numbers.formatInteger(b.year, 4)}" class="headlinefont"></span>
<i class="fas fa-check framed framed-green" th:if="${b.progress} == 'approved'"></i>
<i class="fas fa-ban framed framed-red" th:if="${b.progress} == 'rejected'"></i>
<i class="fas fa-question framed framed-orange" th:if="${b.progress} == 'requested'"></i>
<i class="fas fa-trash framed framed-pink" th:if="${b.progress} == 'revoked'"></i>
<span th:text="${b.forename + ' ' + b.surname + ' @ ' + b.campName + ' ' + #numbers.formatInteger(b.year, 4)}" class="headlinefont"></span>
</button>
</h2>
<div th:id="'acc-body-' + ${b.pk}" class="accordion-collapse collapse" th:aria-labelledby="'acc-head-' + ${b.pk}">
@ -62,7 +64,7 @@
</div>
</div>
</div>
<div class="card" th:if="${b.accept}">
<div class="card" th:if="${b.progress} == 'approved'">
<div class="card-header">Dokumente</div>
<div class="card-body">
<div class="container">
@ -77,7 +79,7 @@
<div class="card">
<div class="card-header">Teilnehmerdaten</div>
<div class="card-body">
<form th:action="@{/dashboard/update/}" th:object="${b}" method="post">
<form th:action="@{/dashboard/update}" th:object="${b}" method="post">
<input type="hidden" th:value="*{pk}" name="pk" />
<div class="container">
<div class="row mb-2">
@ -126,8 +128,8 @@
</div>
<div class="row mb-2">
<div class="col-sm-12">Foto-Einverständnis:&nbsp;
<a th:href="@{/registration/toggleconsent/{id}/(id=${b.pk})}" th:if="${!b.consentCatalogPhoto}"><i class="fas fa-ban framed framed-red" ></i></a>
<a th:href="@{/registration/toggleconsent/{id}/(id=${b.pk})}" th:if="${b.consentCatalogPhoto}"><i class="fas fa-check framed framed-green" ></i></a>
<a th:href="@{/registration/toggleconsent/{id}(id=${b.pk})}" th:if="${!b.consentCatalogPhoto}"><i class="fas fa-ban framed framed-red" ></i></a>
<a th:href="@{/registration/toggleconsent/{id}(id=${b.pk})}" th:if="${b.consentCatalogPhoto}"><i class="fas fa-check framed framed-green" ></i></a>
</div>
</div>
<div class="row mb-2">
@ -139,8 +141,11 @@
<div class="col-sm-8">
<input type="submit" class="btn btn-primary" value="Änderungen übernehmen" />
</div>
<div class="col-sm-2">
<a th:href="@{/registration/cancel/{id}(id=${b.pk})}" class="btn btn-outline-danger" th:if="${!b.isOver}">stornieren</a>
<div class="col-sm-2" th:if="${b.progress != 'revoked'}">
<a th:href="@{/registration/revoke/{id}(id=${b.pk})}" class="btn btn-outline-danger" th:if="${!b.isOver}">stornieren</a>
</div>
<div class="col-sm-2" th:if="${b.progress == 'revoked'}">
<a th:href="@{/registration/unrevoke/{id}(id=${b.pk})}" class="btn btn-outline-success" th:if="${!b.isOver}">Stornierung aufheben</a>
</div>
</div>
</div>
@ -150,8 +155,12 @@
<div class="alert alert-primary" th:if="${b.created != null}">
angemeldet am <span th:text="${#temporals.format(b.created, 'dd.MM.yyyy')}"></span> von <span th:text="${b.subscriber}"></span>
</div>
<div th:class="'alert ' + ${b.accept ? 'alert-success' : 'alert-danger'}" th:if="${b.accept != null}">
<span th:text="${b.accept ? 'bestätigt' : 'abgelehnt'}"></span> von <span th:text="${b.registrator}"></span>
<div class="alert alert-danger" th:if="${b.progress == 'revoked'}">
storniert von <span th:text="${b.subscriber}"></span>
</div>
<div th:class="'alert alert-' + (${b.progress} == 'approved' ? 'success' : 'danger')" th:if="${#lists.contains({'approved', 'rejected'}, b.progress)}">
<span th:if="${b.progress} == 'approved'">bestätigt</span>
<span th:if="${b.progress} == 'rejected'">abgelehnt</span> von <span th:text="${b.registrator}"></span>
</div>
<div class="alert alert-warning" th:if="${b.isOver}">Die Freizeit ist bereits vorbei.</div>
</div>

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
th:if="${bean.isDirector}">Leiter</span><span th:if="${bean.isFeeder}">Küchenhilfe</span>
</div>
<div class="card-footer">
<a th:href="@{/registration/remove/{id}(id=${bean.pk})}" class="btn btn-danger">Ja, stornieren</a> &nbsp;<a th:href="@{/dashboard}" class="btn btn-outline-success">Stornierung abbrechen</a>
<a th:href="@{/registration/revoke/{id}(id=${bean.pk})}" class="btn btn-danger">Ja, stornieren</a> &nbsp;<a th:href="@{/dashboard}" class="btn btn-outline-success">Stornierung abbrechen</a>
</div>
</div>
</div>

View File

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

Some files were not shown because too many files have changed in this diff Show More