From a7965136d75c97bb6e2696c46a7d4a27dc33996c Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Wed, 7 Jul 2021 12:46:08 +0530 Subject: create basic menu for adding transport info --- src/components/Form/Transport/TransportForm.tsx | 84 +++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/components/Form/Transport/TransportForm.tsx (limited to 'src/components/Form/Transport') 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) => { + const [transporterName, setTransporterName] = useState(""); + const [vehicleNum, setVehicleNum] = useState(""); + const [transportMethod, setTransportMethod] = useState(""); + const [transporterGSTIN, setTransporterGSTIN] = useState(""); + const [builtyNumber, setBuiltyNumber] = useState(""); + + 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 ( +
+
+ + + + + + + + + + + +
+
+ ); +} + +export default TransportForm; -- cgit v1.2.3