Anzeigen der Schülernamen

This commit is contained in:
Franz Dietrich 2023-02-21 09:05:29 +01:00
parent daec6f092a
commit 6b7415f0dd
Signed by: dietrich
GPG Key ID: F0CE5A20AB5C4B27
6 changed files with 10 additions and 8 deletions

View File

@ -139,7 +139,7 @@ pub async fn get_all_teachers(db: &Pool) -> Result<Vec<TeacherWithAppointments>,
let nutzer = query_as!(
Nutzer,
r#"
SELECT name, schueler as schüler,email
SELECT name, schueler as schueler,email
FROM `nutzer` WHERE id = ? "#,
appointment.nutzer_id
)

View File

@ -37,7 +37,7 @@ pub async fn save_nutzer(pool: &Pool, nutzer: &Nutzer) -> Result<IdType, sqlx::E
query!(
"INSERT INTO nutzer (name, schueler, email) VALUES ($1, $2, $3)",
nutzer.name,
nutzer.schüler,
nutzer.schueler,
nutzer.email
)
.execute(pool)

View File

@ -1,6 +1,7 @@
use actix_web::{error, web, HttpResponse};
use handlebars::Handlebars;
use lettre::{AsyncSmtpTransport, Tokio1Executor};
use log::info;
use serde_json::json;
use terminwahl_typen::IdType;
@ -71,6 +72,7 @@ pub async fn export_appointments(
"css_file" : css.path,
"teachers": teachers,
});
info!("{:?}", data);
Ok(HttpResponse::Ok()
.body(handlebars.render("lehrer_einzeln.html", &data).unwrap()))
}

View File

@ -58,7 +58,7 @@
{{time_of appointment.slot.end_time}}
</th>
<td>
{{appointment.nutzer.name}}
{{appointment.nutzer.name}} <br /><small>⇨ {{appointment.nutzer.schueler}}</small>
</td>
</tr>
{{/each}}

View File

@ -59,7 +59,7 @@ impl Component for App {
nutzer: None,
tmp_nutzer: Nutzer {
name: "".into(),
schüler: "".into(),
schueler: "".into(),
email: "".into(),
},
successfully_saved: None,
@ -112,7 +112,7 @@ impl Component for App {
true
}
Msg::UpdateSchüler(s) => {
self.tmp_nutzer.schüler = s;
self.tmp_nutzer.schueler = s;
true
}
Msg::UpdateEmail(s) => {
@ -204,7 +204,7 @@ impl App {
<div class="field">
<label class="label">{"Alle betreffenden SchülerInnen"}</label>
<p class="control has-icons-left has-icons-right">
<input class="input" type="email" placeholder="SchülerInnen" value={self.tmp_nutzer.schüler.to_string()}
<input class="input" type="email" placeholder="SchülerInnen" value={self.tmp_nutzer.schueler.to_string()}
oninput={ctx.link().batch_callback(|event:InputEvent| {
event.target_dyn_into::<HtmlInputElement>().map(|input|Msg::UpdateSchüler(input.value()))
})}/>

View File

@ -75,12 +75,12 @@ pub enum RequestState {
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Nutzer {
pub name: String,
pub schüler: String,
pub schueler: String,
pub email: String,
}
impl Nutzer {
pub fn validate(&self) -> bool {
!self.name.is_empty() && !self.email.is_empty() && !self.schüler.is_empty()
!self.name.is_empty() && !self.email.is_empty() && !self.schueler.is_empty()
}
}