From 708862c94bd119ca7e86540fbc68595a6256c9e3 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 26 Sep 2022 23:57:18 +0530 Subject: created very basic client editor --- src/components/tables/client-table.js | 82 +++++++++++++++++++++++++++++++++++ src/components/tables/item-table.js | 6 ++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/components/tables/client-table.js (limited to 'src/components/tables') diff --git a/src/components/tables/client-table.js b/src/components/tables/client-table.js new file mode 100644 index 0000000..fda999d --- /dev/null +++ b/src/components/tables/client-table.js @@ -0,0 +1,82 @@ +/* OpenBills-web - Web based libre billing software + * Copyright (C) 2022 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 . + */ + +import './scss/table.scss'; +import { deleteItem } from './../../classes/item'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faPencil, faTrashCan } from '@fortawesome/free-solid-svg-icons' + +const ClientTable = (props) => { + const handleEdit = (i) => { + alert("editing coming soon") + } + + const handleDelete = (i) => { + // TODO: add confirmation prompt + deleteItem(i.Id, handleDelSuccess, handleDelFail); + } + + const handleDelSuccess = () => { + props.refresh(); + } + + const handleDelFail = () => { + alert("fail") + } + + return ( + + + + + + + + + + + + + + + + + + {props.items && props.items.map((i, id=id+1) => ( + + + + + + + + + + + + + + ))} + +
S. NoNameDescriptionBrand NameUOMHSNUnit PriceGST %Min QtyMax Qty
{id+1}{i.Name}{i.Description}{i.Brand.Name}{i.UnitOfMeasure}{i.HSN}{i.UnitPrice}{i.GSTPercentage}{i.MinQuantity}{i.MaxQuantity} + handleEdit(i)}/> + handleDelete(i)}/> +
+ ); +} + +export default ClientTable; diff --git a/src/components/tables/item-table.js b/src/components/tables/item-table.js index c1115c1..e42b272 100644 --- a/src/components/tables/item-table.js +++ b/src/components/tables/item-table.js @@ -21,6 +21,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faPencil, faTrashCan } from '@fortawesome/free-solid-svg-icons' const ItemTable = (props) => { + const handleEdit = (i) => { + alert("editing coming soon") + } + const handleDelete = (i) => { // TODO: add confirmation prompt deleteItem(i.Id, handleDelSuccess, handleDelFail); @@ -65,7 +69,7 @@ const ItemTable = (props) => { {i.MinQuantity} {i.MaxQuantity} - alert("editing coming soon")}/> + handleEdit(i)}/> handleDelete(i)}/> -- cgit v1.2.3