From 10dbff87243b91fb4e50a86f1ec4cc30d5c63dc0 Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Mon, 12 Jul 2021 10:42:05 +0530
Subject: implemented sleek way to handle generating PDFs

---
 src/components/Pages/BillingPage.tsx | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

(limited to 'src/components/Pages/BillingPage.tsx')

diff --git a/src/components/Pages/BillingPage.tsx b/src/components/Pages/BillingPage.tsx
index 301f39e..8848406 100644
--- a/src/components/Pages/BillingPage.tsx
+++ b/src/components/Pages/BillingPage.tsx
@@ -7,22 +7,21 @@
 */
 
 import React, { useState, useEffect } from "react";
-import axios from "axios";
-
 import { Item, Person, Transport, Invoice } from "../../interfaces";
+import axios from "axios";
 
+import DocumentInfoForm from "./../Form/Document/DocumentInfoForm";
 import AddNewItemForm from "./../Form/Items/AddNewItemForm";
+import TransportForm from "./../Form/Transport/TransportForm";
 import RegisterItemForm from "./../Form/Items/RegisterItemForm";
-
 import RegisterPersonForm from "./../Form/People/RegisterPersonForm";
 
-import DocumentInfoForm from "./../Form/Document/DocumentInfoForm";
-import InvoiceInfoMenu from "./../Menu/InvoiceInfoMenu";
-
 import ItemsDisplay from "./../Display/ItemsDisplay";
 import SummaryDisplay from "./../Display/SummaryDisplay"; 
 
-import TransportForm from "./../Form/Transport/TransportForm";
+import InvoiceInfoMenu from "./../Menu/InvoiceInfoMenu";
+import SubmitMenu from "./../Menu/SubmitMenu";
+
 
 const BillingPage: React.FC = () => {
   const [savedItems, getSavedItems] = useState<Item[]>([]);
@@ -34,6 +33,7 @@ const BillingPage: React.FC = () => {
   const [showTransportForm, setShowTransportForm] = useState<boolean>(false);
   const [transporter, setTransporter] = useState<Transport>({Name: "", VehicleNum: "", Method: "", GSTIN: "", Builty: ""})
   console.log(transporter);
+  const [showSubmitMenu, setShowSubmitMenu] = useState<boolean>(false);
 
   const getRegisteredItems = () =>
     axios.get(`/api/items/get-all`)
@@ -57,6 +57,7 @@ const BillingPage: React.FC = () => {
   // update the items from AddNewItemForm
   const getItems = (item: Item) => setItems([...items, item]);
 
+  /*
   const postInvoice = () => {
     const newInvoice: Invoice = {
       Items: items,
@@ -74,6 +75,11 @@ const BillingPage: React.FC = () => {
         console.log(res)
       })
   }
+  */
+
+  const handleSubmit = () => {
+    setShowSubmitMenu(true);
+  }
 
   return (
     <>
@@ -99,6 +105,12 @@ const BillingPage: React.FC = () => {
         />
       }
 
+      {showSubmitMenu &&
+        <SubmitMenu
+          setVisibility={setShowSubmitMenu}
+        />
+      }
+
       <DocumentInfoForm 
         savedPeople={savedPeople}
         invoiceNumber={invoiceNumber}
@@ -124,7 +136,7 @@ const BillingPage: React.FC = () => {
         />
         <SummaryDisplay items={items}/>
       </div>
-      <button onClick={postInvoice}>post (experimental)</button>
+      <button onClick={handleSubmit}>post (experimental)</button>
     </>
   );
 }
-- 
cgit v1.2.3

