feat: link student pages to database

This commit is contained in:
alphafetus committed 2026-02-05 12:15:46 -05:00
1 parent fdc5374f17
commit 838a412376
4 files changed
+39 -39

No files matched your search

+11 -11
View File
@@ -1,6 +1,6 @@
use std::collections::HashMap;
use leptos::prelude::*;
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
use crate::pages::student::form_setup::use_student_form;
#[component]
pub fn StudentDemographicsPage() -> impl IntoView {
@@ -8,17 +8,17 @@ pub fn StudentDemographicsPage() -> impl IntoView {
// It's a simple form, really nothing more than a contact form.
// I'm going to test out creating this form without using a panel - we'll just use the page as
// it is with a specially spaced invisible div instead of a shaded container.
let data_map = RwSignal::new(HashMap::new());
let controller = use_student_form("demographics");
view! {
<div class="flex flex-1" />
<div class="flex flex-col flex-2 mt-6">
<ValidatedForm title="Student Demographic Form" on_submit=move || {}>
<ValidatedForm title="Student Demographic Form" on_submit=controller.submit_action>
// Inputs here.
<OutlinedTextField
label="First Name:"
data_map=data_map
data_map=controller.data_map
data_member="first_name"
placeholder="John"
input_type=TextFieldType::Text
@@ -26,7 +26,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
/>
<OutlinedTextField
label="Last Name:"
data_map=data_map
data_map=controller.data_map
data_member="last_name"
placeholder="Smith"
input_type=TextFieldType::Text
@@ -35,7 +35,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
// There must be a date of birth selection field here.
<OutlinedTextField
label="Student ID Number:"
data_map=data_map
data_map=controller.data_map
data_member="id_number"
placeholder="Your 7 digit number..."
input_type=TextFieldType::Number
@@ -43,7 +43,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
/>
<OutlinedTextField
label="Preferred Email:"
data_map=data_map
data_map=controller.data_map
data_member="email"
placeholder="me@example.com"
input_type=TextFieldType::Email(vec!["*".to_string()])
@@ -51,7 +51,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
/>
<OutlinedTextField
label="Preferred Phone Number:"
data_map=data_map
data_map=controller.data_map
data_member="phone_number"
placeholder="000-000-0000"
input_type=TextFieldType::Text
@@ -59,7 +59,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
/>
<OutlinedTextField
label="Street Address:"
data_map=data_map
data_map=controller.data_map
data_member="street_address"
placeholder="234 Judd Rd"
input_type=TextFieldType::Text
@@ -68,7 +68,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
<Select
label="Town:"
value_list=vec!["Southbury".to_string(), "Middlebury".to_string()]
data_map=data_map
data_map=controller.data_map
data_member="town"
required=true
/>
+6 -6
View File
@@ -1,20 +1,20 @@
use std::collections::HashMap;
use leptos::prelude::*;
use leptos::prelude::*;
use crate::components::{MultiEntry, OutlinedTextField, TextFieldType, ValidatedForm};
use crate::input;
use crate::pages::student::form_setup::use_student_form;
#[component]
pub fn StudentExtracurricularsPage() -> impl IntoView {
let data_map = RwSignal::new(HashMap::new());
let controller = use_student_form("demographics");
view! {
<div class="flex flex-1" />
<div class="flex flex-col flex-2 mt-6">
<ValidatedForm title="Extracurricular Information" on_submit=move || {}>
<ValidatedForm title="Extracurricular Information" on_submit=controller.submit_action>
// Inputs here.
<OutlinedTextField
label="Total number of service hours:"
data_map=data_map
data_map=controller.data_map
data_member="service_hours"
placeholder="Any number..."
input_type=TextFieldType::Number
@@ -23,7 +23,7 @@ pub fn StudentExtracurricularsPage() -> impl IntoView {
<MultiEntry
label="Extracurricular Activities:"
description="Leave blank if not applicable."
data_map=data_map
data_map=controller.data_map
data_member="extracurricular"
schema=vec![
input!(Text, "activity_name", "Activity Name:", true, "Some activity..."),
+13 -13
View File
@@ -1,19 +1,19 @@
use std::collections::HashMap;
use leptos::prelude::*;
use crate::components::{OutlinedTextField, TextFieldType, ValidatedForm};
use crate::pages::student::form_setup::use_student_form;
#[component]
pub fn StudentFamilyPage() -> impl IntoView {
let data_map = RwSignal::new(HashMap::new());
let controller = use_student_form("family");
view! {
<div class="flex flex-1" />
<div class="flex flex-col flex-2 mt-6">
<ValidatedForm title="Family Information" on_submit=move || {}>
<ValidatedForm title="Family Information" on_submit=controller.submit_action>
// Inputs here.
<OutlinedTextField
label="Total number of children in family:"
data_map=data_map
data_map=controller.data_map
data_member="num_children"
placeholder="Any number..."
input_type=TextFieldType::Number
@@ -21,7 +21,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
/>
<OutlinedTextField
label="Total number of children currently attending college:"
data_map=data_map
data_map=controller.data_map
data_member="num_children_college"
placeholder="Any number..."
input_type=TextFieldType::Number
@@ -29,7 +29,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
/>
<OutlinedTextField
label="Parent/Guardian 1 Name:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_name"
placeholder="John Smith"
input_type=TextFieldType::Text
@@ -38,7 +38,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
// TODO Could this be a select dropdown?
<OutlinedTextField
label="Parent/Guardian 1 Relationship:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_relationship"
placeholder="Mother/Father"
input_type=TextFieldType::Text
@@ -47,7 +47,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
// TODO Get a better example
<OutlinedTextField
label="Parent/Guardian 1 Occupation:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_occupation"
placeholder="Milkman"
input_type=TextFieldType::Text
@@ -55,7 +55,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
/>
<OutlinedTextField
label="Parent/Guardian 1 Employer:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_employer"
placeholder="Example Employer"
input_type=TextFieldType::Text
@@ -64,7 +64,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
<OutlinedTextField
label="Parent/Guardian 2 Name:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_name"
placeholder="John Smith"
input_type=TextFieldType::Text
@@ -73,7 +73,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
// TODO Could this be a select dropdown?
<OutlinedTextField
label="Parent/Guardian 2 Relationship:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_relationship"
placeholder="Mother/Father"
input_type=TextFieldType::Text
@@ -82,7 +82,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
// TODO Get a better example
<OutlinedTextField
label="Parent/Guardian 2 Occupation:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_occupation"
placeholder="Milkman"
input_type=TextFieldType::Text
@@ -90,7 +90,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
/>
<OutlinedTextField
label="Parent/Guardian 2 Employer:"
data_map=data_map
data_map=controller.data_map
data_member="parent_one_employer"
placeholder="Example Employer"
input_type=TextFieldType::Text
+9 -9
View File
@@ -1,10 +1,10 @@
use leptos::prelude::*;
use std::collections::HashMap;
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
use crate::pages::student::form_setup::use_student_form;
#[component]
pub fn StudentUniversityPage() -> impl IntoView {
let data_map = RwSignal::new(HashMap::new());
let controller = use_student_form("university");
// college name, state, city, zip
// major, study field, intended career, college_acceptance
@@ -12,11 +12,11 @@ pub fn StudentUniversityPage() -> impl IntoView {
view! {
<div class="flex flex-1" />
<div class="flex flex-col flex-2 mt-6">
<ValidatedForm title="University Information" on_submit=move || {}>
<ValidatedForm title="University Information" on_submit=controller.submit_action>
// Inputs here.
<OutlinedTextField
label="University Name:"
data_map=data_map
data_map=controller.data_map
data_member="college_name"
placeholder="University of Example"
input_type=TextFieldType::Number
@@ -24,7 +24,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
/>
<OutlinedTextField
label="University Street Address:"
data_map=data_map
data_map=controller.data_map
data_member="college_city"
placeholder="123 Example Rd"
input_type=TextFieldType::Text
@@ -33,7 +33,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
// TODO Make this a select dropdown.
<OutlinedTextField
label="University State:"
data_map=data_map
data_map=controller.data_map
data_member="college_state"
placeholder="The State of Panic"
input_type=TextFieldType::Text
@@ -41,7 +41,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
/>
<OutlinedTextField
label="University ZIP:"
data_map=data_map
data_map=controller.data_map
data_member="college_zip"
placeholder="12345"
input_type=TextFieldType::Number
@@ -49,7 +49,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
/>
<Select
label="Have you been sent an acceptance to the university?"
data_map=data_map
data_map=controller.data_map
data_member="college_acceptance"
required=true
value_list=vec![
@@ -60,7 +60,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
// TODO Make this a select dropdown.
<OutlinedTextField
label="Chosen Major:"
data_map=data_map
data_map=controller.data_map
data_member="major"
placeholder="Computer Science"
input_type=TextFieldType::Text