This commit is contained in:
parent
796624eebd
commit
2126f4de62
@ -42,6 +42,30 @@ public class BookingBean implements Serializable {
|
|||||||
private Boolean accept;
|
private Boolean accept;
|
||||||
private String subscriber;
|
private String subscriber;
|
||||||
|
|
||||||
|
public Boolean isFemale() {
|
||||||
|
return EnumSex.female.equals(sex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isMale() {
|
||||||
|
return EnumSex.male.equals(sex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isTeacher() {
|
||||||
|
return EnumCamprole.teacher.equals(camprole);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isStudent() {
|
||||||
|
return EnumCamprole.student.equals(camprole);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isDirector() {
|
||||||
|
return EnumCamprole.director.equals(camprole);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isFeeder() {
|
||||||
|
return EnumCamprole.feeder.equals(camprole);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the forename
|
* @return the forename
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -36,9 +38,16 @@ public class IndexController extends CommonController {
|
|||||||
public String dashboard(Model model) {
|
public String dashboard(Model model) {
|
||||||
super.setupSession(model, request);
|
super.setupSession(model, request);
|
||||||
model.addAttribute("mybookings", service.getBookingsOf(super.getCurrentUser(request)));
|
model.addAttribute("mybookings", service.getBookingsOf(super.getCurrentUser(request)));
|
||||||
|
model.addAttribute("bookingBean", new BookingBean());
|
||||||
return "/dashboard";
|
return "/dashboard";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/dashboard/update")
|
||||||
|
public String updateBooking(Model model, @ModelAttribute BookingBean bean) {
|
||||||
|
service.update(bean);
|
||||||
|
return dashboard(model);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/logout")
|
@GetMapping("/logout")
|
||||||
public String getLogout(HttpServletRequest request) throws ServletException {
|
public String getLogout(HttpServletRequest request) throws ServletException {
|
||||||
request.logout();
|
request.logout();
|
||||||
|
@ -14,11 +14,13 @@ import org.jooq.Condition;
|
|||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
import org.jooq.Record;
|
import org.jooq.Record;
|
||||||
import org.jooq.SelectConditionStep;
|
import org.jooq.SelectConditionStep;
|
||||||
|
import org.jooq.UpdateConditionStep;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
||||||
|
import de.jottyfan.camporganizer.db.jooq.tables.records.TPersonRecord;
|
||||||
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +112,7 @@ public class IndexGateway {
|
|||||||
String forename = r.get(REGISTRATOR.FORENAME);
|
String forename = r.get(REGISTRATOR.FORENAME);
|
||||||
String surname = r.get(REGISTRATOR.SURNAME);
|
String surname = r.get(REGISTRATOR.SURNAME);
|
||||||
if (forename != null) {
|
if (forename != null) {
|
||||||
buf.append(forename).append(" ");
|
buf.append(forename).append(" ");
|
||||||
}
|
}
|
||||||
buf.append(surname != null ? surname : "");
|
buf.append(surname != null ? surname : "");
|
||||||
bean.setRegistrator(buf.toString());
|
bean.setRegistrator(buf.toString());
|
||||||
@ -118,7 +120,7 @@ public class IndexGateway {
|
|||||||
String regForename = r.get(T_PROFILE.FORENAME);
|
String regForename = r.get(T_PROFILE.FORENAME);
|
||||||
String regSurname = r.get(T_PROFILE.SURNAME);
|
String regSurname = r.get(T_PROFILE.SURNAME);
|
||||||
if (regForename != null) {
|
if (regForename != null) {
|
||||||
buf.append(regForename).append(" ");
|
buf.append(regForename).append(" ");
|
||||||
}
|
}
|
||||||
buf.append(regSurname != null ? regSurname : "");
|
buf.append(regSurname != null ? regSurname : "");
|
||||||
bean.setSubscriber(buf.toString());
|
bean.setSubscriber(buf.toString());
|
||||||
@ -126,4 +128,28 @@ public class IndexGateway {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update defined fields of the bean
|
||||||
|
*
|
||||||
|
* @param bean the bean
|
||||||
|
* @return number of affected database rows; should be 1
|
||||||
|
*/
|
||||||
|
public Integer update(BookingBean bean) {
|
||||||
|
UpdateConditionStep<TPersonRecord> sql = jooq
|
||||||
|
// @formatter:off
|
||||||
|
.update(T_PERSON)
|
||||||
|
.set(T_PERSON.FORENAME, bean.getForename())
|
||||||
|
.set(T_PERSON.SURNAME, bean.getSurname())
|
||||||
|
.set(T_PERSON.STREET, bean.getStreet())
|
||||||
|
.set(T_PERSON.ZIP, bean.getZip())
|
||||||
|
.set(T_PERSON.CITY, bean.getCity())
|
||||||
|
.set(T_PERSON.PHONE, bean.getPhone())
|
||||||
|
.set(T_PERSON.EMAIL, bean.getEmail())
|
||||||
|
.set(T_PERSON.COMMENT, bean.getComment())
|
||||||
|
.where(T_PERSON.PK.eq(bean.getPk()));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.debug(sql.toString());
|
||||||
|
return sql.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,23 @@ public class IndexService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get all bookings that the user can see
|
||||||
|
*
|
||||||
|
* @param username the name of the user
|
||||||
|
* @return a list of beans
|
||||||
|
*/
|
||||||
public List<BookingBean> getBookingsOf(String username) {
|
public List<BookingBean> getBookingsOf(String username) {
|
||||||
return gateway.getAllBookings(username);
|
return gateway.getAllBookings(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update defined contents of the bean
|
||||||
|
*
|
||||||
|
* @param bean the bean
|
||||||
|
* @return true or false
|
||||||
|
*/
|
||||||
|
public Boolean update(BookingBean bean) {
|
||||||
|
return gateway.update(bean) == 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,23 +185,33 @@ body {
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
min-width: 32px;
|
min-width: 30px;
|
||||||
|
min-height: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.framed-green {
|
.framed-green {
|
||||||
background: linear-gradient(to bottom right, lime, darkgreen);
|
background: linear-gradient(to bottom right, lime, darkgreen);
|
||||||
color: white;
|
color: white;
|
||||||
|
border: 1px solid green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.framed-red {
|
.framed-red {
|
||||||
background: linear-gradient(to bottom right, red, darkred);
|
background: linear-gradient(to bottom right, red, darkred);
|
||||||
color: white;
|
color: white;
|
||||||
|
border: 1px solid red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.framed-orange {
|
.framed-orange {
|
||||||
background: linear-gradient(to bottom right, orange, #bf6c06);
|
background: linear-gradient(to bottom right, orange, #bf6c06);
|
||||||
color: white;
|
color: white;
|
||||||
|
border: 1px solid orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
.framed-white {
|
||||||
|
background: white;
|
||||||
|
color: black;
|
||||||
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nomaxwidth {
|
.nomaxwidth {
|
||||||
|
@ -113,12 +113,12 @@
|
|||||||
<label for="inputAccept" class="col-sm-2 col-form-label">Status</label>
|
<label for="inputAccept" class="col-sm-2 col-form-label">Status</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="radio" class="btn-check" id="accept1" name="accept1" value="" th:field="*{accept}" />
|
<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> offen</label>
|
<label class="btn btn-outline-primary" for="accept1"><i class="fas fa-question"></i> offen</label>
|
||||||
<input type="radio" class="btn-check" id="accept2" name="accept2" value="true" th:field="*{accept}" />
|
<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> bestätigt</label>
|
<label class="btn btn-outline-success" for="accept2"><i class="fas fa-check"></i> bestätigt</label>
|
||||||
<input type="radio" class="btn-check" id="accept3" name="accept3" value="false" th:field="*{accept}" />
|
<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> abgelehnt</label>
|
<label class="btn btn-outline-danger" for="accept3"><i class="fas fa-ban"></i> abgelehnt</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,70 +14,113 @@
|
|||||||
</header>
|
</header>
|
||||||
<content>
|
<content>
|
||||||
<div class="mainpage">
|
<div class="mainpage">
|
||||||
|
<script type="text/javascript">
|
||||||
|
function mark(e) {
|
||||||
|
$(e).css("background", "orange");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<div class="accordion" id="acc">
|
<div class="accordion" id="acc">
|
||||||
<div class="accordion-item" th:each="b : ${mybookings}">
|
<div class="accordion-item" th:each="b : ${mybookings}">
|
||||||
<h2 class="accordion-header" th:id="'acc-head-' + ${b.pk}">
|
<h2 class="accordion-header" th:id="'acc-head-' + ${b.pk}">
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#acc-body-' + ${b.pk}" aria-expanded="true"
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#acc-body-' + ${b.pk}" aria-expanded="true"
|
||||||
th:aria-controls="'#acc-body-' + ${b.pk}">
|
th:aria-controls="'#acc-body-' + ${b.pk}">
|
||||||
<i class="fas fa-check framed framed-green" th:if="${b.accept}"></i>
|
<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
|
||||||
<i class="fas fa-ban framed framed-red" th:if="${b.accept} == false"></i>
|
class="fas fa-question framed framed-orange" th:if="${b.accept} == null"></i> <span
|
||||||
<i class="fas fa-question framed framed-orange" th:if="${b.accept} == null"></i>
|
th:text="${b.forename + ' ' + b.surname + ' an ' + b.campName + ' ' + #numbers.formatInteger(b.year, 4)}" style="font-weight: bolder"></span> in <span
|
||||||
<span th:text="${b.forename + ' ' + b.surname + ' an ' + b.campName + ' ' + #numbers.formatInteger(b.year, 4)}" style="font-weight: bolder"></span> in <span
|
|
||||||
th:text="${b.locationName}"></span>
|
th:text="${b.locationName}"></span>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div th:id="'acc-body-' + ${b.pk}" class="accordion-collapse collapse" th:aria-labelledby="'acc-head-' + ${b.pk}">
|
<div th:id="'acc-body-' + ${b.pk}" class="accordion-collapse collapse" th:aria-labelledby="'acc-head-' + ${b.pk}">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
<div class="container">
|
<div class="card">
|
||||||
<div class="row">
|
<div class="card-header">Freizeitdaten</div>
|
||||||
<div class="col-sm-12">
|
<div class="card-body">
|
||||||
<h3>Freizeitdaten</h3>
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2">Ort:</div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<a th:href="${b.url}" target="_blank" th:text="${b.locationName}"></a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">Zeit:</div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<span th:text="${#temporals.format(b.arrive, 'dd.MM.') + ' - ' + #temporals.format(b.depart, 'dd.MM.yyyy')}" th:if="${b.arrive != null and b.depart != null}"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">Preis:</div>
|
||||||
|
<div class="col-sm-10" th:text="${b.price}"></div>
|
||||||
|
<div class="col-sm-2">Ferien:</div>
|
||||||
|
<div class="col-sm-10" th:text="${b.countries}"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">Ort:</div>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<a th:href="${b.url}" target="_blank" th:text="${b.locationName}"></a>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">Zeit:</div>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<span th:text="${#temporals.format(b.arrive, 'dd.MM.') + ' - ' + #temporals.format(b.depart, 'dd.MM.yyyy')}" th:if="${b.arrive != null and b.depart != null}"></span>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">Preis:</div>
|
|
||||||
<div class="col-sm-8" th:text="${b.price} + ' €'"></div>
|
|
||||||
<div class="col-sm-4">Ferien:</div>
|
|
||||||
<div class="col-sm-8" th:text="${b.countries}"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="card">
|
||||||
<div class="row">
|
<div class="card-header">Teilnehmerdaten</div>
|
||||||
<div class="col-sm-12">
|
<div class="card-body">
|
||||||
<h3>Teilnehmerdaten</h3>
|
<form th:action="@{/dashboard/update/}" th:object="${b}" method="post">
|
||||||
</div>
|
<input type="hidden" th:value="*{pk}" name="pk" />
|
||||||
<div class="col-sm-4">Rolle:</div>
|
<div class="container">
|
||||||
<span class="col-sm-8" th:text="${b.camprole}"></span>
|
<div class="row mb-2">
|
||||||
<div class="col-sm-4">ID:</div>
|
<div class="col-sm-2">Rolle:</div>
|
||||||
<span class="col-sm-8" th:text="${b.pk}"></span>
|
<span class="col-sm-10"> <span th:if="${b.isTeacher()}">Mitarbeiter</span> <span th:if="${b.isStudent()}">Teilnehmer</span> <span th:if="${b.isDirector()}">Leiter</span> <span
|
||||||
<div class="col-sm-4">Vorname:</div>
|
th:if="${b.isFeeder()}">Küchenteam</span>
|
||||||
<span class="col-sm-8" th:text="${b.forename}"></span>
|
</span>
|
||||||
<div class="col-sm-4">Nachname:</div>
|
</div>
|
||||||
<span class="col-sm-8" th:text="${b.surname}"></span>
|
<div class="row mb-2">
|
||||||
<div class="col-sm-4">Straße:</div>
|
<div class="col-sm-2">Geschlecht:</div>
|
||||||
<span class="col-sm-8" th:text="${b.street}"></span>
|
<span class="col-sm-10">
|
||||||
<div class="col-sm-4">PLZ:</div>
|
<span th:if="${b.isMale()}">männlich</span>
|
||||||
<span class="col-sm-8" th:text="${b.zip}"></span>
|
<span th:if="${b.isFemale()}">weiblich</span>
|
||||||
<div class="col-sm-4">Ort:</div>
|
<i class="fas fa-info framed framed-white" title="Änderungen am Geschlecht wirken sich auch auf den Anmeldestatus aus. Wenn Du Dein Geschlecht ändern möchtest, lösche bitte diese Anmeldung und leg eine neue an. Dann wird neu entschieden, ob noch ein Platz frei ist."></i>
|
||||||
<span class="col-sm-8" th:text="${b.city}"></span>
|
</span>
|
||||||
<div class="col-sm-4">Telefon:</div>
|
</div>
|
||||||
<span class="col-sm-8" th:text="${b.phone}"></span>
|
<div class="row mb-2">
|
||||||
<div class="col-sm-4">Geburtstag:</div>
|
<div class="col-sm-2">Vorname:</div>
|
||||||
<span class="col-sm-8" th:text="${#temporals.format(b.birthdate, 'dd.MM.yyyy')}"></span>
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{forename}" name="forename" onchange="mark(this)" /></span>
|
||||||
<div class="col-sm-4">E-Mail:</div>
|
</div>
|
||||||
<span class="col-sm-8" th:text="${b.email}"></span>
|
<div class="row mb-2">
|
||||||
<div class="col-sm-4">Geschlecht:</div>
|
<div class="col-sm-2">Nachname:</div>
|
||||||
<span class="col-sm-8" th:text="${b.sex}"></span>
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{surname}" name="surname" onchange="mark(this)" /></span>
|
||||||
<div class="col-sm-4">Foto-Einverständnis:</div>
|
</div>
|
||||||
<span class="col-sm-8" th:text="${b.consentCatalogPhoto}"></span>
|
<div class="row mb-2">
|
||||||
<div class="col-sm-4">Kommentar:</div>
|
<div class="col-sm-2">Straße:</div>
|
||||||
<span class="col-sm-8" th:text="${b.comment}"></span>
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{street}" name="street" onchange="mark(this)" /></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">PLZ:</div>
|
||||||
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{zip}" name="zip" onchange="mark(this)" /></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">Ort:</div>
|
||||||
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{city}" name="city" onchange="mark(this)" /></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">Telefon:</div>
|
||||||
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{phone}" name="phone" onchange="mark(this)" /></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">Geburtstag:</div>
|
||||||
|
<span class="col-sm-10" th:text="${#temporals.format(b.birthdate, 'dd.MM.yyyy')}"></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">E-Mail:</div>
|
||||||
|
<span class="col-sm-10"><input type="text" class="form-control" th:value="*{email}" name="email" onchange="mark(this)" /></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">Foto-Einverständnis:</div>
|
||||||
|
<span class="col-sm-10" th:text="${b.consentCatalogPhoto ? 'ja' : 'nein'}"></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">Kommentar:</div>
|
||||||
|
<span class="col-sm-10"><textarea class="form-control" th:text="*{comment}" name="comment" onchange="mark(this)"></textarea></span>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="submit" class="btn btn-primary" value="Änderungen übernehmen" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-primary" th:if="${b.created != null}">
|
<div class="alert alert-primary" th:if="${b.created != null}">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user