Anzeigen der Schülernamen
This commit is contained in:
parent
daec6f092a
commit
6b7415f0dd
@ -139,7 +139,7 @@ pub async fn get_all_teachers(db: &Pool) -> Result<Vec<TeacherWithAppointments>,
|
|||||||
let nutzer = query_as!(
|
let nutzer = query_as!(
|
||||||
Nutzer,
|
Nutzer,
|
||||||
r#"
|
r#"
|
||||||
SELECT name, schueler as schüler,email
|
SELECT name, schueler as schueler,email
|
||||||
FROM `nutzer` WHERE id = ? "#,
|
FROM `nutzer` WHERE id = ? "#,
|
||||||
appointment.nutzer_id
|
appointment.nutzer_id
|
||||||
)
|
)
|
||||||
|
@ -37,7 +37,7 @@ pub async fn save_nutzer(pool: &Pool, nutzer: &Nutzer) -> Result<IdType, sqlx::E
|
|||||||
query!(
|
query!(
|
||||||
"INSERT INTO nutzer (name, schueler, email) VALUES ($1, $2, $3)",
|
"INSERT INTO nutzer (name, schueler, email) VALUES ($1, $2, $3)",
|
||||||
nutzer.name,
|
nutzer.name,
|
||||||
nutzer.schüler,
|
nutzer.schueler,
|
||||||
nutzer.email
|
nutzer.email
|
||||||
)
|
)
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use actix_web::{error, web, HttpResponse};
|
use actix_web::{error, web, HttpResponse};
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use lettre::{AsyncSmtpTransport, Tokio1Executor};
|
use lettre::{AsyncSmtpTransport, Tokio1Executor};
|
||||||
|
use log::info;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use terminwahl_typen::IdType;
|
use terminwahl_typen::IdType;
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ pub async fn export_appointments(
|
|||||||
"css_file" : css.path,
|
"css_file" : css.path,
|
||||||
"teachers": teachers,
|
"teachers": teachers,
|
||||||
});
|
});
|
||||||
|
info!("{:?}", data);
|
||||||
Ok(HttpResponse::Ok()
|
Ok(HttpResponse::Ok()
|
||||||
.body(handlebars.render("lehrer_einzeln.html", &data).unwrap()))
|
.body(handlebars.render("lehrer_einzeln.html", &data).unwrap()))
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
{{time_of appointment.slot.end_time}}
|
{{time_of appointment.slot.end_time}}
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
{{appointment.nutzer.name}}
|
{{appointment.nutzer.name}} <br /><small>⇨ {{appointment.nutzer.schueler}}</small>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -59,7 +59,7 @@ impl Component for App {
|
|||||||
nutzer: None,
|
nutzer: None,
|
||||||
tmp_nutzer: Nutzer {
|
tmp_nutzer: Nutzer {
|
||||||
name: "".into(),
|
name: "".into(),
|
||||||
schüler: "".into(),
|
schueler: "".into(),
|
||||||
email: "".into(),
|
email: "".into(),
|
||||||
},
|
},
|
||||||
successfully_saved: None,
|
successfully_saved: None,
|
||||||
@ -112,7 +112,7 @@ impl Component for App {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
Msg::UpdateSchüler(s) => {
|
Msg::UpdateSchüler(s) => {
|
||||||
self.tmp_nutzer.schüler = s;
|
self.tmp_nutzer.schueler = s;
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Msg::UpdateEmail(s) => {
|
Msg::UpdateEmail(s) => {
|
||||||
@ -204,7 +204,7 @@ impl App {
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">{"Alle betreffenden SchülerInnen"}</label>
|
<label class="label">{"Alle betreffenden SchülerInnen"}</label>
|
||||||
<p class="control has-icons-left has-icons-right">
|
<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| {
|
oninput={ctx.link().batch_callback(|event:InputEvent| {
|
||||||
event.target_dyn_into::<HtmlInputElement>().map(|input|Msg::UpdateSchüler(input.value()))
|
event.target_dyn_into::<HtmlInputElement>().map(|input|Msg::UpdateSchüler(input.value()))
|
||||||
})}/>
|
})}/>
|
||||||
|
@ -75,12 +75,12 @@ pub enum RequestState {
|
|||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
pub struct Nutzer {
|
pub struct Nutzer {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub schüler: String,
|
pub schueler: String,
|
||||||
pub email: String,
|
pub email: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Nutzer {
|
impl Nutzer {
|
||||||
pub fn validate(&self) -> bool {
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user