progress @fees, next step, deply+enter families/student/pupil/...
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
2024-01-19 00:39:15 +01:00
parent ff795ce66c
commit 267becfbce
6 changed files with 245 additions and 33 deletions

View File

@ -3,9 +3,9 @@ use std::collections::HashMap;
use crate::model::{
family::Family,
role::Role,
user::{AdminUser, User, UserWithRoles},
user::{AdminUser, Fee, User, UserWithRoles, VorstandUser},
};
use futures::future::join_all;
use futures::future::{self, join_all};
use rocket::{
form::Form,
get, post,
@ -51,40 +51,27 @@ async fn index(
#[get("/user/fees")]
async fn fees(
db: &State<SqlitePool>,
admin: AdminUser,
admin: VorstandUser,
flash: Option<FlashMessage<'_>>,
) -> Template {
// Checks
// Fördernd -> Donau Linz
// Fördernd -> keine Family
// Unterstützend -> Donau Linz
// Unterstützend -> keine Family
// Schüler -> Donau Linz
// Student -> Donau Linz
// Fördernd + boat: 85€
// Unterstützend + boat: 25€
// select id, size_of_family, count_rennsport, amount_boats from family
// 2-Family: 220€
// 3+-Family: 350€
// select student+schüler, amount_boats, rennsportbeitrag where !family
// Student, Schüler: 80€
// select donaulinz, amount_boats, rennsportbeitrag where !family !student ! schüler
// Normal: 220€
// Rennsportbeitrag: 110€
// Bootsplatz: 45€
let mut context = Context::new();
let users = User::all(db).await;
let mut fees = Vec::new();
for user in users {
if let Some(fee) = user.fee(db).await {
fees.push(fee);
}
}
context.insert("fees", &fees);
if let Some(msg) = flash {
context.insert("flash", &msg.into_inner());
}
context.insert(
"loggedin_user",
&UserWithRoles::from_user(admin.user, db).await,
&UserWithRoles::from_user(admin.into(), db).await,
);
Template::render("admin/user/fees", context.into_json())