This commit is contained in:
parent
f8521095f7
commit
e223118a75
@ -0,0 +1,58 @@
|
||||
package de.jottyfan.camporganizer.module.registration;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public class CampBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer pk;
|
||||
private String name;
|
||||
private Integer year;
|
||||
|
||||
/**
|
||||
* @return the pk
|
||||
*/
|
||||
public Integer getPk() {
|
||||
return pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pk the pk to set
|
||||
*/
|
||||
public void setPk(Integer pk) {
|
||||
this.pk = pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Integer getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param year the year to set
|
||||
*/
|
||||
public void setYear(Integer year) {
|
||||
this.year = year;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package de.jottyfan.camporganizer.module.registration;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
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.common.CommonController;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class RegistrationController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Autowired
|
||||
private RegistrationService service;
|
||||
|
||||
@GetMapping("/registration/{fkCamp}")
|
||||
public String index(@PathVariable(name = "fkCamp", required = true) Integer fkCamp, Model model) {
|
||||
super.setupSession(model, request);
|
||||
model.addAttribute("camp", service.getCamp(fkCamp));
|
||||
// TODO: prepare a bean for the form variables; use model.getAttribute("camp").getPk() for the fk_camp
|
||||
return "/registration";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package de.jottyfan.camporganizer.module.registration;
|
||||
|
||||
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.SelectConditionStep;
|
||||
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.TCampRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Repository
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public class RegistrationGateway {
|
||||
private static final Logger LOGGER = LogManager.getLogger(RegistrationGateway.class);
|
||||
|
||||
@Autowired
|
||||
private DSLContext jooq;
|
||||
|
||||
/**
|
||||
* get the camp
|
||||
*
|
||||
* @param pk the ID of the camp
|
||||
* @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();
|
||||
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());
|
||||
return bean;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package de.jottyfan.camporganizer.module.registration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class RegistrationService {
|
||||
|
||||
@Autowired
|
||||
private RegistrationGateway gateway;
|
||||
|
||||
/**
|
||||
* get the camp
|
||||
*
|
||||
* @param fkCamp the ID of the camp
|
||||
* @return the camp bean or null
|
||||
*/
|
||||
public CampBean getCamp(Integer fkCamp) {
|
||||
return gateway.getCamp(fkCamp);
|
||||
}
|
||||
|
||||
}
|
@ -47,6 +47,10 @@ div {
|
||||
font-family: 'Fira Sans';
|
||||
}
|
||||
|
||||
.cabin {
|
||||
font-family: 'Cabin Sketch' !important;
|
||||
}
|
||||
|
||||
.headlinefont {
|
||||
font-family: 'Cabin Sketch' !important;
|
||||
font-size: xx-large;
|
||||
@ -101,6 +105,20 @@ div {
|
||||
right: 40vw;
|
||||
}
|
||||
|
||||
.centered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.centered-card {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.rowdist {
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.myheadline {
|
||||
margin: 8px;
|
||||
}
|
||||
|
92
src/main/resources/templates/registration.html
Normal file
92
src/main/resources/templates/registration.html
Normal file
@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html th:replace="~{template :: layout(~{::title}, ~{::libs}, ~{::header}, ~{::content})}" xmlns:th="http://www.thymeleaf.org" 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" />
|
||||
<libs></libs>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<a th:href="@{/}" class="btn btn-secondary btn-icon-silent" target="_blank" title="Startseite laden"><i class="fas fa-home"></i></a>
|
||||
</header>
|
||||
<content>
|
||||
<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" style="max-width: 48rem">
|
||||
<div class="card-body">
|
||||
<form action="#" method="post">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="text" class="form-control" placeholder="Vorname" />
|
||||
</div>
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="text" class="form-control" placeholder="Nachname" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 rowdist">
|
||||
<select class="form-select">
|
||||
<option value="">Geschlecht</option>
|
||||
<option value="female">weiblich</option>
|
||||
<option value="male">männlich</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="date" class="form-control" placeholder="Geburtsdatum" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="text" class="form-control" placeholder="Straße und Hausnummer" />
|
||||
</div>
|
||||
<div class="col-sm-2 rowdist">
|
||||
<input type="text" class="form-control" placeholder="PLZ" />
|
||||
</div>
|
||||
<div class="col-sm-4 rowdist">
|
||||
<input type="text" class="form-control" placeholder="Ort" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="text" class="form-control" placeholder="E-Mail" />
|
||||
</div>
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="text" class="form-control" placeholder="Telefonnummer" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 rowdist">
|
||||
<textarea class="form-control" placeholder="Sonstiges"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 rowdist">
|
||||
<div class="form-check" title="Die Anmeldedaten können in den Kontoeinstellungen bearbeitet und für die nächsten Freizeitanmeldungen verwendet werden.">
|
||||
<input id="save" type="checkbox" class="form-check-input" checked="checked" onchange="$('#createlogin').toggle();" />
|
||||
<label class="form-check-label" for="save">Anmeldedaten speichern</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="createlogin" class="row">
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="text" class="form-control" placeholder="Login" />
|
||||
</div>
|
||||
<div class="col-sm-6 rowdist">
|
||||
<input type="password" class="form-control" placeholder="Passwort" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 rowdist centered">
|
||||
<input type="submit" class="btn btn-outline-secondary" value="jetzt anmelden" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</content>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user