group teams by routes, sort by last inserted; Fixes #36
This commit is contained in:
parent
944d4d8d19
commit
f55ce1829d
@ -87,7 +87,7 @@ impl Team {
|
|||||||
pub(crate) async fn all_with_route(db: &SqlitePool, route: &Route) -> Vec<Self> {
|
pub(crate) async fn all_with_route(db: &SqlitePool, route: &Route) -> Vec<Self> {
|
||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
Team,
|
Team,
|
||||||
"select id, name, notes, amount_people, first_station_id, route_id from team where route_id = ?;",
|
"SELECT id, name, notes, amount_people, first_station_id, route_id FROM team WHERE route_id = ?;",
|
||||||
route.id
|
route.id
|
||||||
)
|
)
|
||||||
.fetch_all(db)
|
.fetch_all(db)
|
||||||
|
@ -528,32 +528,7 @@ async fn index(State(db): State<Arc<SqlitePool>>, session: Session) -> Markup {
|
|||||||
a href="/admin/route" { "Route" }
|
a href="/admin/route" { "Route" }
|
||||||
" sie zugewiesen sind."
|
" sie zugewiesen sind."
|
||||||
}
|
}
|
||||||
ol {
|
article {
|
||||||
@for team in &teams{
|
|
||||||
li {
|
|
||||||
a href=(format!("/admin/team/{}", team.id)){
|
|
||||||
(team.name)
|
|
||||||
}
|
|
||||||
a href=(format!("/admin/team/{}/delete", team.id))
|
|
||||||
onclick="return confirm('Bist du sicher, dass das Team gelöscht werden soll? Das kann _NICHT_ mehr rückgängig gemacht werden.');" {
|
|
||||||
"🗑️"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@if teams.is_empty() {
|
|
||||||
article class="warning" {
|
|
||||||
"Es gibt noch keine Teams. "
|
|
||||||
@if !routes.is_empty() {
|
|
||||||
"Das kannst du hier ändern ⤵️"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
a href="/admin/team/lost" {
|
|
||||||
button class="outline" {
|
|
||||||
"Hab ich eine Gruppe verloren? 😳"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
h2 { "Neues Team" }
|
h2 { "Neues Team" }
|
||||||
@if routes.is_empty() {
|
@if routes.is_empty() {
|
||||||
article class="error" {
|
article class="error" {
|
||||||
@ -583,6 +558,36 @@ async fn index(State(db): State<Arc<SqlitePool>>, session: Session) -> Markup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
a href="/admin/team/lost" {
|
||||||
|
button class="outline" {
|
||||||
|
"Hab ich eine Gruppe verloren? 😳"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@for route in &routes {
|
||||||
|
h2 { (route.name) }
|
||||||
|
ol {
|
||||||
|
@for team in &route.teams(&db).await{
|
||||||
|
li {
|
||||||
|
a href=(format!("/admin/team/{}", team.id)){
|
||||||
|
(team.name)
|
||||||
|
}
|
||||||
|
a href=(format!("/admin/team/{}/delete", team.id))
|
||||||
|
onclick="return confirm('Bist du sicher, dass das Team gelöscht werden soll? Das kann _NICHT_ mehr rückgängig gemacht werden.');" {
|
||||||
|
"🗑️"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if teams.is_empty() {
|
||||||
|
article class="warning" {
|
||||||
|
"Es gibt noch keine Teams. "
|
||||||
|
@if !routes.is_empty() {
|
||||||
|
"Das kannst du hier ändern ⤵️"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
page(content, session, false).await
|
page(content, session, false).await
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user