#pass the input values from html to a function to save it as a JSON

44 messages · Page 1 of 1 (latest)

twin falcon
#
struct CustomerArgs {
    customer: String,
    hours: u64,
    room: String,
    items: [String; 5],
}

#[component]
pub fn App() -> impl IntoView {
    fn update_values(customer: String, hours: u64, room: String, items:  [String; 5]) {

    }

    view! {
        <main class="container">
            <p>"Bir isim ve saat giriniz."</p>

            <form class="column" action="">
                <input
                    id="customer-input"
                    placeholder="Isim girin."

                />
                <input
                    id="time-input"
                    placeholder="Bir Saat girin"

                />
                <input
                id="items-input"
                placeholder="Alına mallar."

                />
                <select class="selector" name="rooms" id="rooms">
                  <option value="placeholder" selected hidden disabled>otağ seç</option>
                  <option value="mexico">mexico</option>
                  <option value="baku">baku</option>
                  <option value="green">green</option>
                  <option value="istanbul">istanbul</option>
                  <option value="vip">vip</option>
                </select> 
                <button class="submit" type="submit">"Ekle"</button>
            </form>

            <div class="col">
                <table class="tbl">
                    <tr>
                    <th>Ad</th>
                    <th>Saat</th>
                    <th>Borc</th>
                    <th>Ödenilib</th>
                    <th>Düzenle</th>
                    </tr>
                    <tr>
                    <td>Deniz</td>
                    <td>4 Saat  (Green Room)</td>
                    <td>AZN 20</td>
                    <td>Yox</td>
                    <td class="buttonin">
                        <button class="btn">
                            <svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
                        </button>
                    </td>
                    </tr>
                    <tr>
                    <td>Tural</td>
                    <td>4 Saat  (Mexico)</td>
                    <td>AZN 16</td>
                    <td>Yox</td>
                    <td class="buttonin">
                        <button class="btn">
                            <svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
                        </button>
                    </td>
                    </tr>
                </table> 
            </div>

        </main>
    }
}
#

my current code

limpid marsh
#

What's the issue?

tardy prairie
#

are u using leptos?

twin falcon
limpid marsh
twin falcon
#

perferably a json

#

or a database

#

but first i gotta know how to make a json out of these input's

#

inputs*

#

(which i don't)

limpid marsh
twin falcon
twin falcon
#
use leptos::*;
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(js_namespace = ["window", "__TAURI__", "tauri"])]
    async fn invoke(cmd: &str, args: JsValue) -> JsValue;
}

#[derive(Serialize, Deserialize)]
struct CustomerArgs {
    customer: String,
    hours: u64,
    room: String,
    items: [String; 5],
}

#[component]
pub fn App() -> impl IntoView {
    fn update_values(customer: String, hours: u64, room: String, items:  [String; 5]) {

    }

    view! {
        <main class="container">
            <p>"Bir isim ve saat giriniz."</p>

            <form class="column" action="">
                <input
                    id="customer-input"
                    placeholder="Isim girin."

                />
                <input
                    id="time-input"
                    placeholder="Bir Saat girin"

                />
                <input
                id="items-input"
                placeholder="Alına mallar."

                />
                <select class="selector" name="rooms" id="rooms">
                  <option value="placeholder" selected hidden disabled>otağ seç</option>
                  <option value="mexico">mexico</option>
                  <option value="baku">baku</option>
                  <option value="green">green</option>
                  <option value="istanbul">istanbul</option>
                  <option value="vip">vip</option>
                </select> 
                <button class="submit" type="submit">"Ekle"</button>
            </form>

            <div class="col">
                <table class="tbl">
                    <tr>
                    <th>Ad</th>
                    <th>Saat</th>
                    <th>Borc</th>
                    <th>Ödenilib</th>
                    <th>Düzenle</th>
                    </tr>
                    <tr>
                    <td>Deniz</td>
                    <td>4 Saat  (Green Room)</td>
                    <td>AZN 20</td>
                    <td>Yox</td>
                    <td class="buttonin">
                        <button class="btn">
                            <svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
                        </button>
                    </td>
                    </tr>
                    <tr>
                    <td>Tural</td>
                    <td>4 Saat  (Mexico)</td>
                    <td>AZN 16</td>
                    <td>Yox</td>
                    <td class="buttonin">
                        <button class="btn">
                            <svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
                        </button>
                    </td>
                    </tr>
                </table> 
            </div>

        </main>
    }
}
#

this is the whole code

limpid marsh
#

That's not helpful

tardy prairie
#

oh sorry

twin falcon
#

what did they say

tardy prairie
limpid marsh
#

Looks like you write a closure in the view macro

limpid marsh
#

To be completely honest neither do I from my skimming of the docs

twin falcon
#

i've been stuck for a week now 😭

limpid marsh
#

My hate of super macros grows by the day

tardy prairie
#

different approach to the problem

twin falcon
#

not like we found a solution that we're sweitching it to another one

#

we don't know how to fix it

#

or i don't atleast

tardy prairie
#

did u try llm?

#

blackbox is good at coding problems

twin falcon
#

HELL noh.

tardy prairie
#

this wont help but here is a ferris to cheer u up fewwisSmol

twin falcon
#

@tardy prairie @limpid marsh doesn't this crate has a method like this

#

i go to it's crates.rs page and it has the method

#

yea this shit just made my code 10 times worse

limpid marsh
twin falcon
#

it worsened my code

#

i removed it