summaryrefslogtreecommitdiff
path: root/src/viewmodel/organizational.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-07 21:43:48 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-07 21:43:48 +0100
commitad9ba30ed217ec9907d1faf389c321a1dcf5c13a (patch)
tree7fdadcde26842e4806881492b993b948c1f2032c /src/viewmodel/organizational.rs
parentf88f8d7c7dc87cdf47de95b54cc6e9f8429820a4 (diff)
downloadwasm-card-ad9ba30ed217ec9907d1faf389c321a1dcf5c13a.tar.gz
wasm-card-ad9ba30ed217ec9907d1faf389c321a1dcf5c13a.tar.bz2
add organizational properties
Diffstat (limited to 'src/viewmodel/organizational.rs')
-rw-r--r--src/viewmodel/organizational.rs86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/viewmodel/organizational.rs b/src/viewmodel/organizational.rs
new file mode 100644
index 0000000..e7a4ae7
--- /dev/null
+++ b/src/viewmodel/organizational.rs
@@ -0,0 +1,86 @@
+use crate::view::organizational::*;
+use super::*;
+
+#[derive(Clone,Debug,PartialEq)]
+pub struct Organizational {
+ pub org: String,
+ pub logo: String,
+ pub title: String,
+ pub role: String,
+ pub member: String,
+ pub related: String,
+}
+
+impl VCardPropertyInputObject<OrganizationalView> for Organizational {
+ fn new() -> Self {
+ Self {
+ org: String::new(),
+ logo: String::new(),
+ title: String::new(),
+ role: String::new(),
+ member: String::new(),
+ related: String::new(),
+ }
+ }
+ fn get_input_fields(&self, link: &yew::html::Scope<OrganizationalView>) -> std::vec::Vec<VCardPropertyInputField> {
+ let typ = String::from("text");
+ vec![
+ VCardPropertyInputField::Text{
+ label: "Organisation".to_string(),
+ id: Some("org".to_string()),
+ placeholder: None,
+ oninput: link.callback(|e: InputData| Msg::UpdateOrg(e.value)),
+ value: self.org.clone(),
+ typ: typ.clone(),
+ },
+ VCardPropertyInputField::Text{ // TODO: Add Upload for logo
+ label: "Logo".to_string(),
+ id: Some("logo".to_string()),
+ placeholder: None,
+ oninput: link.callback(|e: InputData| Msg::UpdateLogo(e.value)),
+ value: self.logo.clone(),
+ typ: typ.clone(),
+ },
+ VCardPropertyInputField::Text{
+ label: "Title".to_string(),
+ id: Some("title".to_string()),
+ placeholder: None,
+ oninput: link.callback(|e: InputData| Msg::UpdateTitle(e.value)),
+ value: self.title.clone(),
+ typ: typ.clone(),
+ },
+ VCardPropertyInputField::Text{
+ label: "Role".to_string(),
+ id: Some("role".to_string()),
+ placeholder: None,
+ oninput: link.callback(|e: InputData| Msg::UpdateRole(e.value)),
+ value: self.role.clone(),
+ typ: typ.clone(),
+ },
+ VCardPropertyInputField::Text{
+ label: "Member".to_string(),
+ id: Some("member".to_string()),
+ placeholder: None,
+ oninput: link.callback(|e: InputData| Msg::UpdateMember(e.value)),
+ value: self.member.clone(),
+ typ: typ.clone(),
+ },
+ VCardPropertyInputField::Text{
+ label: "Related".to_string(),
+ id: Some("related".to_string()),
+ placeholder: None,
+ oninput: link.callback(|e: InputData| Msg::UpdateRelated(e.value)),
+ value: self.related.clone(),
+ typ: typ,
+ },
+ ]
+ }
+ fn is_empty(&self) -> bool {
+ self.org.is_empty() &&
+ self.logo.is_empty() &&
+ self.title.is_empty() &&
+ self.role.is_empty() &&
+ self.member.is_empty() &&
+ self.related.is_empty()
+ }
+} \ No newline at end of file