From 05dcdcc398af3ec859a750d7e514a286a265da94 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Wed, 28 Apr 2021 17:53:25 +0530 Subject: styled the RegisterItemForm properly and introduced like 20 bugs --- src/components/Form/RegisterItemForm.js | 124 +++++++++++++++++++------------- 1 file changed, 73 insertions(+), 51 deletions(-) (limited to 'src/components/Form/RegisterItemForm.js') diff --git a/src/components/Form/RegisterItemForm.js b/src/components/Form/RegisterItemForm.js index 1b38c8d..ddc3eff 100644 --- a/src/components/Form/RegisterItemForm.js +++ b/src/components/Form/RegisterItemForm.js @@ -7,16 +7,19 @@ */ // TODO: Code isn't tested properly -// I'd be surprised if it has no bugs +// I'd be surprised if it < 10 bugs + +// TODO: Implement override protection import React, { useState } from "react"; import axios from "axios"; import "./Form.css"; -const RegisterItemForm = () => { +const RegisterItemForm = (props) => { // show/hide this component - const [visibility, setVisibility] = useState(true)// useState(props.visibility); + // experimental + const [visibility, setVisibility] = useState(true); const [newItemNameValue, setNewItemNameValue] = useState(""); const [newItemDescValue, setNewItemDescValue] = useState(""); @@ -29,9 +32,13 @@ const RegisterItemForm = () => { return (
-
{ event.preventDefault(); + + // experimental + // make sure it shows confirmation + // before hiding itself setVisibility(false); axios.post(`/api/items/?model=${newItemNameValue}&desc=${newItemDescValue}&price=${newItemPriceValue}&hsn=${newItemHSNValue}&gst=${newItemGSTValue}`) @@ -41,60 +48,75 @@ const RegisterItemForm = () => { .catch((err) => { console.log(err); }); + props.updateItemsList(); } }> -
- +
+
+ - + +
+ +
+ + + + + +
-
- - - - -
); -- cgit v1.2.3