aboutsummaryrefslogtreecommitdiff
path: root/src/app/manage/customer/mod.rs
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-30 16:48:26 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-30 16:48:26 +0530
commit4f49ef89df3e9ca00a068a3fc796646b26245cf0 (patch)
treefc7f297335f0e3be2814c3dba309891a97f87d18 /src/app/manage/customer/mod.rs
parent7a7847555ec3384b3462da6b90138cce3ca7cceb (diff)
added new table component for clients list
Diffstat (limited to 'src/app/manage/customer/mod.rs')
-rw-r--r--src/app/manage/customer/mod.rs49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/app/manage/customer/mod.rs b/src/app/manage/customer/mod.rs
index 0ae0f24..2f5d505 100644
--- a/src/app/manage/customer/mod.rs
+++ b/src/app/manage/customer/mod.rs
@@ -15,8 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-mod list;
-
use yew::prelude::*;
use crate::models::customer;
@@ -54,43 +52,36 @@ pub fn manage_customer() -> Html {
c1s1.country = "India".to_string();
c1.add_shipping_address(c1s1);
- for _ in 0..20 {
+ for _ in 0..5000 {
customers.push(c1.clone());
}
+ let table_template = String::from("1fr 3fr 2fr");
+
+ let customers_table: Html = customers
+ .iter()
+ .enumerate()
+ .map(|(id, c)| html! (
+ <Row key={c.id} template={table_template.clone()}>
+ <Cell>{id + 1}</Cell>
+ <Cell>{c.name.clone()}</Cell>
+ <Cell>{c.gstin.clone()}</Cell>
+ </Row>
+ ))
+ .collect();
+
html! {
<div id={"manage-customer-page"}>
<p>{"To Add: Searching, Viewing, Editing, Deletion, Batch Deletion"}</p>
<Table>
- <Header template={"1fr 3fr 2fr 2fr"}>
- <Cell>
- {"S. No"}
- </Cell>
-
- <Cell>
- {"Customer Name"}
- </Cell>
-
- <Cell>
- {"GSTIN"}
- </Cell>
+ <Header template={table_template.clone()}>
+ <Cell>{"S. No"}</Cell>
+ <Cell>{"Customer Name"}</Cell>
+ <Cell>{"GSTIN"}</Cell>
</Header>
-
<Items>
- <Row template={"1fr 3fr 2fr 2fr"}>
- <Cell>
- {"S. No"}
- </Cell>
-
- <Cell>
- {"Customer Name"}
- </Cell>
-
- <Cell>
- {"GSTIN"}
- </Cell>
- </Row>
+ {customers_table}
</Items>
</Table>
</div>