diff options
Diffstat (limited to 'src/app/manage/customer/mod.rs')
-rw-r--r-- | src/app/manage/customer/mod.rs | 49 |
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> |