From e138d204fce15202f22010665efae2017dd00547 Mon Sep 17 00:00:00 2001 From: Trevor Sawler Date: Sun, 21 Feb 2021 11:28:20 -0400 Subject: [PATCH] Date picker in dialog --- working-html/reservation.html | 63 +++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/working-html/reservation.html b/working-html/reservation.html index 71d2596..fade4f1 100644 --- a/working-html/reservation.html +++ b/working-html/reservation.html @@ -28,6 +28,10 @@ .notie-container { box-shadow: none; } + + .datepicker { + z-index: 10000; + } @@ -159,8 +163,26 @@

Search for Availability

})(); document.getElementById("colorButton").addEventListener("click", function () { - attention.error({ - msg: 'Ooops...', + let html = ` +
+
+
+
+
+ +
+
+ +
+ +
+
+
+
+ `; + attention.custom({ + title: 'Choose your dates', + msg: html, }); }) @@ -243,10 +265,47 @@

Search for Availability

} + async function custom(c) { + const { + msg = "", + title = "", + } = c; + + const { value: formValues } = await Swal.fire({ + title: title, + html: msg, + backdrop: false, + focusConfirm: false, + showCancelButton: true, + willOpen: () => { + const elem = document.getElementById("reservation-dates-modal"); + const rp = new DateRangePicker(elem, { + format: 'yyyy-mm-dd', + showOnFocus: true, + }) + }, + didOpen: () => { + document.getElementById("start").removeAttribute("disabled"); + document.getElementById("end").removeAttribute("disabled"); + }, + preConfirm: () => { + return [ + document.getElementById('start').value, + document.getElementById('end').value + ] + } + }) + + if (formValues) { + Swal.fire(JSON.stringify(formValues)) + } + } + return { toast: toast, success: success, error: error, + custom: custom, } }