aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-30 15:15:31 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-30 15:15:31 +0530
commit0d7d20829623b14c8ea5284bc24e63f7c31d61b7 (patch)
treed918be383306e88e659162f5bd5fc8249de885b6
parenta1b3b7fb92fae98e9f6df7b9d4e3e3b4ff6b1a44 (diff)
renamed client to customer
-rw-r--r--Cargo.lock289
-rw-r--r--Cargo.toml3
-rw-r--r--css/manage/_customer.scss (renamed from css/manage/_client.scss)14
-rw-r--r--css/styles.scss2
-rw-r--r--src/app/manage/customer/list/address.rs (renamed from src/app/manage/client/list/address.rs)6
-rw-r--r--src/app/manage/customer/list/list_item.rs (renamed from src/app/manage/client/list/list_item.rs)10
-rw-r--r--src/app/manage/customer/list/mod.rs (renamed from src/app/manage/client/list/mod.rs)20
-rw-r--r--src/app/manage/customer/mod.rs (renamed from src/app/manage/client/mod.rs)24
-rw-r--r--src/app/manage/mod.rs8
-rw-r--r--src/app/mod.rs6
-rw-r--r--src/components/navbar/nav.rs20
-rw-r--r--src/models/customer.rs (renamed from src/models/client.rs)8
-rw-r--r--src/models/mod.rs2
13 files changed, 332 insertions, 80 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 01f4954..d90ee43 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -94,6 +94,12 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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",
@@ -234,6 +272,16 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -244,13 +292,35 @@ dependencies = [
]
[[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"
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",
@@ -304,12 +411,37 @@ dependencies = [
]
[[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",
@@ -331,6 +463,16 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -344,6 +486,19 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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",
@@ -361,12 +516,49 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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",
@@ -538,6 +741,16 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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",
@@ -748,6 +961,23 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -868,6 +1098,15 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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/_customer.scss
index c16a5fe..f67bcbb 100644
--- a/css/manage/_client.scss
+++ b/css/manage/_customer.scss
@@ -1,22 +1,22 @@
-#manage-client-page {
+#manage-customer-page {
//$h: calc(var(--nav-height) + calc(var(--main-padding) * 2));
//height: calc(100vh - $h);
width: 100%;
- .clients-list-wrapper {
+ .customers-list-wrapper {
$header-height: 3rem;
$list-item-height: 2.5rem;
$pd: 0.7em;
position: relative;
- .clients-list-header, .clients-list-item {
+ .customers-list-header, .customers-list-item {
display: grid;
grid-template-columns: 5rem 2fr 1fr 1fr;
padding: 0 $pd;
align-items: center;
}
- .clients-list-header {
+ .customers-list-header {
$br: $pd;
background-color: var(--body-bg-alt);
width: 100%;
@@ -30,7 +30,7 @@
border-radius: $br $br 0 0;
}
- .clients-list {
+ .customers-list {
border: 1px solid var(--body-bg-alt);
min-height: 40rem;
max-height: 75vh;
@@ -40,12 +40,12 @@
top: $header-height;
left: 0;
- .clients-list-item {
+ .customers-list-item {
grid-template-rows: $list-item-height;
font-size: 1.2em;
}
- .clients-list-item:nth-child(even) {
+ .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/customer/list/address.rs
index 233de92..8498530 100644
--- a/src/app/manage/client/list/address.rs
+++ b/src/app/manage/customer/list/address.rs
@@ -17,11 +17,11 @@
use yew::prelude::*;
-use crate::models::client;
+use crate::models::customer;
#[derive(Properties, PartialEq)]
pub struct Props {
- pub address: client::Address,
+ pub address: customer::Address,
pub title: String,
}
@@ -29,7 +29,7 @@ pub struct Props {
pub fn address(props: &Props) -> Html {
html! {
- <div class={"client-address"}>
+ <div class={"customer-address"}>
<span class={"title"}>{props.title.clone()}</span>
<span>{props.address.address_text.clone()}</span>
</div>
diff --git a/src/app/manage/client/list/list_item.rs b/src/app/manage/customer/list/list_item.rs
index 2e6fed0..26ac51d 100644
--- a/src/app/manage/client/list/list_item.rs
+++ b/src/app/manage/customer/list/list_item.rs
@@ -17,21 +17,21 @@
use yew::prelude::*;
-use crate::models::client;
+use crate::models::customer;
#[derive(Properties, PartialEq)]
pub struct Props {
- pub client: client::Client,
+ pub customer: customer::Customer,
pub s_no: usize,
}
#[function_component(ListItem)]
pub fn list_item(props: &Props) -> Html {
html! {
- <div class={"clients-list-item"}>
+ <div class={"customers-list-item"}>
<span>{props.s_no}</span>
- <span>{props.client.name.clone()}</span>
- <span>{props.client.gstin.clone()}</span>
+ <span>{props.customer.name.clone()}</span>
+ <span>{props.customer.gstin.clone()}</span>
<span class={"options"}></span>
</div>
}
diff --git a/src/app/manage/client/list/mod.rs b/src/app/manage/customer/list/mod.rs
index 1c00f0a..00beb63 100644
--- a/src/app/manage/client/list/mod.rs
+++ b/src/app/manage/customer/list/mod.rs
@@ -20,30 +20,30 @@ mod address;
use yew::prelude::*;
-use crate::models::client;
+use crate::models::customer;
#[derive(Properties, PartialEq)]
pub struct Props {
- pub clients: Vec<client::Client>,
+ pub customers: Vec<customer::Customer>,
}
-#[function_component(ClientsList)]
-pub fn clients_list(props: &Props) -> Html {
- let list_items: Html = props.clients
+#[function_component(CustomersList)]
+pub fn customers_list(props: &Props) -> Html {
+ let list_items: Html = props.customers
.iter()
.enumerate()
- .map(|(id, c)| html!(<list_item::ListItem key={c.id} s_no={id + 1} client={c.clone()} />))
+ .map(|(id, c)| html!(<list_item::ListItem key={c.id} s_no={id + 1} customer={c.clone()} />))
.collect();
html! {
- <div class={"clients-list-wrapper"}>
- <div class={"clients-list-header"}>
+ <div class={"customers-list-wrapper"}>
+ <div class={"customers-list-header"}>
<span>{"S. No"}</span>
- <span>{"Client Name"}</span>
+ <span>{"Customer Name"}</span>
<span>{"GSTIN"}</span>
<span class={"options"}></span>
</div>
- <div class={"clients-list"}>
+ <div class={"customers-list"}>
{list_items}
</div>
</div>
diff --git a/src/app/manage/client/mod.rs b/src/app/manage/customer/mod.rs
index e81f9a5..8f5f6fb 100644
--- a/src/app/manage/client/mod.rs
+++ b/src/app/manage/customer/mod.rs
@@ -19,13 +19,13 @@ mod list;
use yew::prelude::*;
-use crate::models::client;
+use crate::models::customer;
-#[function_component(ManageClientPage)]
-pub fn manage_client_page() -> Html {
- let mut clients = Vec::new();
+#[function_component(ManageCustomerPage)]
+pub fn manage_customer() -> Html {
+ let mut customers = Vec::new();
- let mut c1: client::Client = client::Client::new();
+ let mut c1: customer::Customer = customer::Customer::new();
c1.id = 1;
c1.name = "MikunoNaka".to_string();
c1.gstin = "AKSK821KASJ123LJF".to_string();
@@ -38,16 +38,16 @@ pub fn manage_client_page() -> Html {
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();
+ 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);
- clients.push(c1);
+ customers.push(c1);
- let mut c2: client::Client = client::Client::new();
+ let mut c2: customer::Customer = customer::Customer::new();
c2.id = 1;
c2.name = "Google Inc.".to_string();
c2.gstin = "AKSK821KA12SJ123LJF".to_string();
@@ -60,7 +60,7 @@ pub fn manage_client_page() -> Html {
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();
+ let mut c2s1 = customer::Address::new();
c2s1.address_text = "Address".to_string();
c2s1.city = "City".to_string();
c2s1.state = "State".to_string();
@@ -69,13 +69,13 @@ pub fn manage_client_page() -> Html {
c2.add_shipping_address(c2s1);
for _ in 0..1000 {
- clients.push(c2.clone());
+ customers.push(c2.clone());
}
html! {
- <div id={"manage-client-page"}>
+ <div id={"manage-customer-page"}>
<p>{"To Add: Searching, Viewing, Editing, Deletion, Batch Deletion"}</p>
- <list::ClientsList clients={clients}/>
+ <list::CustomersList customers={customers}/>
</div>
}
}
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 <https://www.gnu.org/licenses/>.
*/
-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 {
<NavigationMenu>
<menu_header::MenuHeader>
<h1>{ "Manage OpenBills Data" }</h1>
- <p>{ "Here you can add/modify/delete OpenBills data (clients, invoices, etc)" }</p>
+ <p>{ "Here you can add/modify/delete OpenBills data (customers, invoices, etc)" }</p>
</menu_header::MenuHeader>
<menu_items::MenuItems items={page_menu_items}/>
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! {<home::HomePage />},
Route::ManageMenu => html! {<manage::ManageMenuPage />},
- Route::ManageClients => html! {<manage::client::ManageClientPage />},
+ Route::ManageCustomers => html! {<manage::customer::ManageCustomerPage />},
Route::ManageBrands => html! {<h1>{ "Edit Brands (To Be Added)" }</h1>},
Route::ManageItems => html! {<h1>{ "Edit Items (To Be Added)" }</h1>},
Route::ManageInvoices => html! {<h1>{ "Edit Invoices (To Be Added)" }</h1>},
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!(<NavLink label={link.label.clone()} to={link.to.clone()} />))
.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! {
<nav>
{links_html}
diff --git a/src/models/client.rs b/src/models/customer.rs
index a76af70..65bd700 100644
--- a/src/models/client.rs
+++ b/src/models/customer.rs
@@ -56,7 +56,7 @@ impl Contact {
}
#[derive(Clone, PartialEq)]
-pub struct Client {
+pub struct Customer {
pub id: u64,
pub name: String,
pub contact: Contact,
@@ -65,9 +65,9 @@ pub struct Client {
pub shipping_addresses: Vec<Address>,
}
-impl Client {
- pub fn new() -> Client {
- Client {
+impl Customer {
+ pub fn new() -> Customer {
+ Customer {
id: 0,
name: String::new(),
contact: Contact::new(),
diff --git a/src/models/mod.rs b/src/models/mod.rs
index 514c03d..74c6b60 100644
--- a/src/models/mod.rs
+++ b/src/models/mod.rs
@@ -15,4 +15,4 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-pub mod client;
+pub mod customer;