Skip to content

Commit

Permalink
Merge pull request #57 from distoq/develop
Browse files Browse the repository at this point in the history
Develop into main branch #3
  • Loading branch information
rich-dacan authored May 19, 2022
2 parents cb2dea4 + 2858ad2 commit b9e6f9f
Show file tree
Hide file tree
Showing 13 changed files with 928 additions and 699 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { useStockList } from "../../../../Providers/Stock";
export const CardCompras = ({ order, getOrdersList, setOrdersList, token }) => {
const { id, providerData, quantity, status, supplyData, totalValue } = order;
const [selectValue, setSelectValue] = useState("");
const { getListStock } = useStockList();
const { stockList, getListStock } = useStockList();

return (
<Flex
key={id}
Expand Down Expand Up @@ -92,25 +93,61 @@ export const CardCompras = ({ order, getOrdersList, setOrdersList, token }) => {
});

if (e.target.value === "Finalizado") {
api
.post(
"/stock",
{
...order,
ownerId: 1,
userId: 1,
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
console.log(stockList);
console.log(supplyData);
console.log(order);

if (
stockList.some(
(ele) => ele.supplyData.name === supplyData.name
)
.then((res) => {
getListStock();
});
) {
const itemInStock = stockList.filter(
(ele) => ele.supplyData.name === supplyData.name
);

console.log(itemInStock);
console.log(itemInStock[0].id);

api
.patch(
`/stock/${itemInStock[0].id}`,
{
...itemInStock[0],
quantity: +itemInStock[0].quantity + +order.quantity,
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
)
.then((rep) => {
getOrdersList();
});
} else {
api
.post(
"/stock",
{
...order,
ownerId: 1,
userId: 1,
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
)
.then((res) => {
getListStock();
});
}
}

setSelectValue(e.target.value);
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import {
Box,
Flex,
Heading,
Stack,
Text,
useRadio,
useRadioGroup,
VStack,
} from "@chakra-ui/react";
import { motion } from "framer-motion";
import { GoSearch } from "react-icons/go";
import { useActivePage } from "../../../Providers/DashboardPageController";
import { useUser } from "../../../Providers/Users";
import AOS from "aos";
import "aos/dist/aos.css";
import Example from "../../lottie/lottie";
Expand All @@ -20,7 +17,7 @@ AOS.init();
export const DashboardPage = () => {
const { activeDashboardPage, setActiveDashboardPage, handleIcons, options } =
useActivePage();
const { userLogin } = useUser();
const userLogin = JSON.parse(localStorage.getItem("@DEStoq:user")) || ""

const { getRootProps, getRadioProps } = useRadioGroup({
name: "menuOptions",
Expand Down Expand Up @@ -105,14 +102,6 @@ export const DashboardPage = () => {
bgRepeat="no-repeat"
backgroundSize="100% 100%"
>
<Heading
variant="primary"
width="100%"
margin={["0px", "0px", "0px", "0px", "20px 0px"]}
textAlign="center"
>
Dashboard Page
</Heading>
<Flex
width={"100%"}
height={"100%"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { ShowcaseContext } from "../../../Providers/showcase";
import { AiFillGithub } from "react-icons/ai";
import { ExternalLinkIcon } from "@chakra-ui/icons";
import { FaHeartbeat } from "react-icons/fa";
import { GiBrain, GiBrainstorm } from "react-icons/gi";

export const DevelopersPage = () => {
const { activeDashboardPage, setActiveDashboardPage, handleIcons, options } =
Expand Down Expand Up @@ -159,7 +160,6 @@ export const DevelopersPage = () => {
textAlign="center"
>
Developers

</Heading>
<Flex
width={"100%"}
Expand All @@ -179,9 +179,9 @@ export const DevelopersPage = () => {
mt={"170px"}
direction={"column"}
>
<Heading fontSize={"1.8rem"} color={"#111"} mt={"70px"} width={"100%"} textAlign={"center"}>
<Heading fontSize={"1.8rem"} color={"#111"} mt={"50px"} width={"100%"} textAlign={"center"}>
<Flex justify={"center"} align={"center"}>
Developed with <Box m={"10px"}><FaHeartbeat/></Box> by :
Developed with <Box m={"10px"}><GiBrainstorm /></Box> and <Box m={"10px"}><FaHeartbeat/></Box>, by:
</Flex>
</Heading>
<Flex
Expand All @@ -202,7 +202,6 @@ export const DevelopersPage = () => {
"transform": "scale(1.05)",
"boxShadow":" 0px 20px 40px rgba(0, 0, 0, 0.25)",
"border": "solid 1px #de9e36"

}}
listStyleType={"none"}
transition= "all ease .5s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
VStack,
} from "@chakra-ui/react";
import { motion } from "framer-motion";
import { useContext, useState } from "react";
import { useContext, useState, useEffect } from "react";
import { useActivePage } from "../../../Providers/DashboardPageController";
import { useStockList } from "../../../Providers/Stock";
import { StockList } from "./StockList";
Expand All @@ -33,7 +33,7 @@ export const EstoquePage = () => {
);
const { activeDashboardPage, setActiveDashboardPage, handleIcons, options } =
useActivePage();
const { stockList } = useStockList();
const { stockList, getListStock } = useStockList();
const { inputSearch } = useContext(DashFilterContext);

const filteredStockList = stockList.filter(
Expand All @@ -49,13 +49,16 @@ export const EstoquePage = () => {
.toLowerCase()
.includes(inputSearch.toLowerCase())
);

const { getRootProps, getRadioProps } = useRadioGroup({
name: "menuOptions",
defaultValue: activeDashboardPage,
onChange: setActiveDashboardPage,
});

useEffect(() => {
getListStock();
}, []);

const group = getRootProps();
const formSchema = yup.object().shape({
min: yup
Expand Down
Loading

0 comments on commit b9e6f9f

Please sign in to comment.