aboutsummaryrefslogtreecommitdiff
path: root/src/components/Form/AddNewItemForm.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-17 19:04:55 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-17 19:04:55 +0530
commitee77e57189a6b0375e840b386754973a376dc089 (patch)
treeeb5868219a01c68acb6ae996d99629020ef00e89 /src/components/Form/AddNewItemForm.js
parent444a8147f59df78ebf14222edcebf944226b533e (diff)
added a way to see the total cost and number of items in ItemsDisplay
Diffstat (limited to 'src/components/Form/AddNewItemForm.js')
-rw-r--r--src/components/Form/AddNewItemForm.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/components/Form/AddNewItemForm.js b/src/components/Form/AddNewItemForm.js
index 07b3092..09536b1 100644
--- a/src/components/Form/AddNewItemForm.js
+++ b/src/components/Form/AddNewItemForm.js
@@ -25,15 +25,15 @@ const AddNewItemForm = (props) => {
// set description and price
// when item is entered
const setItemInfo = (itemName) => {
- for (let i = 0; i <= props.savedItems.length - 1; i++) {
- const mod = props.savedItems[i].Model.toLowerCase();
- const desc = props.savedItems[i].Description;
- const price = props.savedItems[i].Price;
+ for (let i = 0; i < props.savedItems.length - 1; i++) {
+ const mod = props.savedItems[i].Model.toLowerCase();
+ const desc = props.savedItems[i].Description;
+ const price = props.savedItems[i].Price;
- if (mod === itemName) {
- setItemDescValue(desc);
- setItemPriceValue(price);
- break;
+ if (mod === itemName) {
+ setItemDescValue(desc);
+ setItemPriceValue(price);
+ break;
}
}
}
@@ -56,7 +56,7 @@ const AddNewItemForm = (props) => {
"Model": itemNameValue,
"Description": itemDescValue,
"Quantity": parseInt(itemQtyValue),
- "Price": parseInt(itemPriceValue),
+ "Price": parseFloat(itemPriceValue),
"Discount": parseInt(itemDiscountValue),
"GST": parseInt(itemGSTValue)
};
@@ -105,7 +105,7 @@ const AddNewItemForm = (props) => {
</label>
<label>
- Price: <input type="number" min="1" value={itemPriceValue} onChange={
+ Price: <input type="number" min="1.00" step="0.001" value={itemPriceValue} onChange={
(event) => {
const value = event.target.value;
setItemPriceValue(value);
@@ -114,7 +114,7 @@ const AddNewItemForm = (props) => {
</label>
<label>
- Discount: <input type="number" min="0" value={itemDiscountValue} onChange={
+ Discount: <input type="number" min="0" step="0.001" value={itemDiscountValue} onChange={
(event) => {
const value = event.target.value;
setItemDiscountValue(value);