some updates to the rust server
This commit is contained in:
parent
400ad2ad5b
commit
9b70af3dba
25
content/ministries/mission-trip/2024/index.md
Normal file
25
content/ministries/mission-trip/2024/index.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: "Mission Trip 2024"
|
||||
date: 2023-08-23
|
||||
tags: ["mission-trip", "tfc"]
|
||||
newsletter: true
|
||||
featured_image: "featured.png"
|
||||
showHero: true
|
||||
description: ""
|
||||
summary: ""
|
||||
showAuthor: false
|
||||
showTableOfContents: true
|
||||
authors: ["Jeremy Ford"]
|
||||
showAuthorsBadge: true
|
||||
showTaxonomies: true
|
||||
---
|
||||
|
||||
# Mission Trip 2024
|
||||
|
||||
Some cool things happened!
|
||||
|
||||
##
|
||||
{{< pt src="https://videos.tfcconnection.org/videos/embed/193ae521-0064-4c78-a435-4cfb0ff86d2e" >}}
|
||||
{{< spacing >}}
|
||||
|
||||
{{< pt src="https://videos.tfcconnection.org/videos/embed/d2cf2a32-0d01-462c-8557-f1895046f3d0" >}}
|
|
@ -217,7 +217,7 @@
|
|||
|
||||
<div id="health-form" class="form text-lg w-full">
|
||||
<form id='form'
|
||||
hx-post="https://api.tfcconnection.org/health-form"
|
||||
hx-post="http://localhost:4242/health-form"
|
||||
hx-encoding="multipart/form-data"
|
||||
autocomplete="on" method="post"
|
||||
target="_parent"
|
||||
|
|
|
@ -8,13 +8,13 @@ use lettre::{
|
|||
|
||||
#[derive(Debug, MultipartForm, Default)]
|
||||
struct CampForm {
|
||||
#[multipart(rename = "firstname")]
|
||||
#[multipart(rename = "first-name")]
|
||||
first_name: Option<Text<String>>,
|
||||
#[multipart(rename = "lastname")]
|
||||
#[multipart(rename = "last-name")]
|
||||
last_name: Option<Text<String>>,
|
||||
#[multipart(rename = "parentfirstname")]
|
||||
#[multipart(rename = "parent-first-name")]
|
||||
parent_first_name: Option<Text<String>>,
|
||||
#[multipart(rename = "parentlastname")]
|
||||
#[multipart(rename = "parent-last-name")]
|
||||
parent_last_name: Option<Text<String>>,
|
||||
birthdate: Option<Text<String>>,
|
||||
gender: Option<Text<String>>,
|
||||
|
@ -22,8 +22,10 @@ struct CampForm {
|
|||
city: Option<Text<String>>,
|
||||
state: Option<Text<String>>,
|
||||
zip: Option<Text<i32>>,
|
||||
parentphone: Option<Text<String>>,
|
||||
parentemail: Option<Text<String>>,
|
||||
#[multipart(rename = "parent-phone")]
|
||||
parent_phone: Option<Text<String>>,
|
||||
#[multipart(rename = "parent-email")]
|
||||
parent_email: Option<Text<String>>,
|
||||
grade: Option<Text<String>>,
|
||||
shirt: Option<Text<String>>,
|
||||
allergies: Option<Text<String>>,
|
||||
|
@ -50,6 +52,7 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
|||
})
|
||||
.0
|
||||
.clone();
|
||||
let full_name = format!("{} {}", first, last);
|
||||
let email_subject = format!("{} {} signed up for camp!", first, last);
|
||||
let parent = format!(
|
||||
"{} {}",
|
||||
|
@ -109,16 +112,16 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
|||
.0
|
||||
.clone();
|
||||
let zip = form.zip.as_ref().unwrap_or(&Text { 0: 0 }).0.clone();
|
||||
let parentphone = form
|
||||
.parentphone
|
||||
let parent_phone = form
|
||||
.parent_phone
|
||||
.as_ref()
|
||||
.unwrap_or(&Text {
|
||||
0: String::from(""),
|
||||
})
|
||||
.0
|
||||
.clone();
|
||||
let parentemail = form
|
||||
.parentemail
|
||||
let parent_email = form
|
||||
.parent_email
|
||||
.as_ref()
|
||||
.unwrap_or(&Text {
|
||||
0: String::from(""),
|
||||
|
@ -219,11 +222,11 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
|||
}
|
||||
tr {
|
||||
th { "Parent Phone" }
|
||||
td { @parentphone }
|
||||
td { @parent_phone }
|
||||
}
|
||||
tr {
|
||||
th { "Parent Email" }
|
||||
td { @parentemail }
|
||||
td { @parent_email }
|
||||
}
|
||||
tr {
|
||||
th { "Grade" }
|
||||
|
@ -276,7 +279,7 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
|||
.build();
|
||||
match sender.send(&m) {
|
||||
Ok(res) => log::info!("{:?}", res),
|
||||
Err(e) => log::info!("{e}"),
|
||||
Err(e) => log::error!("{e}"),
|
||||
}
|
||||
} else {
|
||||
log::info!("Email incorrect");
|
||||
|
@ -285,16 +288,57 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
|
|||
match reg.as_str() {
|
||||
"now" => {
|
||||
log::info!("Sending them to pay for registration now");
|
||||
HttpResponse::Ok()
|
||||
.insert_header(("Access-Control-Expose-Headers", "*"))
|
||||
.insert_header((
|
||||
"HX-Redirect",
|
||||
"https://secure.myvanco.com/L-Z772/campaign/C-13JPJ",
|
||||
))
|
||||
.finish()
|
||||
}
|
||||
"full" => {
|
||||
log::info!("Sending them to pay for the full registration now");
|
||||
HttpResponse::Ok()
|
||||
.insert_header(("Access-Control-Expose-Headers", "*"))
|
||||
.insert_header((
|
||||
"HX-Redirect",
|
||||
"https://secure.myvanco.com/L-Z772/campaign/C-13JQE",
|
||||
))
|
||||
.finish()
|
||||
}
|
||||
"later" => {
|
||||
log::info!("They'd like to pay later");
|
||||
log::info!("{} would like to pay later", full_name);
|
||||
let html = markup::new! {
|
||||
div {
|
||||
class { "mt-8" }
|
||||
h2 {
|
||||
@format!("Thank you, {}!", full_name)
|
||||
}
|
||||
p { "Can't wait to see you at camp!" }
|
||||
p {
|
||||
class { "" }
|
||||
"If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option."
|
||||
}
|
||||
}
|
||||
};
|
||||
HttpResponse::Ok().body(html.to_string())
|
||||
}
|
||||
_ => {
|
||||
log::error!("Got registration error.....");
|
||||
let html = markup::new! {
|
||||
div {
|
||||
class { "mt-8" }
|
||||
h2 {
|
||||
@format!("Thank you, {}!", full_name)
|
||||
}
|
||||
p { "Can't wait to see you at camp!" }
|
||||
p {
|
||||
class { "" }
|
||||
"If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option."
|
||||
}
|
||||
}
|
||||
};
|
||||
HttpResponse::Ok().body(html.to_string())
|
||||
}
|
||||
}
|
||||
HttpResponse::Ok().body("thankyou")
|
||||
}
|
||||
|
|
|
@ -10,25 +10,25 @@ use lettre::{
|
|||
|
||||
#[derive(Debug, MultipartForm, Default)]
|
||||
struct HealthForm {
|
||||
#[multipart(rename = "firstname")]
|
||||
#[multipart(rename = "first-name")]
|
||||
first_name: Option<Text<String>>,
|
||||
#[multipart(rename = "lastname")]
|
||||
#[multipart(rename = "last-name")]
|
||||
last_name: Option<Text<String>>,
|
||||
#[multipart(rename = "parentfirstname")]
|
||||
#[multipart(rename = "parent-first-name")]
|
||||
parent_first_name: Option<Text<String>>,
|
||||
#[multipart(rename = "parentlastname")]
|
||||
#[multipart(rename = "parent-last-name")]
|
||||
parent_last_name: Option<Text<String>>,
|
||||
birthdate: Option<Text<String>>,
|
||||
street: Option<Text<String>>,
|
||||
city: Option<Text<String>>,
|
||||
state: Option<Text<String>>,
|
||||
zip: Option<Text<String>>,
|
||||
#[multipart(rename = "cellphone")]
|
||||
#[multipart(rename = "cell-phone")]
|
||||
parent_cellphone: Option<Text<String>>,
|
||||
homephone: Option<Text<String>>,
|
||||
#[multipart(rename = "add-emergency-contact")]
|
||||
#[multipart(rename = "additional-emergency-contact")]
|
||||
contact: Option<Text<String>>,
|
||||
#[multipart(rename = "add-emergency-contact-phone")]
|
||||
#[multipart(rename = "addtional-emergency-contact-phone")]
|
||||
contact_phone: Option<Text<String>>,
|
||||
doctorname: Option<Text<String>>,
|
||||
doctorcity: Option<Text<String>>,
|
||||
|
@ -58,6 +58,7 @@ struct HealthForm {
|
|||
agreement: Option<Text<String>>,
|
||||
#[multipart(rename = "image")]
|
||||
file: Option<TempFile>,
|
||||
registration: Option<Text<String>>,
|
||||
}
|
||||
|
||||
#[post("/health-form")]
|
||||
|
@ -78,6 +79,15 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
})
|
||||
.0
|
||||
.clone();
|
||||
let full_name = format!("{} {}", first, last);
|
||||
let registration = form
|
||||
.registration
|
||||
.as_ref()
|
||||
.unwrap_or(&Text {
|
||||
0: String::from(""),
|
||||
})
|
||||
.0
|
||||
.clone();
|
||||
let email_subject = format!("{} {} filled out a health form!", first, last);
|
||||
let filename_noext = String::from(format!("{}_{}", first, last));
|
||||
let parent = format!(
|
||||
|
@ -475,7 +485,7 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
.unwrap(),
|
||||
)
|
||||
.to("Chris Cochrun <chris@tfcconnection.org>".parse().unwrap())
|
||||
.to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
||||
// .to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
||||
.subject(email_subject)
|
||||
.multipart(multi)
|
||||
{
|
||||
|
@ -496,5 +506,65 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
log::info!("Email incorrect");
|
||||
}
|
||||
|
||||
HttpResponse::Ok().body("hi")
|
||||
match registration.as_str() {
|
||||
"now" => {
|
||||
log::info!("Sending them to pay for registration now");
|
||||
HttpResponse::Ok()
|
||||
.insert_header(("Access-Control-Expose-Headers", "*"))
|
||||
.insert_header((
|
||||
"HX-Redirect",
|
||||
"https://secure.myvanco.com/L-Z772/campaign/C-13JPJ",
|
||||
))
|
||||
.finish()
|
||||
}
|
||||
"full" => {
|
||||
log::info!("Sending them to pay for the full registration now");
|
||||
HttpResponse::Ok()
|
||||
.insert_header(("Access-Control-Expose-Headers", "*"))
|
||||
.insert_header((
|
||||
"HX-Redirect",
|
||||
"https://secure.myvanco.com/L-Z772/campaign/C-13JQE",
|
||||
))
|
||||
.finish()
|
||||
}
|
||||
"later" => {
|
||||
log::info!("{} would like to pay later", full_name);
|
||||
let html = markup::new! {
|
||||
div {
|
||||
class { "mt-8" }
|
||||
h2 {
|
||||
@format!("Thank you, {}!", full_name)
|
||||
}
|
||||
p { "Can't wait to see you at camp!" }
|
||||
p {
|
||||
class { "" }
|
||||
"If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option."
|
||||
}
|
||||
}
|
||||
};
|
||||
HttpResponse::Ok().body(html.to_string())
|
||||
}
|
||||
_ => {
|
||||
log::error!("Got registration error.....");
|
||||
let html = markup::new! {
|
||||
div {
|
||||
class { "mt-8" }
|
||||
h2 {
|
||||
@format!("Thank you, {}!", full_name)
|
||||
}
|
||||
p { "Can't wait to see you at camp!" }
|
||||
p {
|
||||
class { "" }
|
||||
"If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option."
|
||||
}
|
||||
}
|
||||
};
|
||||
HttpResponse::Ok().body(html.to_string())
|
||||
}
|
||||
}
|
||||
// HttpResponse::Ok().body("hi")
|
||||
}
|
||||
|
||||
async fn post_health_form(form: HealthForm) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue