initial yew wasm app
This commit is contained in:
commit
4d46e985a5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
888
Cargo.lock
generated
Normal file
888
Cargo.lock
generated
Normal file
@ -0,0 +1,888 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anymap2"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bincode"
|
||||||
|
version = "1.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "boolinator"
|
||||||
|
version = "2.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "console_error_panic_hook"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "form_urlencoded"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
|
||||||
|
dependencies = [
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-channel"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-core"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-io"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-macro"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-sink"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-task"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-util"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"futures-macro",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"memchr",
|
||||||
|
"pin-project-lite",
|
||||||
|
"pin-utils",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a4bef6b277b3ab073253d4bca60761240cf8d6998f4bd142211957b69a61b20"
|
||||||
|
dependencies = [
|
||||||
|
"gloo-console",
|
||||||
|
"gloo-dialogs",
|
||||||
|
"gloo-events",
|
||||||
|
"gloo-file",
|
||||||
|
"gloo-history",
|
||||||
|
"gloo-net",
|
||||||
|
"gloo-render",
|
||||||
|
"gloo-storage",
|
||||||
|
"gloo-timers",
|
||||||
|
"gloo-utils",
|
||||||
|
"gloo-worker",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-console"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f"
|
||||||
|
dependencies = [
|
||||||
|
"gloo-utils",
|
||||||
|
"js-sys",
|
||||||
|
"serde",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-dialogs"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-events"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-file"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7"
|
||||||
|
dependencies = [
|
||||||
|
"gloo-events",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-history"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5ce5ae65c5d76e2bbd9f274d7dcc00a306a79964305efa275a0ac728caaeb792"
|
||||||
|
dependencies = [
|
||||||
|
"gloo-events",
|
||||||
|
"gloo-utils",
|
||||||
|
"serde",
|
||||||
|
"serde-wasm-bindgen",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"thiserror",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-net"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9050ff8617e950288d7bf7f300707639fdeda5ca0d0ecf380cff448cfd52f4a6"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"gloo-utils",
|
||||||
|
"js-sys",
|
||||||
|
"pin-project",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-render"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-storage"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480"
|
||||||
|
dependencies = [
|
||||||
|
"gloo-utils",
|
||||||
|
"js-sys",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-timers"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-utils"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gloo-worker"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a"
|
||||||
|
dependencies = [
|
||||||
|
"anymap2",
|
||||||
|
"bincode",
|
||||||
|
"gloo-console",
|
||||||
|
"gloo-utils",
|
||||||
|
"js-sys",
|
||||||
|
"serde",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "implicit-clone"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "40fc102e70475c320b185cd18c1e48bba2d7210b63970a4d581ef903e4368ef7"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "1.9.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.10.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.60"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.139"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_cpus"
|
||||||
|
version = "1.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
|
||||||
|
dependencies = [
|
||||||
|
"hermit-abi",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "percent-encoding"
|
||||||
|
version = "2.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project"
|
||||||
|
version = "1.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
|
||||||
|
dependencies = [
|
||||||
|
"pin-project-internal",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-internal"
|
||||||
|
version = "1.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-lite"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-utils"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pinned"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b"
|
||||||
|
dependencies = [
|
||||||
|
"futures",
|
||||||
|
"rustversion",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prettyplease"
|
||||||
|
version = "0.1.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro-error"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-error-attr",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro-error-attr"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.49"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prokio"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488"
|
||||||
|
dependencies = [
|
||||||
|
"futures",
|
||||||
|
"gloo",
|
||||||
|
"num_cpus",
|
||||||
|
"once_cell",
|
||||||
|
"pin-project",
|
||||||
|
"pinned",
|
||||||
|
"tokio",
|
||||||
|
"tokio-stream",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.152"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde-wasm-bindgen"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "618365e8e586c22123d692b72a7d791d5ee697817b65a218cdf12a98870af0f7"
|
||||||
|
dependencies = [
|
||||||
|
"fnv",
|
||||||
|
"js-sys",
|
||||||
|
"serde",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.152"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.91"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_urlencoded"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "solawis-yew"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"gloo-console",
|
||||||
|
"gloo-net",
|
||||||
|
"implicit-clone",
|
||||||
|
"itertools",
|
||||||
|
"serde",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"yew",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.107"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.38"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "1.0.38"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio"
|
||||||
|
version = "1.23.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"pin-project-lite",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-stream"
|
||||||
|
version = "0.1.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing"
|
||||||
|
version = "0.1.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tracing-attributes",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-attributes"
|
||||||
|
version = "0.1.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-core"
|
||||||
|
version = "0.1.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-backend"
|
||||||
|
version = "0.2.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-futures"
|
||||||
|
version = "0.4.33"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-sys"
|
||||||
|
version = "0.3.60"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.42.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yew"
|
||||||
|
version = "0.20.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc"
|
||||||
|
dependencies = [
|
||||||
|
"console_error_panic_hook",
|
||||||
|
"futures",
|
||||||
|
"gloo",
|
||||||
|
"implicit-clone",
|
||||||
|
"indexmap",
|
||||||
|
"js-sys",
|
||||||
|
"prokio",
|
||||||
|
"rustversion",
|
||||||
|
"serde",
|
||||||
|
"slab",
|
||||||
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"yew-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yew-macro"
|
||||||
|
version = "0.20.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301"
|
||||||
|
dependencies = [
|
||||||
|
"boolinator",
|
||||||
|
"once_cell",
|
||||||
|
"prettyplease",
|
||||||
|
"proc-macro-error",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
16
Cargo.toml
Normal file
16
Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "solawis-yew"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
yew = { version = "0.20.0", features = ["csr"] }
|
||||||
|
web-sys = "*"
|
||||||
|
gloo-net = "*"
|
||||||
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
wasm-bindgen-futures = "0.4"
|
||||||
|
implicit-clone = "*"
|
||||||
|
gloo-console = "*"
|
||||||
|
itertools = "*"
|
1
divnode.html
Normal file
1
divnode.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div id="mana"></div>
|
13
index.html
Normal file
13
index.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>My first Sycamore app</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<link data-trunk rel="inline" href="divnode.html" />
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
121
src/filter_menu.rs
Normal file
121
src/filter_menu.rs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
use web_sys::HtmlInputElement;
|
||||||
|
use yew::prelude::*;
|
||||||
|
|
||||||
|
#[derive(PartialEq, Debug, Default)]
|
||||||
|
pub enum AnteilsTyp {
|
||||||
|
#[default]
|
||||||
|
Anmeldungen,
|
||||||
|
Gebote,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Debug, Default)]
|
||||||
|
pub struct PersonenFilter {
|
||||||
|
pub stammmitglied_alter_vp: bool,
|
||||||
|
pub stammmitglied_neuer_vp: bool,
|
||||||
|
pub neumitglied: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Properties, PartialEq, Debug, Default)]
|
||||||
|
pub struct ZuordnungsFilter {
|
||||||
|
#[prop_or_default]
|
||||||
|
pub jahr: Option<u32>,
|
||||||
|
#[prop_or_default]
|
||||||
|
pub ernte_anteile: AnteilsTyp,
|
||||||
|
#[prop_or_default]
|
||||||
|
pub personen: PersonenFilter,
|
||||||
|
pub callback_jahr: Callback<Option<u32>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum FilterMessages {}
|
||||||
|
|
||||||
|
pub struct Filter {
|
||||||
|
pub jahr_node: NodeRef,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Component for Filter {
|
||||||
|
type Message = FilterMessages;
|
||||||
|
|
||||||
|
type Properties = ZuordnungsFilter;
|
||||||
|
|
||||||
|
fn create(_ctx: &Context<Self>) -> Self {
|
||||||
|
Self {
|
||||||
|
jahr_node: NodeRef::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||||
|
let jahre: Html = (2020..2035)
|
||||||
|
.into_iter()
|
||||||
|
.map(|x| {
|
||||||
|
html! {<option value={x.to_string()} key={x}>
|
||||||
|
{x}
|
||||||
|
</option>}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let on_change_year = {
|
||||||
|
let node = self.jahr_node.clone();
|
||||||
|
ctx.props().callback_jahr.reform(move |_| {
|
||||||
|
let jahr = node.cast::<HtmlInputElement>()?;
|
||||||
|
let jahr = jahr.value().parse().ok()?;
|
||||||
|
Some(jahr)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
html! {
|
||||||
|
<>
|
||||||
|
<div class="container-fluid border border-light bg-light bg-gradient">
|
||||||
|
<form action="" method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4 d-flex justify-content-end">
|
||||||
|
<label for="filterjahr">
|
||||||
|
<b>{"Zuordnung für Saison"}</b>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select class="form-select" name="filterjahr" id="filterjahr" ref={&self.jahr_node} onchange={on_change_year}>
|
||||||
|
<option value="None" selected=true >{"Nicht ausgewählt"}</option>
|
||||||
|
{jahre}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4 d-flex justify-content-end">
|
||||||
|
<b> {"Zeige Ernteanteile"} </b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
{radio("radio_anteile_anmeldung".into(), "auf Basis der Anmeldungen".into() )}
|
||||||
|
{radio("radio_anteile_gebote".into(), "auf Basis der Gebote".into() )}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4 d-flex justify-content-end">
|
||||||
|
<b> {"Zeige Personen"} </b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
{check("check_bestandsmitglied_selberVP".to_string(), "Stammmitglieder, unveränderter VP-Erstwunsch".to_string())}
|
||||||
|
{check("check_bestandsmitglied_neuerVP".to_string(), "Stammmitglieder, neuer VP-Erstwunsch".to_string())}
|
||||||
|
{check("check_neueinsteiger".to_string(), "Neueinsteiger".to_string())}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</>}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn radio(id: AttrValue, text: AttrValue) -> Html {
|
||||||
|
html! {
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio" name={id.clone()} id={id.clone()} checked=false />
|
||||||
|
<label class="form-check-label" for={id}>{text}</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn check(id: String, text: String) -> Html {
|
||||||
|
html! {
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name={id.clone()} id={id.clone()} checked=false />
|
||||||
|
<label class="form-check-label" for={id}>{text}</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
18
src/main.rs
Normal file
18
src/main.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
use web_sys::window;
|
||||||
|
use zuordnung::ZuordnungApp;
|
||||||
|
|
||||||
|
mod filter_menu;
|
||||||
|
mod requests;
|
||||||
|
mod types;
|
||||||
|
mod zuordnung;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// get the window object
|
||||||
|
let window = window().unwrap();
|
||||||
|
// get the document object
|
||||||
|
let document = window.document().unwrap();
|
||||||
|
// get the element with the id "mana"
|
||||||
|
let element = document.get_element_by_id("mana").unwrap();
|
||||||
|
|
||||||
|
yew::Renderer::<ZuordnungApp>::with_root(element).render();
|
||||||
|
}
|
46
src/requests.rs
Normal file
46
src/requests.rs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use gloo_net::http::Request;
|
||||||
|
|
||||||
|
use crate::zuordnung::{NetworkObjekte, ZuordnungMessage};
|
||||||
|
|
||||||
|
/// A helper function that sends a request to the specified URL and returns a ZuordnungMessage with the
|
||||||
|
/// given network object and the response.
|
||||||
|
async fn fetch_data(url: &str, network_object: NetworkObjekte) -> ZuordnungMessage {
|
||||||
|
// Send the request to the specified URL.
|
||||||
|
let response = Request::new(url).send().await;
|
||||||
|
// Return the ZuordnungMessage with the given network object and the response.
|
||||||
|
ZuordnungMessage::Recieved(network_object, response)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn fetch_verteilpunkte() -> ZuordnungMessage {
|
||||||
|
fetch_data(
|
||||||
|
"/orga/api/verteilpunkte/",
|
||||||
|
NetworkObjekte::Verteilpunkt(HashMap::new()),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn fetch_wünsche(jahr: u32) -> ZuordnungMessage {
|
||||||
|
fetch_data(
|
||||||
|
&format!("/orga/api/wuensche/{}/", jahr),
|
||||||
|
NetworkObjekte::Wunsch(None),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn fetch_user(jahr: u32) -> ZuordnungMessage {
|
||||||
|
fetch_data(
|
||||||
|
&format!("/orga/api/benutzer/{}/", jahr),
|
||||||
|
NetworkObjekte::User(None),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn fetch_zuordnung(jahr: u32) -> ZuordnungMessage {
|
||||||
|
fetch_data(
|
||||||
|
&format!("/orga/api/zuordnung_jahr/{}/", jahr),
|
||||||
|
NetworkObjekte::ZuordnungVorjahr(None),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
68
src/types.rs
Normal file
68
src/types.rs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug)]
|
||||||
|
pub struct Daten {
|
||||||
|
pub vps: Vec<i32>,
|
||||||
|
pub anfragen: Vec<GemüseAnfrage>,
|
||||||
|
pub wuensche: Vec<VpWunsch>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Hash, Eq)]
|
||||||
|
pub struct GemüseAnfrage {
|
||||||
|
pub id: u32,
|
||||||
|
pub anteile: u32,
|
||||||
|
pub user: Benutzer,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Hash, Eq)]
|
||||||
|
pub struct VpWunsch {
|
||||||
|
pub id: i32,
|
||||||
|
pub anfrage_id: i32,
|
||||||
|
pub user_id: i32,
|
||||||
|
pub verteilpunkt_id: i32,
|
||||||
|
pub prioritaet: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct Wünsche {
|
||||||
|
pub wünsche: HashMap<i32, VpWunsch>,
|
||||||
|
pub prioritäten: Vec<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Verteilpunkt {
|
||||||
|
pub id: i32,
|
||||||
|
pub name: String,
|
||||||
|
pub kapazitaet: u32,
|
||||||
|
pub anzahl_mitglieder: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Benutzer {
|
||||||
|
pub vorname: String,
|
||||||
|
pub nachname: String,
|
||||||
|
pub mitgliedsnummer: i32,
|
||||||
|
pub gemüseanfragen: Vec<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Hash, Eq)]
|
||||||
|
pub struct VpZuordnung {
|
||||||
|
pub mitgliedschaft_id: i32,
|
||||||
|
pub user_mitgliedsnummer: i32,
|
||||||
|
pub verteilpunkt_id: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct JahresVpZuordnung {
|
||||||
|
pub jahr: i32,
|
||||||
|
pub zuordnungen: HashMap<i32, VpZuordnung>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Hash, Eq)]
|
||||||
|
pub struct GeplanteVpZuordnung {
|
||||||
|
pub mitgliedschaft_id: i32,
|
||||||
|
pub user_mitgliedsnummer: i32,
|
||||||
|
pub verteilpunkt_id: i32,
|
||||||
|
}
|
378
src/zuordnung.rs
Normal file
378
src/zuordnung.rs
Normal file
@ -0,0 +1,378 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use gloo_console::log;
|
||||||
|
use gloo_net::http::Response;
|
||||||
|
use itertools::Itertools;
|
||||||
|
use yew::{prelude::*, Component, Properties};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
filter_menu::Filter,
|
||||||
|
requests,
|
||||||
|
types::{
|
||||||
|
Benutzer, GeplanteVpZuordnung, JahresVpZuordnung, Verteilpunkt, VpWunsch, VpZuordnung,
|
||||||
|
Wünsche,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
/// An enumeration representing different types of data that can be received from the server.
|
||||||
|
pub enum NetworkObjekte {
|
||||||
|
/// Distribution point data.
|
||||||
|
Verteilpunkt(HashMap<i32, Verteilpunkt>),
|
||||||
|
/// Wish data.
|
||||||
|
Wunsch(Option<Wünsche>),
|
||||||
|
/// User data.
|
||||||
|
User(Option<HashMap<i32, Benutzer>>),
|
||||||
|
/// Previous year's assignment data.
|
||||||
|
ZuordnungVorjahr(Option<JahresVpZuordnung>),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An enumeration representing messages that can be passed between the model and the view.
|
||||||
|
pub enum ZuordnungMessage {
|
||||||
|
/// A message requesting data from the server.
|
||||||
|
Get,
|
||||||
|
/// A message indicating that data has been received from the server.
|
||||||
|
Recieved(NetworkObjekte, Result<Response, gloo_net::Error>),
|
||||||
|
/// A message indicating that data has been parsed.
|
||||||
|
Parsed(NetworkObjekte),
|
||||||
|
/// A message indicating that the year has been updated.
|
||||||
|
UpdatedJahr(Option<u32>),
|
||||||
|
/// A message indicating that a dialog should be displayed.
|
||||||
|
ShowDialog(Dialog),
|
||||||
|
/// A message indicating that the current dialog should be hidden.
|
||||||
|
HideDialog,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Dialog {
|
||||||
|
pub title: String,
|
||||||
|
pub content: DialogContent,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum DialogContent {
|
||||||
|
Wunschliste(Vec<VpWunsch>),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Properties, PartialEq, Default)]
|
||||||
|
pub struct ZuordnungProps {}
|
||||||
|
|
||||||
|
/// A struct representing the state of the assignment app.
|
||||||
|
pub struct ZuordnungApp {
|
||||||
|
/// The year for which assignments are being made.
|
||||||
|
jahr: u32,
|
||||||
|
/// A mapping from distribution point IDs to distribution point objects.
|
||||||
|
verteilpunkte: HashMap<i32, Verteilpunkt>,
|
||||||
|
/// The list of wishes made by users.
|
||||||
|
wünsche: Option<Wünsche>,
|
||||||
|
/// A mapping from user IDs to user objects.
|
||||||
|
user: Option<HashMap<i32, Benutzer>>,
|
||||||
|
/// The assignments made for the previous year.
|
||||||
|
zuordnung_vorjahr: Option<JahresVpZuordnung>,
|
||||||
|
/// The planned assignments for the current year.
|
||||||
|
geplante_zuordnung: HashMap<i32, GeplanteVpZuordnung>,
|
||||||
|
/// The currently displayed dialog.
|
||||||
|
dialog: Option<Dialog>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Component for ZuordnungApp {
|
||||||
|
type Message = ZuordnungMessage;
|
||||||
|
|
||||||
|
type Properties = ZuordnungProps;
|
||||||
|
|
||||||
|
fn create(ctx: &yew::Context<Self>) -> Self {
|
||||||
|
ctx.link().send_message(ZuordnungMessage::Get);
|
||||||
|
Self {
|
||||||
|
jahr: 0,
|
||||||
|
verteilpunkte: HashMap::new(),
|
||||||
|
wünsche: None,
|
||||||
|
user: None,
|
||||||
|
zuordnung_vorjahr: None,
|
||||||
|
geplante_zuordnung: HashMap::new(),
|
||||||
|
dialog: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||||
|
match msg {
|
||||||
|
ZuordnungMessage::Get => {
|
||||||
|
ctx.link().send_future(requests::fetch_verteilpunkte());
|
||||||
|
log!("Update der Verteilpunkte");
|
||||||
|
false
|
||||||
|
}
|
||||||
|
ZuordnungMessage::Recieved(t, e) => {
|
||||||
|
ctx.link().send_future(async move {
|
||||||
|
let network_objekt = match t {
|
||||||
|
NetworkObjekte::Verteilpunkt(_) => {
|
||||||
|
let response = e.unwrap().json().await;
|
||||||
|
NetworkObjekte::Verteilpunkt(response.unwrap())
|
||||||
|
}
|
||||||
|
NetworkObjekte::Wunsch(_) => {
|
||||||
|
let response = e.unwrap().json().await;
|
||||||
|
NetworkObjekte::Wunsch(Some(response.unwrap()))
|
||||||
|
}
|
||||||
|
NetworkObjekte::User(_) => {
|
||||||
|
let response = e.unwrap().json().await;
|
||||||
|
NetworkObjekte::User(Some(response.unwrap()))
|
||||||
|
}
|
||||||
|
NetworkObjekte::ZuordnungVorjahr(_) => {
|
||||||
|
let response = e.unwrap().json().await;
|
||||||
|
NetworkObjekte::ZuordnungVorjahr(Some(response.unwrap()))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ZuordnungMessage::Parsed(network_objekt)
|
||||||
|
});
|
||||||
|
log!("received");
|
||||||
|
true
|
||||||
|
}
|
||||||
|
ZuordnungMessage::UpdatedJahr(jahr) => {
|
||||||
|
log!("Test updated to {}", jahr);
|
||||||
|
if let Some(jahr) = jahr {
|
||||||
|
self.jahr = jahr;
|
||||||
|
ctx.link().send_future(requests::fetch_wünsche(jahr));
|
||||||
|
ctx.link().send_future(requests::fetch_user(jahr));
|
||||||
|
ctx.link().send_future(requests::fetch_zuordnung(jahr - 1));
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ZuordnungMessage::Parsed(t) => match t {
|
||||||
|
NetworkObjekte::Verteilpunkt(v) => {
|
||||||
|
log!("Verteilpunkte geparsed");
|
||||||
|
self.verteilpunkte = v;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
NetworkObjekte::Wunsch(v) => {
|
||||||
|
log!("Wünsche geparsed!");
|
||||||
|
self.wünsche = v;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
NetworkObjekte::User(v) => {
|
||||||
|
log!("User geparsed");
|
||||||
|
self.user = v;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
NetworkObjekte::ZuordnungVorjahr(v) => {
|
||||||
|
log!("Vorjahreszuordnung geparsed");
|
||||||
|
self.zuordnung_vorjahr = v;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ZuordnungMessage::ShowDialog(dialog) => {
|
||||||
|
self.dialog = Some(dialog);
|
||||||
|
true
|
||||||
|
}
|
||||||
|
ZuordnungMessage::HideDialog => {
|
||||||
|
self.dialog = None;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
|
||||||
|
let callback_jahr = ctx.link().callback(ZuordnungMessage::UpdatedJahr);
|
||||||
|
|
||||||
|
html! {<>
|
||||||
|
<h1>{"Verteilpunktzuordnung"}{if self.jahr>2000 {html!{<>{" für das Jahr "} {self.jahr}</>}}else{html!{}}}</h1>
|
||||||
|
<div class="filter"><Filter {callback_jahr}/></div>
|
||||||
|
{
|
||||||
|
if self.wünsche.is_some(){html!{
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-hover">
|
||||||
|
<thead class="table-dark">
|
||||||
|
{self.tabellen_überschrift(&self.wünsche)}
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{self.verteilpunkte
|
||||||
|
.iter()
|
||||||
|
.map(|(id, v)| html! {
|
||||||
|
<tr>
|
||||||
|
<td>{self.verteilpunkt_name(v)}</td>
|
||||||
|
<td>{self.aktuelle_mitglieder(v, &self.zuordnung_vorjahr)}</td>
|
||||||
|
<td>{self.zukünftige_mitglieder(v)}</td>
|
||||||
|
{self.count_wünsche(*id, ctx)}
|
||||||
|
</tr>
|
||||||
|
})
|
||||||
|
.collect::<Html>()}
|
||||||
|
</tbody></table>
|
||||||
|
{{self.show_dialog( ctx)}}
|
||||||
|
</div>}}else{html!{<h3 style="padding-top: 100px; text-align:center;">{"Es ist keine Saison ausgewählt"}</h3>}}}</>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl ZuordnungApp {
|
||||||
|
fn count_wünsche(&self, verteilpunkt_id: i32, ctx: &yew::Context<ZuordnungApp>) -> Html {
|
||||||
|
// Erst wenn die Wünsche geladen sind wird etwas angezeigt.
|
||||||
|
if let Some(wünsche) = &self.wünsche {
|
||||||
|
// zähle nur die wünsche für den aktuellen Verteilpunkt
|
||||||
|
let filtered = wünsche
|
||||||
|
.wünsche
|
||||||
|
.iter()
|
||||||
|
.filter(|(_, wunsch)| wunsch.verteilpunkt_id == verteilpunkt_id);
|
||||||
|
// A mapping from priority values to lists of wishes.
|
||||||
|
let counts: HashMap<i32, Vec<VpWunsch>> = wünsche
|
||||||
|
.prioritäten
|
||||||
|
.iter()
|
||||||
|
.map(|prio| (*prio, Vec::new()))
|
||||||
|
.collect();
|
||||||
|
let counts: HashMap<i32, Vec<VpWunsch>> =
|
||||||
|
filtered.fold(counts, |mut counts, (_, wunsch)| {
|
||||||
|
counts
|
||||||
|
.entry(wunsch.prioritaet)
|
||||||
|
.or_insert_with(Vec::new)
|
||||||
|
.push(wunsch.clone());
|
||||||
|
counts
|
||||||
|
});
|
||||||
|
// sortiere nach Priorität
|
||||||
|
let sorted_and_grouped_by_priority = counts.into_iter().sorted_by_key(|x| x.0);
|
||||||
|
|
||||||
|
sorted_and_grouped_by_priority
|
||||||
|
.into_iter()
|
||||||
|
.map(|(_priorität, wunsch)| {
|
||||||
|
let length = wunsch.len();
|
||||||
|
let verteilpunkte = self.verteilpunkte.clone();
|
||||||
|
|
||||||
|
let onclick = ctx.link().callback(move |_| {
|
||||||
|
ZuordnungMessage::ShowDialog(Dialog {
|
||||||
|
title: {
|
||||||
|
let vp = verteilpunkte
|
||||||
|
.get(&verteilpunkt_id)
|
||||||
|
.expect("should allways be there");
|
||||||
|
format!("Wünsche für {}", vp.name)
|
||||||
|
},
|
||||||
|
content: DialogContent::Wunschliste(wunsch.clone()),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
html! {<td><b {onclick}>{length}</b></td>}
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
} else {
|
||||||
|
html!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tabellen_überschrift(&self, wünsche: &Option<Wünsche>) -> Html {
|
||||||
|
// Generate the HTML for the wish priorities
|
||||||
|
fn wünsche_überschrift(prioritäten: &[i32]) -> Html {
|
||||||
|
prioritäten
|
||||||
|
.iter()
|
||||||
|
.map(|id| html! {<th>{id}{". Wunsch"}</th>})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
match wünsche {
|
||||||
|
Some(wünsche) => {
|
||||||
|
let wünsche_überschrift = wünsche_überschrift(&wünsche.prioritäten);
|
||||||
|
|
||||||
|
// Render the table header
|
||||||
|
html! {
|
||||||
|
<>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">{"Verteilpunkt"}</th>
|
||||||
|
<th scope="col" colspan="2">{"Mitglieder"}</th>
|
||||||
|
<th scope="col" colspan={wünsche.prioritäten.len().to_string()}>{"Nicht zugeordnete Bieter"}</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"></th>
|
||||||
|
<th scope="col">{"aktuell"}</th>
|
||||||
|
<th scope="col">{"zukünftig"}</th>
|
||||||
|
{wünsche_überschrift}
|
||||||
|
</tr></>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => html!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn verteilpunkt_name(&self, verteilpunkt: &Verteilpunkt) -> Html {
|
||||||
|
// Render a div with a checkbox and label
|
||||||
|
html! {
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
role="switch"
|
||||||
|
id="flexSwitchCheckChecked2"
|
||||||
|
checked=true />
|
||||||
|
<label class="form-check-label" for="flexSwitchCheckChecked">{&verteilpunkt.name}</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn aktuelle_mitglieder(&self, v: &Verteilpunkt, z: &Option<JahresVpZuordnung>) -> Html {
|
||||||
|
// Count the number of items in the zuordnungen map with the matching verteilpunkt_id
|
||||||
|
fn count_zuordnungen(v: &Verteilpunkt, zuordnungen: &HashMap<i32, VpZuordnung>) -> usize {
|
||||||
|
zuordnungen
|
||||||
|
.iter()
|
||||||
|
.filter(|(_, zuo)| v.id == zuo.verteilpunkt_id)
|
||||||
|
.count()
|
||||||
|
}
|
||||||
|
|
||||||
|
match z {
|
||||||
|
Some(z) => {
|
||||||
|
// Render the count and the kapazitaet as "X/Y"
|
||||||
|
let count = count_zuordnungen(v, &z.zuordnungen);
|
||||||
|
html! {<>{count}{"/"} {v.kapazitaet}</>}
|
||||||
|
}
|
||||||
|
None => html!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn zukünftige_mitglieder(&self, verteilpunkt: &Verteilpunkt) -> Html {
|
||||||
|
// Count the number of items in the z map with the matching verteilpunkt_id
|
||||||
|
let count = &self
|
||||||
|
.geplante_zuordnung
|
||||||
|
.iter()
|
||||||
|
.filter(|(_, zuo)| verteilpunkt.id == zuo.verteilpunkt_id)
|
||||||
|
.count();
|
||||||
|
|
||||||
|
// Render the count and the kapazitaet as "X/Y"
|
||||||
|
html! {<>{count}{"/"} {verteilpunkt.kapazitaet}</>}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn show_dialog(&self, ctx: &yew::Context<Self>) -> Html {
|
||||||
|
match &self.dialog {
|
||||||
|
Some(dialog) => {
|
||||||
|
// Create a callback that calls the HideDialog function when triggered
|
||||||
|
let onclick = ctx.link().callback(|_| ZuordnungMessage::HideDialog);
|
||||||
|
|
||||||
|
html! {
|
||||||
|
// Render the dialog container with the onclick callback attached
|
||||||
|
<div class="modal_wasm" {onclick}>
|
||||||
|
<div class="container">
|
||||||
|
<div class="body">
|
||||||
|
// Render the dialog title
|
||||||
|
<h3>{&dialog.title}</h3>
|
||||||
|
// Render the dialog content
|
||||||
|
{self.show_dialog_content(&dialog.content)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => html! {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn show_dialog_content(&self, content: &DialogContent) -> Html {
|
||||||
|
match content {
|
||||||
|
DialogContent::Wunschliste(content) => {
|
||||||
|
let mut htmlnodes = Vec::new();
|
||||||
|
|
||||||
|
// Iterate over each wish in the list
|
||||||
|
for wunsch in content {
|
||||||
|
// Find the user associated with this wish
|
||||||
|
let user = match &self.user {
|
||||||
|
Some(users) => match users.get(&wunsch.user_id) {
|
||||||
|
Some(user) => user,
|
||||||
|
None => continue, // Skip this wish if the user is not found
|
||||||
|
},
|
||||||
|
None => continue, // Skip this wish if self.user is not set
|
||||||
|
};
|
||||||
|
|
||||||
|
// Append the user's first and last name to the HTML
|
||||||
|
htmlnodes
|
||||||
|
.push(html! {<tr><td>{&user.vorname}</td><td>{&user.nachname}</td></tr>});
|
||||||
|
}
|
||||||
|
|
||||||
|
html! {{ htmlnodes.into_iter().collect::<Html>() }}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user