diff --git a/Client/src/app/components/vbs-page/vbs-page.component.ts b/Client/src/app/components/vbs-page/vbs-page.component.ts
index 4e5b90c..6d8b61d 100644
--- a/Client/src/app/components/vbs-page/vbs-page.component.ts
+++ b/Client/src/app/components/vbs-page/vbs-page.component.ts
@@ -4,6 +4,7 @@ import { MissionarySupportService } from 'src/app/services/missionary-support-se
import { MatDialog, MatDialogConfig } from '@angular/material';
import { OkPopupComponent } from '../popups/ok-popup/ok-popup.component';
import { EmailService } from 'src/app/services/email.service';
+import { ViewportScroller } from '@angular/common';
@Component({
selector: 'app-vbs-page',
@@ -23,7 +24,7 @@ export class VbsPageComponent implements OnInit {
public completeStep: boolean = false;
public submitting: boolean = false;
- constructor(private formBuilder: FormBuilder, private matDialog: MatDialog, private emailService: EmailService, private missionarySupportService: MissionarySupportService) {
+ constructor(private formBuilder: FormBuilder, private matDialog: MatDialog, private emailService: EmailService, private scroller: ViewportScroller) {
//this.setupForm();
this.form = this.formBuilder.group({
firstName: ['', [Validators.required]],
@@ -51,13 +52,14 @@ this.form = this.formBuilder.group({
emergencyFirstName: ['', []],
emergencyLastName: ['', []],
emergencyPhone: ['', []],
+ notes: ['', []],
hp: ['.', [Validators.required]]
});
}
ngOnInit(): void {
-
+ this.scroller.setOffset(() => [0, 60]);
}
hasErrors(formControlName: string): boolean {
@@ -148,6 +150,9 @@ this.form = this.formBuilder.group({
this.parentStep = false;
this.emergencyStep = false;
this.completeStep = false;
+ setTimeout(() => {
+ this.scrollToElement('studentInfo');
+ }, 0);
}
gotoParentStep() {
@@ -155,6 +160,9 @@ this.form = this.formBuilder.group({
this.parentStep = true;
this.emergencyStep = false;
this.completeStep = false;
+ setTimeout(() => {
+ this.scrollToElement('parentInfo');
+ }, 0);
}
gotoEmergencyStep() {
@@ -162,6 +170,9 @@ this.form = this.formBuilder.group({
this.parentStep = false;
this.emergencyStep = true;
this.completeStep = false;
+ setTimeout(() => {
+ this.scrollToElement('emergencyInfo');
+ }, 0);
}
gotoCompleteStep() {
@@ -170,6 +181,9 @@ this.form = this.formBuilder.group({
this.emergencyStep = false;
this.completeStep = true;
this.submitting = false;
+ setTimeout(() => {
+ this.scrollToElement('completeInfo');
+ }, 0);
}
submit() {
@@ -208,6 +222,21 @@ this.form = this.formBuilder.group({
this.form.get('ridesBus').reset();
}
+ scrollToElement(elementId: string) {
+ const headerOffset = 70; // Your fixed header height
+ const element = document.getElementById(elementId);
+
+ if (element) {
+ const elementPosition = element.getBoundingClientRect().top;
+ const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
+
+ window.scrollTo({
+ top: offsetPosition,
+ behavior: 'smooth'
+ });
+ }
+ }
+
public stateList = [
{ code: 'AL', name: 'Alabama' }, { code: 'AK', name: 'Alaska' }, { code: 'AZ', name: 'Arizona' },
{ code: 'AR', name: 'Arkansas' }, { code: 'CA', name: 'California' }, { code: 'CO', name: 'Colorado' },
diff --git a/Server/src/routes/api/vbs.js b/Server/src/routes/api/vbs.js
index dcd195a..7bbdaff 100644
--- a/Server/src/routes/api/vbs.js
+++ b/Server/src/routes/api/vbs.js
@@ -33,12 +33,20 @@ router.post("/", function(req,res){
subject: 'OFB - VBS Registration' + req.body.firstName,
html: generateRegistrationEmailHTML(req.body)
};
+ let mailOptions2 = {
+ from: 'donotreply@ofbbutte.com',
+ to: req.body.parentEmail,
+ subject: 'OFB - Vaction Bible School Registration',
+ html: generateVbsConfirmationEmail(req.body.firstName, req.body.parentFirstName)
+ }
transporter.sendMail(mailOptions,(error, info) =>{
if (error){
console.log(error);
res.status(400).json({"status":400,"message":"There was an error","error":error.response});
} else {
- res.status(200).json({"status":200,"message":"Success"});
+ transporter.sendMail(mailOptions2, (error, into) => {
+ res.status(200).json({"status":200,"message":"Success"});
+ });
}
});
@@ -65,6 +73,15 @@ function generateRegistrationEmailHTML(data) {
return String(val).trim();
};
+ const formatDate = (date) => {
+ if (date === '') return date;
+ return new Intl.DateTimeFormat('en-US', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit'
+ }).format(date);
+ }
+
// Define the layout sections and human-readable labels
const sections = [
{
@@ -72,7 +89,7 @@ function generateRegistrationEmailHTML(data) {
fields: [
{ label: "Student Name", value: `${sanitizeValue(data.firstName)} ${sanitizeValue(data.lastName)}`.trim() },
{ label: "Grade", value: sanitizeValue(data.grade) },
- { label: "Date of Birth", value: sanitizeValue(data.dob) },
+ { label: "Date of Birth", value: formatDate(sanitizeValue(data.dob)) },
{ label: "Has Allergies?", value: sanitizeValue(formatBool(data.hasAllergies)) },
{ label: "Allergies", value: sanitizeValue(data.allergies) },
{ label: "Has Dietary Restrictions?", value: sanitizeValue(formatBool(data.hasDietaryRestrictions)) },
@@ -82,7 +99,7 @@ function generateRegistrationEmailHTML(data) {
]
},
{
- title: "Parent / Guardian Contact",
+ title: "Parent / Guardian Information",
fields: [
{ label: "Parent Name", value: `${sanitizeValue(data.parentFirstName)} ${sanitizeValue(data.parentLastName)}`.trim() },
{ label: "Email", value: sanitizeValue(data.parentEmail) },
@@ -97,7 +114,8 @@ function generateRegistrationEmailHTML(data) {
fields: [
{ label: "Same as Parent?", value: sanitizeValue(formatBool(data.emergencySameAsParent)) },
{ label: "Emergency Name", value: `${sanitizeValue(data.emergencyFirstName)} ${sanitizeValue(data.emergencyLastName)}`.trim() },
- { label: "Emergency Phone", value: sanitizeValue(data.emergencyPhone) }
+ { label: "Emergency Phone", value: sanitizeValue(data.emergencyPhone) },
+ { label: "Notes", value: sanitizeValue(data.notes) }
]
}
];
@@ -133,7 +151,7 @@ function generateRegistrationEmailHTML(data) {
-
New Registration Submission
+
Vacation Bible School Registration
@@ -143,9 +161,9 @@ function generateRegistrationEmailHTML(data) {
- |
+ |
- New Registration Submitted
+ Vacation Bible School Registration
|
@@ -154,7 +172,7 @@ function generateRegistrationEmailHTML(data) {
|
- A new form submission has been received.
+
${htmlContent}
@@ -165,7 +183,7 @@ function generateRegistrationEmailHTML(data) {
|
|
- This email was automatically generated and sent from the registration system.
+ Old Fashion Baptist Church Vacation Bible School Registration
|
@@ -178,4 +196,129 @@ function generateRegistrationEmailHTML(data) {
`;
}
+function generateVbsConfirmationEmail(studentName, parentName) {
+ return `
+
+
+
+
+
+
+
+
+
+
+
+
${parentName},
+
+
+ ${studentName}
+ has been registered for our
+ Vacation Bible School!
+
+
+
We look forward to having your child join us for Bible lessons, games, snacks, and prizes!
+
+
Vacation Bible School Information
+
+
+
+ | Ages |
+ 4 - 12 years old |
+
+
+ | Dates |
+ August 10 - 13 |
+
+
+ | Time |
+ 6:30 PM - 8:00 PM |
+
+
+ | Location |
+
+ Old Fashion Baptist Church
+ 5003 Wynne Ave
+ Butte, MT
+ |
+
+
+ | Contact |
+ (406) 494-5028 |
+
+
+
+
+ If you have any questions, please don't hesitate to contact us.
+
+
+
We look forward to seeing you!
+
+
+ Old Fashion Baptist Church
+
+
+
+
+
+
+
+`;
+}
+
module.exports = router;
\ No newline at end of file