Error fixes
type mismatch in update user and some styling improvements
This commit is contained in:
@@ -302,7 +302,7 @@ pub fn submit_ticket_component() -> Html {
|
||||
<option value="Whiteboard Beamer">{ "Whiteboard Beamer" }</option>
|
||||
<option value="Internet">{ "Internet" }</option>
|
||||
<option value="iPad Koffer">{ "iPad Koffer" }</option>
|
||||
<option value="Apple TV">{ "Apple TV" }</option>
|
||||
<option value="Apple TV" selected=true>{ "Apple TV" }</option>
|
||||
<option value="Docu Cam">{ "Dokumenten Kamera" }</option>
|
||||
<option value="Sonstiges">{ "Sonstiges" }</option>
|
||||
</select>
|
||||
|
||||
@@ -771,10 +771,10 @@ pub fn user_by_id_component(props: &UserProps) -> Html {
|
||||
|
||||
<button type="submit" disabled={*saving}>{ if *saving { "Speichern..." } else { "Speichern" } }</button>
|
||||
if *save_success {
|
||||
<p style="color:green">{ "Erfolgreich aktualisiert" }</p>
|
||||
<p class="alert success">{ "Erfolgreich aktualisiert" }</p>
|
||||
}
|
||||
if let Some(err) = &*save_error {
|
||||
<p style="color:red">{ err.clone() }</p>
|
||||
<p class="alert error">{ err.clone() }</p>
|
||||
}
|
||||
</form>
|
||||
|
||||
@@ -784,7 +784,7 @@ pub fn user_by_id_component(props: &UserProps) -> Html {
|
||||
|
||||
<Link<crate::Route> to={crate::Route::AllUsers} classes="return-to">{ "Zurück zur Benutzerübersicht" }</Link<crate::Route>>
|
||||
if let Some(err) = &*delete_error {
|
||||
<p style="color:red">{ err.clone() }</p>
|
||||
<p class="alert error">{ err.clone() }</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user