Add overnight button
This commit is contained in:
22
js/main.js
22
js/main.js
@@ -306,6 +306,16 @@
|
||||
$(window).stellar({ horizontalScrolling: false });
|
||||
};
|
||||
|
||||
var defaultUncheckedInputCheckboxes = function() {
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
|
||||
for (var i=0; i<inputs.length; i++) {
|
||||
if (inputs[i].type == 'checkbox') {
|
||||
inputs[i].checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(function(){
|
||||
mobileMenuOutsideClick();
|
||||
@@ -320,6 +330,7 @@
|
||||
counter();
|
||||
counterWayPoint();
|
||||
addField();
|
||||
defaultUncheckedInputCheckboxes();
|
||||
});
|
||||
|
||||
|
||||
@@ -366,9 +377,15 @@ document.getElementById("js-submitbtn").addEventListener("click", async function
|
||||
return;
|
||||
}
|
||||
|
||||
let overnightRequired = false;
|
||||
|
||||
if ($('.overnight-js').is(":checked")) {
|
||||
overnightRequired = true;
|
||||
}
|
||||
|
||||
let family = {
|
||||
name: lastname,
|
||||
overnight: true,
|
||||
overnight: overnightRequired,
|
||||
telephonenumber: telephonenumber,
|
||||
email: eMail,
|
||||
members: []
|
||||
@@ -418,7 +435,7 @@ document.getElementById("js-submitbtn").addEventListener("click", async function
|
||||
redirect: 'follow', // manual, *follow, error
|
||||
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
|
||||
body: JSON.stringify(family) // body data type must match "Content-Type" header
|
||||
});
|
||||
}).catch(function (timeout) { SubmitError("API error. Call the phone number."); });
|
||||
if(response.ok)
|
||||
{
|
||||
let jsonResponse = await response.json();
|
||||
@@ -477,6 +494,7 @@ document.getElementById("js-submitbtn").addEventListener("click", async function
|
||||
}).catch(function (timeout) { });
|
||||
|
||||
document.getElementById("attentant-container").remove();
|
||||
document.getElementById("overnight-div").remove();
|
||||
document.getElementById("js-submitbtn").disabled = 'true';
|
||||
document.getElementById("js-submitbtn").textContent = await translator.getTranslationByKey(document.documentElement.lang,"already_participating");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user