feat: link student pages to database
This commit is contained in:
1 parent
fdc5374f17
commit
838a412376
4 files changed
+39
-39
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
|
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
|
||||||
|
use crate::pages::student::form_setup::use_student_form;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn StudentDemographicsPage() -> impl IntoView {
|
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.
|
// 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
|
// 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.
|
// 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! {
|
view! {
|
||||||
<div class="flex flex-1" />
|
<div class="flex flex-1" />
|
||||||
<div class="flex flex-col flex-2 mt-6">
|
<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.
|
// Inputs here.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="First Name:"
|
label="First Name:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="first_name"
|
data_member="first_name"
|
||||||
placeholder="John"
|
placeholder="John"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -26,7 +26,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Last Name:"
|
label="Last Name:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="last_name"
|
data_member="last_name"
|
||||||
placeholder="Smith"
|
placeholder="Smith"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -35,7 +35,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
|
|||||||
// There must be a date of birth selection field here.
|
// There must be a date of birth selection field here.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Student ID Number:"
|
label="Student ID Number:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="id_number"
|
data_member="id_number"
|
||||||
placeholder="Your 7 digit number..."
|
placeholder="Your 7 digit number..."
|
||||||
input_type=TextFieldType::Number
|
input_type=TextFieldType::Number
|
||||||
@@ -43,7 +43,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Preferred Email:"
|
label="Preferred Email:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="email"
|
data_member="email"
|
||||||
placeholder="me@example.com"
|
placeholder="me@example.com"
|
||||||
input_type=TextFieldType::Email(vec!["*".to_string()])
|
input_type=TextFieldType::Email(vec!["*".to_string()])
|
||||||
@@ -51,7 +51,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Preferred Phone Number:"
|
label="Preferred Phone Number:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="phone_number"
|
data_member="phone_number"
|
||||||
placeholder="000-000-0000"
|
placeholder="000-000-0000"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -59,7 +59,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Street Address:"
|
label="Street Address:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="street_address"
|
data_member="street_address"
|
||||||
placeholder="234 Judd Rd"
|
placeholder="234 Judd Rd"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -68,7 +68,7 @@ pub fn StudentDemographicsPage() -> impl IntoView {
|
|||||||
<Select
|
<Select
|
||||||
label="Town:"
|
label="Town:"
|
||||||
value_list=vec!["Southbury".to_string(), "Middlebury".to_string()]
|
value_list=vec!["Southbury".to_string(), "Middlebury".to_string()]
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="town"
|
data_member="town"
|
||||||
required=true
|
required=true
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
use std::collections::HashMap;
|
use leptos::prelude::*;
|
||||||
use leptos::prelude::*;
|
|
||||||
use crate::components::{MultiEntry, OutlinedTextField, TextFieldType, ValidatedForm};
|
use crate::components::{MultiEntry, OutlinedTextField, TextFieldType, ValidatedForm};
|
||||||
use crate::input;
|
use crate::input;
|
||||||
|
use crate::pages::student::form_setup::use_student_form;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn StudentExtracurricularsPage() -> impl IntoView {
|
pub fn StudentExtracurricularsPage() -> impl IntoView {
|
||||||
let data_map = RwSignal::new(HashMap::new());
|
let controller = use_student_form("demographics");
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="flex flex-1" />
|
<div class="flex flex-1" />
|
||||||
<div class="flex flex-col flex-2 mt-6">
|
<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.
|
// Inputs here.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Total number of service hours:"
|
label="Total number of service hours:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="service_hours"
|
data_member="service_hours"
|
||||||
placeholder="Any number..."
|
placeholder="Any number..."
|
||||||
input_type=TextFieldType::Number
|
input_type=TextFieldType::Number
|
||||||
@@ -23,7 +23,7 @@ pub fn StudentExtracurricularsPage() -> impl IntoView {
|
|||||||
<MultiEntry
|
<MultiEntry
|
||||||
label="Extracurricular Activities:"
|
label="Extracurricular Activities:"
|
||||||
description="Leave blank if not applicable."
|
description="Leave blank if not applicable."
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="extracurricular"
|
data_member="extracurricular"
|
||||||
schema=vec![
|
schema=vec![
|
||||||
input!(Text, "activity_name", "Activity Name:", true, "Some activity..."),
|
input!(Text, "activity_name", "Activity Name:", true, "Some activity..."),
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use crate::components::{OutlinedTextField, TextFieldType, ValidatedForm};
|
use crate::components::{OutlinedTextField, TextFieldType, ValidatedForm};
|
||||||
|
use crate::pages::student::form_setup::use_student_form;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn StudentFamilyPage() -> impl IntoView {
|
pub fn StudentFamilyPage() -> impl IntoView {
|
||||||
let data_map = RwSignal::new(HashMap::new());
|
let controller = use_student_form("family");
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="flex flex-1" />
|
<div class="flex flex-1" />
|
||||||
<div class="flex flex-col flex-2 mt-6">
|
<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.
|
// Inputs here.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Total number of children in family:"
|
label="Total number of children in family:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="num_children"
|
data_member="num_children"
|
||||||
placeholder="Any number..."
|
placeholder="Any number..."
|
||||||
input_type=TextFieldType::Number
|
input_type=TextFieldType::Number
|
||||||
@@ -21,7 +21,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Total number of children currently attending college:"
|
label="Total number of children currently attending college:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="num_children_college"
|
data_member="num_children_college"
|
||||||
placeholder="Any number..."
|
placeholder="Any number..."
|
||||||
input_type=TextFieldType::Number
|
input_type=TextFieldType::Number
|
||||||
@@ -29,7 +29,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 1 Name:"
|
label="Parent/Guardian 1 Name:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_name"
|
data_member="parent_one_name"
|
||||||
placeholder="John Smith"
|
placeholder="John Smith"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -38,7 +38,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
// TODO Could this be a select dropdown?
|
// TODO Could this be a select dropdown?
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 1 Relationship:"
|
label="Parent/Guardian 1 Relationship:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_relationship"
|
data_member="parent_one_relationship"
|
||||||
placeholder="Mother/Father"
|
placeholder="Mother/Father"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -47,7 +47,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
// TODO Get a better example
|
// TODO Get a better example
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 1 Occupation:"
|
label="Parent/Guardian 1 Occupation:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_occupation"
|
data_member="parent_one_occupation"
|
||||||
placeholder="Milkman"
|
placeholder="Milkman"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -55,7 +55,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 1 Employer:"
|
label="Parent/Guardian 1 Employer:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_employer"
|
data_member="parent_one_employer"
|
||||||
placeholder="Example Employer"
|
placeholder="Example Employer"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -64,7 +64,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
|
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 2 Name:"
|
label="Parent/Guardian 2 Name:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_name"
|
data_member="parent_one_name"
|
||||||
placeholder="John Smith"
|
placeholder="John Smith"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -73,7 +73,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
// TODO Could this be a select dropdown?
|
// TODO Could this be a select dropdown?
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 2 Relationship:"
|
label="Parent/Guardian 2 Relationship:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_relationship"
|
data_member="parent_one_relationship"
|
||||||
placeholder="Mother/Father"
|
placeholder="Mother/Father"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -82,7 +82,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
// TODO Get a better example
|
// TODO Get a better example
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 2 Occupation:"
|
label="Parent/Guardian 2 Occupation:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_occupation"
|
data_member="parent_one_occupation"
|
||||||
placeholder="Milkman"
|
placeholder="Milkman"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -90,7 +90,7 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Parent/Guardian 2 Employer:"
|
label="Parent/Guardian 2 Employer:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="parent_one_employer"
|
data_member="parent_one_employer"
|
||||||
placeholder="Example Employer"
|
placeholder="Example Employer"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use std::collections::HashMap;
|
|
||||||
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
|
use crate::components::{OutlinedTextField, Select, TextFieldType, ValidatedForm};
|
||||||
|
use crate::pages::student::form_setup::use_student_form;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn StudentUniversityPage() -> impl IntoView {
|
pub fn StudentUniversityPage() -> impl IntoView {
|
||||||
let data_map = RwSignal::new(HashMap::new());
|
let controller = use_student_form("university");
|
||||||
|
|
||||||
// college name, state, city, zip
|
// college name, state, city, zip
|
||||||
// major, study field, intended career, college_acceptance
|
// major, study field, intended career, college_acceptance
|
||||||
@@ -12,11 +12,11 @@ pub fn StudentUniversityPage() -> impl IntoView {
|
|||||||
view! {
|
view! {
|
||||||
<div class="flex flex-1" />
|
<div class="flex flex-1" />
|
||||||
<div class="flex flex-col flex-2 mt-6">
|
<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.
|
// Inputs here.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="University Name:"
|
label="University Name:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="college_name"
|
data_member="college_name"
|
||||||
placeholder="University of Example"
|
placeholder="University of Example"
|
||||||
input_type=TextFieldType::Number
|
input_type=TextFieldType::Number
|
||||||
@@ -24,7 +24,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="University Street Address:"
|
label="University Street Address:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="college_city"
|
data_member="college_city"
|
||||||
placeholder="123 Example Rd"
|
placeholder="123 Example Rd"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -33,7 +33,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
|
|||||||
// TODO Make this a select dropdown.
|
// TODO Make this a select dropdown.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="University State:"
|
label="University State:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="college_state"
|
data_member="college_state"
|
||||||
placeholder="The State of Panic"
|
placeholder="The State of Panic"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
@@ -41,7 +41,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="University ZIP:"
|
label="University ZIP:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="college_zip"
|
data_member="college_zip"
|
||||||
placeholder="12345"
|
placeholder="12345"
|
||||||
input_type=TextFieldType::Number
|
input_type=TextFieldType::Number
|
||||||
@@ -49,7 +49,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
|
|||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
label="Have you been sent an acceptance to the university?"
|
label="Have you been sent an acceptance to the university?"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="college_acceptance"
|
data_member="college_acceptance"
|
||||||
required=true
|
required=true
|
||||||
value_list=vec![
|
value_list=vec![
|
||||||
@@ -60,7 +60,7 @@ pub fn StudentUniversityPage() -> impl IntoView {
|
|||||||
// TODO Make this a select dropdown.
|
// TODO Make this a select dropdown.
|
||||||
<OutlinedTextField
|
<OutlinedTextField
|
||||||
label="Chosen Major:"
|
label="Chosen Major:"
|
||||||
data_map=data_map
|
data_map=controller.data_map
|
||||||
data_member="major"
|
data_member="major"
|
||||||
placeholder="Computer Science"
|
placeholder="Computer Science"
|
||||||
input_type=TextFieldType::Text
|
input_type=TextFieldType::Text
|
||||||
|
|||||||
Reference in new issue
Block a user