parent
5832b9f0b4
commit
edb06e84b0
BIN
database.sqlite
BIN
database.sqlite
Binary file not shown.
12
src/main.rs
12
src/main.rs
@ -237,6 +237,8 @@ fn post_stunde_form(stunde: Form<StundeForm>, conn: DbConn) -> Result<Redirect,
|
||||
#[derive(Serialize)]
|
||||
struct AddVertretungContext<'a> {
|
||||
vertretungen: Vec<Vertretung>,
|
||||
stunden: Vec<Stunde>,
|
||||
klassen: Vec<Klasse>,
|
||||
parent: &'a str,
|
||||
}
|
||||
|
||||
@ -246,10 +248,20 @@ fn get_vertretung_form(conn: DbConn) -> Template {
|
||||
.order(vertretungen::klasse_id.asc())
|
||||
.load::<Vertretung>(&*conn)
|
||||
.expect("could not load vertretungen");
|
||||
let loc_stunden = stunden::table
|
||||
.order(stunden::ordinal.asc())
|
||||
.load::<Stunde>(&*conn)
|
||||
.expect("could not load Stunden");
|
||||
let loc_klassen = klassen::table
|
||||
.order(klassen::ordnung.asc())
|
||||
.load::<Klasse>(&*conn)
|
||||
.expect("could not load Stunden");
|
||||
Template::render(
|
||||
"add_vertretung_form",
|
||||
AddVertretungContext {
|
||||
vertretungen: loc_vertretungen,
|
||||
stunden: loc_stunden,
|
||||
klassen: loc_klassen,
|
||||
parent: "base",
|
||||
},
|
||||
)
|
||||
|
71
templates/add_vertretung_form.hbs
Normal file
71
templates/add_vertretung_form.hbs
Normal file
@ -0,0 +1,71 @@
|
||||
{{#* inline "page"}}
|
||||
<h1>Klassen</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Klasse, Stunde</th>
|
||||
<th>Fehlend</th>
|
||||
<th>Vertretung</th>
|
||||
<th>Kommentar</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
{{#each vertretungen}}
|
||||
<tr>
|
||||
<td>{{this.klasse_id}}, {{this.stunde_id}}</td>
|
||||
<td>{{this.fehlend}}</td>
|
||||
<td>{{this.vertretung}}</td>
|
||||
<td>{{this.kommentar}}</td>
|
||||
<td>{{this.vertretungen_id}} why empty? </td>
|
||||
<td>
|
||||
<a href="/admin/delete/vertretung/{{this.vertretungen_id}}">löschen</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
<h1>Vertretung hinzu fügen</h1>
|
||||
<form action="/admin/add/vertretung" method="post" accept-charset="utf-8">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Klasse:</th>
|
||||
<td>
|
||||
<select name="klasse_id">
|
||||
{{#each klassen}}
|
||||
<option value="{{this.klassen_id}}">
|
||||
{{this.stufe}}{{this.gruppe}}
|
||||
</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Stunde:</th>
|
||||
<td>
|
||||
<select name="stunde_id">
|
||||
{{#each stunden}}
|
||||
<option value="{{this.stunden_id}}">
|
||||
{{this.title}}
|
||||
</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fehlend:</th>
|
||||
<td><input type="text" name="fehlend"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Vertretung:</th>
|
||||
<td><input type="text" name="vertretung"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Kommentar:</th>
|
||||
<td><input type="text" name="kommentar"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td><input type="submit" value="Vertretung Erstellen"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{{/inline}}
|
||||
{{! remove whitespaces with ~ }}
|
||||
{{~> (parent)~}}
|
Loading…
Reference in New Issue
Block a user