Error fixes

type mismatch in update user and some styling improvements
This commit is contained in:
2026-05-28 18:49:29 +02:00
parent 04b9ef8f9e
commit 6ef50d06aa
4 changed files with 22 additions and 24 deletions

View File

@@ -285,19 +285,20 @@ pub fn ticket_count_component() -> Html {
.send()
.await
&& response.status() == 200
&& let Ok(json) = response.json::<serde_json::Value>().await {
let id = json
.get("data")
.and_then(|d| d.get("id"))
.and_then(|v| v.as_i64())
.and_then(|n| i16::try_from(n).ok());
let is_admin = json
.get("data")
.and_then(|d| d.get("is_admin"))
.and_then(|v| v.as_bool())
.unwrap_or(false);
user.set(ActiveUser { id, is_admin });
}
&& let Ok(json) = response.json::<serde_json::Value>().await
{
let id = json
.get("data")
.and_then(|d| d.get("id"))
.and_then(|v| v.as_i64())
.and_then(|n| i16::try_from(n).ok());
let is_admin = json
.get("data")
.and_then(|d| d.get("is_admin"))
.and_then(|v| v.as_bool())
.unwrap_or(false);
user.set(ActiveUser { id, is_admin });
}
});
|| ()
});
@@ -311,10 +312,7 @@ pub fn ticket_count_component() -> Html {
let status_conditions = |t: &Ticket| t.status == "ToDo" || t.status == "InProgress";
let count = tickets
.iter()
.filter(|t| {
status_conditions(t)
&& (user.is_admin || (user.id == Some(t.user_id)))
})
.filter(|t| status_conditions(t) && (user.is_admin || (user.id == Some(t.user_id))))
.count();
html! {
<div class="open-tickets">
@@ -435,7 +433,7 @@ pub fn submit_stats_component() -> Html {
<p>{ "Lade..." }</p>
}
if let Some(e) = &*error {
<p style="color: red;">{ e.clone() }</p>
<p class="alert error">{ e.clone() }</p>
}
<h3>{ "Tickets pro Wochentag" }</h3>
<div class="weekday-chart">