Compare commits

...
7 Commits
5 changed files with 54 additions and 34 deletions

No files matched your search

+18 -27
View File
@@ -1,11 +1,11 @@
use crate::components::ToastList;
use crate::components::login::ProviderLoginContext;
use crate::pages::student;
use crate::pages::{
AdminHomePage, AdminProviderPage, AdminScholarshipPage, AdminShell, AdminUtilsPage,
ApplicantsPageFallback, AuthCallbackPage, LoanerBorrowForm, LoanerFallback, LoanerReturnForm,
LoanerShell, ProviderContactPage, ProviderPortal, ScholarshipInfoPage,
LoanerShell, ProviderContactPage, ProviderPortal,
};
use crate::pages::{FormClosedPage, student};
use leptos::prelude::*;
use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context};
use leptos_oidc::AuthSignal;
@@ -89,11 +89,11 @@ fn ProviderRoutes() -> impl MatchNestedRoutes + Clone {
<Route path=path!("/applicants") view=ApplicantsPageFallback />
<Route path=path!("/callback") view=AuthCallbackPage />
<Route path=path!("/profile") view=ProviderContactPage />
// <Route path=path!("/scholarships") view=FormClosedPage />
<ParentRoute path=path!("/scholarships") view=ScholarshipInfoPage>
<Route path=path!(":id") view=ScholarshipInfoPage />
<Route path=path!("") view=ScholarshipInfoPage />
</ParentRoute>
<Route path=path!("/scholarships") view=FormClosedPage />
// <ParentRoute path=path!("/scholarships") view=ScholarshipInfoPage>
// <Route path=path!(":id") view=ScholarshipInfoPage />
// <Route path=path!("") view=ScholarshipInfoPage />
// </ParentRoute>
</ParentRoute>
}
.into_inner()
@@ -134,26 +134,17 @@ fn StudentRoutes() -> impl MatchNestedRoutes + Clone {
<ParentRoute path=path!("students") view=student::StudentShell>
<Route path=path!("callback") view=AuthCallbackPage />
<Route path=path!("home") view=student::StudentHomePage />
<Route path=path!("demographics") view=student::StudentDemographicsPage />
<Route path=path!("eligibility") view=student::StudentEligibilityPage />
<Route path=path!("additional") view=student::AdditionalPage />
<Route path=path!("additional/academics") view=student::StudentAcademicsPage />
<Route path=path!("additional/athletics") view=student::StudentAthleticsPage />
<Route
path=path!("additional/extracurriculars")
view=student::StudentExtracurricularsPage
/>
<Route
path=path!("additional/work-experience")
view=student::StudentWorkExperiencePage
/>
<Route path=path!("additional/university") view=student::StudentUniversityPage />
<Route path=path!("additional/family-info") view=student::StudentFamilyPage />
<Route path=path!("additional/financials") view=student::StudentFinancialPage />
<Route
path=path!("additional/specifics")
view=student::StudentSpecificRequirementsPage
/>
<Route path=path!("demographics") view=student::ClosedForm />
<Route path=path!("eligibility") view=student::ClosedForm />
<Route path=path!("additional") view=student::ClosedForm />
<Route path=path!("additional/academics") view=student::ClosedForm />
<Route path=path!("additional/athletics") view=student::ClosedForm />
<Route path=path!("additional/extracurriculars") view=student::ClosedForm />
<Route path=path!("additional/work-experience") view=student::ClosedForm />
<Route path=path!("additional/university") view=student::ClosedForm />
<Route path=path!("additional/family-info") view=student::ClosedForm />
<Route path=path!("additional/financials") view=student::ClosedForm />
<Route path=path!("additional/specifics") view=student::ClosedForm />
</ParentRoute>
}
.into_inner()
+16 -4
View File
@@ -1,6 +1,6 @@
use crate::pages::api::files::{DeleteFile, upload_file};
use leptos::html::{Input, Label};
use leptos::logging::debug_log;
use leptos::logging::{debug_error, debug_log};
use leptos::prelude::*;
use leptos::web_sys::{File, FormData};
use leptos_icons::Icon;
@@ -28,6 +28,7 @@ pub fn FileDrop(
let file_name_list = RwSignal::new(Vec::new());
let hovering = RwSignal::new(false);
let error_msg = RwSignal::new(String::new());
let name = StoredValue::new(name);
let form_id = StoredValue::new(form_id);
let auth = expect_context::<AuthSignal>();
@@ -172,10 +173,18 @@ pub fn FileDrop(
existing_files
.get()
.map(|result| {
if let Ok(files) = result {
file_name_list.set(files);
match result {
Ok(files) => {
error_msg.set("".to_string());
file_name_list.set(files);
}
Err(err) => {
let msg = err.to_string();
debug_error!("Error while getting files: {}", msg);
error_msg.set(msg);
}
}
})
});
}}
<label
node_ref=zone_ref
@@ -194,6 +203,9 @@ pub fn FileDrop(
<div class="text-sm text-gray-400">"Or click to select a file"</div>
<input node_ref=input_ref type="file" class="hidden" on:change=on_input_change />
</label>
<Show when=move || !error_msg.get().is_empty()>
<div class="flex-1">{error_msg}</div>
</Show>
<For
each=move || file_name_list.get()
key=|file| file.clone()
+13
View File
@@ -0,0 +1,13 @@
use leptos::prelude::*;
#[component]
pub fn ClosedForm() -> impl IntoView {
view! {
<div class="flex flex-col items-center mx-auto mt-10">
<h1 class="text-2xl font-bold">"Form Closed"</h1>
<p class="text-lg">
"This form is now closed. If you believe this is an error, please contact the guidance office."
</p>
</div>
}
}
+3 -1
View File
@@ -146,7 +146,9 @@ pub fn StudentEligibilityPage() -> impl IntoView {
),
async move |(access_token, form_id, scholarship_id)| {
let Some(access_token) = access_token else {
return Ok(Vec::new());
return Err(
ServerFnError::new("Couldn't find access token"),
);
};
list_files(access_token, form_id, scholarship_id).await
},
+4 -2
View File
@@ -1,6 +1,7 @@
mod academics_page;
mod additional_page;
mod athletics_page;
mod closed_form;
mod demographics_page;
mod eligibility_page;
mod extracurriculars_page;
@@ -9,14 +10,15 @@ mod financial_page;
mod form_setup;
mod home_page;
mod shell;
mod specific_requirements_page;
mod test_display;
mod university_page;
mod work_experience_page;
mod specific_requirements_page;
pub use academics_page::*;
pub use additional_page::*;
pub use athletics_page::*;
pub use closed_form::*;
pub use demographics_page::*;
pub use eligibility_page::*;
pub use extracurriculars_page::*;
@@ -24,7 +26,7 @@ pub use family_info_page::*;
pub use financial_page::*;
pub use home_page::*;
pub use shell::*;
pub use specific_requirements_page::*;
pub use test_display::*;
pub use university_page::*;
pub use work_experience_page::*;
pub use specific_requirements_page::*;