aboutsummaryrefslogtreecommitdiff
path: root/src/views/invoice
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-12-04 18:05:11 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-12-04 18:05:11 +0530
commitbb38d843de17bb0b206a663e008c5dbb37f04708 (patch)
tree3dd62fb8961d85a277fe5a882e8a41bc2c4d71dd /src/views/invoice
parent9ca1864b79ede841e71836132effc2e260b4e758 (diff)
added (untested) auth mechanism
Diffstat (limited to 'src/views/invoice')
-rw-r--r--src/views/invoice/new.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/views/invoice/new.js b/src/views/invoice/new.js
index 2d88e40..b1d601f 100644
--- a/src/views/invoice/new.js
+++ b/src/views/invoice/new.js
@@ -36,6 +36,8 @@ const NewInvoicePage = () => {
const [roundOffTotal, setRoundOffTotal] = useState(true); //TODO: load from config
//const [isInterstate, setIsInterstate] = useState(false);
const [transport, setTransport] = useState(new Transport());
+ const [invoiceNumber, setInvoiceNumber] = useState("0"); // TODO: auto increment
+ const [invoiceDate, setInvoiceDate] = useState(new Date());
const isInterstate = false; // temporary
const [sum, setSum] = useState({
GST: currency(0),
@@ -47,8 +49,8 @@ const NewInvoicePage = () => {
const submitInvoice = () => {
const invoice = new Invoice();
- invoice.InvoiceNumber = 69; // TODO: set accordingly
- invoice.CreatedAt = new Date();
+ invoice.InvoiceNumber = invoiceNumber;
+ invoice.CreatedAt = invoiceDate;
invoice.TotalAmount = sum.Amount;
const recipient = new Client();
@@ -67,7 +69,7 @@ const NewInvoicePage = () => {
invoice.Note = ""; // TODO: set accordingly
invoice.Draft = false; // TODO: set accordingly
- saveInvoice(invoice, handleSuccess, handleFail)
+ saveInvoice(invoice, handleSuccess, handleFail);
}
const handleSuccess = () => {
@@ -102,7 +104,11 @@ const NewInvoicePage = () => {
roundOff={roundOffTotal}
setRoundOff={setRoundOffTotal}
transport={transport}
- setTransport={setTransport} />
+ setTransport={setTransport}
+ invoiceNumber={invoiceNumber}
+ setInvoiceNumber={setInvoiceNumber}
+ date={invoiceDate}
+ setDate={setInvoiceDate} />
<div>
<InvoiceSummary
sum={sum}