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
/>