diff --git a/.eslintrc.json b/.eslintrc.backup.json similarity index 100% rename from .eslintrc.json rename to .eslintrc.backup.json diff --git a/package.json b/package.json index 7fca2da57..49d87214a 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,16 @@ "@emotion/styled": "11.10.8", "@mui/icons-material": "5.11.16", "@mui/material": "5.12.3", + "@reduxjs/toolkit": "^1.8.5", "chart.js": "4.3.0", "chroma-js": "2.4.2", + "classnames": "^2.3.2", "prop-types": "15.8.1", "react": "18.2.0", "react-chartjs-2": "5.2.0", "react-dom": "18.2.0", "react-github-btn": "1.4.0", + "react-redux": "^8.0.4", "react-router-dom": "6.11.0", "react-scripts": "5.0.1", "react-table": "7.8.0", @@ -59,6 +62,7 @@ }, "devDependencies": { "ajv": "^7.2.4", + "axios": "^1.1.3", "eslint": "8.39.0", "eslint-config-prettier": "8.8.0", "eslint-plugin-import": "2.27.5", diff --git a/src/App.js b/src/App.js index 5ba40edb9..065435559 100644 --- a/src/App.js +++ b/src/App.js @@ -16,6 +16,7 @@ Coded by www.creative-tim.com import { useState, useEffect, useMemo } from "react"; // react-router components +import { Provider } from 'react-redux'; import { Routes, Route, Navigate, useLocation } from "react-router-dom"; // @mui material components @@ -53,6 +54,9 @@ import { useMaterialUIController, setMiniSidenav, setOpenConfigurator } from "co import brandWhite from "assets/images/logo-ct.png"; import brandDark from "assets/images/logo-ct-dark.png"; +// Store +import store from './store' + export default function App() { const [controller, dispatch] = useMaterialUIController(); const { @@ -147,8 +151,35 @@ export default function App() { ); return direction === "rtl" ? ( - - + + + + + {layout === "dashboard" && ( + <> + + + {configsButton} + + )} + {layout === "vr" && } + + {getRoutes(routes)} + } /> + + + + + ) : ( + + {layout === "dashboard" && ( <> @@ -170,29 +201,6 @@ export default function App() { } /> - - ) : ( - - - {layout === "dashboard" && ( - <> - - - {configsButton} - - )} - {layout === "vr" && } - - {getRoutes(routes)} - } /> - - + ); } diff --git a/src/assets/images/small-store.jpeg b/src/assets/images/small-store.jpeg new file mode 100644 index 000000000..ee265e7e2 Binary files /dev/null and b/src/assets/images/small-store.jpeg differ diff --git a/src/examples/Sidenav/index.js b/src/examples/Sidenav/index.js index 5efd2d2c7..acf2d3b86 100644 --- a/src/examples/Sidenav/index.js +++ b/src/examples/Sidenav/index.js @@ -179,7 +179,8 @@ function Sidenav({ color, brand, brandName, routes, ...rest }) { } /> {renderRoutes} - + {/* // ! CHECK THIS OUT */} + {/* upgrade to pro - + */} ); } diff --git a/src/interfaces/clients.interface.ts b/src/interfaces/clients.interface.ts new file mode 100644 index 000000000..230b6f934 --- /dev/null +++ b/src/interfaces/clients.interface.ts @@ -0,0 +1,8 @@ +export interface Client { + id: string; + full_name: string; + tax_id: string; + phone: string; + email: string; + _deleted: boolean; +} diff --git a/src/interfaces/discounts.interface.ts b/src/interfaces/discounts.interface.ts new file mode 100644 index 000000000..e03defe94 --- /dev/null +++ b/src/interfaces/discounts.interface.ts @@ -0,0 +1,10 @@ +export interface Discount { + id: string; + products: string[]; + type: 'total' | 'percentage'; + amount: number; + start_date: Date; + end_date: Date; + enabled: boolean; + _deleted: boolean; +} diff --git a/src/interfaces/products.interface.ts b/src/interfaces/products.interface.ts new file mode 100644 index 000000000..78039b38b --- /dev/null +++ b/src/interfaces/products.interface.ts @@ -0,0 +1,9 @@ +export interface Product { + id: string; + internal_code: string; + name: string; + description: string; + price: number; + measurement: string; + _deleted: boolean; +} diff --git a/src/interfaces/sales.interface.ts b/src/interfaces/sales.interface.ts new file mode 100644 index 000000000..0b32ca45d --- /dev/null +++ b/src/interfaces/sales.interface.ts @@ -0,0 +1,10 @@ +export interface Sale { + id: string; + products: { + product_id: string, + quantity: number + }[]; + client_id: string; + amount: number; + _deleted: boolean; +} diff --git a/src/layouts/create-sale/CreateSale.jsx b/src/layouts/create-sale/CreateSale.jsx new file mode 100644 index 000000000..3bac2ef46 --- /dev/null +++ b/src/layouts/create-sale/CreateSale.jsx @@ -0,0 +1,52 @@ +import { useNavigate } from "react-router-dom"; + +import SaleForm from "../sale-form"; +import GeneralButton from "../../shared/components/button"; + +import "../../shared/styles/GeneralStyles.css"; + +function CreateSale({ addSale, updateField, saleSelected, fetchClients, clientsList }) { + + const navigate = useNavigate(); + const navigateData = { + url: '/sales/list', + } + + const addSaleData = { + saleSelected: saleSelected, + } + + return ( + <> +
+ + +
+ + +
+
+ + +
+
+ + ) +} + +export default CreateSale; \ No newline at end of file diff --git a/src/layouts/create-sale/index.js b/src/layouts/create-sale/index.js new file mode 100644 index 000000000..dc72225bb --- /dev/null +++ b/src/layouts/create-sale/index.js @@ -0,0 +1,25 @@ +import { useSelector, useDispatch } from 'react-redux'; + +import CreateSale from "./CreateSale"; +import fromSales from '../../store/sales/selectors'; +import fromClients from '../../store/clients/selectors'; +import salesCommands from '../../store/sales/commands'; +import clientsCommands from '../../store/clients/commands'; + +const ConnectedCreateSale = () => { + const dispatch = useDispatch(); + + const selectorProps = { + saleSelected: useSelector(fromSales.currentSaleSelected), + clientsList: useSelector(fromClients.currentClients), + } + + const dispatchProps = { + addSale: sale => dispatch(salesCommands.addSale(sale)), + updateField: (value, field) => dispatch(salesCommands.updateField(value, field)), + fetchClients: filter => dispatch(clientsCommands.getClients(filter)), + } + return () +} + +export default ConnectedCreateSale; \ No newline at end of file diff --git a/src/layouts/profile/components/PlatformSettings/index.js b/src/layouts/profile/components/PlatformSettings/index.js deleted file mode 100644 index 398c0d4b6..000000000 --- a/src/layouts/profile/components/PlatformSettings/index.js +++ /dev/null @@ -1,115 +0,0 @@ -/** -========================================================= -* Material Dashboard 2 React - v2.2.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/material-dashboard-react -* Copyright 2023 Creative Tim (https://www.creative-tim.com) - -Coded by www.creative-tim.com - - ========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -*/ - -import { useState } from "react"; - -// @mui material components -import Card from "@mui/material/Card"; -import Switch from "@mui/material/Switch"; - -// Material Dashboard 2 React components -import MDBox from "components/MDBox"; -import MDTypography from "components/MDTypography"; - -function PlatformSettings() { - const [followsMe, setFollowsMe] = useState(true); - const [answersPost, setAnswersPost] = useState(false); - const [mentionsMe, setMentionsMe] = useState(true); - const [newLaunches, setNewLaunches] = useState(false); - const [productUpdate, setProductUpdate] = useState(true); - const [newsletter, setNewsletter] = useState(false); - - return ( - - - - platform settings - - - - - account - - - - setFollowsMe(!followsMe)} /> - - - - Email me when someone follows me - - - - - - setAnswersPost(!answersPost)} /> - - - - Email me when someone answers on my post - - - - - - setMentionsMe(!mentionsMe)} /> - - - - Email me when someone mentions me - - - - - - application - - - - - setNewLaunches(!newLaunches)} /> - - - - New launches and projects - - - - - - setProductUpdate(!productUpdate)} /> - - - - Monthly product updates - - - - - - setNewsletter(!newsletter)} /> - - - - Subscribe to newsletter - - - - - - ); -} - -export default PlatformSettings; diff --git a/src/layouts/profile/data/profilesListData.js b/src/layouts/profile/data/profilesListData.js deleted file mode 100644 index 61a4aecdf..000000000 --- a/src/layouts/profile/data/profilesListData.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -========================================================= -* Material Dashboard 2 React - v2.2.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/material-dashboard-react -* Copyright 2023 Creative Tim (https://www.creative-tim.com) - -Coded by www.creative-tim.com - - ========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -*/ - -// Images -import kal from "assets/images/kal-visuals-square.jpg"; -import marie from "assets/images/marie.jpg"; -import ivana from "assets/images/ivana-square.jpg"; -import team3 from "assets/images/team-3.jpg"; -import team4 from "assets/images/team-4.jpg"; - -export default [ - { - image: kal, - name: "Sophie B.", - description: "Hi! I need more information..", - action: { - type: "internal", - route: "/pages/profile/profile-overview", - color: "info", - label: "reply", - }, - }, - { - image: marie, - name: "Anne Marie", - description: "Awesome work, can you..", - action: { - type: "internal", - route: "/pages/profile/profile-overview", - color: "info", - label: "reply", - }, - }, - { - image: ivana, - name: "Ivanna", - description: "About files I can..", - action: { - type: "internal", - route: "/pages/profile/profile-overview", - color: "info", - label: "reply", - }, - }, - { - image: team4, - name: "Peterson", - description: "Have a great afternoon..", - action: { - type: "internal", - route: "/pages/profile/profile-overview", - color: "info", - label: "reply", - }, - }, - { - image: team3, - name: "Nick Daniel", - description: "Hi! I need more information..", - action: { - type: "internal", - route: "/pages/profile/profile-overview", - color: "info", - label: "reply", - }, - }, -]; diff --git a/src/layouts/profile/index.js b/src/layouts/profile/index.js deleted file mode 100644 index f51f6108f..000000000 --- a/src/layouts/profile/index.js +++ /dev/null @@ -1,203 +0,0 @@ -/** -========================================================= -* Material Dashboard 2 React - v2.2.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/material-dashboard-react -* Copyright 2023 Creative Tim (https://www.creative-tim.com) - -Coded by www.creative-tim.com - - ========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -*/ - -// @mui material components -import Grid from "@mui/material/Grid"; -import Divider from "@mui/material/Divider"; - -// @mui icons -import FacebookIcon from "@mui/icons-material/Facebook"; -import TwitterIcon from "@mui/icons-material/Twitter"; -import InstagramIcon from "@mui/icons-material/Instagram"; - -// Material Dashboard 2 React components -import MDBox from "components/MDBox"; -import MDTypography from "components/MDTypography"; - -// Material Dashboard 2 React example components -import DashboardLayout from "examples/LayoutContainers/DashboardLayout"; -import DashboardNavbar from "examples/Navbars/DashboardNavbar"; -import Footer from "examples/Footer"; -import ProfileInfoCard from "examples/Cards/InfoCards/ProfileInfoCard"; -import ProfilesList from "examples/Lists/ProfilesList"; -import DefaultProjectCard from "examples/Cards/ProjectCards/DefaultProjectCard"; - -// Overview page components -import Header from "layouts/profile/components/Header"; -import PlatformSettings from "layouts/profile/components/PlatformSettings"; - -// Data -import profilesListData from "layouts/profile/data/profilesListData"; - -// Images -import homeDecor1 from "assets/images/home-decor-1.jpg"; -import homeDecor2 from "assets/images/home-decor-2.jpg"; -import homeDecor3 from "assets/images/home-decor-3.jpg"; -import homeDecor4 from "assets/images/home-decor-4.jpeg"; -import team1 from "assets/images/team-1.jpg"; -import team2 from "assets/images/team-2.jpg"; -import team3 from "assets/images/team-3.jpg"; -import team4 from "assets/images/team-4.jpg"; - -function Overview() { - return ( - - - -
- - - - - - - - , - color: "facebook", - }, - { - link: "https://twitter.com/creativetim", - icon: , - color: "twitter", - }, - { - link: "https://www.instagram.com/creativetimofficial/", - icon: , - color: "instagram", - }, - ]} - action={{ route: "", tooltip: "Edit Profile" }} - shadow={false} - /> - - - - - - - - - - Projects - - - - Architects design houses - - - - - - - - - - - - - - - - - - - -
-