moving to using a rust api
This commit is contained in:
parent
2d1424aeb2
commit
f00ed3a04c
12 changed files with 1044 additions and 272 deletions
|
@ -1,2 +1,2 @@
|
|||
{{ time.Format "Jan 2006" "2022-05-01" }} -
|
||||
{{ time.Format "Jan 2006" "2023-05-01" }}.
|
||||
{{ time.Format "Jan 2006" "2023-05-01" }} -
|
||||
{{ time.Format "Jan 2006" "2024-05-01" }}.
|
||||
|
|
|
@ -69,8 +69,8 @@
|
|||
// For use in dev
|
||||
// Can now start using this in production IF,
|
||||
// I get the server running on the server
|
||||
let base = "https://api.tfcconnection.org/health-form";
|
||||
/* let base = "http://localhost:4242/health-form"; */
|
||||
/* let base = "https://api.tfcconnection.org/health-form"; */
|
||||
let base = "http://localhost:4242/health-form";
|
||||
fetch(base, {
|
||||
method: "POST",
|
||||
body: data
|
||||
|
@ -141,6 +141,18 @@
|
|||
document.getElementById('warning-insurance').style.margin = '0';
|
||||
document.getElementById('warning-policy').style.margin = '0';
|
||||
document.getElementById('warning-image').style.margin = '0';
|
||||
|
||||
// Prefill form based from MT form
|
||||
document.getElementById('firstname').value = firstName;
|
||||
document.getElementById('lastname').value = lastName;
|
||||
document.getElementById('parentfirstname').value = parentFirstName;
|
||||
document.getElementById('parentlastname').value = parentLastName;
|
||||
document.getElementById('birthdate').value = birthdate;
|
||||
document.getElementById('street').value = streetP;
|
||||
document.getElementById('city').value = cityP;
|
||||
document.getElementById('state').value = stateP;
|
||||
document.getElementById('zip').value = zipP;
|
||||
document.getElementById('cellphone').value = parentPhone;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', process);
|
||||
|
@ -169,16 +181,28 @@
|
|||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', dated);
|
||||
const myUrl = new URL(window.location.toLocaleString());
|
||||
const mtRegistration = myUrl.searchParams.get('mtregistration');
|
||||
const registration = myUrl.searchParams.get('registration');
|
||||
const params = new URL(window.location.toLocaleString()).searchParams;
|
||||
const mtRegistration = params.get('mtregistration');
|
||||
const registration = params.get('registration');
|
||||
|
||||
const firstName = params.get('firstName');
|
||||
const lastName = params.get('lastName');
|
||||
const parentFirstName = params.get('parentFirstName');
|
||||
const parentLastName = params.get('parentLastName');
|
||||
const birthdate = params.get('birthdate');
|
||||
const streetP = params.get('street');
|
||||
const cityP = params.get('city');
|
||||
const stateP = params.get('state');
|
||||
const zipP = params.get('zip');
|
||||
const parentPhone = params.get('parentPhone');
|
||||
|
||||
console.log(mtRegistration);
|
||||
|
||||
</script>
|
||||
|
||||
<div id="health-form" class="form text-lg w-full">
|
||||
<form id='form' onsubmit="submitForm(event);" autocomplete="on" method="post" target="_parent" class="w-full items-center flex flex-wrap">
|
||||
<h3 class="basis-full">2023-2024 Health Form</h3>
|
||||
<h3 class="basis-full">2024-2025 Health Form</h3>
|
||||
<div class="basis-full flex flex-wrap my-4">
|
||||
<label for="firstname" class="basis-full">What is your first and last name?</label>
|
||||
<br/>
|
||||
|
|
|
@ -21,29 +21,21 @@
|
|||
}).then((res) => {
|
||||
console.log(res);
|
||||
if (res.ok) {
|
||||
//var payment = document.getElementById('registration').value;
|
||||
//window.location.href = '/mt-health-form?mtregistration=' + payment;
|
||||
var payment = document.getElementById('registration').value;
|
||||
window.location.href = '/mt-health-form?mtregistration=' + payment +
|
||||
"&firstName=" + data.get('firstname') +
|
||||
"&lastName=" + data.get('lastname') +
|
||||
"&parentFirstName=" + data.get('parentfirstname') +
|
||||
"&parentLastName=" + data.get('parentlastname') +
|
||||
"&birthdate=" + data.get('birthdate') +
|
||||
"&street=" + data.get('street') +
|
||||
"&city=" + data.get('city') +
|
||||
"&state=" + data.get('state') +
|
||||
"&zip=" + data.get('zip') +
|
||||
"&parentPhone=" + data.get('parentphone');
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
|
||||
/* var xhr = new XMLHttpRequest();
|
||||
* xhr.onreadystatechange = function() {
|
||||
* if (this.readyState == 4 && this.status == 200) {
|
||||
* // Logic directing where to send the user after form submission based on results.
|
||||
* // This is how to send them. window.location.href = '/thankyou/';
|
||||
|
||||
* var payment = document.getElementById('registration').value;
|
||||
* window.location.href = '/mt-health-form?mtregistration=' + payment;
|
||||
* // Need to eventually get the user here: https://secure.myvanco.com/L-Z772/campaign/C-13DM3
|
||||
* }
|
||||
* }; */
|
||||
/* xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-application"); */
|
||||
/* xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-application");
|
||||
* xhr.send(data);
|
||||
* console.log(data);
|
||||
* console.log("Hallo!"); */
|
||||
/* return false; */
|
||||
}
|
||||
|
||||
function calculate_age(dob) {
|
||||
|
@ -139,8 +131,8 @@
|
|||
class="flex-auto form-input {{ $formClasses }}">
|
||||
</div>
|
||||
<div class="flex-auto flex flex-wrap items-center">
|
||||
<label for="homephone" class="basis-1/4 mr-4">Parent phone</label>
|
||||
<input type="tel" id="homephone" name="homephone"
|
||||
<label for="parentphone" class="basis-1/4 mr-4">Parent phone</label>
|
||||
<input type="tel" id="parentphone" name="parentphone"
|
||||
class="flex-auto form-input {{ $formClasses }}">
|
||||
</div>
|
||||
<div class="basis-full flex items-center">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue