diff --git a/src/leptos/cafe.rs b/src/leptos/cafe.rs
index 5137ce1..db7a184 100644
--- a/src/leptos/cafe.rs
+++ b/src/leptos/cafe.rs
@@ -8,14 +8,45 @@ use crate::types::*;
#[component]
pub fn Cafe() -> impl IntoView {
+ let acc = signal(Account::Sumpf);
view! {
-
+ }
+}
+
+#[component]
+fn Reception(acc: ReadSignal) -> impl IntoView {
+ view! {
-
+
+ {move || format!("{}", acc.get())}
+
+
+
+
+
+
+
+
+
}
}
@@ -26,7 +57,7 @@ fn StoreLogo(store: Store) -> impl IntoView {
::into(&store))
class="logo"
- // FIXME: Implement fmt trait for Store
+ // FIXME: Implement fmt::Display for Store
alt=format!("{:?}", store)
/>
}
@@ -70,27 +101,6 @@ fn StoreInput(store: Store) -> impl IntoView {
}
}
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-struct Cash(i64);
-
-impl std::str::FromStr for Cash {
- type Err = ();
-
- fn from_str(s: &str) -> Result {
- let split: Vec<&str> = s.split(".").collect();
- let i = i64::from_str(split.get(0).ok_or(())?)
- .map_err(|e| println!("{:?}", e))?;
- let f = match split.get(1) {
- None => 0,
- Some(fs) => i64::from_str(
- &format!("00{}", fs)[0..2]
- )
- .map_err(|e| println!("{:?}", e))?,
- };
- Ok(Cash(i*100+f))
- }
-}
-
#[component]
fn CashInput(value: RwSignal) -> impl IntoView {
let txt = "cash";
@@ -140,8 +150,7 @@ fn AccRadio(acc: Account) -> impl IntoView {
}
diff --git a/src/types.rs b/src/types.rs
index d774769..fd2815b 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -31,6 +31,27 @@ pub struct VoucherInventory {
pub count: i64,
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+struct Cash(i64);
+
+impl std::str::FromStr for Cash {
+ type Err = ();
+
+ fn from_str(s: &str) -> Result {
+ let split: Vec<&str> = s.split(".").collect();
+ let i = i64::from_str(split.get(0).ok_or(())?)
+ .map_err(|e| println!("{:?}", e))?;
+ let f = match split.get(1) {
+ None => 0,
+ Some(fs) => i64::from_str(
+ &format!("00{}", fs)[0..2]
+ )
+ .map_err(|e| println!("{:?}", e))?,
+ };
+ Ok(Cash(i*100+f))
+ }
+}
+
impl Into for &Store {
fn into(self) -> String {
String::from(match *self {
@@ -81,6 +102,15 @@ impl Into for &Account {
}
}
+impl std::fmt::Display for Account {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match *self {
+ Account::Sumpf => "Sumpf",
+ Account::Heinersyndikat => "Heinersyndikat",
+ }.fmt(f)
+ }
+}
+
#[cfg(feature = "server")]
impl ToSql for Store {
fn to_sql(&self) -> rusqlite::Result> {