mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2024-11-17 06:39:25 +08:00
Akong gisidebar ky ang array di gasave diko kabalo
This commit is contained in:
parent
1edc69ab95
commit
151231ae1a
3 changed files with 18 additions and 4 deletions
|
@ -11,6 +11,12 @@ const ProductsLists = [
|
||||||
stocks: 5,
|
stocks: 5,
|
||||||
lastModified: '2022-02-23'
|
lastModified: '2022-02-23'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: 'Product 3',
|
||||||
|
stocks: 15,
|
||||||
|
lastModified: '2022-02-25'
|
||||||
|
},
|
||||||
// add more products here
|
// add more products here
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,14 @@ export default function Sidebar() {
|
||||||
>
|
>
|
||||||
<ProductsIcon size={4} color="white" />
|
<ProductsIcon size={4} color="white" />
|
||||||
</SidebarButton>
|
</SidebarButton>
|
||||||
|
|
||||||
|
<SidebarButton
|
||||||
|
onClick={() => navigate("/Products/AddProduct")}
|
||||||
|
name="Add Product"
|
||||||
|
>
|
||||||
|
<ProductsIcon size={4} color="white" />
|
||||||
|
</SidebarButton>
|
||||||
|
|
||||||
<SidebarButton
|
<SidebarButton
|
||||||
onClick={() => navigate("/Inventory")}
|
onClick={() => navigate("/Inventory")}
|
||||||
name="Inventory"
|
name="Inventory"
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
import ProductsLists from "../../../Components/ProductsLists/ProductsLists";
|
import ProductsLists from "../../../Components/ProductsLists/ProductsLists";
|
||||||
import { ProductType } from "../../../Components/ProductType/ProductType";
|
import { ProductType } from "../../../Components/ProductType/ProductType";
|
||||||
import styles from "../../../styles";
|
import styles from "../../../styles";
|
||||||
import ProductsIcon from "../../../Components/Icons/ProductsIcon/ProductsIcon";
|
import ProductsIcon from "../../../Components/Icons/ProductsIcon/ProductsIcon";
|
||||||
import ProductInfo from "../../../Components/ProductInfo/ProductInfo";
|
import ProductInfo from "../../../Components/ProductInfo/ProductInfo";
|
||||||
|
|
||||||
|
|
||||||
export default function AddProduct() {
|
export default function AddProduct() {
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [stocks, setStocks] = useState("");
|
const [stocks, setStocks] = useState("");
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleNameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleNameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setName(event.target.value);
|
setName(event.target.value);
|
||||||
|
@ -28,11 +29,11 @@ export default function AddProduct() {
|
||||||
};
|
};
|
||||||
ProductsLists.push(newProduct);
|
ProductsLists.push(newProduct);
|
||||||
}
|
}
|
||||||
//window.location.href = "/Products";
|
navigate("/Products");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
window.location.href = "/Products";
|
navigate("/Products");
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -55,7 +56,6 @@ export default function AddProduct() {
|
||||||
<br />
|
<br />
|
||||||
<button onClick={handleAddProduct}>Add</button>
|
<button onClick={handleAddProduct}>Add</button>
|
||||||
<button onClick={handleCancel}>Cancel</button>
|
<button onClick={handleCancel}>Cancel</button>
|
||||||
<ProductInfo products={ProductsLists} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue