diff --git a/src/main/java/de/jottyfan/camporganizer/module/registration/CampBean.java b/src/main/java/de/jottyfan/camporganizer/module/registration/CampBean.java new file mode 100644 index 0000000..f396f0a --- /dev/null +++ b/src/main/java/de/jottyfan/camporganizer/module/registration/CampBean.java @@ -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; + } +} diff --git a/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java new file mode 100644 index 0000000..5073525 --- /dev/null +++ b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java @@ -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"; + } + +} diff --git a/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationGateway.java b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationGateway.java new file mode 100644 index 0000000..c5f431e --- /dev/null +++ b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationGateway.java @@ -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 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; + } + } + +} diff --git a/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationService.java b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationService.java new file mode 100644 index 0000000..23d477a --- /dev/null +++ b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationService.java @@ -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); + } + +} diff --git a/src/main/resources/static/css/style.css b/src/main/resources/static/css/style.css index 0feb186..7025123 100644 --- a/src/main/resources/static/css/style.css +++ b/src/main/resources/static/css/style.css @@ -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; } diff --git a/src/main/resources/templates/registration.html b/src/main/resources/templates/registration.html new file mode 100644 index 0000000..a14d487 --- /dev/null +++ b/src/main/resources/templates/registration.html @@ -0,0 +1,92 @@ + + + +Camp Organizer 2 + + + + +
+ +
+ +
+

Anmeldung

+

+
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ + \ No newline at end of file