aboutsummaryrefslogtreecommitdiff
path: root/src/components/Form/Transport
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-07-07 12:46:08 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-07-07 12:46:08 +0530
commita7965136d75c97bb6e2696c46a7d4a27dc33996c (patch)
treecbcec33c13b088a9b8260a6068aa911ec885e27e /src/components/Form/Transport
parent1b5622ba01eb30768c49dcb9b7ac155cca0504e2 (diff)
create basic menu for adding transport info
Diffstat (limited to 'src/components/Form/Transport')
-rw-r--r--src/components/Form/Transport/TransportForm.tsx84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/components/Form/Transport/TransportForm.tsx b/src/components/Form/Transport/TransportForm.tsx
new file mode 100644
index 0000000..0611cc1
--- /dev/null
+++ b/src/components/Form/Transport/TransportForm.tsx
@@ -0,0 +1,84 @@
+/*
+ * OpenBills - Self hosted browser app to generate and keep track of simple invoices
+ * Version - 0
+ * Licensed under the MIT license - https://opensource.org/licenses/MIT
+ *
+ * Copyright (c) 2021 Vidhu Kant Sharma
+*/
+
+import React, { useState } from "react";
+import { Transport } from "./../../../interfaces"
+
+interface Props {
+ setVisibility: any // this component's visibility
+}
+
+const TransportForm: React.FC<Props> = (props) => {
+ const [transporterName, setTransporterName] = useState<string>("");
+ const [vehicleNum, setVehicleNum] = useState<string>("");
+ const [transportMethod, setTransportMethod] = useState<string>("");
+ const [transporterGSTIN, setTransporterGSTIN] = useState<string>("");
+ const [builtyNumber, setBuiltyNumber] = useState<string>("");
+
+ const hideSelf = () =>
+ props.setVisibility(false);
+
+
+ const closeOnBGClicked = (event: any) =>
+ event.target.className === "floatingMenuBG" && hideSelf();
+
+ const handleSubmit = (event: any) => {
+ event.preventDefault();
+
+ const newTransport: Transport = {
+ Name: transporterName,
+ VehicleNum: vehicleNum,
+ Method: transportMethod,
+ GSTIN: transporterGSTIN,
+ Builty: builtyNumber
+ }
+ console.log(newTransport);
+
+ hideSelf();
+ }
+
+ return (
+ <div className={"floatingMenuBG"} onClick={closeOnBGClicked}>
+ <form className={"smallFloatingMenu TransportForm"} onSubmit={handleSubmit}>
+ <label>
+ Transporter Name: <input className={"wideInputBox"} type="text" value={transporterName} onChange={
+ (event) => (setTransporterName(event.target.value))
+ }/>
+ </label>
+
+ <label>
+ Vehicle Number: <input className={"wideInputBox"} type="text" value={vehicleNum} onChange={
+ (event) => (setVehicleNum(event.target.value))
+ } required />
+ </label>
+
+ <label>
+ Transport Method: <input className={"wideInputBox"} type="text" value={transportMethod} onChange={
+ (event) => (setTransportMethod(event.target.value))
+ } required />
+ </label>
+
+ <label>
+ Transporter GSTIN: <input className={"wideInputBox"} type="text" value={transporterGSTIN} onChange={
+ (event) => (setTransporterGSTIN(event.target.value))
+ }/>
+ </label>
+
+ <label>
+ Builty Number: <input className={"wideInputBox"} type="text" value={builtyNumber} onChange={
+ (event) => (setBuiltyNumber(event.target.value))
+ }/>
+ </label>
+
+ <input type="submit" value="ok"/>
+ </form>
+ </div>
+ );
+}
+
+export default TransportForm;