From 03a991b1c59e010253f8673a4aa82c89f7bc7d13 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Fri, 16 Apr 2021 17:37:07 +0530 Subject: added validation to AddNewItemForm --- src/components/Form/AddNewItemForm.js | 63 ++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 27 deletions(-) (limited to 'src/components/Form') diff --git a/src/components/Form/AddNewItemForm.js b/src/components/Form/AddNewItemForm.js index 8484724..5d0b224 100644 --- a/src/components/Form/AddNewItemForm.js +++ b/src/components/Form/AddNewItemForm.js @@ -22,13 +22,6 @@ const AddNewItemForm = (props) => { savedItemNames.push(savedItems[i].Model); } - const filteredItems = savedItemNames.filter( - (item) => { - // case insensitive - return item.toLowerCase().includes(itemNameValue.toLowerCase()); - } - ); - // set description and price // when item is entered const setItemInfo = (itemName) => { @@ -50,7 +43,15 @@ const AddNewItemForm = (props) => {
{ event.preventDefault(); - console.log(itemNameValue, itemDescValue, itemPriceValue); + const newInvoiceItem = { + "Model": itemNameValue, + "Description": itemDescValue, + "Quantity": itemQtyValue, + "Price": itemPriceValue, + "Discount": itemDiscountValue, + "GST": itemGSTValue + }; + console.log(newInvoiceItem); } }>
@@ -63,7 +64,7 @@ const AddNewItemForm = (props) => { setItemNameValue(event.target.value); setItemInfo(event.target.value.toLowerCase()); } - }> + } > {savedItemNames.map( (i) => { @@ -72,11 +73,10 @@ const AddNewItemForm = (props) => { )} -
-- cgit v1.2.3