basic camp form system

This commit is contained in:
Chris Cochrun 2024-03-21 10:00:13 -05:00
parent 432436c0c1
commit dc15b66627
7 changed files with 340 additions and 80 deletions

View file

@ -23,13 +23,17 @@
document.getElementById('warning-email').style.margin = '0';
}
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
let base = "http://localhost:4242/camp-form";
/* let base = "https://api.tfcconnection.org/camp-form"; */
fetch(base, {
method: "POST",
body: data
}).then((res) => {
console.log(res);
if (res.ok) {
let payment = data.get('registration');
console.log(payment);
let health = data.get('health');
console.log(health);
if (health === 'later') {
if (payment === 'now')
window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13JPJ';
@ -39,20 +43,10 @@
window.location.href = '/thankyou/';
}
else {
if (payment === 'later')
window.location.href = '/thankyou/';
else
window.location.href = '/camp-health-form?registration=' + payment;
window.location.href = '/camp-health-form?registration=' + payment;
}
}
};
/* xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-application"); */
xhr.open("POST", "https://api.tfcconnection.org/camp-form");
xhr.send(data);
console.log(data);
console.log("Hallo!");
/* return false; */
});
}
function calculate_age(dob) {
@ -168,8 +162,8 @@
<label for="week" class="basis-full">My Camp Plan <span class='inline-block text-[#f39] text-sm align-sub'>* required</span></label>
<select id="week" name="week" class="flex-auto form-select {{ $formClasses }}">
<option value="week1">Week 1: July 17-21</option>
<!-- <option value="week2">Week 2: July 24-28</option> -->
<option value="week1">Week 1: July 22-26</option>
<option value="week2">Week 2: July 29-Aug 2</option>
</select>
<label for="shirt" class="basis-full">T-Shirt Size <span class='inline-block text-[#f39] text-sm'>all t-shirts are in adult sizes only</span></label>
@ -218,7 +212,7 @@
<input type="radio" value="now" id="registration" name="registration"
class="form-input {{ $formClasses }}" checked>
<label for="registration" class="">
Now - $85
Now - $65
</label>
</div>
<div class="basis-full">
@ -232,7 +226,7 @@
<input type="radio" value="later" id="registration" name="registration"
class="form-input {{ $formClasses }}">
<label for="registration" class="">
Later - Send $85 or $185 to the TFC Office
Later - Send $65 or $165 to the TFC Office
</label>
</div>
<div class="basis-full mt-8">