Added settings for company info. Added code for entity validation.
This commit is contained in:
@@ -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>}
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user