aboutsummaryrefslogtreecommitdiff
path: root/src/components/BillingPage.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-28 16:19:00 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-28 16:19:00 +0530
commit5ca14fcf3e949308eb0b2d636169e6601df1908d (patch)
tree9edcbc4163f81d8b52861a2c9e991423764e3e43 /src/components/BillingPage.js
parent60f5d0cf22adc77b236f6c5a6e6aa2c7ff39ed77 (diff)
New Feature: Ability to register new items in the database
Diffstat (limited to 'src/components/BillingPage.js')
-rw-r--r--src/components/BillingPage.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/components/BillingPage.js b/src/components/BillingPage.js
index 7f97b32..fc09694 100644
--- a/src/components/BillingPage.js
+++ b/src/components/BillingPage.js
@@ -10,15 +10,15 @@ import React, { useState, useEffect } from "react";
import axios from "axios";
import AddNewItemForm from "./Form/AddNewItemForm";
+import RegisterItemForm from "./Form/RegisterItemForm";
+import MetaInfoForm from "./Form/MetaInfoForm";
import ItemsDisplay from "./Display/ItemsDisplay";
import SummaryDisplay from "./Display/SummaryDisplay";
-import MetaInfoForm from "./Form/MetaInfoForm";
const BillingPage = () => {
const [savedItems, getSavedItems] = useState([])
- // get data from server on startup
- useEffect(() => {
+ const getRegisteredItems = () => {
axios.get(`/api/items`)
.then((res) => {
getSavedItems(res.data);
@@ -27,8 +27,13 @@ const BillingPage = () => {
alert("The promise returned an error idk what to do");
console.log(res);
})
+ }
+
+ // get data from server on startup
+ useEffect(() => {
+ getRegisteredItems();
}, []);
- // to be handled by backend
+ // TODO: to be handled by backend
const defGSTValue = 18;
// update the items from AddNewItemForm
@@ -42,6 +47,7 @@ const BillingPage = () => {
return (
<>
<AddNewItemForm savedItems={savedItems} addItem={getItems} defGSTValue={defGSTValue}/>
+ <RegisterItemForm/>
<ItemsDisplay items={items} defGSTValue={defGSTValue}/>
<div className={"BillingPageFlex"}>
<MetaInfoForm/>