Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
60 changes: 34 additions & 26 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -147,8 +151,35 @@ export default function App() {
);

return direction === "rtl" ? (
<CacheProvider value={rtlCache}>
<ThemeProvider theme={darkMode ? themeDarkRTL : themeRTL}>
<Provider store={store}>
<CacheProvider value={rtlCache}>
<ThemeProvider theme={darkMode ? themeDarkRTL : themeRTL}>
<CssBaseline />
{layout === "dashboard" && (
<>
<Sidenav
color={sidenavColor}
brand={(transparentSidenav && !darkMode) || whiteSidenav ? brandDark : brandWhite}
brandName="Material Dashboard 2"
routes={routes}
onMouseEnter={handleOnMouseEnter}
onMouseLeave={handleOnMouseLeave}
/>
<Configurator />
{configsButton}
</>
)}
{layout === "vr" && <Configurator />}
<Routes>
{getRoutes(routes)}
<Route path="*" element={<Navigate to="/dashboard" />} />
</Routes>
</ThemeProvider>
</CacheProvider>
</Provider>
) : (
<Provider store={store}>
<ThemeProvider theme={darkMode ? themeDark : theme}>
<CssBaseline />
{layout === "dashboard" && (
<>
Expand All @@ -170,29 +201,6 @@ export default function App() {
<Route path="*" element={<Navigate to="/dashboard" />} />
</Routes>
</ThemeProvider>
</CacheProvider>
) : (
<ThemeProvider theme={darkMode ? themeDark : theme}>
<CssBaseline />
{layout === "dashboard" && (
<>
<Sidenav
color={sidenavColor}
brand={(transparentSidenav && !darkMode) || whiteSidenav ? brandDark : brandWhite}
brandName="Material Dashboard 2"
routes={routes}
onMouseEnter={handleOnMouseEnter}
onMouseLeave={handleOnMouseLeave}
/>
<Configurator />
{configsButton}
</>
)}
{layout === "vr" && <Configurator />}
<Routes>
{getRoutes(routes)}
<Route path="*" element={<Navigate to="/dashboard" />} />
</Routes>
</ThemeProvider>
</Provider>
);
}
Binary file added src/assets/images/small-store.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/examples/Sidenav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ function Sidenav({ color, brand, brandName, routes, ...rest }) {
}
/>
<List>{renderRoutes}</List>
<MDBox p={2} mt="auto">
{/* // ! CHECK THIS OUT */}
{/* <MDBox p={2} mt="auto">
<MDButton
component="a"
href="https://www.creative-tim.com/product/material-dashboard-pro-react"
Expand All @@ -191,7 +192,7 @@ function Sidenav({ color, brand, brandName, routes, ...rest }) {
>
upgrade to pro
</MDButton>
</MDBox>
</MDBox> */}
</SidenavRoot>
);
}
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/clients.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface Client {
id: string;
full_name: string;
tax_id: string;
phone: string;
email: string;
_deleted: boolean;
}
10 changes: 10 additions & 0 deletions src/interfaces/discounts.interface.ts
Original file line number Diff line number Diff line change
@@ -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;
}
9 changes: 9 additions & 0 deletions src/interfaces/products.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface Product {
id: string;
internal_code: string;
name: string;
description: string;
price: number;
measurement: string;
_deleted: boolean;
}
10 changes: 10 additions & 0 deletions src/interfaces/sales.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface Sale {
id: string;
products: {
product_id: string,
quantity: number
}[];
client_id: string;
amount: number;
_deleted: boolean;
}
52 changes: 52 additions & 0 deletions src/layouts/create-sale/CreateSale.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<>
<div>
<SaleForm
formFieldChange={updateField}
fetchClients={fetchClients}
clientsList={clientsList}
saleSelected={saleSelected}>
</SaleForm>
<div>
<GeneralButton
buttonText={'Crear'}
actionOnSubmit={addSale}
data={addSaleData}
keysArray={['saleSelected']}
buttonClasses={'mb-15'}
primary>
</GeneralButton>
</div>
<div>
<GeneralButton
buttonText={'Quiero regresar a la lista'}
actionOnSubmit={navigate}
data={navigateData}
keysArray={['url']}
buttonClasses={'mb-15 btn-secondary'}>
</GeneralButton>
</div>
</div>
</>
)
}

export default CreateSale;
25 changes: 25 additions & 0 deletions src/layouts/create-sale/index.js
Original file line number Diff line number Diff line change
@@ -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 (<CreateSale {...dispatchProps}{...selectorProps}></CreateSale>)
}

export default ConnectedCreateSale;
115 changes: 0 additions & 115 deletions src/layouts/profile/components/PlatformSettings/index.js

This file was deleted.

Loading