summary refs log tree commit diff stats
path: root/src/components/buy.rs
blob: 0c294ee1fcefb36ba24cbf33d7afdf4c9fdd2815 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use leptos::{IntoView, component, view};
use log::info;

use crate::components::{form::Form, input_placeholder::InputPlaceholder, site_header::SiteHeader};

#[component]
pub fn Buy() -> impl IntoView {
    view! {
        <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}");
            }

            <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"
            />
            <Input
                name=amount,
                signal_name_get=amount_get,
                signal_name_set=amount_set,
                rust_type=u16,
                html_type="number",
                label="Amount"
            />
        }}
    }
}