diff --git a/content/ministries/mission-trip/2024/index.md b/content/ministries/mission-trip/2024/index.md new file mode 100644 index 0000000..a0474ec --- /dev/null +++ b/content/ministries/mission-trip/2024/index.md @@ -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" >}} diff --git a/layouts/shortcodes/health-form.html b/layouts/shortcodes/health-form.html index 87aeebb..cca4ebd 100644 --- a/layouts/shortcodes/health-form.html +++ b/layouts/shortcodes/health-form.html @@ -217,7 +217,7 @@
>, - #[multipart(rename = "lastname")] + #[multipart(rename = "last-name")] last_name: Option>, - #[multipart(rename = "parentfirstname")] + #[multipart(rename = "parent-first-name")] parent_first_name: Option>, - #[multipart(rename = "parentlastname")] + #[multipart(rename = "parent-last-name")] parent_last_name: Option>, birthdate: Option>, gender: Option>, @@ -22,8 +22,10 @@ struct CampForm { city: Option>, state: Option>, zip: Option>, - parentphone: Option>, - parentemail: Option>, + #[multipart(rename = "parent-phone")] + parent_phone: Option>, + #[multipart(rename = "parent-email")] + parent_email: Option>, grade: Option>, shirt: Option>, allergies: Option>, @@ -50,6 +52,7 @@ pub async fn camp_form(MultipartForm(form): MultipartForm) -> 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) -> 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) -> 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) -> 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) -> 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") } diff --git a/src/api/health_form.rs b/src/api/health_form.rs index 9101772..04a715f 100644 --- a/src/api/health_form.rs +++ b/src/api/health_form.rs @@ -10,25 +10,25 @@ use lettre::{ #[derive(Debug, MultipartForm, Default)] struct HealthForm { - #[multipart(rename = "firstname")] + #[multipart(rename = "first-name")] first_name: Option>, - #[multipart(rename = "lastname")] + #[multipart(rename = "last-name")] last_name: Option>, - #[multipart(rename = "parentfirstname")] + #[multipart(rename = "parent-first-name")] parent_first_name: Option>, - #[multipart(rename = "parentlastname")] + #[multipart(rename = "parent-last-name")] parent_last_name: Option>, birthdate: Option>, street: Option>, city: Option>, state: Option>, zip: Option>, - #[multipart(rename = "cellphone")] + #[multipart(rename = "cell-phone")] parent_cellphone: Option>, homephone: Option>, - #[multipart(rename = "add-emergency-contact")] + #[multipart(rename = "additional-emergency-contact")] contact: Option>, - #[multipart(rename = "add-emergency-contact-phone")] + #[multipart(rename = "addtional-emergency-contact-phone")] contact_phone: Option>, doctorname: Option>, doctorcity: Option>, @@ -58,6 +58,7 @@ struct HealthForm { agreement: Option>, #[multipart(rename = "image")] file: Option, + registration: Option>, } #[post("/health-form")] @@ -78,6 +79,15 @@ pub async fn health_form(MultipartForm(form): MultipartForm) -> 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) -> Http .unwrap(), ) .to("Chris Cochrun ".parse().unwrap()) - .to("Ethan Rose ".parse().unwrap()) + // .to("Ethan Rose ".parse().unwrap()) .subject(email_subject) .multipart(multi) { @@ -496,5 +506,65 @@ pub async fn health_form(MultipartForm(form): MultipartForm) -> 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!() }