From 0b4343bed2cace86552929f25202680c0d99c541 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 10 Oct 2022 22:45:28 +0530 Subject: added ItemTable for the invoice page --- src/components/pickers/item-picker.js | 56 ++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 21 deletions(-) (limited to 'src/components/pickers/item-picker.js') diff --git a/src/components/pickers/item-picker.js b/src/components/pickers/item-picker.js index 46310db..339319f 100644 --- a/src/components/pickers/item-picker.js +++ b/src/components/pickers/item-picker.js @@ -10,8 +10,7 @@ * 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 +* You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -19,10 +18,11 @@ import { Item, InvoiceItem, getAllItems } from '../../classes/item'; import './scss/item-picker.scss'; import { useState, useEffect } from 'react'; +import { Link } from 'react-router-dom'; //import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' //import { faPhone, faEnvelope, faGlobe } from '@fortawesome/free-solid-svg-icons' -const ItemPicker = () => { +const ItemPicker = ({invoiceItems, addInvoiceItem}) => { const [items, setItems] = useState([new Item()]); const [item, setItem] = useState(new InvoiceItem()); @@ -44,30 +44,33 @@ const ItemPicker = () => { })); } + // add item to the invoice items list + const addItem = (e) => { + e.preventDefault(); + addInvoiceItem(item); + setItem(new InvoiceItem()); + } + + // input elements are sorted on the basis of + // how likely they are going to be edited return (

Add an Item

-
- {items && items.length > 0 && +
+ {items.length > 0 ? <> - -
+
); -- cgit v1.2.3