Commit 3d6c1616 authored by Michael Koch's avatar Michael Koch
Browse files

Add "send refreshment confirmation" button

parent ea45cadf
......@@ -79,5 +79,9 @@
"reservation_undecide_outbound_ls": {
"subject": "[stadtcampus] The decision for your reservation for Sprintraum has been reverted.",
"body": "<h2>Sprintraum</h2>Your previously confirmed or denied reservation for Sprintraum has been marked again as undecided.<br /><br /><h4>Reservation details</h4><strong>Room:</strong> %s<br /><strong>Timeslot:</strong> %s-%s"
},
"reservation_refreshment_order_confirmed_outbound": {
"subject": "[stadtcampus] Your refreshment order for Stadtcampus has been accepted.",
"body": "<h2>Stadtcampus</h2>Your refreshment order for Stadtcampus has been accepted.<br /><br /><h4>Reservation details</h4><strong>Subject:</strong> %s<br /><strong>Room:</strong> %s<br /><strong>Timeslot:</strong> %s-%s"
}
}
\ No newline at end of file
......@@ -628,6 +628,7 @@ function showReservationDetails(fieldorid) {
}
if (reservation.refreshments === 1) {
refreshments = "<br /><button onclick='closeDialog(); showRefreshments(" + reservation.id + ");'>🍺🍔 Zur Getränke- und Snackbestellung</button>";
refreshments += "<br /><button onclick='sendOutboundConfirmRefreshmentsMail();'>📧 Bestätigungsmail Annahme Bestellung</button>";
}
refreshments += "<br /><button onclick='sendOutboundReservationMail();'>📧 Link zum Bestellformular erneut zuschicken</button>";
......@@ -755,3 +756,33 @@ function sendOutboundReservationMail() {
}
});
}
/**
* Send notification mail about acceptance of refreshment order
*/
function sendOutboundConfirmRefreshmentsMail() {
showSpinner();
_callBackend({
"cmd": "sendOutboundConfirmRefreshmentsMail",
"room_name": _currentReservation.room.longname,
"email": _currentReservation.contact.email,
"name": _currentReservation.contact.name,
"times": {
"preparation": {
"from": _currentReservation.times.preparation.from,
"to": _currentReservation.times.preparation.to
},
"event": {
"from": _currentReservation.times.event.from,
"to": _currentReservation.times.event.to
}
}
}, (r) => {
hideSpinner();
if (r.result === "success") {
showDialog("Die Email wurde erfolgreich verschickt.", "Erfolg");
} else {
showDialog("Die Email konnte nicht verschickt werden:<br />" + r.reason, "Fehler");
}
});
}
......@@ -502,6 +502,29 @@ function sendOutboundReservationMail($q, $internal = false) {
success();
}
function sendOutboundConfirmRefreshmentsMail($q, $internal = false) {
global $config;
$mail_body = sprintf($config["reservation_refreshment_order_confirmed_outbound"]["body"], $q->subject, $q->room_name, $q->from_preparation, $q->to_preparation, $q->from_event, $q->to_event);
$mail_options = array(
"to" => array(
array(
"mail" => $q->email,
"name" => $q->name
)
),
"subject" => $config["reservation_refreshment_order_confirmed_outbound"]["subject"],
"body" => $mail_body
);
$mail = sendMail(json_decode(json_encode($mail_options), false), true);
if (! $mail["success"]) {
fail("Couldn't send external mail: " . $mail["detail"]);
}
success();
}
function confirmReservation($q) {
global $m, $m2, $config;
......
Supports Markdown
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