createOrder

This commit is contained in:
joshikannan
2024-04-01 20:17:03 +05:30
parent 30b05f9524
commit 3a255749bb
12 changed files with 2208 additions and 1430 deletions

View File

@@ -1,3 +1,3 @@
REACT_APP_URL='https://jupiter.nearle.app/live/api/v1' REACT_APP_URL='https://jupiter.nearle.app/live/api/v1'
REACT_APP_URL2='' REACT_APP_URL2='https://jupiter.nearle.app/live/api/v2'
REACT_APP_STAFF_TOKEN='' REACT_APP_STAFF_TOKEN=''

View File

@@ -1,3 +1,3 @@
REACT_APP_URL='https://jupiter.nearle.app/live/api/v1' REACT_APP_URL='https://jupiter.nearle.app/live/api/v1'
REACT_APP_URL2='' REACT_APP_URL2='https://jupiter.nearle.app/live/api/v2'
REACT_APP_STAFF_TOKEN='' REACT_APP_STAFF_TOKEN=''

65
package-lock.json generated
View File

@@ -51,6 +51,7 @@
"react-icons": "^4.12.0", "react-icons": "^4.12.0",
"react-intl": "^6.4.1", "react-intl": "^6.4.1",
"react-loading-icons": "^1.1.0", "react-loading-icons": "^1.1.0",
"react-phone-number-input": "^3.3.10",
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"react-router": "^6.10.0", "react-router": "^6.10.0",
"react-router-dom": "^6.10.0", "react-router-dom": "^6.10.0",
@@ -7161,6 +7162,11 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/country-flag-icons": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.10.tgz",
"integrity": "sha512-x3elaK+ZY23W1YtFsNQknRdURzkV7g3Z93AoA7SHZJUEXbVjRsNh4h9Uf09+OjWF/4u8tXeAt37gezGRdwR/2g=="
},
"node_modules/create-ecdh": { "node_modules/create-ecdh": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz",
@@ -10649,6 +10655,14 @@
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
}, },
"node_modules/input-format": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/input-format/-/input-format-0.3.10.tgz",
"integrity": "sha512-5cFv/kOZD7Ch0viprVkuYPDkAU7HBZYBx8QrIpQ6yXUWbAQ0+RQ8IIojDJOf/RO6FDJLL099HDSK2KoVZ2zevg==",
"dependencies": {
"prop-types": "^15.8.1"
}
},
"node_modules/internal-slot": { "node_modules/internal-slot": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
@@ -13464,6 +13478,11 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/libphonenumber-js": {
"version": "1.10.59",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.59.tgz",
"integrity": "sha512-HeTsOrDF/hWhEiKqZVwg9Cqlep5x2T+IYDENvT2VRj3iX8JQ7Y+omENv+AIn0vC8m6GYhivfCed5Cgfw27r5SA=="
},
"node_modules/lilconfig": { "node_modules/lilconfig": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz",
@@ -16933,6 +16952,22 @@
"node": ">= 12.0.0" "node": ">= 12.0.0"
} }
}, },
"node_modules/react-phone-number-input": {
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/react-phone-number-input/-/react-phone-number-input-3.3.10.tgz",
"integrity": "sha512-onv6ETMejyA4Wi0/6Ay00FcSokHIJcowLUcwdizpALSpeXPFqbyrjHQSL8+pgkxIIruRxr5nyIAB8LT+Sa/Vlg==",
"dependencies": {
"classnames": "^2.3.1",
"country-flag-icons": "^1.5.4",
"input-format": "^0.3.10",
"libphonenumber-js": "^1.10.59",
"prop-types": "^15.8.1"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
}
},
"node_modules/react-redux": { "node_modules/react-redux": {
"version": "8.0.5", "version": "8.0.5",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",
@@ -25456,6 +25491,11 @@
"yaml": "^1.7.2" "yaml": "^1.7.2"
} }
}, },
"country-flag-icons": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.10.tgz",
"integrity": "sha512-x3elaK+ZY23W1YtFsNQknRdURzkV7g3Z93AoA7SHZJUEXbVjRsNh4h9Uf09+OjWF/4u8tXeAt37gezGRdwR/2g=="
},
"create-ecdh": { "create-ecdh": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz",
@@ -27969,6 +28009,14 @@
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
}, },
"input-format": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/input-format/-/input-format-0.3.10.tgz",
"integrity": "sha512-5cFv/kOZD7Ch0viprVkuYPDkAU7HBZYBx8QrIpQ6yXUWbAQ0+RQ8IIojDJOf/RO6FDJLL099HDSK2KoVZ2zevg==",
"requires": {
"prop-types": "^15.8.1"
}
},
"internal-slot": { "internal-slot": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
@@ -29998,6 +30046,11 @@
"type-check": "~0.4.0" "type-check": "~0.4.0"
} }
}, },
"libphonenumber-js": {
"version": "1.10.59",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.59.tgz",
"integrity": "sha512-HeTsOrDF/hWhEiKqZVwg9Cqlep5x2T+IYDENvT2VRj3iX8JQ7Y+omENv+AIn0vC8m6GYhivfCed5Cgfw27r5SA=="
},
"lilconfig": { "lilconfig": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz",
@@ -32302,6 +32355,18 @@
"resolved": "https://registry.npmjs.org/react-loading-icons/-/react-loading-icons-1.1.0.tgz", "resolved": "https://registry.npmjs.org/react-loading-icons/-/react-loading-icons-1.1.0.tgz",
"integrity": "sha512-Y9eZ6HAufmUd8DIQd6rFrx5Bt/oDlTM9Nsjvf8YpajTa3dI8cLNU8jUN5z7KTANU+Yd6/KJuBjxVlrU2dMw33g==" "integrity": "sha512-Y9eZ6HAufmUd8DIQd6rFrx5Bt/oDlTM9Nsjvf8YpajTa3dI8cLNU8jUN5z7KTANU+Yd6/KJuBjxVlrU2dMw33g=="
}, },
"react-phone-number-input": {
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/react-phone-number-input/-/react-phone-number-input-3.3.10.tgz",
"integrity": "sha512-onv6ETMejyA4Wi0/6Ay00FcSokHIJcowLUcwdizpALSpeXPFqbyrjHQSL8+pgkxIIruRxr5nyIAB8LT+Sa/Vlg==",
"requires": {
"classnames": "^2.3.1",
"country-flag-icons": "^1.5.4",
"input-format": "^0.3.10",
"libphonenumber-js": "^1.10.59",
"prop-types": "^15.8.1"
}
},
"react-redux": { "react-redux": {
"version": "8.0.5", "version": "8.0.5",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",

View File

@@ -46,6 +46,7 @@
"react-icons": "^4.12.0", "react-icons": "^4.12.0",
"react-intl": "^6.4.1", "react-intl": "^6.4.1",
"react-loading-icons": "^1.1.0", "react-loading-icons": "^1.1.0",
"react-phone-number-input": "^3.3.10",
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"react-router": "^6.10.0", "react-router": "^6.10.0",
"react-router-dom": "^6.10.0", "react-router-dom": "^6.10.0",

View File

@@ -13,33 +13,34 @@ import { useEffect } from 'react';
// ==============================|| APP - THEME, ROUTER, LOCAL ||============================== // // ==============================|| APP - THEME, ROUTER, LOCAL ||============================== //
const App = () =>{ const App = () => {
let navigate=useNavigate() let navigate = useNavigate();
useEffect(()=>{ useEffect(() => {
if (!localStorage.getItem("authname")) { if (!localStorage.getItem('authname')) {
navigate('/login') navigate('/login');
} }
},[]) }, []);
return (
return <> <>
<ThemeCustomization> <ThemeCustomization>
{/* <RTLLayout> */} {/* <RTLLayout> */}
<Locales> <Locales>
<ScrollTop> <ScrollTop>
{/* <AuthProvider> */} {/* <AuthProvider> */}
<> <>
<Notistack> <Notistack>
<Routes /> <Routes />
<Snackbar /> <Snackbar />
</Notistack> </Notistack>
</> </>
{/* </AuthProvider> */} {/* </AuthProvider> */}
</ScrollTop> </ScrollTop>
</Locales> </Locales>
{/* </RTLLayout> */} {/* </RTLLayout> */}
</ThemeCustomization> </ThemeCustomization>
</> </>
} );
};
export default App; export default App;

View File

@@ -73,7 +73,7 @@ const HeaderContent = () => {
{matchesXs && <Box sx={{ width: '100%', ml: 1 }} />} {matchesXs && <Box sx={{ width: '100%', ml: 1 }} />}
<Stack direction={'row'} spacing={2}> <Stack direction={'row'} spacing={2}>
<Box sx={{ flexShrink: 0, ml: 0.75 }}> <Box sx={{ flexShrink: 0, ml: 0.75 }}>
<Tooltip title="Quick Menu"> <Tooltip title="Create Menu" placement="left">
<IconButton <IconButton
// color="secondary" // color="secondary"
// variant="light" // variant="light"

View File

@@ -22,7 +22,9 @@ import { openDrawer } from 'store/reducers/menu';
const MainLayout = () => { const MainLayout = () => {
const theme = useTheme(); const theme = useTheme();
const matchDownXL = useMediaQuery(theme.breakpoints.down('xl')); // const matchDownXL = useMediaQuery(theme.breakpoints.down('xl'));
const matchDownXL = useMediaQuery(`(max-width: 1440px)`);
const downLG = useMediaQuery(theme.breakpoints.down('lg')); const downLG = useMediaQuery(theme.breakpoints.down('lg'));
const { container, miniDrawer, menuOrientation } = useConfig(); const { container, miniDrawer, menuOrientation } = useConfig();

View File

@@ -52,10 +52,10 @@ export const fetchAllTenants = async ({ queryKey }) => {
let url = ''; let url = '';
if (search) { if (search) {
// url = `https://jupiter.nearle.app/live/api/v1/tenants/search/?keyword=${search}`; // url = `${process.env.REACT_APP_URL}/tenants/search/?keyword=${search}`;
url = `${process.env.REACT_APP_URL}/tenants/search/?keyword=${search}`; url = `${process.env.REACT_APP_URL}/tenants/search/?keyword=${search}`;
} else { } else {
// url = `https://jupiter.nearle.app/live/api/v1/tenants/getalltenants?pageno=${pageno}&pagesize=${size}`; // url = `${process.env.REACT_APP_URL}/tenants/getalltenants?pageno=${pageno}&pagesize=${size}`;
url = `${process.env.REACT_APP_URL}/tenants/getalltenants?pageno=${pageno}&pagesize=${size}`; url = `${process.env.REACT_APP_URL}/tenants/getalltenants?pageno=${pageno}&pagesize=${size}`;
} }
const response = await axios.get(url); const response = await axios.get(url);
@@ -139,9 +139,9 @@ export const fetchorderdetails = async ({ queryKey }) => {
let status = tabValue === 0 ? 'delivered' : tabValue === 1 ? 'pending' : 'cancelled'; let status = tabValue === 0 ? 'delivered' : tabValue === 1 ? 'pending' : 'cancelled';
const response = await axios.get( const response = await axios.get(
// appId == -1 // appId == -1
// ? `https://jupiter.nearle.app/live/api/v1/orders/getorders/?fromdate=${startdate}&todate=${enddate}` // ? `${process.env.REACT_APP_URL}/orders/getorders/?fromdate=${startdate}&todate=${enddate}`
// : `https://jupiter.nearle.app/live/api/v1/orders/getorders/?fromdate=${startdate}&todate=${enddate}&applocationid=${appId}` // : `${process.env.REACT_APP_URL}/orders/getorders/?fromdate=${startdate}&todate=${enddate}&applocationid=${appId}`
`https://jupiter.nearle.app/live/api/v1/deliveries/getdeliveries/?tenantid=${tenid}&fromdate=${startdate}&todate=${enddate}` `${process.env.REACT_APP_URL}/deliveries/getdeliveries/?tenantid=${tenid}&fromdate=${startdate}&todate=${enddate}`
); );
console.log('fetchorderdetails', response.data.details); console.log('fetchorderdetails', response.data.details);
@@ -151,7 +151,7 @@ export const fetchorderdetails = async ({ queryKey }) => {
export const fetchCount = async ({ queryKey }) => { export const fetchCount = async ({ queryKey }) => {
console.log('queryKey of fetchCount', queryKey); console.log('queryKey of fetchCount', queryKey);
const [startdate, enddate] = queryKey; const [startdate, enddate] = queryKey;
const response = await axios.get(`https://jupiter.nearle.app/live/api/v1/orders/getorders/?fromdate=${startdate}&todate=${enddate}`); const response = await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?fromdate=${startdate}&todate=${enddate}`);
const calculateOrderCounts = () => { const calculateOrderCounts = () => {
let deliveredCount = 0; let deliveredCount = 0;
let pendingCount = 0; let pendingCount = 0;

View File

@@ -1,318 +1,309 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react';
// import { useSelector } from 'react-redux'; // import { useSelector } from 'react-redux';
// import AuthWrapper from 'sections/auth/AuthWrapper'; // import AuthWrapper from 'sections/auth/AuthWrapper';
import { import {
Box, Grid, Card, Box,
CardContent, Grid,
// CardHeader, Card,
Stack, CardContent,
// Divider, // CardHeader,
// InputLabel, Stack,
// OutlinedInput, // Divider,
TextField, // InputLabel,
Button, // OutlinedInput,
Typography, TextField,
CardHeader, Button,
Container, Typography,
Link CardHeader,
} from '@mui/material' Container,
Link
} from '@mui/material';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import AnimateButton from 'components/@extended/AnimateButton'; import AnimateButton from 'components/@extended/AnimateButton';
import logo from 'assets/images/logo-nearle1.png';
import logo from 'assets/images/logo-nearle1.png' import axios from 'axios';
import { useNavigate } from 'react-router-dom';
import axios from 'axios'
import { useNavigate } from 'react-router-dom'
// import { openSnackbar } from 'store/reducers/snackbar'; // import { openSnackbar } from 'store/reducers/snackbar';
// import { useDispatch } from 'react-redux'; // import { useDispatch } from 'react-redux';
import Loader from 'components/Loader'; import Loader from 'components/Loader';
import { enqueueSnackbar } from 'notistack'; import { enqueueSnackbar } from 'notistack';
const Login = () => { const Login = () => {
const theme = useTheme(); const theme = useTheme();
const [username, setUsername] = useState(''); const [username, setUsername] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [alertmessage, setAlertmessage] = useState(''); const [alertmessage, setAlertmessage] = useState('');
const [checkusername, setCheckusername] = useState(false); const [checkusername, setCheckusername] = useState(false);
// const [toast, setToast] = useState(false); // const [toast, setToast] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
let navigate = useNavigate(); let navigate = useNavigate();
// let dispatch = useDispatch(); // let dispatch = useDispatch();
const [submitting, setSubmitting] = useState(false) const [submitting, setSubmitting] = useState(false);
// let loginuserid = useSelector((state)=>state.logininfo); // let loginuserid = useSelector((state)=>state.logininfo);
// useEffect(() => { // useEffect(() => {
// if (alertmessage) { // if (alertmessage) {
// dispatch( // dispatch(
// openSnackbar({ // openSnackbar({
// open: true, // open: true,
// message: alertmessage, // message: alertmessage,
// variant: 'alert', // variant: 'alert',
// anchorOrigin: { vertical: 'top', horizontal: 'right' }, // anchorOrigin: { vertical: 'top', horizontal: 'right' },
// alert: { // alert: {
// // variant:'info', // // variant:'info',
// color: 'error', // color: 'error',
// } // }
// }) // })
// ) // )
// } // }
// }, [toast]) // }, [toast])
useEffect(() => { useEffect(() => {
if (localStorage.getItem("authname") if (
// || localStorage.getItem("appuserid") localStorage.getItem('authname')
) { // || localStorage.getItem("appuserid")
navigate('/orders') ) {
} navigate('/orders');
// console.log(alertmessage)
}, [])
const usernamecheck = async (e) => {
e.preventDefault();
setUsername(e.target.value)
if (e.target.value) {
try {
// await axios.post(`${process.env.REACT_APP_URL}/auth/login`, {
// "authname": e.target.value
// })
await axios.post(`${process.env.REACT_APP_URL}/users/login`, {
"authname": e.target.value,
"configid": 1,
"password": 'admin'
})
.then((res) => {
console.log(res.data)
if (res.data.details.authname === e.target.value) {
setUsername(e.target.value);
setCheckusername(false);
} else {
setCheckusername(true);
}
// if (res.data.authname === e.target.value) {
// setUsername(e.target.value);
// setCheckusername(false);
// }
}).catch((err) => {
// if (err.response.data.message === 'No user found') {
setCheckusername(true);
// }
})
} catch (err) {
console.log(err)
}
}
} }
const loginsend = async () => { // console.log(alertmessage)
// e.preventDefault(); }, []);
setLoading(true)
if (password && username) { const usernamecheck = async (e) => {
if (password == 'admin') { e.preventDefault();
setUsername(e.target.value);
if (e.target.value) {
setSubmitting(true) try {
try { // await axios.post(`${process.env.REACT_APP_URL}/auth/login`, {
await axios.post(`${process.env.REACT_APP_URL}/users/login`, { // "authname": e.target.value
"authname": username, // })
"configid": 1, await axios
"password": password // .post(`${process.env.REACT_APP_URL}/users/login`, {
}).then((res) => { .post(`${process.env.REACT_APP_URL}/users/tenant/login`, {
console.log(res.data) authname: e.target.value,
if (res.data.details.authname === username) { configid: 1,
// setAlertmessage('login Successfull'); password: 'admin'
setLoading(false) })
// dispatch( .then((res) => {
// openSnackbar({ console.log(res.data);
// open: true, if (res.data.details.authname === e.target.value) {
// message: 'login Successfull', setUsername(e.target.value);
// variant: 'alert', setCheckusername(false);
// anchorOrigin: { vertical: 'top', horizontal: 'right' }, } else {
// alert: { setCheckusername(true);
// color: 'success'
// }
// })
// )
enqueueSnackbar('login Successfull', {
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 3000
})
setUsername('');
setPassword('');
localStorage.setItem("firstname", res.data.details.tenantname);
localStorage.setItem("authname", res.data.details.authname);
localStorage.setItem("appuserid", res.data.details.userid);
localStorage.setItem("roleid", res.data.details.roleid);
localStorage.setItem("tenantid", res.data.details.tenantid);
localStorage.setItem("applocationid", res.data.details.applocationid);
localStorage.setItem("fullname", res.data.details.fullname);
navigate('/orders');
setSubmitting(false)
}else{
opentoast('Login Error')
setLoading(false)
setSubmitting(false)
}
}).catch((err) => {
console.log(err);
// setAlertmessage('Invalid Data');
// if(err.message == 'Network Error'){
opentoast(err.message)
// }else{
// opentoast('Invalid Data');
// }
setLoading(false)
setSubmitting(false)
console.log(err.message)
})
} catch (err) {
console.log(err)
setLoading(false)
setSubmitting(false)
}
}else{
opentoast('Password is Incorrect');
setLoading(false)
} }
} else { // if (res.data.authname === e.target.value) {
// let el2 = document.getElementById('toastid');
// el2.classList.add('d-block');
// el2.classList.remove('d-none');
setAlertmessage('Fill All required fields');
opentoast('Fill All required fields');
setLoading(false)
}
// setUsername(e.target.value);
// setCheckusername(false);
// }
})
.catch((err) => {
// if (err.response.data.message === 'No user found') {
setCheckusername(true);
// }
});
} catch (err) {
console.log(err);
}
} }
};
// const handleClose = () => { const loginsend = async () => {
// e.preventDefault();
setLoading(true);
if (password && username) {
if (password == 'admin') {
setSubmitting(true);
try {
await axios
// .post(`${process.env.REACT_APP_URL}/users/login`, {
.post(`${process.env.REACT_APP_URL}/users/tenant/login`, {
authname: username,
configid: 1,
password: password
})
.then((res) => {
console.log(res.data);
if (res.data.details.authname === username) {
// setAlertmessage('login Successfull');
setLoading(false);
// dispatch(
// openSnackbar({
// open: true,
// message: 'login Successfull',
// variant: 'alert',
// anchorOrigin: { vertical: 'top', horizontal: 'right' },
// alert: {
// color: 'success'
// }
// })
// )
enqueueSnackbar('login Successfull', {
variant: 'success',
anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 1000
});
setUsername('');
setPassword('');
localStorage.setItem('firstname', res.data.details.tenantname);
localStorage.setItem('authname', res.data.details.authname);
localStorage.setItem('appuserid', res.data.details.userid);
localStorage.setItem('roleid', res.data.details.roleid);
localStorage.setItem('tenantid', res.data.details.tenantid);
localStorage.setItem('applocationid', res.data.details.applocationid);
localStorage.setItem('fullname', res.data.details.fullname);
localStorage.setItem('configid', res.data.details.configid);
localStorage.setItem('locationid', res.data.details.locationid);
localStorage.setItem('moduleid', res.data.details.moduleid);
localStorage.setItem('userid', res.data.details.userid);
navigate('/orders');
setSubmitting(false);
} else {
opentoast('Login Error');
setLoading(false);
setSubmitting(false);
}
})
.catch((err) => {
console.log(err);
// setAlertmessage('Invalid Data');
// if(err.message == 'Network Error'){
opentoast(err.message);
// }else{
// opentoast('Invalid Data');
// }
setLoading(false);
setSubmitting(false);
console.log(err.message);
});
} catch (err) {
console.log(err);
setLoading(false);
setSubmitting(false);
}
} else {
opentoast('Password is Incorrect');
setLoading(false);
}
} else {
// let el2 = document.getElementById('toastid');
// el2.classList.add('d-block');
// el2.classList.remove('d-none');
setAlertmessage('Fill All required fields');
opentoast('Fill All required fields');
setLoading(false);
}
};
// const handleClose = () => {
// setToast(false)
// }
const opentoast = (message) => {
// setToast(true)
// setTimeout(() => {
// // handleClose();
// setToast(false) // setToast(false)
// } // }, 2000);
const opentoast = (message) => { enqueueSnackbar(message, {
// setToast(true) variant: 'error',
anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
});
};
return (
<>
// setTimeout(() => { {/* <AuthWrapper> */}
// // handleClose(); <Box sx={{ minHeight: '100vh' }}>
// setToast(false) {loading && <Loader />}
// }, 2000); {/* <AuthBackground /> */}
enqueueSnackbar(message, { <Grid
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, container
autoHideDuration: 2000 direction="column"
}) justifyContent="flex-start"
} sx={{
minHeight: '100vh'
}}
>
return <> <Grid
{/* <AuthWrapper> */} item
<Box sx={{ minHeight: '100vh' }}> xs={12}
{(loading) && // sx={{ ml: 3, mt: 3 }}
sx={{ ml: 3, mt: 1 }}
<Loader /> >
} <img src={logo} alt="legendary" width="200px" />
{/* <AuthBackground /> */} </Grid>
<Grid item xs={12}>
<Grid <Grid
container item
direction="column" xs={12}
justifyContent="flex-start" container
sx={{ justifyContent="center"
minHeight: '100vh' alignItems="center"
}} // sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 112px)' } }}
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 140px)' } }}
> >
<Grid item xs={12} <Grid item>
// sx={{ ml: 3, mt: 3 }} {/* <AuthCard>{children}</AuthCard> */}
sx={{ ml: 3, mt: 1 }} <Box
sx={{
maxWidth: { xs: 400, lg: 475 },
margin: { xs: 2.5, md: 3 },
'& > *': {
flexGrow: 1,
flexBasis: '50%'
}
}}
> >
<Card
sx={{
position: 'relative',
border: '1px solid',
borderRadius: 1,
borderColor: theme.palette.divider,
boxShadow: 'inherit',
p: 2,
width: '100%'
}}
>
{/* <CardHeader title={<Typography variant="h4">Login</Typography>} /> */}
{/* <Divider sx={{ borderStyle: 'dashed' }} /> */}
{/* <h1>eee</h1> */}
{/* <CardHeader> */}
<img src={logo} alt='legendary' <Grid container spacing={3}>
width='200px' <Grid item xs={12}>
/> <Stack direction="row" justifyContent="flex-start" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
</Grid> <CardHeader title={<Typography variant="h3">Login</Typography>} />
<Grid item xs={12}> </Stack>
<Grid </Grid>
item
xs={12}
container
justifyContent="center"
alignItems="center"
// sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 112px)' } }}
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 140px)' } }}
> {/* <Grid item xs={12}>
<Grid item>
{/* <AuthCard>{children}</AuthCard> */}
<Box sx={{
maxWidth: { xs: 400, lg: 475 },
margin: { xs: 2.5, md: 3 },
'& > *': {
flexGrow: 1,
flexBasis: '50%'
}
}} >
<Card sx={{
position: 'relative',
border: '1px solid',
borderRadius: 1,
borderColor: theme.palette.divider,
boxShadow: 'inherit',
p: 2,
width: '100%'
}}>
{/* <CardHeader title={<Typography variant="h4">Login</Typography>} /> */}
{/* <Divider sx={{ borderStyle: 'dashed' }} /> */}
{/* <h1>eee</h1> */}
{/* <CardHeader> */}
<Grid container
spacing={3}
>
<Grid item xs={12}>
<Stack direction="row" justifyContent="flex-start" alignItems="baseline"
sx={{ mb: { xs: -0.5, sm: 0.5 } }}
>
<CardHeader
title={<Typography variant="h3">Login</Typography>}
/>
</Stack>
</Grid>
{/* <Grid item xs={12}>
<AuthLogin isDemo={isLoggedIn} /> <AuthLogin isDemo={isLoggedIn} />
</Grid> */} </Grid> */}
</Grid> </Grid>
<CardContent> <CardContent>
<form noValidate <form
onSubmit={(e) => { e.preventDefault() }} noValidate
> onSubmit={(e) => {
<Grid container e.preventDefault();
spacing={2} }}
> >
<Grid item xs={12}> <Grid container spacing={2}>
{/* <Stack spacing={1}> */} <Grid item xs={12}>
{/* <InputLabel htmlFor="email-login">Email Address</InputLabel> {/* <Stack spacing={1}> */}
{/* <InputLabel htmlFor="email-login">Email Address</InputLabel>
<OutlinedInput <OutlinedInput
id="email-login" id="email-login"
type="email" type="email"
@@ -336,26 +327,34 @@ const Login = () => {
{errors.email} {errors.email}
</FormHelperText> </FormHelperText>
)} */} )} */}
<TextField <TextField
margin="normal" margin="normal"
fullWidth fullWidth
id="username1" label="E-mail Address" variant="outlined" autoComplete='email' required id="username1"
onChange={usernamecheck} label="E-mail Address"
error={checkusername} variant="outlined"
/> autoComplete="email"
<TextField required
margin="normal" onChange={usernamecheck}
fullWidth error={checkusername}
required />
autoComplete="current-password" <TextField
onChange={(e) => setPassword(e.target.value)} margin="normal"
type='password' id="password1" label="Password" variant="outlined" /> fullWidth
{/* </Stack> */} required
</Grid> autoComplete="current-password"
<Grid item xs={12}> onChange={(e) => setPassword(e.target.value)}
{/* <Stack spacing={0}> */} type="password"
{/* <InputLabel htmlFor="password-login">Password</InputLabel> */} id="password1"
{/* <OutlinedInput label="Password"
variant="outlined"
/>
{/* </Stack> */}
</Grid>
<Grid item xs={12}>
{/* <Stack spacing={0}> */}
{/* <InputLabel htmlFor="password-login">Password</InputLabel> */}
{/* <OutlinedInput
fullWidth fullWidth
// error={Boolean(touched.password && errors.password)} // error={Boolean(touched.password && errors.password)}
// id="-password-login" // id="-password-login"
@@ -385,20 +384,19 @@ const Login = () => {
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
type='password' id="password1" type='password' id="password1"
/> */} /> */}
{/* {touched.password && errors.password && ( {/* {touched.password && errors.password && (
<FormHelperText error id="standard-weight-helper-text-password-login"> <FormHelperText error id="standard-weight-helper-text-password-login">
{errors.password} {errors.password}
</FormHelperText> </FormHelperText>
)} */} )} */}
{/* </Stack> */} {/* </Stack> */}
<Link href="#" variant="h6" > <Link href="#" variant="h6">
Forgot password? Forgot password?
</Link> </Link>
</Grid> </Grid>
{/* <Grid item xs={12} sx={{ mt: -1 }}>
{/* <Grid item xs={12} sx={{ mt: -1 }}>
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
<FormControlLabel <FormControlLabel
control={ control={
@@ -417,92 +415,96 @@ const Login = () => {
</Link> </Link>
</Stack> </Stack>
</Grid> */} </Grid> */}
{/* {errors.submit && ( {/* {errors.submit && (
<Grid item xs={12}> <Grid item xs={12}>
<FormHelperText error>{errors.submit}</FormHelperText> <FormHelperText error>{errors.submit}</FormHelperText>
</Grid> </Grid>
)} */} )} */}
<Grid item xs={12}> <Grid item xs={12}>
{/* <AnimateButton> */} {/* <AnimateButton> */}
<AnimateButton> <AnimateButton>
<Button <Button
disabled={submitting} disabled={submitting}
onClick={() => {
onClick={() => { loginsend();
loginsend() // navigate('/dashboard')
// navigate('/dashboard') }}
}} fullWidth
fullWidth size="large" type="submit" variant="contained" color="primary"> size="large"
Login type="submit"
</Button> variant="contained"
</AnimateButton> color="primary"
{/* </AnimateButton> */} >
</Grid> Login
</Grid> </Button>
{/* </Grid> */} </AnimateButton>
</form> {/* </AnimateButton> */}
</CardContent> </Grid>
{/* </CardHeader> */}
</Card>
</Box>
</Grid> </Grid>
</Grid> {/* </Grid> */}
</Grid> </form>
<Grid item xs={12} </CardContent>
// sx={{ m: 3, mt: 1 }} {/* </CardHeader> */}
sx={{ mb: 1 }} </Card>
</Box>
</Grid>
</Grid>
</Grid>
<Grid
item
xs={12}
// sx={{ m: 3, mt: 1 }}
sx={{ mb: 1 }}
>
{/* <AuthFooter /> */}
<Container maxWidth="xl">
<Stack
direction={{ sx: 'column', md: 'row' }}
justifyContent={{ sx: 'center', md: 'space-between' }}
spacing={2}
// textAlign={{ sx: 'center', md: 'inherit' }}
alignItems={{ sx: 'center', md: 'inherit' }}
width="100%"
>
<Stack direction="row" justifyContent="center" spacing={1}>
<Typography variant="subtitle2" color="secondary" component="span" sx={{ display: 'flex' }}>
&copy; All rights reserved
{/* <Typography variant="subtitle2" href="#mantis-privacy" target="_blank" underline="hover" sx={{ml:1}}>Privacy Policy</Typography> */}
</Typography>
</Stack>
<Stack
direction={{ sx: 'column', md: 'row' }}
spacing={{ sx: 1, md: 3 }}
textAlign={{ sx: 'center', md: 'inherit' }}
alignItems={{ sx: 'center', md: 'inherit' }}
// width='100%'
> >
{/* <AuthFooter /> */} <Typography
variant="subtitle2"
color="secondary"
<Container maxWidth="xl"> component={Link}
<Stack href="#"
direction={{ sx: 'column', md: 'row' }} // target="_blank"
justifyContent={{ sx: 'center', md: 'space-between' }} underline="hover"
spacing={2} textAlign="center"
// textAlign={{ sx: 'center', md: 'inherit' }} >
Terms and Conditions
alignItems={{ sx: 'center', md: 'inherit' }} </Typography>
width='100%' <Typography
variant="subtitle2"
> color="secondary"
<Stack direction='row' justifyContent='center' spacing={1}> component={Link}
<Typography variant="subtitle2" color="secondary" component="span" sx={{ display: 'flex' }}>&copy; All rights reserved href="#"
{/* <Typography variant="subtitle2" href="#mantis-privacy" target="_blank" underline="hover" sx={{ml:1}}>Privacy Policy</Typography> */} // target="_blank"
underline="hover"
</Typography> textAlign="center"
</Stack> >
Privacy Policy
<Stack direction={{ sx: 'column', md: 'row' }} spacing={{ sx: 1, md: 3 }} </Typography>
textAlign={{ sx: 'center', md: 'inherit' }} {/* <Typography
alignItems={{ sx: 'center', md: 'inherit' }}
// width='100%'
>
<Typography
variant="subtitle2"
color="secondary"
component={Link}
href="#"
// target="_blank"
underline="hover"
textAlign='center'
>
Terms and Conditions
</Typography>
<Typography
variant="subtitle2"
color="secondary"
component={Link}
href="#"
// target="_blank"
underline="hover"
textAlign='center'
>
Privacy Policy
</Typography>
{/* <Typography
variant="subtitle2" variant="subtitle2"
color="secondary" color="secondary"
component={Link} component={Link}
@@ -513,14 +515,15 @@ const Login = () => {
> >
CA Privacy Notice CA Privacy Notice
</Typography> */} </Typography> */}
</Stack> </Stack>
</Stack> </Stack>
</Container> </Container>
</Grid> </Grid>
</Grid> </Grid>
</Box > </Box>
{/* </AuthWrapper> */} {/* </AuthWrapper> */}
</> </>
} );
};
export default Login; export default Login;

File diff suppressed because it is too large Load Diff

View File

@@ -406,8 +406,8 @@ const Orders = () => {
{loading && ( {loading && (
<> <>
<TableBody> <TableBody>
{[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((item) => ( {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((item, index) => (
<TableRow key={item}> <TableRow key={index}>
<TableCell> <TableCell>
<Skeleton animation="wave" /> <Skeleton animation="wave" />
</TableCell> </TableCell>

View File

@@ -4173,6 +4173,11 @@ cosmiconfig@^8.1.3:
parse-json "^5.0.0" parse-json "^5.0.0"
path-type "^4.0.0" path-type "^4.0.0"
country-flag-icons@^1.5.4:
version "1.5.10"
resolved "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.10.tgz"
integrity sha512-x3elaK+ZY23W1YtFsNQknRdURzkV7g3Z93AoA7SHZJUEXbVjRsNh4h9Uf09+OjWF/4u8tXeAt37gezGRdwR/2g==
create-ecdh@^4.0.0: create-ecdh@^4.0.0:
version "4.0.4" version "4.0.4"
resolved "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz" resolved "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz"
@@ -6202,6 +6207,13 @@ ini@^1.3.5:
resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
input-format@^0.3.10:
version "0.3.10"
resolved "https://registry.npmjs.org/input-format/-/input-format-0.3.10.tgz"
integrity sha512-5cFv/kOZD7Ch0viprVkuYPDkAU7HBZYBx8QrIpQ6yXUWbAQ0+RQ8IIojDJOf/RO6FDJLL099HDSK2KoVZ2zevg==
dependencies:
prop-types "^15.8.1"
internal-slot@^1.0.3, internal-slot@^1.0.4: internal-slot@^1.0.3, internal-slot@^1.0.4:
version "1.0.5" version "1.0.5"
resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz" resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz"
@@ -7230,6 +7242,11 @@ levn@~0.3.0:
prelude-ls "~1.1.2" prelude-ls "~1.1.2"
type-check "~0.3.2" type-check "~0.3.2"
libphonenumber-js@^1.10.59:
version "1.10.59"
resolved "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.59.tgz"
integrity sha512-HeTsOrDF/hWhEiKqZVwg9Cqlep5x2T+IYDENvT2VRj3iX8JQ7Y+omENv+AIn0vC8m6GYhivfCed5Cgfw27r5SA==
lilconfig@^2.0.3, lilconfig@^2.0.5, lilconfig@^2.0.6: lilconfig@^2.0.3, lilconfig@^2.0.5, lilconfig@^2.0.6:
version "2.0.6" version "2.0.6"
resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz" resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz"
@@ -9243,6 +9260,17 @@ react-loading-icons@^1.1.0:
resolved "https://registry.npmjs.org/react-loading-icons/-/react-loading-icons-1.1.0.tgz" resolved "https://registry.npmjs.org/react-loading-icons/-/react-loading-icons-1.1.0.tgz"
integrity sha512-Y9eZ6HAufmUd8DIQd6rFrx5Bt/oDlTM9Nsjvf8YpajTa3dI8cLNU8jUN5z7KTANU+Yd6/KJuBjxVlrU2dMw33g== integrity sha512-Y9eZ6HAufmUd8DIQd6rFrx5Bt/oDlTM9Nsjvf8YpajTa3dI8cLNU8jUN5z7KTANU+Yd6/KJuBjxVlrU2dMw33g==
react-phone-number-input@^3.3.10:
version "3.3.10"
resolved "https://registry.npmjs.org/react-phone-number-input/-/react-phone-number-input-3.3.10.tgz"
integrity sha512-onv6ETMejyA4Wi0/6Ay00FcSokHIJcowLUcwdizpALSpeXPFqbyrjHQSL8+pgkxIIruRxr5nyIAB8LT+Sa/Vlg==
dependencies:
classnames "^2.3.1"
country-flag-icons "^1.5.4"
input-format "^0.3.10"
libphonenumber-js "^1.10.59"
prop-types "^15.8.1"
"react-redux@^7.2.1 || ^8.0.2", react-redux@^8.0.5: "react-redux@^7.2.1 || ^8.0.2", react-redux@^8.0.5:
version "8.0.5" version "8.0.5"
resolved "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz" resolved "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz"