Providing feedback when searching by room, and connecting to the reservation page

This commit is contained in:
2024-07-10 23:32:49 +02:00
parent 5eb9284b6f
commit fed901ce25
3 changed files with 35 additions and 7 deletions

View File

@ -183,16 +183,20 @@
async function custom(c) {
const {
icon = "",
msg = "",
title = "",
showConfirmButton = true,
} = c;
const {value: result} = await Swal.fire({
icon: icon,
title: title,
html: msg,
backdrop: false,
focusConfirm: false,
showCancelButton: true,
showConfirmButton: showConfirmButton,
willOpen: () => {
if (c.willOpen !== undefined) {
c.willOpen();

View File

@ -43,7 +43,8 @@
</div>
</form>
`;
Prompt().custom({
let attention = Prompt()
attention.custom({
title: "Choose your dates",
msg: html,
willOpen: () => {
@ -74,8 +75,25 @@
.then(data => {
if (data.ok) {
console.log("room is available")
attention.custom({
icon: "success",
// TODO: use the default ok button instead
msg: '<p>Room is available</p>' +
'<p><a href="/book-room?id=' +
data.room_id +
'&s=' +
data.start_date +
'&e=' +
data.end_date +
'" class="btn btn-primary">' +
'Book now!</a></p>',
showConfirmButton: false,
});
} else {
console.log("room is not available")
attention.error({
msg: "No availability"
});
}
})
},