Compare commits
No commits in common. "9e49770b9942e0243676110d40d05762158ecb95" and "993aea10484012139b464958bb09f9b85d08353f" have entirely different histories.
9e49770b99
...
993aea1048
7
.gitignore
vendored
|
@ -9,10 +9,3 @@ gen/
|
||||||
# Generated by `cargo tauri icon`
|
# Generated by `cargo tauri icon`
|
||||||
# will have various versions of the app icon
|
# will have various versions of the app icon
|
||||||
icons/
|
icons/
|
||||||
|
|
||||||
# Generated by Trunk
|
|
||||||
# will have the files to be served over http
|
|
||||||
www/
|
|
||||||
|
|
||||||
# Secret
|
|
||||||
src/server/cloud_user.txt
|
|
||||||
|
|
1342
Cargo.lock
generated
48
Cargo.toml
|
@ -5,44 +5,28 @@ description = "Buchhaltung für „Darmstadt sagt Nein zur Bezahlkarte!“"
|
||||||
authors = ["Bianca Fürstenau"]
|
authors = ["Bianca Fürstenau"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
tauri = ["server"]
|
|
||||||
leptos = []
|
|
||||||
server = [
|
|
||||||
"dep:tauri",
|
|
||||||
"dep:tauri-plugin-opener",
|
|
||||||
"dep:tauri-plugin-fs",
|
|
||||||
"dep:rusqlite",
|
|
||||||
"dep:rand",
|
|
||||||
"dep:chrono",
|
|
||||||
"dep:tokio",
|
|
||||||
"dep:curl",
|
|
||||||
"dep:openssl",
|
|
||||||
"dep:ring-compat",
|
|
||||||
]
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "bkbh"
|
# The `_lib` suffix may seem redundant but it is necessary
|
||||||
|
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||||
|
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||||
|
name = "bkbh_lib"
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2", features = [] }
|
tauri-build = { version = "2", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
leptos = { version = "^0.7", features = ["csr"] }
|
tauri = { version = "2", features = [] }
|
||||||
leptos_router = { version = "^0.7" }
|
tauri-plugin-opener = "2"
|
||||||
tauri-sys = { git = "ssh://git@gitea.mathebau.de:3022/Peter/tauri-sys.git", branch = "v2", features = ["core"] }
|
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = { version = "1" }
|
serde_json = "1"
|
||||||
|
rusqlite = {version = "^0.33", features = ["backup", "bundled"] }
|
||||||
tauri = { version = "2", features = [], optional = true }
|
rand = {version = "^0.8"}
|
||||||
tauri-plugin-opener = { version = "2", optional = true }
|
chrono = {version = "^0.4"}
|
||||||
tauri-plugin-fs = {version = "2", optional = true}
|
tokio = {version = "^1.43"}
|
||||||
rusqlite = {version = "^0.33", features = ["backup", "bundled"], optional = true }
|
tauri-plugin-fs = {version = "2"}
|
||||||
rand = {version = "^0.8", optional = true}
|
curl = {version = "^0.4"}
|
||||||
chrono = {version = "^0.4", optional = true}
|
openssl = {version = "^0.10", features = ["vendored"] }
|
||||||
tokio = {version = "^1.43", optional = true}
|
ring-compat = {version = "^0.8", features = ["signature", "rand_core"] }
|
||||||
curl = {version = "^0.4", optional = true}
|
|
||||||
openssl = {version = "^0.10", features = ["vendored"], optional = true}
|
|
||||||
ring-compat = {version = "^0.8", features = ["signature", "rand_core"], optional = true}
|
|
||||||
console_error_panic_hook = {version = "0.1.7"}
|
|
||||||
|
|
35
README.md
|
@ -1,35 +0,0 @@
|
||||||
# Setup
|
|
||||||
```bash
|
|
||||||
git clone …
|
|
||||||
cargo tauri android init
|
|
||||||
git restore gen/android/app/build.gradle.kts
|
|
||||||
cargo tauri img/icon.svg
|
|
||||||
# Set up gen/android/keystore.properties
|
|
||||||
```
|
|
||||||
|
|
||||||
# Run
|
|
||||||
|
|
||||||
## Linux Development
|
|
||||||
|
|
||||||
Tauri does not seem to support
|
|
||||||
specifying the binary
|
|
||||||
to be run in a config,
|
|
||||||
so we have to do it
|
|
||||||
on the command line.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo tauri dev -- --bin tauri
|
|
||||||
```
|
|
||||||
|
|
||||||
## Android Development
|
|
||||||
|
|
||||||
Tauri does not seem to support
|
|
||||||
specifying the Cargo features
|
|
||||||
of the library for mobile
|
|
||||||
in a config,
|
|
||||||
so we have to do it
|
|
||||||
on the command line.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
NDK_HOME=<path> ANDROID_HOME=<path> cargo tauri android dev --features tauri
|
|
||||||
```
|
|
|
@ -1,9 +0,0 @@
|
||||||
[build]
|
|
||||||
target = "trunk.html"
|
|
||||||
html_output = "index.html"
|
|
||||||
dist = "www"
|
|
||||||
|
|
||||||
[serve]
|
|
||||||
port = 1420
|
|
||||||
open = false
|
|
||||||
ws_protocol = "ws"
|
|
6
build.rs
|
@ -1,7 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
if cfg!(feature = "tauri") {
|
tauri_build::build()
|
||||||
tauri_build::build();
|
|
||||||
} else {
|
|
||||||
println!("cargo::rustc-check-cfg=cfg(mobile)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
@ -1,9 +0,0 @@
|
||||||
use leptos::prelude::*;
|
|
||||||
use bkbh::leptos::cafe::Cafe;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
console_error_panic_hook::set_once();
|
|
||||||
leptos::mount::mount_to_body(
|
|
||||||
|| view! { <Cafe /> }
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
use tauri_sys::Error;
|
|
||||||
use tauri_sys::core::invoke;
|
|
||||||
use crate::types::*;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
|
||||||
pub struct Swap {
|
|
||||||
store: Store,
|
|
||||||
acc: i64,
|
|
||||||
}
|
|
||||||
pub async fn swap(store: Store, acc: i64) -> Result<(), Error> {
|
|
||||||
let args = Swap { store, acc };
|
|
||||||
invoke("swap", &args).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
|
||||||
pub struct Inventory {
|
|
||||||
data: HashMap<String, String>,
|
|
||||||
}
|
|
||||||
pub async fn inventory(data: HashMap<String, String>) -> Result<(), Error> {
|
|
||||||
let args = Inventory { data };
|
|
||||||
invoke("inventory", &args).await
|
|
||||||
}
|
|
|
@ -6,7 +6,7 @@ use ring_compat::signature::ed25519::SigningKey;
|
||||||
use tauri::{Manager, State};
|
use tauri::{Manager, State};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use crate::server::app_state::AppState;
|
use crate::app_state::AppState;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Collector(Vec<u8>, Vec<u8>, usize);
|
struct Collector(Vec<u8>, Vec<u8>, usize);
|
|
@ -1,184 +0,0 @@
|
||||||
use leptos::prelude::*;
|
|
||||||
use crate::commands::*;
|
|
||||||
use leptos::task::spawn_local;
|
|
||||||
use leptos::web_sys::FormData;
|
|
||||||
use leptos::form::FromFormData;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use crate::types::*;
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
pub fn Cafe() -> impl IntoView {
|
|
||||||
view! {
|
|
||||||
<SwapButton
|
|
||||||
store=Store::Aldi
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
id="cafe-inventory"
|
|
||||||
>
|
|
||||||
<InvForm />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
fn StoreLogo(store: Store) -> impl IntoView {
|
|
||||||
view! {
|
|
||||||
<img
|
|
||||||
src=format!("assets/{}.svg", Into::<String>::into(&store))
|
|
||||||
class="logo"
|
|
||||||
// FIXME: Implement fmt trait for Store
|
|
||||||
alt=format!("{:?}", store)
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
fn SwapButton(store: Store) -> impl IntoView {
|
|
||||||
view! {
|
|
||||||
<button
|
|
||||||
on:click=move |_| {
|
|
||||||
spawn_local(async move {
|
|
||||||
swap(store, 0).await.unwrap();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
class="column"
|
|
||||||
>
|
|
||||||
<StoreLogo store=store />
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
fn StoreInput(store: Store) -> impl IntoView {
|
|
||||||
let txt = format!("{}", Into::<String>::into(&store));
|
|
||||||
view! {
|
|
||||||
<div
|
|
||||||
class="labelled-input"
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
for=txt.clone()
|
|
||||||
>
|
|
||||||
<StoreLogo store=store />
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name=txt.clone()
|
|
||||||
id=txt.clone()
|
|
||||||
min=0
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
struct Cash(i64);
|
|
||||||
|
|
||||||
impl std::str::FromStr for Cash {
|
|
||||||
type Err = ();
|
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
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<String>) -> impl IntoView {
|
|
||||||
let txt = "cash";
|
|
||||||
view! {
|
|
||||||
<div
|
|
||||||
class="labelled-input"
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
for=txt.clone()
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="assets/cash.svg"
|
|
||||||
class="logo"
|
|
||||||
alt="Bargeld"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name=txt.clone()
|
|
||||||
id=txt.clone()
|
|
||||||
min=0
|
|
||||||
step=0.01
|
|
||||||
bind:value=value
|
|
||||||
on:change=move |_| {
|
|
||||||
println!("{:?}", value.get());
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
fn AccRadio(acc: Account) -> impl IntoView {
|
|
||||||
let txt = format!("{}", Into::<String>::into(&acc));
|
|
||||||
let id = format!("acc-{}", txt);
|
|
||||||
view! {
|
|
||||||
<div
|
|
||||||
class="labelled-input"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="acc"
|
|
||||||
id=id.clone()
|
|
||||||
value=txt
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
for=id.clone()
|
|
||||||
>
|
|
||||||
// FIXME: Implement fmt trait for Account
|
|
||||||
{format!("{:?}", acc)}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
fn SubmitButton() -> impl IntoView {
|
|
||||||
view! {
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="shout"
|
|
||||||
>
|
|
||||||
"Senden"
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
fn InvForm() -> impl IntoView {
|
|
||||||
let cash = RwSignal::new(String::from("0.00"));
|
|
||||||
view! {
|
|
||||||
<form
|
|
||||||
on:submit=move |ev| {
|
|
||||||
ev.prevent_default();
|
|
||||||
let data = FromFormData::from_event(ev.as_ref()).unwrap();
|
|
||||||
spawn_local(async move {inventory(data).await;});
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<AccRadio acc=Account::Sumpf />
|
|
||||||
<AccRadio acc=Account::Heinersyndikat />
|
|
||||||
<StoreInput store=Store::Aldi />
|
|
||||||
<StoreInput store=Store::Dm />
|
|
||||||
<StoreInput store=Store::Lidl />
|
|
||||||
<StoreInput store=Store::Rewe />
|
|
||||||
<StoreInput store=Store::Tegut />
|
|
||||||
<CashInput value=cash />
|
|
||||||
<SubmitButton />
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
pub mod cafe;
|
|
198
src/lib.rs
|
@ -1,18 +1,184 @@
|
||||||
pub mod commands;
|
use chrono::offset::Utc;
|
||||||
#[cfg(feature = "server")]
|
use rusqlite::{types::ToSqlOutput, ToSql};
|
||||||
pub mod server;
|
|
||||||
#[cfg(feature = "leptos")]
|
|
||||||
pub mod leptos;
|
|
||||||
pub mod types;
|
|
||||||
|
|
||||||
#[cfg(all(feature = "tauri", feature="server"))]
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
||||||
pub fn run() {
|
|
||||||
use tauri::{Manager, State};
|
use tauri::{Manager, State};
|
||||||
use tauri_plugin_fs::FsExt;
|
use tauri_plugin_fs::FsExt;
|
||||||
use server::app_state::AppState;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
mod app_state;
|
||||||
|
mod data_door;
|
||||||
|
|
||||||
|
use app_state::AppState;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
enum Store {
|
||||||
|
Aldi,
|
||||||
|
Edeka,
|
||||||
|
Dm,
|
||||||
|
Lidl,
|
||||||
|
Rewe,
|
||||||
|
Tegut,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
enum Account {
|
||||||
|
Sumpf,
|
||||||
|
Heinersyndikat,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Inventory {
|
||||||
|
acc: Account,
|
||||||
|
cash: i64,
|
||||||
|
vouchers: Vec<VoucherInventory>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct VoucherInventory {
|
||||||
|
store: Store,
|
||||||
|
count: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<&str> for Store {
|
||||||
|
type Error = ();
|
||||||
|
|
||||||
|
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
||||||
|
match s {
|
||||||
|
"aldi" => Ok(Store::Aldi),
|
||||||
|
"edeka" => Ok(Store::Edeka),
|
||||||
|
"dm" => Ok(Store::Dm),
|
||||||
|
"lidl" => Ok(Store::Lidl),
|
||||||
|
"rewe" => Ok(Store::Rewe),
|
||||||
|
"tegut" => Ok(Store::Tegut),
|
||||||
|
_ => Err(()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<&str> for Account {
|
||||||
|
type Error = ();
|
||||||
|
|
||||||
|
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
||||||
|
match s {
|
||||||
|
"sumpf" => Ok(Account::Sumpf),
|
||||||
|
"hs" => Ok(Account::Heinersyndikat),
|
||||||
|
_ => Err(()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToSql for Store {
|
||||||
|
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
|
||||||
|
match self {
|
||||||
|
Store::Aldi => 0.to_sql(),
|
||||||
|
Store::Edeka => 1.to_sql(),
|
||||||
|
Store::Dm => 2.to_sql(),
|
||||||
|
Store::Lidl => 3.to_sql(),
|
||||||
|
Store::Rewe => 4.to_sql(),
|
||||||
|
Store::Tegut => 5.to_sql(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToSql for Account {
|
||||||
|
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
|
||||||
|
match self {
|
||||||
|
Account::Sumpf => 0.to_sql(),
|
||||||
|
Account::Heinersyndikat => 1.to_sql(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_inventory(data: HashMap<String, String>) -> Result<Inventory, ()> {
|
||||||
|
let a = data.get("cafe-inventory-acc").ok_or(())?;
|
||||||
|
let acc: Account = Account::try_from(a.as_ref())?;
|
||||||
|
let mut vouchers = Vec::new();
|
||||||
|
for s in ["aldi", "dm", "lidl", "rewe", "tegut"] {
|
||||||
|
let Ok(store) = s.try_into() else {
|
||||||
|
println!("Did not find '{}' in inventory data.", s);
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
match data.get(&format!("cafe-inventory-{}", s)) {
|
||||||
|
None => (),
|
||||||
|
Some(c) => {
|
||||||
|
let c = if c == "" {"0"} else {c};
|
||||||
|
let Ok(count) = c.parse() else {
|
||||||
|
println!("Invalid count '{}' for '{}' in inventory data.", c, s);
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let v = VoucherInventory { store, count };
|
||||||
|
vouchers.push(v);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn inventory(
|
||||||
|
data: HashMap<String, String>,
|
||||||
|
state: State<'_, Mutex<AppState>>,
|
||||||
|
) -> Result<(), ()> {
|
||||||
|
let now = Utc::now().timestamp();
|
||||||
|
let state = state.lock().await;
|
||||||
|
let inv = parse_inventory(data)?;
|
||||||
|
for v in inv.vouchers {
|
||||||
|
state.db.execute(
|
||||||
|
"INSERT INTO voucher_inventory VALUES ()",
|
||||||
|
(
|
||||||
|
inv.acc,
|
||||||
|
v.store,
|
||||||
|
v.count,
|
||||||
|
now,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.map_err(|e| println!("{:?}", e))?;
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn swap(
|
||||||
|
store: &str,
|
||||||
|
acc: i64,
|
||||||
|
state: State<'_, Mutex<AppState>>,
|
||||||
|
) -> Result<(), ()> {
|
||||||
|
let state = state.lock().await;
|
||||||
|
let store: Store = store.try_into()?;
|
||||||
|
state.db.execute(
|
||||||
|
"INSERT INTO swap VALUES (?1, ?2, ?3, ?4, ?5)",
|
||||||
|
(
|
||||||
|
store,
|
||||||
|
acc,
|
||||||
|
i64::from_ne_bytes(state.id.to_ne_bytes()),
|
||||||
|
Utc::now().timestamp(),
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.map_err(|e| println!("{:?}", e))?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
async fn count(state: State<'_, Mutex<AppState>>) -> Result<String, ()> {
|
||||||
|
let state = state.lock().await;
|
||||||
|
let mut stmt =
|
||||||
|
state.db.prepare("SELECT COUNT(*) FROM swap")
|
||||||
|
.map_err(|e| println!("{:?}", e))?;
|
||||||
|
let mut rows = stmt.query([]).map_err(|e| println!("{:?}", e))?;
|
||||||
|
let row = rows.next().map_err(|e| println!("{:?}", e))?;
|
||||||
|
let row = match row {
|
||||||
|
Some(r) => Ok(r),
|
||||||
|
None => {
|
||||||
|
println!("No rows");
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
}?;
|
||||||
|
let cnt: u64 = row.get(0).map_err(|e| println!("{:?}", e))?;
|
||||||
|
Ok(cnt.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
|
pub fn run() {
|
||||||
let state = AppState::new();
|
let state = AppState::new();
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
|
@ -24,11 +190,11 @@ pub fn run() {
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
server::swap,
|
swap,
|
||||||
server::count,
|
count,
|
||||||
server::inventory,
|
inventory,
|
||||||
server::data_door::pull_data,
|
data_door::pull_data,
|
||||||
server::data_door::push_data,
|
data_door::push_data,
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
bkbh::run()
|
bkbh_lib::run()
|
||||||
}
|
}
|
|
@ -1,100 +0,0 @@
|
||||||
use chrono::offset::Utc;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use tokio::sync::Mutex;
|
|
||||||
use tauri::State;
|
|
||||||
|
|
||||||
use crate::types::*;
|
|
||||||
|
|
||||||
pub mod app_state;
|
|
||||||
pub mod data_door;
|
|
||||||
|
|
||||||
use app_state::AppState;
|
|
||||||
|
|
||||||
fn parse_inventory(data: HashMap<String, String>) -> Result<Inventory, ()> {
|
|
||||||
let a = data.get("cafe-inventory-acc").ok_or(())?;
|
|
||||||
let acc: Account = Account::try_from(a.as_ref())?;
|
|
||||||
let mut vouchers = Vec::new();
|
|
||||||
for s in ["aldi", "dm", "lidl", "rewe", "tegut"] {
|
|
||||||
let Ok(store) = s.try_into() else {
|
|
||||||
println!("Did not find '{}' in inventory data.", s);
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
match data.get(&format!("cafe-inventory-{}", s)) {
|
|
||||||
None => (),
|
|
||||||
Some(c) => {
|
|
||||||
let c = if c == "" {"0"} else {c};
|
|
||||||
let Ok(count) = c.parse() else {
|
|
||||||
println!("Invalid count '{}' for '{}' in inventory data.", c, s);
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let v = VoucherInventory { store, count };
|
|
||||||
vouchers.push(v);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub async fn inventory(
|
|
||||||
data: HashMap<String, String>,
|
|
||||||
state: State<'_, Mutex<AppState>>,
|
|
||||||
) -> Result<(), ()> {
|
|
||||||
println!("{:?}", data);
|
|
||||||
let now = Utc::now().timestamp();
|
|
||||||
let state = state.lock().await;
|
|
||||||
let inv = parse_inventory(data)?;
|
|
||||||
for v in inv.vouchers {
|
|
||||||
state.db.execute(
|
|
||||||
"INSERT INTO voucher_inventory VALUES ()",
|
|
||||||
(
|
|
||||||
inv.acc,
|
|
||||||
v.store,
|
|
||||||
v.count,
|
|
||||||
now,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.map_err(|e| println!("{:?}", e))?;
|
|
||||||
};
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub async fn swap(
|
|
||||||
store: Store,
|
|
||||||
acc: i64,
|
|
||||||
state: State<'_, Mutex<AppState>>,
|
|
||||||
) -> Result<(), ()> {
|
|
||||||
let state = state.lock().await;
|
|
||||||
state.db.execute(
|
|
||||||
"INSERT INTO swap VALUES (?1, ?2, ?3, ?4, ?5)",
|
|
||||||
(
|
|
||||||
store,
|
|
||||||
acc,
|
|
||||||
i64::from_ne_bytes(state.id.to_ne_bytes()),
|
|
||||||
Utc::now().timestamp(),
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.map_err(|e| println!("{:?}", e))?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub async fn count(state: State<'_, Mutex<AppState>>) -> Result<String, ()> {
|
|
||||||
let state = state.lock().await;
|
|
||||||
let mut stmt =
|
|
||||||
state.db.prepare("SELECT COUNT(*) FROM swap")
|
|
||||||
.map_err(|e| println!("{:?}", e))?;
|
|
||||||
let mut rows = stmt.query([]).map_err(|e| println!("{:?}", e))?;
|
|
||||||
let row = rows.next().map_err(|e| println!("{:?}", e))?;
|
|
||||||
let row = match row {
|
|
||||||
Some(r) => Ok(r),
|
|
||||||
None => {
|
|
||||||
println!("No rows");
|
|
||||||
Err(())
|
|
||||||
}
|
|
||||||
}?;
|
|
||||||
let cnt: u64 = row.get(0).map_err(|e| println!("{:?}", e))?;
|
|
||||||
Ok(cnt.to_string())
|
|
||||||
}
|
|
106
src/types.rs
|
@ -1,106 +0,0 @@
|
||||||
#[cfg(feature = "server")]
|
|
||||||
use rusqlite::{types::ToSqlOutput, ToSql};
|
|
||||||
use serde::{Serialize, Deserialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
|
||||||
pub enum Store {
|
|
||||||
Aldi,
|
|
||||||
Edeka,
|
|
||||||
Dm,
|
|
||||||
Lidl,
|
|
||||||
Rewe,
|
|
||||||
Tegut,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
|
||||||
pub enum Account {
|
|
||||||
Sumpf,
|
|
||||||
Heinersyndikat,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
||||||
pub struct Inventory {
|
|
||||||
pub acc: Account,
|
|
||||||
pub cash: i64,
|
|
||||||
pub vouchers: Vec<VoucherInventory>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
|
||||||
pub struct VoucherInventory {
|
|
||||||
pub store: Store,
|
|
||||||
pub count: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Into<String> for &Store {
|
|
||||||
fn into(self) -> String {
|
|
||||||
String::from(match *self {
|
|
||||||
Store::Aldi => "aldi",
|
|
||||||
Store::Edeka => "edeka",
|
|
||||||
Store::Dm => "dm",
|
|
||||||
Store::Lidl => "lidl",
|
|
||||||
Store::Rewe => "rewe",
|
|
||||||
Store::Tegut => "tegut",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&str> for Store {
|
|
||||||
type Error = ();
|
|
||||||
|
|
||||||
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
|
||||||
match s {
|
|
||||||
"aldi" => Ok(Store::Aldi),
|
|
||||||
"edeka" => Ok(Store::Edeka),
|
|
||||||
"dm" => Ok(Store::Dm),
|
|
||||||
"lidl" => Ok(Store::Lidl),
|
|
||||||
"rewe" => Ok(Store::Rewe),
|
|
||||||
"tegut" => Ok(Store::Tegut),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&str> for Account {
|
|
||||||
type Error = ();
|
|
||||||
|
|
||||||
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
|
||||||
match s {
|
|
||||||
"sumpf" => Ok(Account::Sumpf),
|
|
||||||
"hs" => Ok(Account::Heinersyndikat),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Into<String> for &Account {
|
|
||||||
fn into(self) -> String {
|
|
||||||
String::from(match *self {
|
|
||||||
Account::Sumpf => "sumpf",
|
|
||||||
Account::Heinersyndikat => "hs",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "server")]
|
|
||||||
impl ToSql for Store {
|
|
||||||
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
|
|
||||||
match self {
|
|
||||||
Store::Aldi => 0.to_sql(),
|
|
||||||
Store::Edeka => 1.to_sql(),
|
|
||||||
Store::Dm => 2.to_sql(),
|
|
||||||
Store::Lidl => 3.to_sql(),
|
|
||||||
Store::Rewe => 4.to_sql(),
|
|
||||||
Store::Tegut => 5.to_sql(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "server")]
|
|
||||||
impl ToSql for Account {
|
|
||||||
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
|
|
||||||
match self {
|
|
||||||
Account::Sumpf => 0.to_sql(),
|
|
||||||
Account::Heinersyndikat => 1.to_sql(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,11 +4,7 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"identifier": "de.mathebau.bkbh",
|
"identifier": "de.mathebau.bkbh",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "cd bkbh && trunk serve",
|
"frontendDist": "www"
|
||||||
"devUrl": "http://localhost:1420",
|
|
||||||
"beforeBuildCommand": "cd bkbh && trunk build",
|
|
||||||
"frontendDist": "www",
|
|
||||||
"features": ["tauri"]
|
|
||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
|
|
13
trunk.html
|
@ -1,13 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link data-trunk rel="scss" href="styles.scss" />
|
|
||||||
<link data-trunk rel="copy-dir" href="assets" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Darmstadt sagt Nein zur Bezahlkartei!</title>
|
|
||||||
<link data-trunk rel="rust" href="." data-bin="leptos" data-cargo-features="leptos" data-wasm-opt="4" data-weak-refs />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 7 KiB After Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
188
www/index.html
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="stylesheet" href="styles.css" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Darmstadt sagt Nein zur Bezahlkartei!</title>
|
||||||
|
<script type="module" src="main.js" defer></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="v-container" id="cafe" style="display: none">
|
||||||
|
<div id="cafe-voucher" style="display: none">
|
||||||
|
<h1 class="shout">
|
||||||
|
Sumpf
|
||||||
|
</h1>
|
||||||
|
<div class="h-container">
|
||||||
|
<form class="column" id="cafe-voucher-aldi">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/aldi.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="ALDI-Süd-Logo"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<form class="column" id="cafe-voucher-dm">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/dm.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="dm-Logo"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<form class="column" id="cafe-voucher-lidl">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/lidl.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Lidl-Logo"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<form class="column" id="cafe-voucher-rewe">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/rewe.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Rewe-Logo"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<form class="column" id="cafe-voucher-tegut">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/tegut.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Tegut-Logo"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="cafe-inventory" style="display: none">
|
||||||
|
<form>
|
||||||
|
<div style="display: contents">
|
||||||
|
<div class="labelled-input">
|
||||||
|
<input type="radio" id="cafe-inventory-acc-sumpf" name="cafe-inventory-acc" value="sumpf" required>
|
||||||
|
<label for="cafe-inventory-acc-sumpf">Sumpf</label>
|
||||||
|
</div>
|
||||||
|
<div class="labelled-input">
|
||||||
|
<input type="radio" id="cafe-inventory-acc-hs" name="cafe-inventory-acc" value="hs" required>
|
||||||
|
<label for="cafe-inventory-acc-hs">Heinersyndikat</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="display: contents">
|
||||||
|
<div class="labelled-input" id="cafe-inventory-aldi">
|
||||||
|
<label for="cafe-inventory-aldi">
|
||||||
|
<img
|
||||||
|
src="assets/aldi.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="ALDI-Süd-Logo"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="cafe-inventory-aldi" min="0">
|
||||||
|
</div>
|
||||||
|
<div class="labelled-input" id="cafe-inventory-dm">
|
||||||
|
<label for="cafe-inventory-dm">
|
||||||
|
<img
|
||||||
|
src="assets/dm.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="dm-Logo"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="cafe-inventory-dm" min="0">
|
||||||
|
</div>
|
||||||
|
<div class="labelled-input" id="cafe-inventory-lidl">
|
||||||
|
<label for="cafe-inventory-lidl">
|
||||||
|
<img
|
||||||
|
src="assets/lidl.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Lidl-Logo"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="cafe-inventory-lidl" min="0">
|
||||||
|
</div>
|
||||||
|
<div class="labelled-input" id="cafe-inventory-rewe">
|
||||||
|
<label for="cafe-inventory-rewe">
|
||||||
|
<img
|
||||||
|
src="assets/rewe.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Rewe-Logo"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="cafe-inventory-rewe" min="0">
|
||||||
|
</div>
|
||||||
|
<div class="labelled-input" id="cafe-inventory-tegut">
|
||||||
|
<label for="cafe-inventory-tegut">
|
||||||
|
<img
|
||||||
|
src="assets/tegut.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Tegut-Logo"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="cafe-inventory-tegut" min="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="labelled-input" id="cafe-inventory-cash">
|
||||||
|
<label for="cafe-inventory-cash">
|
||||||
|
<img
|
||||||
|
src="assets/cash.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Bargeld"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="cafe-inventory-cash" min="0" step=".01">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="shout">
|
||||||
|
Senden
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="v-container nav" id="cafe-nav">
|
||||||
|
<form id="cafe-nav-inventory">
|
||||||
|
<button type="submit">
|
||||||
|
<span class="shout">
|
||||||
|
Bestand
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<form id="cafe-nav-voucher">
|
||||||
|
<button type="submit">
|
||||||
|
<span class="shout">
|
||||||
|
Annahme
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="angel">
|
||||||
|
<div>
|
||||||
|
<form class="h-container">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="v-container nav" id="nav">
|
||||||
|
<form class="column" id="nav-cafe">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/cafe.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Tauschcafé"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<form class="column" id="nav-angel">
|
||||||
|
<button type="submit">
|
||||||
|
<img
|
||||||
|
src="assets/angel.svg"
|
||||||
|
class="logo"
|
||||||
|
alt="Botengang"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
67
www/main.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
const { invoke } = window.__TAURI__.core;
|
||||||
|
|
||||||
|
let callbacks = {
|
||||||
|
'#nav-cafe': () => activate("", "cafe", ["angel"]),
|
||||||
|
'#nav-angel': () => activate("", "angel", ["cafe"]),
|
||||||
|
'#cafe-nav-inventory': () => activate("cafe-", "inventory", ["voucher"]),
|
||||||
|
'#cafe-nav-voucher': () => activate("cafe-", "voucher", ["inventory"]),
|
||||||
|
'#cafe-inventory form': () => inventory(),
|
||||||
|
'#cafe-voucher-aldi': () => swap("aldi"),
|
||||||
|
'#cafe-voucher-dm': () => swap("dm"),
|
||||||
|
'#cafe-voucher-lidl': () => swap("lidl"),
|
||||||
|
'#cafe-voucher-rewe': () => swap("rewe"),
|
||||||
|
'#cafe-voucher-tegut': () => swap("tegut"),
|
||||||
|
}
|
||||||
|
let stores = [
|
||||||
|
"aldi",
|
||||||
|
"dm",
|
||||||
|
"lidl",
|
||||||
|
"rewe",
|
||||||
|
"tegut",
|
||||||
|
]
|
||||||
|
|
||||||
|
async function increment(el) {
|
||||||
|
var el = document.querySelector(el+" input");
|
||||||
|
let v = parseInt(el.value, 10);
|
||||||
|
v = isNaN(v) ? 0 : v;
|
||||||
|
v++;
|
||||||
|
el.value = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function inventory() {
|
||||||
|
const form = document.querySelector("#cafe-inventory form");
|
||||||
|
const fd = new FormData(form);
|
||||||
|
const obj = Object.fromEntries(fd);
|
||||||
|
await invoke("inventory", { data: obj });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function swap(s) {
|
||||||
|
await invoke("swap", { store: s, acc: 1 });
|
||||||
|
document.querySelector("h1").textContent = await invoke("count", {});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function activate(ctx, el, nels) {
|
||||||
|
document.querySelector("#"+ctx+el).style.display = "";
|
||||||
|
for (const nel of nels) {
|
||||||
|
document.querySelector("#"+ctx+nel).style.display = "none";
|
||||||
|
}
|
||||||
|
document.querySelector("#"+ctx+"nav").classList.remove("v-container");
|
||||||
|
document.querySelector("#"+ctx+"nav").classList.add("h-container");
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
for (let key in callbacks) {
|
||||||
|
if (callbacks.hasOwnProperty(key)) {
|
||||||
|
document.querySelector(key).addEventListener("submit", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
callbacks[key]();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const store of stores) {
|
||||||
|
document.querySelector("#cafe-inventory-"+store+" label").addEventListener("click", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
increment("#cafe-inventory-"+store);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
|
@ -106,8 +106,7 @@ input[type=number] {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=radio] {
|
input[type=radio] {
|
||||||
width: 100%;
|
height: 60%;
|
||||||
height: 7mm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
button:hover {
|