diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-10-05 18:27:05 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-10-05 18:27:05 +0200 |
| commit | 1fc165f2a5a3b6d77da2cfea2aa05e1db1c73577 (patch) | |
| tree | 2ea10b7aa960ecfa932b1091a43f101c5668cea8 /src/components/buy.rs | |
| parent | feat(form): Provide basic form framework (diff) | |
| download | web-client-1fc165f2a5a3b6d77da2cfea2aa05e1db1c73577.zip | |
feat(form): Re-write the form macro as a proc macro
This allows more possibilities.
Diffstat (limited to '')
| -rw-r--r-- | src/components/buy.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/components/buy.rs b/src/components/buy.rs index 0c294ee..6d9402e 100644 --- a/src/components/buy.rs +++ b/src/components/buy.rs @@ -1,7 +1,9 @@ use leptos::{IntoView, component, view}; use log::info; +use rocie_client::models::UnitId; +use uuid::Uuid; -use crate::components::{form::Form, input_placeholder::InputPlaceholder, site_header::SiteHeader}; +use crate::components::{form::Form, site_header::SiteHeader}; #[component] pub fn Buy() -> impl IntoView { @@ -9,22 +11,27 @@ pub fn Buy() -> impl IntoView { <SiteHeader logo=icondata_io::IoPricetag back_location="/" name="Buy" /> {Form! { - on_submit = |Inputs {product_barcode, amount}| { - info!("Got product barcode: {product_barcode} with amount: {amount}"); - } + on_submit = |product_barcode, amount, unit_id| { + info!("Got product barcode: {product_barcode} with amount: {amount}, {unit_id}"); + }; <Input name=product_barcode, - signal_name_get=product_barcode_get, - signal_name_set=product_barcode_set, rust_type=u32, html_type="number", label="Product Barcode" /> + <Select + name=unit_id, + rust_type=Uuid, + label="Unit", + options=[ + ("Kilogram", Uuid::new_v4()), + ("Gram", Uuid::new_v4()) + ] + /> <Input name=amount, - signal_name_get=amount_get, - signal_name_set=amount_set, rust_type=u16, html_type="number", label="Amount" |
