From 3a0e91bda1e93afa33dd182c2e820c94b3e94593 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 25 Oct 2025 02:15:31 +0200 Subject: feat(treewide): Add further buttons The register product > associate barcode > buy barcode workflow is now usable. The only missing features for an MVP are unit and unit property creation. --- src/components/inventory.rs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/components/inventory.rs (limited to 'src/components/inventory.rs') diff --git a/src/components/inventory.rs b/src/components/inventory.rs new file mode 100644 index 0000000..275dd0b --- /dev/null +++ b/src/components/inventory.rs @@ -0,0 +1,43 @@ +use leptos::{IntoView, component, view}; + +use crate::{ + api::products_in_storage_wrapped, + components::{async_fetch::AsyncFetch, container::Container, icon_p::IconP}, +}; + +#[component] +pub fn Inventory() -> impl IntoView { + view! { + }, "inventory"), + (view! { }, "consume"), + (view! { }, "buy"), + ] + > + { + AsyncFetch! { + @map_error_in_producer + fetcher = products_in_storage_wrapped(), + producer = |products| { + let products_num = products.len(); + let plural_s = if products_num == 1 { "" } else { "s" }; + let products_value = 2; + let products_currency = "EUR"; + + view! { +

+ {format!( + "You have {products_num} product{plural_s} \ + in stock with a value \ + of {products_value} {products_currency}.", + )} +

+ } + } + } + } +
+ } +} -- cgit 1.4.1