From 0d7d20829623b14c8ea5284bc24e63f7c31d61b7 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 30 Aug 2023 15:15:31 +0530 Subject: renamed client to customer --- Cargo.lock | 289 +++++++++++++++++++++++++++--- Cargo.toml | 3 +- css/manage/_client.scss | 53 ------ css/manage/_customer.scss | 53 ++++++ css/styles.scss | 2 +- src/app/manage/client/list/address.rs | 37 ---- src/app/manage/client/list/list_item.rs | 38 ---- src/app/manage/client/list/mod.rs | 51 ------ src/app/manage/client/mod.rs | 81 --------- src/app/manage/customer/list/address.rs | 37 ++++ src/app/manage/customer/list/list_item.rs | 38 ++++ src/app/manage/customer/list/mod.rs | 51 ++++++ src/app/manage/customer/mod.rs | 81 +++++++++ src/app/manage/mod.rs | 8 +- src/app/mod.rs | 6 +- src/components/navbar/nav.rs | 20 ++- src/models/client.rs | 83 --------- src/models/customer.rs | 83 +++++++++ src/models/mod.rs | 2 +- 19 files changed, 634 insertions(+), 382 deletions(-) delete mode 100644 css/manage/_client.scss create mode 100644 css/manage/_customer.scss delete mode 100644 src/app/manage/client/list/address.rs delete mode 100644 src/app/manage/client/list/list_item.rs delete mode 100644 src/app/manage/client/list/mod.rs delete mode 100644 src/app/manage/client/mod.rs create mode 100644 src/app/manage/customer/list/address.rs create mode 100644 src/app/manage/customer/list/list_item.rs create mode 100644 src/app/manage/customer/list/mod.rs create mode 100644 src/app/manage/customer/mod.rs delete mode 100644 src/models/client.rs create mode 100644 src/models/customer.rs diff --git a/Cargo.lock b/Cargo.lock index 01f4954..d90ee43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,6 +93,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "fnv" version = "1.0.7" @@ -197,17 +203,36 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" dependencies = [ - "gloo-console", - "gloo-dialogs", - "gloo-events", - "gloo-file", - "gloo-history", - "gloo-net", - "gloo-render", - "gloo-storage", - "gloo-timers", - "gloo-utils", - "gloo-worker", + "gloo-console 0.2.3", + "gloo-dialogs 0.1.1", + "gloo-events 0.1.2", + "gloo-file 0.2.3", + "gloo-history 0.1.4", + "gloo-net 0.3.0", + "gloo-render 0.1.1", + "gloo-storage 0.2.2", + "gloo-timers 0.2.6", + "gloo-utils 0.1.7", + "gloo-worker 0.2.1", +] + +[[package]] +name = "gloo" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd35526c28cc55c1db77aed6296de58677dbab863b118483a27845631d870249" +dependencies = [ + "gloo-console 0.3.0", + "gloo-dialogs 0.2.0", + "gloo-events 0.2.0", + "gloo-file 0.3.0", + "gloo-history 0.2.0", + "gloo-net 0.4.0", + "gloo-render 0.2.0", + "gloo-storage 0.3.0", + "gloo-timers 0.3.0", + "gloo-utils 0.2.0", + "gloo-worker 0.4.0", ] [[package]] @@ -216,7 +241,20 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" dependencies = [ - "gloo-utils", + "gloo-utils 0.1.7", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-console" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a17868f56b4a24f677b17c8cb69958385102fa879418052d60b50bc1727e261" +dependencies = [ + "gloo-utils 0.2.0", "js-sys", "serde", "wasm-bindgen", @@ -233,6 +271,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-dialogs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4748e10122b01435750ff530095b1217cf6546173459448b83913ebe7815df" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-events" version = "0.1.2" @@ -243,6 +291,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-events" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27c26fb45f7c385ba980f5fa87ac677e363949e065a083722697ef1b2cc91e41" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-file" version = "0.2.3" @@ -250,7 +308,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" dependencies = [ "futures-channel", - "gloo-events", + "gloo-events 0.1.2", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97563d71863fb2824b2e974e754a81d19c4a7ec47b09ced8a0e6656b6d54bd1f" +dependencies = [ + "gloo-events 0.2.0", "js-sys", "wasm-bindgen", "web-sys", @@ -262,8 +332,24 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfd137a4b629e72b8c949ec56c71ea9bd5491cc66358a0a7787e94875feec71" dependencies = [ - "gloo-events", - "gloo-utils", + "gloo-events 0.1.2", + "gloo-utils 0.1.7", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91be9f3dd048f35a59c8de3d716ef6d568360078c73ed35a7700776ed53153c8" +dependencies = [ + "gloo-events 0.2.0", + "gloo-utils 0.2.0", "serde", "serde-wasm-bindgen", "serde_urlencoded", @@ -281,7 +367,28 @@ dependencies = [ "futures-channel", "futures-core", "futures-sink", - "gloo-utils", + "gloo-utils 0.1.7", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils 0.2.0", "http", "js-sys", "pin-project", @@ -303,13 +410,38 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-render" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56008b6744713a8e8d98ac3dcb7d06543d5662358c9c805b4ce2167ad4649833" +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", + "gloo-utils 0.1.7", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc8031e8c92758af912f9bc08fbbadd3c6f3cfcbf6b64cdf3d6a81f0139277a" +dependencies = [ + "gloo-utils 0.2.0", "js-sys", "serde", "serde_json", @@ -330,6 +462,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "gloo-utils" version = "0.1.7" @@ -343,6 +485,19 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-worker" version = "0.2.1" @@ -351,8 +506,8 @@ checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" dependencies = [ "anymap2", "bincode", - "gloo-console", - "gloo-utils", + "gloo-console 0.2.3", + "gloo-utils 0.1.7", "js-sys", "serde", "wasm-bindgen", @@ -360,12 +515,49 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-worker" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76495d3dd87de51da268fa3a593da118ab43eb7f8809e17eb38d3319b424e400" +dependencies = [ + "bincode", + "futures", + "gloo-utils 0.2.0", + "gloo-worker-macros", + "js-sys", + "pinned", + "serde", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-worker-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956caa58d4857bc9941749d55e4bd3000032d8212762586fa5705632967140e7" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.26", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "hermit-abi" version = "0.3.2" @@ -389,7 +581,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40fc102e70475c320b185cd18c1e48bba2d7210b63970a4d581ef903e4368ef7" dependencies = [ - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -399,7 +591,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -473,6 +675,7 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" name = "openbills-web" version = "0.0.1" dependencies = [ + "gloo 0.10.0", "yew", "yew-router", "yew_icons", @@ -537,6 +740,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -577,7 +790,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" dependencies = [ "futures", - "gloo", + "gloo 0.8.1", "num_cpus", "once_cell", "pin-project", @@ -747,6 +960,23 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "toml_datetime", + "winnow", +] + [[package]] name = "tracing" version = "0.1.37" @@ -867,6 +1097,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "winnow" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +dependencies = [ + "memchr", +] + [[package]] name = "yew" version = "0.20.0" @@ -875,9 +1114,9 @@ checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc" dependencies = [ "console_error_panic_hook", "futures", - "gloo", + "gloo 0.8.1", "implicit-clone", - "indexmap", + "indexmap 1.9.3", "js-sys", "prokio", "rustversion", @@ -913,7 +1152,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "426ee0486d2572a6c5e39fbdbc48b58d59bb555f3326f54631025266cf04146e" dependencies = [ - "gloo", + "gloo 0.8.1", "js-sys", "route-recognizer", "serde", diff --git a/Cargo.toml b/Cargo.toml index 0aecc15..57885a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,5 @@ categories = ["gui", "wasm", "web-programming"] [dependencies] yew = { version="0.20", features=["csr"] } yew_icons = { version = "0.7", features = [ "FontAwesomeSolidCartShopping", "FontAwesomeSolidUser", "FontAwesomeSolidIndustry", "FontAwesomeSolidFileInvoice", "FontAwesomeSolidHouseChimney", "FontAwesomeSolidGear", "FontAwesomeSolidPlus", "FontAwesomeSolidMagnifyingGlass", "FontAwesomeSolidMountainSun" ] } - yew-router = "0.17" - +gloo = "0.10.0" diff --git a/css/manage/_client.scss b/css/manage/_client.scss deleted file mode 100644 index c16a5fe..0000000 --- a/css/manage/_client.scss +++ /dev/null @@ -1,53 +0,0 @@ -#manage-client-page { - //$h: calc(var(--nav-height) + calc(var(--main-padding) * 2)); - //height: calc(100vh - $h); - width: 100%; - - .clients-list-wrapper { - $header-height: 3rem; - $list-item-height: 2.5rem; - $pd: 0.7em; - position: relative; - - .clients-list-header, .clients-list-item { - display: grid; - grid-template-columns: 5rem 2fr 1fr 1fr; - padding: 0 $pd; - align-items: center; - } - - .clients-list-header { - $br: $pd; - background-color: var(--body-bg-alt); - width: 100%; - height: $header-height; - position: absolute; - top: 0; - left: 0; - border-bottom: 1px solid var(--link-fg); - font-weight: bold; - font-size: 1.2em; - border-radius: $br $br 0 0; - } - - .clients-list { - border: 1px solid var(--body-bg-alt); - min-height: 40rem; - max-height: 75vh; - overflow-y: scroll; - width: 100%; - position: absolute; - top: $header-height; - left: 0; - - .clients-list-item { - grid-template-rows: $list-item-height; - font-size: 1.2em; - } - - .clients-list-item:nth-child(even) { - background-color: var(--body-bg-alt); - } - } - } -} diff --git a/css/manage/_customer.scss b/css/manage/_customer.scss new file mode 100644 index 0000000..f67bcbb --- /dev/null +++ b/css/manage/_customer.scss @@ -0,0 +1,53 @@ +#manage-customer-page { + //$h: calc(var(--nav-height) + calc(var(--main-padding) * 2)); + //height: calc(100vh - $h); + width: 100%; + + .customers-list-wrapper { + $header-height: 3rem; + $list-item-height: 2.5rem; + $pd: 0.7em; + position: relative; + + .customers-list-header, .customers-list-item { + display: grid; + grid-template-columns: 5rem 2fr 1fr 1fr; + padding: 0 $pd; + align-items: center; + } + + .customers-list-header { + $br: $pd; + background-color: var(--body-bg-alt); + width: 100%; + height: $header-height; + position: absolute; + top: 0; + left: 0; + border-bottom: 1px solid var(--link-fg); + font-weight: bold; + font-size: 1.2em; + border-radius: $br $br 0 0; + } + + .customers-list { + border: 1px solid var(--body-bg-alt); + min-height: 40rem; + max-height: 75vh; + overflow-y: scroll; + width: 100%; + position: absolute; + top: $header-height; + left: 0; + + .customers-list-item { + grid-template-rows: $list-item-height; + font-size: 1.2em; + } + + .customers-list-item:nth-child(even) { + background-color: var(--body-bg-alt); + } + } + } +} diff --git a/css/styles.scss b/css/styles.scss index 4bdf9a7..6f2424c 100644 --- a/css/styles.scss +++ b/css/styles.scss @@ -4,7 +4,7 @@ @import "navbar"; @import "menu_page"; -@import "manage/client"; +@import "manage/customer"; :root { --body-bg: #282a36; diff --git a/src/app/manage/client/list/address.rs b/src/app/manage/client/list/address.rs deleted file mode 100644 index 233de92..0000000 --- a/src/app/manage/client/list/address.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* openbills-web - Web client for Libre Billing Software - * Copyright (C) 2023 Vidhu Kant Sharma - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -use yew::prelude::*; - -use crate::models::client; - -#[derive(Properties, PartialEq)] -pub struct Props { - pub address: client::Address, - pub title: String, -} - -#[function_component(Address)] -pub fn address(props: &Props) -> Html { - - html! { -
- {props.title.clone()} - {props.address.address_text.clone()} -
- } -} diff --git a/src/app/manage/client/list/list_item.rs b/src/app/manage/client/list/list_item.rs deleted file mode 100644 index 2e6fed0..0000000 --- a/src/app/manage/client/list/list_item.rs +++ /dev/null @@ -1,38 +0,0 @@ -/* openbills-web - Web client for Libre Billing Software - * Copyright (C) 2023 Vidhu Kant Sharma - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -use yew::prelude::*; - -use crate::models::client; - -#[derive(Properties, PartialEq)] -pub struct Props { - pub client: client::Client, - pub s_no: usize, -} - -#[function_component(ListItem)] -pub fn list_item(props: &Props) -> Html { - html! { -
- {props.s_no} - {props.client.name.clone()} - {props.client.gstin.clone()} - -
- } -} diff --git a/src/app/manage/client/list/mod.rs b/src/app/manage/client/list/mod.rs deleted file mode 100644 index 1c00f0a..0000000 --- a/src/app/manage/client/list/mod.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* openbills-web - Web client for Libre Billing Software - * Copyright (C) 2023 Vidhu Kant Sharma - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -mod list_item; -mod address; - -use yew::prelude::*; - -use crate::models::client; - -#[derive(Properties, PartialEq)] -pub struct Props { - pub clients: Vec, -} - -#[function_component(ClientsList)] -pub fn clients_list(props: &Props) -> Html { - let list_items: Html = props.clients - .iter() - .enumerate() - .map(|(id, c)| html!()) - .collect(); - - html! { -
-
- {"S. No"} - {"Client Name"} - {"GSTIN"} - -
-
- {list_items} -
-
- } -} diff --git a/src/app/manage/client/mod.rs b/src/app/manage/client/mod.rs deleted file mode 100644 index e81f9a5..0000000 --- a/src/app/manage/client/mod.rs +++ /dev/null @@ -1,81 +0,0 @@ -/* openbills-web - Web client for Libre Billing Software - * Copyright (C) 2023 Vidhu Kant Sharma - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -mod list; - -use yew::prelude::*; - -use crate::models::client; - -#[function_component(ManageClientPage)] -pub fn manage_client_page() -> Html { - let mut clients = Vec::new(); - - let mut c1: client::Client = client::Client::new(); - c1.id = 1; - c1.name = "MikunoNaka".to_string(); - c1.gstin = "AKSK821KASJ123LJF".to_string(); - c1.contact.contact_name = "Vidhu Kant".to_string(); - c1.contact.phone_number = "123810210293".to_string(); - c1.contact.email_address = "zt@vidhukant.com".to_string(); - c1.contact.website = "vidhukant.com".to_string(); - c1.billing_address.address_text = "Address".to_string(); - c1.billing_address.city = "City".to_string(); - c1.billing_address.state = "State".to_string(); - c1.billing_address.postal_code = "121212".to_string(); - c1.billing_address.country = "India".to_string(); - let mut c1s1 = client::Address::new(); - c1s1.address_text = "Shipping Address".to_string(); - c1s1.city = "City".to_string(); - c1s1.state = "State".to_string(); - c1s1.postal_code = "121212".to_string(); - c1s1.country = "India".to_string(); - c1.add_shipping_address(c1s1); - clients.push(c1); - - let mut c2: client::Client = client::Client::new(); - c2.id = 1; - c2.name = "Google Inc.".to_string(); - c2.gstin = "AKSK821KA12SJ123LJF".to_string(); - c2.contact.contact_name = "Google".to_string(); - c2.contact.phone_number = "490183212".to_string(); - c2.contact.email_address = "google@google.com".to_string(); - c2.contact.website = "google.com".to_string(); - c2.billing_address.address_text = "Address".to_string(); - c2.billing_address.city = "City".to_string(); - c2.billing_address.state = "State".to_string(); - c2.billing_address.postal_code = "121212".to_string(); - c2.billing_address.country = "India".to_string(); - let mut c2s1 = client::Address::new(); - c2s1.address_text = "Address".to_string(); - c2s1.city = "City".to_string(); - c2s1.state = "State".to_string(); - c2s1.postal_code = "121212".to_string(); - c2s1.country = "India".to_string(); - c2.add_shipping_address(c2s1); - - for _ in 0..1000 { - clients.push(c2.clone()); - } - - html! { -
-

{"To Add: Searching, Viewing, Editing, Deletion, Batch Deletion"}

- -
- } -} diff --git a/src/app/manage/customer/list/address.rs b/src/app/manage/customer/list/address.rs new file mode 100644 index 0000000..8498530 --- /dev/null +++ b/src/app/manage/customer/list/address.rs @@ -0,0 +1,37 @@ +/* openbills-web - Web client for Libre Billing Software + * Copyright (C) 2023 Vidhu Kant Sharma + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +use yew::prelude::*; + +use crate::models::customer; + +#[derive(Properties, PartialEq)] +pub struct Props { + pub address: customer::Address, + pub title: String, +} + +#[function_component(Address)] +pub fn address(props: &Props) -> Html { + + html! { +
+ {props.title.clone()} + {props.address.address_text.clone()} +
+ } +} diff --git a/src/app/manage/customer/list/list_item.rs b/src/app/manage/customer/list/list_item.rs new file mode 100644 index 0000000..26ac51d --- /dev/null +++ b/src/app/manage/customer/list/list_item.rs @@ -0,0 +1,38 @@ +/* openbills-web - Web client for Libre Billing Software + * Copyright (C) 2023 Vidhu Kant Sharma + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +use yew::prelude::*; + +use crate::models::customer; + +#[derive(Properties, PartialEq)] +pub struct Props { + pub customer: customer::Customer, + pub s_no: usize, +} + +#[function_component(ListItem)] +pub fn list_item(props: &Props) -> Html { + html! { +
+ {props.s_no} + {props.customer.name.clone()} + {props.customer.gstin.clone()} + +
+ } +} diff --git a/src/app/manage/customer/list/mod.rs b/src/app/manage/customer/list/mod.rs new file mode 100644 index 0000000..00beb63 --- /dev/null +++ b/src/app/manage/customer/list/mod.rs @@ -0,0 +1,51 @@ +/* openbills-web - Web client for Libre Billing Software + * Copyright (C) 2023 Vidhu Kant Sharma + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +mod list_item; +mod address; + +use yew::prelude::*; + +use crate::models::customer; + +#[derive(Properties, PartialEq)] +pub struct Props { + pub customers: Vec, +} + +#[function_component(CustomersList)] +pub fn customers_list(props: &Props) -> Html { + let list_items: Html = props.customers + .iter() + .enumerate() + .map(|(id, c)| html!()) + .collect(); + + html! { +
+
+ {"S. No"} + {"Customer Name"} + {"GSTIN"} + +
+
+ {list_items} +
+
+ } +} diff --git a/src/app/manage/customer/mod.rs b/src/app/manage/customer/mod.rs new file mode 100644 index 0000000..8f5f6fb --- /dev/null +++ b/src/app/manage/customer/mod.rs @@ -0,0 +1,81 @@ +/* openbills-web - Web client for Libre Billing Software + * Copyright (C) 2023 Vidhu Kant Sharma + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +mod list; + +use yew::prelude::*; + +use crate::models::customer; + +#[function_component(ManageCustomerPage)] +pub fn manage_customer() -> Html { + let mut customers = Vec::new(); + + let mut c1: customer::Customer = customer::Customer::new(); + c1.id = 1; + c1.name = "MikunoNaka".to_string(); + c1.gstin = "AKSK821KASJ123LJF".to_string(); + c1.contact.contact_name = "Vidhu Kant".to_string(); + c1.contact.phone_number = "123810210293".to_string(); + c1.contact.email_address = "zt@vidhukant.com".to_string(); + c1.contact.website = "vidhukant.com".to_string(); + c1.billing_address.address_text = "Address".to_string(); + c1.billing_address.city = "City".to_string(); + c1.billing_address.state = "State".to_string(); + c1.billing_address.postal_code = "121212".to_string(); + c1.billing_address.country = "India".to_string(); + let mut c1s1 = customer::Address::new(); + c1s1.address_text = "Shipping Address".to_string(); + c1s1.city = "City".to_string(); + c1s1.state = "State".to_string(); + c1s1.postal_code = "121212".to_string(); + c1s1.country = "India".to_string(); + c1.add_shipping_address(c1s1); + customers.push(c1); + + let mut c2: customer::Customer = customer::Customer::new(); + c2.id = 1; + c2.name = "Google Inc.".to_string(); + c2.gstin = "AKSK821KA12SJ123LJF".to_string(); + c2.contact.contact_name = "Google".to_string(); + c2.contact.phone_number = "490183212".to_string(); + c2.contact.email_address = "google@google.com".to_string(); + c2.contact.website = "google.com".to_string(); + c2.billing_address.address_text = "Address".to_string(); + c2.billing_address.city = "City".to_string(); + c2.billing_address.state = "State".to_string(); + c2.billing_address.postal_code = "121212".to_string(); + c2.billing_address.country = "India".to_string(); + let mut c2s1 = customer::Address::new(); + c2s1.address_text = "Address".to_string(); + c2s1.city = "City".to_string(); + c2s1.state = "State".to_string(); + c2s1.postal_code = "121212".to_string(); + c2s1.country = "India".to_string(); + c2.add_shipping_address(c2s1); + + for _ in 0..1000 { + customers.push(c2.clone()); + } + + html! { +
+

{"To Add: Searching, Viewing, Editing, Deletion, Batch Deletion"}

+ +
+ } +} diff --git a/src/app/manage/mod.rs b/src/app/manage/mod.rs index ccaddc6..354d9d3 100644 --- a/src/app/manage/mod.rs +++ b/src/app/manage/mod.rs @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -pub mod client; +pub mod customer; use yew::prelude::*; use yew_icons::IconId; @@ -28,8 +28,8 @@ pub fn manage_menu_page() -> Html { let page_menu_items = Vec::from([ menu_items::Item { icon: IconId::FontAwesomeSolidUser, - label: String::from("Edit Clients"), - to: Route::ManageClients, + label: String::from("Edit Customers"), + to: Route::ManageCustomers, }, menu_items::Item { icon: IconId::FontAwesomeSolidIndustry, @@ -58,7 +58,7 @@ pub fn manage_menu_page() -> Html {

{ "Manage OpenBills Data" }

-

{ "Here you can add/modify/delete OpenBills data (clients, invoices, etc)" }

+

{ "Here you can add/modify/delete OpenBills data (customers, invoices, etc)" }

diff --git a/src/app/mod.rs b/src/app/mod.rs index 68c4d0c..ac4b57f 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -30,8 +30,8 @@ pub enum Route { #[at("/manage")] ManageMenu, - #[at("/manage/clients")] - ManageClients, + #[at("/manage/customers")] + ManageCustomers, #[at("/manage/brands")] ManageBrands, #[at("/manage/items")] @@ -61,7 +61,7 @@ pub fn switch(routes: Route) -> Html { Route::Home => html! {}, Route::ManageMenu => html! {}, - Route::ManageClients => html! {}, + Route::ManageCustomers => html! {}, Route::ManageBrands => html! {

{ "Edit Brands (To Be Added)" }

}, Route::ManageItems => html! {

{ "Edit Items (To Be Added)" }

}, Route::ManageInvoices => html! {

{ "Edit Invoices (To Be Added)" }

}, diff --git a/src/components/navbar/nav.rs b/src/components/navbar/nav.rs index dd215a0..5249b60 100644 --- a/src/components/navbar/nav.rs +++ b/src/components/navbar/nav.rs @@ -17,6 +17,7 @@ use yew::prelude::*; use yew_router::prelude::*; +use gloo::utils::document; use crate::app::Route; use crate::components::navbar::nav_link::NavLink; @@ -58,8 +59,8 @@ pub fn nav() -> Html { to: Route::Home, }, Link { - label: String::from("Clients"), - to: Route::ManageClients, + label: String::from("Customers"), + to: Route::ManageCustomers, }, Link { label: String::from("Brands"), @@ -76,7 +77,7 @@ pub fn nav() -> Html { ]); let links_html: Html = match current_route { - Route::ManageClients + Route::ManageCustomers | Route::ManageBrands | Route::ManageItems | Route::ManageInvoices => manage_links, @@ -86,6 +87,19 @@ pub fn nav() -> Html { .map(|link| html!()) .collect(); + // set document title + document().set_title(match current_route { + Route::Home => "", + + Route::ManageMenu => "Manage OpenBills Data", + Route::ManageCustomers => "Manage OpenBills Customers", + Route::ManageBrands => "Manage OpenBills Brands", + Route::ManageItems => "Manage OpenBills Items", + Route::ManageInvoices => "Manage OpenBills Invoices", + + _ => "Hello World", + }); + html! {