Commit 16e614d7 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

fix lernsprint intentions

parent b4fe51a1
......@@ -67,14 +67,14 @@ function showReservations() {
* Update reservation table
*/
function updateReservationsTable() {
const callback = arguments.length > 0 && arguments[0] !== undefined && typeof arguments[0] === "function" ? arguments[0] : () => {};
const callback = arguments.length > 0 && arguments[0] !== undefined && typeof arguments[0] === "function" ? arguments[0] : () => { };
const filter = $("#reservations_filter").val();
let reservations = [];
showSpinner();
refreshReservations(() => {
if (_currentTab === "#reservations") {
switch(filter) {
switch (filter) {
case 'all':
reservations = _reservations.all;
break;
......@@ -163,7 +163,7 @@ function updateReservationsTable() {
function getReservationCommentString(reservation) {
let s = reservation.comments.user;
if (! _.isEmpty(reservation.comments.internal)) {
if (!_.isEmpty(reservation.comments.internal)) {
s += "<br /><br /><i><b>" + reservation.comments.internal + "</b></i>";
}
return s;
......@@ -318,14 +318,14 @@ function commentReservation(fieldorid) {
const r = $.grep(_reservations.all, (e, i) => e.id === id);
if (r. length !== 1) {
if (r.length !== 1) {
console.error("Can't find reservation");
} else {
const reservation = r[0];
showDialog({
text: "Diese Buchung kommentieren:<br />" +
"<textarea name='comment' id='comment' placeholder='Kommentar zu dieser Buchung'>" +
(reservation.comments.internal ? reservation.comments.internal : "") +
(reservation.comments.internal ? reservation.comments.internal : "") +
"</textarea>",
title: "Buchung kommentieren",
extraButtons: {
......@@ -382,24 +382,24 @@ function changeReservationTimes(fieldorid) {
showDialog({
text: "<h3>Zeiten &auml;ndern</h3>" +
"<table class='settings-table noborder'>" +
"<tr>" +
"<td colspan='4'><b>Zeitraum inkl. Auf- und Abbau:</b></td>" +
"</tr>" +
(reservation.room.room_type !== 1 ? "<tr>" +
"<td><label for='from_preparation'><b>Von:</b></td>" +
"<td><input class='longer' type='text' id='from_preparation' name='from_preparation'></td>" +
"<td><label for='from_preparation'><b>Bis:</b></td>" +
"<td><input class='longer' type='text' id='to_preparation' name='to_preparation'></td>" +
"<tr>" +
"<td colspan='4'><b>Zeitraum inkl. Auf- und Abbau:</b></td>" +
"</tr>" +
(reservation.room.room_type !== 1 ? "<tr>" +
"<td><label for='from_preparation'><b>Von:</b></td>" +
"<td><input class='longer' type='text' id='from_preparation' name='from_preparation'></td>" +
"<td><label for='from_preparation'><b>Bis:</b></td>" +
"<td><input class='longer' type='text' id='to_preparation' name='to_preparation'></td>" +
"</tr>" : "") +
"<tr>" +
"<td colspan='4'><b>Zeitraum " + (reservation.room.room_type !== 1 ? 'Veranstaltung' : 'Lernsprint') + ":</b></td>" +
"</tr>" +
"<tr>" +
"<td><label for='from_event'><b>Von:</b></td>" +
"<td><input class='longer' type='text' id='from_event' name='from_event'></td>" +
"<td><label for='from_event'><b>Bis:</b></td>" +
"<td><input class='longer' type='text' id='to_event' name='to_event'></td>" +
"</tr>" +
"<tr>" +
"<td colspan='4'><b>Zeitraum " + (reservation.room.room_type !== 1 ? 'Veranstaltung' : 'Lernsprint') + ":</b></td>" +
"</tr>" +
"<tr>" +
"<td><label for='from_event'><b>Von:</b></td>" +
"<td><input class='longer' type='text' id='from_event' name='from_event'></td>" +
"<td><label for='from_event'><b>Bis:</b></td>" +
"<td><input class='longer' type='text' id='to_event' name='to_event'></td>" +
"</tr>" +
"</table>",
title: "Zeiten ändern",
extraButtons: {
......@@ -493,6 +493,7 @@ function addReservation() {
let from_preparation = $("#new_reservation_from_preparation").val();
let to_preparation = $("#new_reservation_to_preparation").val();
let subject = $("#new_reservation_subject").val();
let ls_intentions = $("#new_reservation_ls_intentions").val();
if (r.length === 1) {
let check = checkNewReservationForm();
......@@ -502,6 +503,7 @@ function addReservation() {
from_preparation = "lernsprint";
to_preparation = "lernsprint";
subject = "Lernsprint";
ls_intentions = "none";
} else if (r[0].room_type === 5) {
from_preparation = "studyspace";
to_preparation = "studyspace";
......@@ -519,20 +521,20 @@ function addReservation() {
text: "Buchung bindend abschicken",
click: () => {
_callBackend({
"cmd": "addReservation",
"room_id": parseInt($("#new_reservation_room").val()),
"from_event": from_event,
"to_event": to_event,
"from_preparation": from_preparation,
"to_preparation": to_preparation,
"name": $("#new_reservation_contact_name").val(),
"email": $("#new_reservation_contact_email").val(),
"phone": $("#new_reservation_contact_phone").val(),
"web": $("#new_reservation_contact_web").val(),
"subject": subject,
"comment": $("#new_reservation_comment").val(),
"ls_intentions": r[0].room_type !== 1 ? "kein_lernsprint" : $("#new_reservation_ls_intentions").val()
},
"cmd": "addReservation",
"room_id": parseInt($("#new_reservation_room").val()),
"from_event": from_event,
"to_event": to_event,
"from_preparation": from_preparation,
"to_preparation": to_preparation,
"name": $("#new_reservation_contact_name").val(),
"email": $("#new_reservation_contact_email").val(),
"phone": $("#new_reservation_contact_phone").val(),
"web": $("#new_reservation_contact_web").val(),
"subject": subject,
"comment": $("#new_reservation_comment").val(),
"ls_intentions": ls_intentions
},
(r, e) => {
if (r.result === "success") {
clearNewReservationForm();
......@@ -674,7 +676,7 @@ function showReservationDetails(fieldorid) {
}
}
_currentReservation = reservation;
if (! _.isEmpty(reservation.comments.internal)) {
if (!_.isEmpty(reservation.comments.internal)) {
editorcomment = reservation.comments.internal;
}
if (reservation.refreshments === 1) {
......@@ -689,8 +691,8 @@ function showReservationDetails(fieldorid) {
(reservation.room.room_type === 1 ? "<b>Lernsprint:</b> " + reservation.ls_intentions + "<br />" : "") +
"<br />" +
((reservation.room.room_type !== 1 && reservation.room.room_type !== 5) ? "<b>Zeitraum inkl. An- und Abbau:</b><br />" +
"<b>Von:</b> " + _getLocalDateTime(reservation.preparation.from) + "<br />" +
"<b>Bis:</b> " + _getLocalDateTime(reservation.preparation.to) + "<br /><br />" : "") +
"<b>Von:</b> " + _getLocalDateTime(reservation.preparation.from) + "<br />" +
"<b>Bis:</b> " + _getLocalDateTime(reservation.preparation.to) + "<br /><br />" : "") +
"<b>Zeitraum " + (reservation.room.room_type === 1 ? 'Lernsprint' : (reservation.room_type === 5 ? 'Study Space' : 'Veranstaltung')) + ":</b><br />" +
"<b>Von:</b> " + _getLocalDateTime(reservation.event.from) + "<br />" +
"<b>Bis:</b> " + _getLocalDateTime(reservation.event.to) + "<br /><br />" +
......@@ -718,7 +720,7 @@ function showReservationDetails(fieldorid) {
click: () => {
confirmReservation(_currentReservation.id);
},
disabled: (! _permissionCheck())
disabled: (!_permissionCheck())
},
btn2: {
text: "👎 Ablehnen",
......@@ -726,7 +728,7 @@ function showReservationDetails(fieldorid) {
click: () => {
denyReservation(_currentReservation.id);
},
disabled: (! _permissionCheck())
disabled: (!_permissionCheck())
},
btn3: {
text: "🤷‍♂️ Entscheidung zurückziehen",
......@@ -734,7 +736,7 @@ function showReservationDetails(fieldorid) {
click: () => {
undecideReservation(_currentReservation.id);
},
disabled: (! _permissionCheck())
disabled: (!_permissionCheck())
},
btn4: {
text: "📝 Kommentieren",
......@@ -742,7 +744,7 @@ function showReservationDetails(fieldorid) {
click: () => {
commentReservation(_currentReservation.id);
},
disabled: (! _permissionCheck())
disabled: (!_permissionCheck())
},
btn5: {
text: "⏰ Zeiten ändern",
......@@ -750,7 +752,7 @@ function showReservationDetails(fieldorid) {
click: () => {
changeReservationTimes(_currentReservation.id);
},
disabled: (! _permissionCheck())
disabled: (!_permissionCheck())
},
btn6: {
text: "♻ Löschen",
......@@ -758,7 +760,7 @@ function showReservationDetails(fieldorid) {
click: () => {
deleteReservation(_currentReservation.id);
},
disabled: (! _permissionCheck())
disabled: (!_permissionCheck())
}
}
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment