From 0f0e5f7408969fcc4473746919bb0e8aaa89947c Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sun, 8 Aug 2021 13:00:16 +0530 Subject: half-cleaned the way saving invoices works --- src/components/Form/Transport/TransportForm.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/components/Form/Transport') diff --git a/src/components/Form/Transport/TransportForm.tsx b/src/components/Form/Transport/TransportForm.tsx index 60dfee3..af64d80 100644 --- a/src/components/Form/Transport/TransportForm.tsx +++ b/src/components/Form/Transport/TransportForm.tsx @@ -11,15 +11,17 @@ import { Transport } from "./../../../interfaces" interface Props { setVisibility: Dispatch> // this component's visibility + currentTransporter: Transport setTransporter: Dispatch> } 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(""); + // read values from already existing transporter + const [transporterName, setTransporterName] = useState(props.currentTransporter.Name); + const [vehicleNum, setVehicleNum] = useState(props.currentTransporter.VehicleNum); + const [transportMethod, setTransportMethod] = useState(props.currentTransporter.Method); + const [transporterGSTIN, setTransporterGSTIN] = useState(props.currentTransporter.GSTIN); + const [builtyNumber, setBuiltyNumber] = useState(props.currentTransporter.Builty); const hideSelf = () => props.setVisibility(false); -- cgit v1.2.3