aboutsummaryrefslogtreecommitdiff
path: root/src/components/BillingPage.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-03 12:26:47 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-03 12:26:47 +0530
commit5846185f5a6662265c5330fbed229f49efb26b89 (patch)
treeaf5ae2406218a90d4be3dc96d070fe0172afae8f /src/components/BillingPage.js
parente25e884596cf07a5dee77ba2dc841b45b14f2ac5 (diff)
added some features and many bugs to DocumentInfoForm
Diffstat (limited to 'src/components/BillingPage.js')
-rw-r--r--src/components/BillingPage.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/components/BillingPage.js b/src/components/BillingPage.js
index be2e299..40917e5 100644
--- a/src/components/BillingPage.js
+++ b/src/components/BillingPage.js
@@ -14,6 +14,7 @@ import RegisterItemForm from "./Form/Items/RegisterItemForm";
import RegisterPersonForm from "./Form/People/RegisterPersonForm";
+import DocumentInfoForm from "./Form/Document/DocumentInfoForm";
import MetaInfoForm from "./Form/MetaInfoForm";
import ItemsDisplay from "./Display/ItemsDisplay";
@@ -21,6 +22,7 @@ import SummaryDisplay from "./Display/SummaryDisplay";
const BillingPage = () => {
const [savedItems, getSavedItems] = useState([]);
+ const [savedPeople, getSavedPeople] = useState([]);
const [registerItemFormVisibility, setRegisterItemFormVisibility] = useState(false);
const [registerPersonFormVisibility, setRegisterPersonFormVisibility] = useState(false);
@@ -35,9 +37,21 @@ const BillingPage = () => {
})
}
+ const getRegisteredPeople = () => {
+ axios.get(`/api/people`)
+ .then((res) => {
+ getSavedPeople(res.data);
+ })
+ .catch((res) => {
+ alert("The promise returned an error idk what to do");
+ console.log(res);
+ })
+ }
+
// get data from server on startup
useEffect(() => {
getRegisteredItems();
+ getRegisteredPeople();
}, []);
// TODO: to be handled by backend
const defGSTValue = 18;
@@ -62,12 +76,15 @@ const BillingPage = () => {
{registerPersonFormVisibility &&
<RegisterPersonForm
- defGSTValue={defGSTValue}
updateItemsList={getRegisteredItems}
setVisibility={setRegisterPersonFormVisibility}
/>
}
+ <DocumentInfoForm
+ savedPeople={savedPeople}
+ />
+
<AddNewItemForm
savedItems={savedItems}
addItem={getItems}