Added settings for company info. Added code for entity validation.

This commit is contained in:
2023-09-08 11:53:08 +02:00
parent 44b8b21426
commit 9dd0993204
18 changed files with 488 additions and 20 deletions
+37
View File
@@ -0,0 +1,37 @@
use leptos::*;
use crate::locales::trl;
use crate::validator::Validator;
#[component]
pub fn ValidationErr(
cx: Scope,
validator: Validator,
) -> impl IntoView {
view! {cx, {move || {
if !validator.is_valid() {
if let Some(msgs) = validator.messages() {
let out_msgs = msgs.into_iter().map(move |e| {
view! {cx,
<div class="alert alert-danger">
{trl(cx, &e)}
</div>
}
}).collect_view(cx);
view! {cx,
<div>
{out_msgs}
</div>
}
} else {
view! {cx,
<div class="alert alert-danger">
"Validation error"
</div>
}
}
} else {
view! {cx, <div></div>}
}
}}
}
}