This commit is contained in:
Malai Raja
2023-12-08 19:01:21 +05:30
parent 743cae09b8
commit ecafa8fb25
27 changed files with 658 additions and 836 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -227,7 +227,10 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
item.title && item.title &&
drawerOpen && ( drawerOpen && (
<Box sx={{ pl: 3, mb: 1.5 }}> <Box sx={{ pl: 3, mb: 1.5 }}>
<Typography variant="subtitle2" color={theme.palette.mode === ThemeMode.DARK ? 'textSecondary' : 'text.secondary'}> <Typography variant="subtitle2"
// color={theme.palette.mode === ThemeMode.DARK ? 'textSecondary' : 'text.secondary'}
sx={{color:'#fff'}}
>
{item.title} {item.title}
</Typography> </Typography>
{item.caption && ( {item.caption && (

View File

@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { forwardRef, useEffect } from 'react'; import { forwardRef, useEffect,useState } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
@@ -9,8 +9,10 @@ import { Avatar, Chip, ListItemButton, ListItemIcon, ListItemText, Typography, u
// project import // project import
import Dot from 'components/@extended/Dot'; import Dot from 'components/@extended/Dot';
import { MenuOrientation, ThemeMode } from 'config'; import { MenuOrientation, ThemeMode } from 'config';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
// import { dispatch, useSelector } from 'store';
import { activeItem, openDrawer } from 'store/reducers/menu'; import { activeItem, openDrawer } from 'store/reducers/menu';
// ==============================|| NAVIGATION - LIST ITEM ||============================== // // ==============================|| NAVIGATION - LIST ITEM ||============================== //
@@ -21,9 +23,11 @@ const NavItem = ({ item, level }) => {
const { menuOrientation } = useConfig(); const { menuOrientation } = useConfig();
const { drawerOpen, openItem } = useSelector((state) => state.menu); const { drawerOpen, openItem } = useSelector((state) => state.menu);
const [ishover,setIshover]=useState('')
const downLG = useMediaQuery(theme.breakpoints.down('lg')); const downLG = useMediaQuery(theme.breakpoints.down('lg'));
let itemTarget = '_self'; let itemTarget = '_self';
if (item.target) { if (item.target) {
itemTarget = '_blank'; itemTarget = '_blank';
@@ -35,9 +39,10 @@ const NavItem = ({ item, level }) => {
} }
const Icon = item.icon; const Icon = item.icon;
const itemIcon = item.icon ? <Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem' }} /> : false;
const isSelected = openItem.findIndex((id) => id === item.id) > -1; const isSelected = openItem.findIndex((id) => id === item.id) > -1;
const itemIcon = item.icon ? <Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem',
color:isSelected?'#662582':'#fff' }} /> : false;
// const { pathname } = useLocation(); // const { pathname } = useLocation();
const pathname = document.location.pathname; const pathname = document.location.pathname;
@@ -62,7 +67,7 @@ const NavItem = ({ item, level }) => {
// eslint-disable-next-line // eslint-disable-next-line
}, [pathname]); }, [pathname]);
const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : 'text.primary'; const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : '#fff';
const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? 'text.primary' : 'primary.main'; const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? 'text.primary' : 'primary.main';
return ( return (
@@ -72,13 +77,20 @@ const NavItem = ({ item, level }) => {
{...listItemProps} {...listItemProps}
disabled={item.disabled} disabled={item.disabled}
selected={isSelected} selected={isSelected}
onMouseEnter={(e,val)=>{
console.log(e)
}}
onMouseLeave={()=>{
setIshover('')
}}
sx={{ sx={{
zIndex: 1201, zIndex: 1201,
pl: drawerOpen ? `${level * 28}px` : 1.5, pl: drawerOpen ? `${level * 28}px` : 1.5,
py: !drawerOpen && level === 1 ? 1.25 : 1, py: !drawerOpen && level === 1 ? 1.25 : 1,
...(drawerOpen && { ...(drawerOpen && {
'&:hover': { '&:hover': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter' // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter'
bgcolor:'#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter', bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter',
@@ -92,7 +104,10 @@ const NavItem = ({ item, level }) => {
}), }),
...(!drawerOpen && { ...(!drawerOpen && {
'&:hover': { '&:hover': {
bgcolor: 'transparent' bgcolor: 'transparent',
// bgcolor:'#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
'&:hover': { '&:hover': {
@@ -110,7 +125,11 @@ const NavItem = ({ item, level }) => {
<ListItemIcon <ListItemIcon
sx={{ sx={{
minWidth: 28, minWidth: 28,
'&:hover': {
color:isSelected ? '#fff':iconSelectedColor ,
},
color: isSelected ? iconSelectedColor : textColor, color: isSelected ? iconSelectedColor : textColor,
...(!drawerOpen && { ...(!drawerOpen && {
borderRadius: 1.5, borderRadius: 1.5,
width: 36, width: 36,
@@ -118,7 +137,9 @@ const NavItem = ({ item, level }) => {
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
'&:hover': { '&:hover': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter' // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter'
bgcolor:'#7b1fa2'
} }
}), }),
...(!drawerOpen && ...(!drawerOpen &&

View File

@@ -22,7 +22,8 @@ const DrawerContent = () => {
'& .simplebar-content': { '& .simplebar-content': {
display: 'flex', display: 'flex',
flexDirection: 'column' flexDirection: 'column'
} },
}} }}
> >
<Navigation /> <Navigation />

View File

@@ -11,8 +11,8 @@ import Logo from 'components/logo';
import { MenuOrientation } from 'config'; import { MenuOrientation } from 'config';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
import logo from 'assets/images/logo-nearle.png' import logo from 'assets/images/logo-nearle9.png'
import logo1 from 'assets/images/logo-sm.png' import logo1 from 'assets/images/logo-sm1.png'
// ==============================|| DRAWER HEADER ||============================== // // ==============================|| DRAWER HEADER ||============================== //
const DrawerHeader = ({ open }) => { const DrawerHeader = ({ open }) => {
@@ -39,12 +39,14 @@ const DrawerHeader = ({ open }) => {
{(open) && {(open) &&
<img src={logo} <img src={logo}
// width='160px' // width='160px'
height='45px' // height='45px'
width='170px' // width='170px'
alt='logo'/> alt='logo'/>
} }
{(!open) && {(!open) &&
<img src={logo1} width='40px' alt='logo'/> <img src={logo1}
width='40px'
alt='logo'/>
} }
</DrawerHeaderStyled> </DrawerHeaderStyled>
); );

View File

@@ -13,7 +13,8 @@ const openedMixin = (theme) => ({
duration: theme.transitions.duration.enteringScreen duration: theme.transitions.duration.enteringScreen
}), }),
overflowX: 'hidden', overflowX: 'hidden',
boxShadow: theme.palette.mode === ThemeMode.DARK ? theme.customShadows.z1 : 'none' boxShadow: theme.palette.mode === ThemeMode.DARK ? theme.customShadows.z1 : 'none',
backgroundColor:'#662582',
}); });
const closedMixin = (theme) => ({ const closedMixin = (theme) => ({
@@ -24,7 +25,8 @@ const closedMixin = (theme) => ({
overflowX: 'hidden', overflowX: 'hidden',
width: theme.spacing(7.5), width: theme.spacing(7.5),
borderRight: 'none', borderRight: 'none',
boxShadow: theme.customShadows.z1 boxShadow: theme.customShadows.z1,
backgroundColor:'#662582',
}); });
// ==============================|| DRAWER - MINI STYLED ||============================== // // ==============================|| DRAWER - MINI STYLED ||============================== //
@@ -34,6 +36,7 @@ const MiniDrawerStyled = styled(Drawer, { shouldForwardProp: (prop) => prop !==
flexShrink: 0, flexShrink: 0,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
boxSizing: 'border-box', boxSizing: 'border-box',
...(open && { ...(open && {
...openedMixin(theme), ...openedMixin(theme),
'& .MuiDrawer-paper': openedMixin(theme) '& .MuiDrawer-paper': openedMixin(theme)

View File

@@ -33,7 +33,7 @@ const MainDrawer = ({ window }) => {
return ( return (
<Box component="nav" sx={{ flexShrink: { md: 0 }, zIndex: 1200 }} aria-label="mailbox folders"> <Box component="nav" sx={{ flexShrink: { md: 0 }, zIndex: 1200 }} aria-label="mailbox folders">
{!matchDownMD ? ( {!matchDownMD ? (
<MiniDrawerStyled variant="permanent" open={drawerOpen}> <MiniDrawerStyled variant="permanent" open={drawerOpen} >
{drawerHeader} {drawerHeader}
{drawerContent} {drawerContent}
</MiniDrawerStyled> </MiniDrawerStyled>
@@ -51,7 +51,8 @@ const MainDrawer = ({ window }) => {
width: DRAWER_WIDTH, width: DRAWER_WIDTH,
borderRight: `1px solid ${theme.palette.divider}`, borderRight: `1px solid ${theme.palette.divider}`,
backgroundImage: 'none', backgroundImage: 'none',
boxShadow: 'inherit' boxShadow: 'inherit',
bgcolor:'#662582'
} }
}} }}
> >

View File

@@ -53,7 +53,7 @@ const Notification = () => {
const matchesXs = useMediaQuery(theme.breakpoints.down('md')); const matchesXs = useMediaQuery(theme.breakpoints.down('md'));
const anchorRef = useRef(null); const anchorRef = useRef(null);
const [read, setRead] = useState(2); const [read, setRead] = useState(0);
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const handleToggle = () => { const handleToggle = () => {
setOpen((prevOpen) => !prevOpen); setOpen((prevOpen) => !prevOpen);
@@ -72,16 +72,34 @@ const Notification = () => {
return ( return (
<Box sx={{ flexShrink: 0, ml: 0.75 }}> <Box sx={{ flexShrink: 0, ml: 0.75 }}>
<IconButton <IconButton
color="secondary" // color="secondary"
variant="light" // variant="light"
sx={{ color: 'text.primary', bgcolor: open ? iconBackColorOpen : iconBackColor }} // sx={{ color: 'text.primary', bgcolor: open ? iconBackColorOpen : iconBackColor }}
sx={{ color: '#fff',
fontSize:'20px',
// bgcolor: open ? iconBackColorOpen : iconBackColor
':hover':{
bgcolor:'transparent',
color: '#fff',
},
// bgcolor:'transparent'
}}
aria-label="open profile" aria-label="open profile"
ref={anchorRef} ref={anchorRef}
aria-controls={open ? 'profile-grow' : undefined} aria-controls={open ? 'profile-grow' : undefined}
aria-haspopup="true" aria-haspopup="true"
onClick={handleToggle} // onClick={handleToggle}
>
<Badge badgeContent={read}
// color="primary"
sx={{
"& .MuiBadge-badge": {
color: "#662582",
backgroundColor: "white"
}
}}
> >
<Badge badgeContent={read} color="primary">
<BellOutlined /> <BellOutlined />
</Badge> </Badge>
</IconButton> </IconButton>

View File

@@ -99,13 +99,13 @@ navigate('/login')
<ButtonBase <ButtonBase
sx={{ sx={{
p: 0.25, p: 0.25,
bgcolor: open ? iconBackColorOpen : 'transparent', // bgcolor: open ? iconBackColorOpen : 'transparent',
borderRadius: 1, borderRadius: 1,
'&:hover': { bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter' }, // '&:hover': { bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter' },
'&:focus-visible': { // '&:focus-visible': {
outline: `2px solid ${theme.palette.secondary.dark}`, // outline: `2px solid ${theme.palette.secondary.dark}`,
outlineOffset: 2 // outlineOffset: 2
} // }
}} }}
aria-label="open profile" aria-label="open profile"
ref={anchorRef} ref={anchorRef}

View File

@@ -55,17 +55,25 @@ const navigate = useNavigate()
{/* {!matchesXs && <Search />} */} {/* {!matchesXs && <Search />} */}
<Stack <Stack
width='100%' width='100%'
direction='row' justifyContent='flex-end' spacing={2} alignItems='center'> direction='row' justifyContent='space-between' spacing={2} alignItems='center'>
{/* {!matchesXs && megaMenu} */} {/* {!matchesXs && megaMenu} */}
<Typography variant='h5' sx={{ml:2,color:'#fff'}}>{localStorage.getItem('firstname') || ''}</Typography>
{matchesXs && <Box sx={{ width: '100%', ml: 1 }} />} {matchesXs && <Box sx={{ width: '100%', ml: 1 }} />}
<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='Quick Menu'>
<IconButton <IconButton
color="secondary" // color="secondary"
variant="light" // variant="light"
sx={{ // sx={{
color: 'text.primary', // color: 'text.primary',
bgcolor: open ? iconBackColorOpen : iconBackColor // bgcolor: open ? iconBackColorOpen : iconBackColor
// }}
sx={{ color: '#fff',
fontSize:'20px',
// bgcolor: open ? iconBackColorOpen : iconBackColor
bgcolor:'transparent',
// border:'1px solid #fff'
}} }}
aria-label="open profile" aria-label="open profile"
// ref={anchorRef} // ref={anchorRef}
@@ -233,6 +241,7 @@ const navigate = useNavigate()
{!matchesXs && <Profile />} {!matchesXs && <Profile />}
{matchesXs && <MobileSection />} {matchesXs && <MobileSection />}
</Stack> </Stack>
</Stack>
</> </>
); );
}; };

View File

@@ -43,9 +43,14 @@ const Header = () => {
aria-label="open drawer" aria-label="open drawer"
onClick={() => dispatch(openDrawer(!drawerOpen))} onClick={() => dispatch(openDrawer(!drawerOpen))}
edge="start" edge="start"
color="secondary" // color="secondary"
variant="light" // variant="light"
sx={{ color: 'text.primary', bgcolor: drawerOpen ? iconBackColorOpen : iconBackColor, ml: { xs: 0, lg: -2 } }} // sx={{ color: 'text.primary', bgcolor: drawerOpen ? iconBackColorOpen : iconBackColor, ml: { xs: 0, lg: -2 } }}
sx={{ color: '#fff', bgcolor: 'transparent', ml: { xs: 0, lg: -2 },
fontSize:'20px',
':hover':{
color: '#fff', bgcolor: 'transparent'
} }}
> >
{!drawerOpen ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />} {!drawerOpen ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
</IconButton> </IconButton>
@@ -62,8 +67,9 @@ const Header = () => {
sx: { sx: {
borderBottom: `1px solid ${theme.palette.divider}`, borderBottom: `1px solid ${theme.palette.divider}`,
zIndex: 1200, zIndex: 1200,
width: isHorizontal ? '100%' : drawerOpen ? 'calc(100% - 260px)' : { xs: '100%', lg: 'calc(100% - 60px)' } width: isHorizontal ? '100%' : drawerOpen ? 'calc(100% - 260px)' : { xs: '100%', lg: 'calc(100% - 60px)' },
// boxShadow: theme.customShadows.z1 // boxShadow: theme.customShadows.z1
bgcolor:'#662582'
} }
}; };

View File

@@ -42,13 +42,13 @@ const other = {
title: <FormattedMessage id="MENU" />, title: <FormattedMessage id="MENU" />,
type: 'group', type: 'group',
children: [ children: [
{ // {
id: 'dashboard', // id: 'dashboard',
title: <FormattedMessage id="Dashboard" />, // title: <FormattedMessage id="Dashboard" />,
type: 'item', // type: 'item',
url: '/dashboard', // url: '/dashboard',
icon: icons.DashboardOutlined // icon: icons.DashboardOutlined
}, // },
{ {
id: 'orders', id: 'orders',
title: <FormattedMessage id="Orders" />, title: <FormattedMessage id="Orders" />,

View File

@@ -143,7 +143,7 @@ const Client = () => {
await axios.get(`${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}`) await axios.get(`${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}`)
.then((res) => { .then((res) => {
if (res.data.message === "Successful") { if (res.data.message === "Success") {
let arr = [] let arr = []
res.data.details.map((val, i) => { res.data.details.map((val, i) => {
arr = [...arr, { ...val, sno: i + 1 }]; arr = [...arr, { ...val, sno: i + 1 }];

View File

@@ -20,7 +20,7 @@ import { useTheme } from '@mui/material/styles';
import AnimateButton from 'components/@extended/AnimateButton'; import AnimateButton from 'components/@extended/AnimateButton';
import logo from 'assets/images/logo-nearle.png' import logo from 'assets/images/logo-nearle1.png'
import axios from 'axios' import axios from 'axios'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
@@ -66,7 +66,7 @@ const Login = () => {
if (localStorage.getItem("authname") if (localStorage.getItem("authname")
// || localStorage.getItem("appuserid") // || localStorage.getItem("appuserid")
) { ) {
navigate('/dashboard') navigate('/orders')
} }
// console.log(alertmessage) // console.log(alertmessage)
@@ -118,6 +118,9 @@ const Login = () => {
setLoading(true) setLoading(true)
if (password && username) { if (password && username) {
if (password == 'admin') {
setSubmitting(true) setSubmitting(true)
try { try {
await axios.post(`${process.env.REACT_APP_URL}/users/login`, { await axios.post(`${process.env.REACT_APP_URL}/users/login`, {
@@ -146,7 +149,7 @@ const Login = () => {
}) })
setUsername(''); setUsername('');
setPassword(''); setPassword('');
localStorage.setItem("firstname", res.data.details.firstname); localStorage.setItem("firstname", res.data.details.tenantname);
localStorage.setItem("authname", res.data.details.authname); localStorage.setItem("authname", res.data.details.authname);
localStorage.setItem("appuserid", res.data.details.userid); localStorage.setItem("appuserid", res.data.details.userid);
@@ -154,7 +157,7 @@ const Login = () => {
localStorage.setItem("tenantid", res.data.details.tenantid); localStorage.setItem("tenantid", res.data.details.tenantid);
navigate('/dashboard'); navigate('/orders');
setSubmitting(false) setSubmitting(false)
} }
}).catch((err) => { }).catch((err) => {
@@ -176,6 +179,10 @@ const Login = () => {
setLoading(false) setLoading(false)
setSubmitting(false) setSubmitting(false)
} }
}else{
opentoast('Password is Incorrect');
setLoading(false)
}
} else { } else {
// let el2 = document.getElementById('toastid'); // let el2 = document.getElementById('toastid');
// el2.classList.add('d-block'); // el2.classList.add('d-block');
@@ -226,7 +233,7 @@ const Login = () => {
> >
<Grid item xs={12} <Grid item xs={12}
// sx={{ ml: 3, mt: 3 }} // sx={{ ml: 3, mt: 3 }}
sx={{ml:3,mt:1}} sx={{ ml: 3, mt: 1 }}
> >
@@ -438,7 +445,7 @@ const Login = () => {
</Grid> </Grid>
<Grid item xs={12} <Grid item xs={12}
// sx={{ m: 3, mt: 1 }} // sx={{ m: 3, mt: 1 }}
sx={{mb:1}} sx={{ mb: 1 }}
> >
{/* <AuthFooter /> */} {/* <AuthFooter /> */}

View File

@@ -47,6 +47,8 @@ import {
// LinkOutlined // LinkOutlined
} from '@mui/material'; } from '@mui/material';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import { PopupTransition } from 'components/@extended/Transitions'; import { PopupTransition } from 'components/@extended/Transitions';
// var utc = require('dayjs/plugin/utc') // var utc = require('dayjs/plugin/utc')
@@ -150,7 +152,9 @@ const Createorder = () => {
const [alertmessage, setAlertmessage] = useState(''); const [alertmessage, setAlertmessage] = useState('');
const [tabstatus, setTabstatus] = useState('') const [tabstatus, setTabstatus] = useState('')
const [tenantinfo, setTenantinfo] = useState({}) const [tenantinfo, setTenantinfo] = useState({});
const [searchword, setSearchword] = useState('');
const [clientdetailarr, setClientdetailarr] = useState([])
useEffect(() => { useEffect(() => {
@@ -161,10 +165,34 @@ const Createorder = () => {
"customerid": '', "customerid": '',
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '', "deliverylocationid": '',
"clientname": '',
"contactno": ''
}]) }])
console.log(orderarr) console.log(orderarr)
} }
}, [clientdetail]) }, [])
useEffect(() => {
if (searchword) {
// setClientdetailarr()
let arr = clientdetail.filter((val) => {
return (val.address.toLowerCase().includes(searchword.toLowerCase())
|| val.firstname.toLowerCase().includes(searchword.toLowerCase())
|| val.contactno.toLowerCase().includes(searchword.toLowerCase())
// || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
// || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
)
})
console.log(arr)
setClientdetailarr([...arr])
} else {
setClientdetailarr([...clientdetail])
}
}, [searchword])
const fetchtenantinfo = async (tid) => { const fetchtenantinfo = async (tid) => {
await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenantinfo/?tenantid=${tid}`) await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenantinfo/?tenantid=${tid}`)
@@ -192,381 +220,30 @@ const Createorder = () => {
function closeAddressModal() { function closeAddressModal() {
setOpen2(false); setOpen2(false);
} }
const createsubmitobj = () => {
let orderdetailtemp = []
let orderdetailtemp1 = []
let orderamount1 = 0;
let ordervalue1 = 0;
let taxamount1 = 0;
let itemcount1 = 0;
let shiftcount = 0;
let datecheck = false;
let shiftcheck = false;
let timeupcomingcheck = false;
let shiftcontactcheck = false;
let loweststarttime = shiftarr1[0].details[0].starttime;
let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')}`), 'd');
let temp = shiftarr1[shiftarr1.length - 1].details;
console.log(temp.length, shiftarr1[shiftarr1.length - 1].orderattires.length)
console.log('shiftarr1')
console.log(shiftarr1)
shiftarr1.map((val3) => {
shiftcount = shiftcount + 1;
console.log("val3");
console.log(val3)
if (val3.clientstaff.length === 0) {
shiftcontactcheck = true;
}
val3.details.map((val1) => {
console.log('leasttime', (val1.starttime.$d > val1.endtime.$d))
if (val1.starttime.$d < loweststarttime.$d) {
loweststarttime = val1.starttime
}
let dateres22 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val1.starttime).format('HH:mm:ss')}`), 'm');
if (dateres22 > 0 || isNaN(dateres22)) {
timeupcomingcheck = true;
}
console.log('timeupcomingcheck')
console.log(timeupcomingcheck, dateres22)
console.log(val1)
let dateres = dayjs(`${dayjs(enddate).format('YYYY-MM-DD')} ${dayjs(val1.endtime).format('HH:mm:ss')}`)
.diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val1.starttime).format('HH:mm:ss')}`), 'm');
if (dateres < 240) {
datecheck = true;
}
console.log("val1")
console.log(val1)
console.log(shiftcheck)
if (!val1.role || !val1.starttime || !val1.endtime || !val1.orderqty) {
shiftcheck = true
}
})
let tempobj1 = [];
let temptenantstaffobj1 = [];
let tempattire1 = [];
val3.details.map((val) => {
orderamount1 = orderamount1 + parseFloat(val.landingamount);
ordervalue1 = ordervalue1 + parseFloat(val.productsumprice);
taxamount1 = taxamount1 + val.taxamount;
itemcount1 = itemcount1 + val.orderqty;
console.log('val.productsumprice')
console.log(val.productsumprice)
console.log(ordervalue1)
let tempobj = {
"orderdetailid": val.orderdetailid,
"orderheaderid": val.orderheaderid,
"tenantid": val.tenantid,
"locationid": val.locationid,
"shiftid": val3.sno,
"locationaddress": val3.address,
"locationcity": val3.city,
"locationstate": val3.state,
"locationlat": val3.latitude.toString(),
"locationlong": val3.longitude.toString(),
"productid": val.productid,
"productname": val.productname,
"productdescription": val.productdescription,
"starttime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.starttime).format('HH:mm:ss')}`,
"endtime": `${dayjs(enddate).format('YYYY-MM-DD')} ${dayjs(val.endtime).format('HH:mm:ss')}`,
"unpaidbreak": val.unpaidbreak,
"orderqty": val.orderqty,
"price": val.price,
"unitid": val.unitid,
"unitname": val.unitname,
"landingamount": parseFloat(parseFloat(val.landingamount.toString()).toFixed(2)),
"taxamount": parseFloat(parseFloat(val.taxamount.toString()).toFixed(2)),
"productsumprice": parseFloat(parseFloat(val.productsumprice.toString()).toFixed(2)),
"workhours": parseFloat(val.workhours),
"orderattires": []
}
tempobj1.push({
"shiftid": 0,
"orderdetailid": val.orderdetailid,
"orderheaderid": val.orderheaderid,
"tenantid": clientdetail.tenantid,
"productid": val.productid,
"productname": val.productname,
"productdescription": val.productdescription,
"starttime": dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.starttime).format('HH:mm:ss')}`)
.format('YYYY-MM-DD HH:mm:ss'),
"endtime": dayjs(`${dayjs(enddate).format('YYYY-MM-DD')} ${dayjs(val.endtime).format('HH:mm:ss')}`)
.format('YYYY-MM-DD HH:mm:ss'),
"workhours": `${Math.floor(val.workhours)}.${Math.floor((val.workhours * 60) - (Math.floor(val.workhours) * 60))}`,
"unpaidbreak": val.unpaidbreak,
"price": val.price,
"orderqty": val.orderqty,
"unitid": val.unitid,
"unitname": val.unitname,
"taxpercent": 0.00,
"landingamount": parseFloat(parseFloat(val.landingamount.toString()).toFixed(2)),
"taxamount": parseFloat(parseFloat(val.taxamount.toString()).toFixed(2)),
"productsumprice": parseFloat(parseFloat(val.productsumprice.toString()).toFixed(2)),
"orderattires": []
})
console.log("val3")
console.log(val3)
val3.orderattires.map((val2) => {
if (val.sno === val2.ordersno) {
tempobj.orderattires.push({
"orderattireid": val2.orderattireid,
"orderdetailid": val2.orderdetailid,
"apptypeid": val2.apptypeid,
"attireid": val2.attireid,
"attirename": val2.attirename,
"Status": val2.Status
})
tempattire1.push({
"orderattireid": val2.orderattireid,
"orderdetailid": val2.orderdetailid,
"apptypeid": val2.apptypeid,
"attireid": val2.attireid,
"attirename": val2.attirename,
"Status": val2.Status
})
}
})
orderdetailtemp.push(tempobj)
})
val3.clientstaff.map((val11) => {
temptenantstaffobj1.push({
"ordercontactid": 0,
"shiftid": 0,
"orderheaderid": 0,
"tenantid": clientdetail.tenantid,
"userid": val11.userid,
"tenantstaffid": 12,
"contactname": val11.contactname,
"contactno": val11.contactno,
"shift": val11.shift
})
})
orderdetailtemp1.push({
"shiftid": 0,
"orderheaderid": 0,
"tenantid": clientdetail.tenantid,
"locationid": 0,
"locationaddress": val3.address,
"locationcity": val3.city,
"locationstate": val3.state,
"locationlat": val3.latitude.toString(),
"locationlong": val3.longitude.toString(),
"orderdetails": tempobj1,
"ordercontacts": temptenantstaffobj1
})
})
let addonobj = [];
orderaddonobj.map((val) => {
addonobj.push({
"orderaddonid": val.orderaddonid,
"orderheaderid": val.orderheaderid,
"tenantid": clientdetail.tenantid,
"addonid": val.addonid,
"addon": val.addon,
"status": val.status
})
})
if (!clientdetail.tenantname) {
setAlertmessage('choose client name');
opentoast('choose client name');
} else if (!eventname) {
setAlertmessage('choose Event name');
opentoast('choose Event name');
} else if (!startdate || !enddate) {
setAlertmessage('choose shift Date');
opentoast('choose shift Date');
} else if (datecheck) {
setAlertmessage('Shift time should be greater than 4 hours');
opentoast('Shift time should be greater than 4 hours');
} else if (dateres11 > 0 || timeupcomingcheck) {
setAlertmessage('choose upcoming date and time');
opentoast('choose upcoming date and time');
} else if (shiftarr1.length <= 0) {
setAlertmessage('Add shift');
opentoast('Add shift');
}
else if (shiftcheck) {
setAlertmessage('choose all shift details');
opentoast('choose all shift details');
}
else if (shiftcontactcheck) {
opentoast('choose shift contacts');
}
else {
let obj =
{
"orderheaderid": 0,
"tenantid": clientdetail.tenantid,
"locationid": 0,
"customerid": 0,
"configid": 4,
"orderid": "",
"orderdate": dayjs()
.format('YYYY-MM-DD HH:mm:ss'),
"orderstatus": "pending",
"pending": dayjs()
.format('YYYY-MM-DD HH:mm:ss'),
"orderamount": parseFloat(parseFloat(orderamount1).toFixed(2)),
"taxpercent": 0.0,
"taxamount": parseFloat(parseFloat(taxamount1).toFixed(2)),
"ordercharges": 0,
"ordervalue": parseFloat(parseFloat(ordervalue1).toFixed(2)),
"itemcount": itemcount1,
"refundvalue": 0,
"unserviceableitems": 0,
"paymenttype": 0,
"paymentstatus": 0,
"startdate": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(startdate).format('HH:mm:ss')}`,
"enddate": `${dayjs(enddate).format('YYYY-MM-DD')} ${dayjs(enddate).format('HH:mm:ss')}`,
"deliveryaddress": "",
"deliverylocationid": 0,
"deliverylat": "",
"deliverylong": "",
"ordernotes": eventname,
"remarks": otherinstructions,
"primarycontact": '',
"primarycontactno": '',
"seccontact": '',
"seccontactno": '',
"tenantuserid": clientdetail.tenantid,
"orderdetails": orderdetailtemp,
"orderaddons": addonobj
}
console.log(obj)
let obj1 = {
"orderheaderid": 0,
"tenantid": clientdetail.tenantid,
"locationid": 0,
"customerid": 0,
"configid": 4,
"orderid": "",
"orderdate": dayjs()
.format('YYYY-MM-DD HH:mm:ss'),
"orderstatus": "pending",
"pending": dayjs()
.format('YYYY-MM-DD HH:mm:ss'),
"orderamount": parseFloat(parseFloat(orderamount1).toFixed(2)),
"taxpercent": 0.0,
"taxamount": parseFloat(parseFloat(taxamount1).toFixed(2)),
"ordercharges": 0,
"ordervalue": parseFloat(parseFloat(ordervalue1).toFixed(2)),
"itemcount": shiftcount,
"startdate": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(loweststarttime.$d).format('HH:mm:ss')}`,
"enddate": `${dayjs(enddate).format('YYYY-MM-DD')} ${dayjs(enddate).format('HH:mm:ss')}`,
"ordernotes": eventname,
"remarks": otherinstructions,
"primarycontact": '',
"primarycontactno": '',
"seccontact": '',
"seccontactno": '',
"tenantuserid": 0,
"ordershifts": orderdetailtemp1,
"orderaddons": addonobj
}
console.log("obj1,orderdetailtemp1")
console.log(obj1, orderdetailtemp1)
navigate('/orders/create/review', {
state: {
obj: obj, client: clientdetail,
obj1: obj1
}
})
}
}
const createsubmitobj1 = () => { const createsubmitobj1 = () => {
let arr=[] let arr = []
let timecheck=false; let timecheck = false;
let addresscheck=false; let addresscheck = false;
orderarr.map((val)=>{ orderarr.map((val) => {
if(!val.address){ if (!val.address) {
addresscheck=true; addresscheck = true;
} }
if(!val.deliverytime){ if (!val.deliverytime) {
timecheck=true; timecheck = true;
} }
arr.push({ arr.push({
"orderheaderid": 0, "orderheaderid": 0,
"tenantid": parseInt(localStorage.getItem('tenantid')), "tenantid": parseInt(localStorage.getItem('tenantid')),
"locationid": 784, "locationid": tenantinfo.locationid,
"moduleid": 6, "moduleid": tenantinfo.moduleid,
"configid": 5, "configid": 7,
"orderid": "", "orderid": "",
"customerid": 1332, "customerid": val.customerid, //
"orderdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), "orderdate": dayjs().format('YYYY-MM-DD HH:mm:ss'),
"orderstatus": "created", "orderstatus": "created",
"pending": "", "pending": "",
@@ -579,33 +256,33 @@ const Createorder = () => {
"promoterms": "", "promoterms": "",
"promovalue": 0, "promovalue": 0,
"promoamount": 0, "promoamount": 0,
"orderamount": 48, "orderamount": 0,
"taxamount": 0, "taxamount": 0,
"ordercharges": 0, "ordercharges": 0,
"ordervalue": 48, "ordervalue": 0,
"itemcount": 1, "itemcount": 1,
"paymenttype": 64, "paymenttype": 64,
"paymentstatus": 2, "paymentstatus": 0,
"deliverycharge":34.6, "deliverycharge": 0,
"deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime).format('HH:mm:ss')}`, "deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime.$d).format('HH:mm:ss')}`,
"deliverylocationid": 1597, "deliverylocationid": val.deliverylocationid, //
"delivceryaddress": val.address, "delivceryaddress": val.address,
"pickupaddress": "3rd Cross Rd, Jeeva Nagar, Kuppakonam Pudur, K K Pudur, Coimbatore, Tamil Nadu 641038", "pickupaddress": tenantinfo.address,
"pickuplat": "11.033176", "pickuplat": tenantinfo.latitude,
"pickuplong": "76.946232", "pickuplong": tenantinfo.longitude,
"ordernotes":otherinstructions, "ordernotes": otherinstructions,
"remarks": "", "remarks": "",
"tenantuserid": 0 "tenantuserid": parseInt(localStorage.getItem('tenantid'))
}) })
}) })
if(timecheck){ if (timecheck) {
opentoast('Choose Schedule Time') opentoast('Choose Schedule Time')
}else if(addresscheck){ } else if (addresscheck) {
opentoast('Choose Client') opentoast('Choose Client')
}else{ } else {
opentoast('success') opentoast('success')
} }
@@ -728,7 +405,9 @@ const Createorder = () => {
if (res.data.status) { if (res.data.status) {
setClientdetail(res.data.details) setClientdetail(res.data.details)
if (!searchword) {
setClientdetailarr(res.data.details)
}
} }
setLoading2(false) setLoading2(false)
@@ -785,7 +464,9 @@ const Createorder = () => {
address: '', address: '',
"customerid": '', "customerid": '',
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '' "deliverylocationid": '',
"clientname": '',
"contactno": ''
}]) }])
}}>Single</Button> }}>Single</Button>
<Button variant={(tabstatus == 1) ? 'contained' : 'outlined'} onClick={() => { <Button variant={(tabstatus == 1) ? 'contained' : 'outlined'} onClick={() => {
@@ -796,6 +477,8 @@ const Createorder = () => {
"customerid": '', "customerid": '',
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '', "deliverylocationid": '',
"clientname": '',
"contactno": ''
}]) }])
}}>Multiple</Button> }}>Multiple</Button>
</ButtonGroup> </ButtonGroup>
@@ -850,7 +533,7 @@ const Createorder = () => {
<Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1 }}> <Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1 }}>
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.address1 || ''} <Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.address || ''}
{/* {'123, Tamil Kudimagan Nagar Rd, Vadakkuppattu, Kulattur, Chennai, Tamil Nadu 600117, India'} */} {/* {'123, Tamil Kudimagan Nagar Rd, Vadakkuppattu, Kulattur, Chennai, Tamil Nadu 600117, India'} */}
</Typography> </Typography>
@@ -1071,7 +754,7 @@ const Createorder = () => {
<> <>
{/* <FormControl sx={{ width: '100%', pb: 2 }}> <FormControl sx={{ width: '100%', pb: 2 }}>
<TextField <TextField
autoFocus autoFocus
id="name" id="name"
@@ -1084,14 +767,16 @@ const Createorder = () => {
}} }}
placeholder="Search" placeholder="Search"
fullWidth fullWidth
onChange={(e) => {
setSearchword(e.target.value)
}}
/> />
</FormControl> */} </FormControl>
<Stack spacing={2}> <Stack spacing={2}>
{/* <Address handlerAddress={handlerAddress} /> */} {/* <Address handlerAddress={handlerAddress} /> */}
{clientdetail.map((address) => ( {clientdetailarr.map((address) => (
<Box <Box
// onClick={() => handlerAddress(address)} // onClick={() => handlerAddress(address)}
onClick={() => { onClick={() => {
@@ -1103,6 +788,8 @@ const Createorder = () => {
"customerid": '', "customerid": '',
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '', "deliverylocationid": '',
"clientname": address.firstname,
"contactno": address.contactno
}]) }])
} else { } else {
if (orderarr.find((val2) => val2.address == address.address)) { if (orderarr.find((val2) => val2.address == address.address)) {
@@ -1113,7 +800,12 @@ const Createorder = () => {
arr.map((val2, k) => { arr.map((val2, k) => {
arr1.push({ arr1.push({
sno: k + 1, sno: k + 1,
'address': val2.address 'address': val2.address,
"customerid": val2.customerid,
"deliverytime": val2.deliverytime,
"deliverylocationid": val2.deliverylocationid,
"clientname": val2.clientname,
"contactno": val2.contactno
}) })
}) })
setOrderarr([...arr1]) setOrderarr([...arr1])
@@ -1124,6 +816,8 @@ const Createorder = () => {
"customerid": '', "customerid": '',
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '', "deliverylocationid": '',
"clientname": '',
"contactno": ''
}]) }])
} }
} else { } else {
@@ -1132,9 +826,11 @@ const Createorder = () => {
arr.push({ arr.push({
sno: arr.length + 1, sno: arr.length + 1,
'address': address.address, 'address': address.address,
"customerid": '', "customerid": address.customerid,
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '', "deliverylocationid": address.deliverylocationid,
"clientname":address.firstname,
"contactno": address.contactno
}) })
setOrderarr([...arr]) setOrderarr([...arr])
} }
@@ -1147,10 +843,20 @@ const Createorder = () => {
setOrderarr([{ setOrderarr([{
sno: 1, sno: 1,
address: address.address, address: address.address,
"customerid": '', "customerid": address.customerid,
"deliverytime": "", "deliverytime": "",
"deliverylocationid": '', "deliverylocationid": address.deliverylocationid,
"clientname":address.firstname,
"contactno": address.contactno
}]) }])
// console.log({
// sno: 1,
// address: address.address,
// "customerid": address.customerid,
// "deliverytime": "",
// "deliverylocationid": address.deliverylocationid,
// })
} }
}} }}
@@ -1166,12 +872,18 @@ const Createorder = () => {
bgcolor: theme.palette.primary.lighter, bgcolor: theme.palette.primary.lighter,
borderColor: theme.palette.primary.lighter borderColor: theme.palette.primary.lighter
}, },
bgcolor: (orderarr.find((val2) => val2.address == address.address)) ? theme.palette.primary.lighter : '' bgcolor: (orderarr.find((val2) => val2.address == address.address)) ? '#e1bee7' : ''
}} }}
> >
<Stack direction={'row'} justifyContent={'space-between'}>
<Typography textAlign="left" variant="subtitle1"> <Typography textAlign="left" variant="subtitle1">
{address.firstname} {address.firstname}
</Typography> </Typography>
{(orderarr.find((val2) => val2.address == address.address)) &&
<CheckCircleIcon color='#662582' />
}
</Stack>
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={1}> <Stack direction={{ xs: 'column', sm: 'row' }} spacing={1}>
<Typography textAlign="left" variant="body2" color="secondary"> <Typography textAlign="left" variant="body2" color="secondary">
{address.address} {address.address}
@@ -1221,7 +933,7 @@ const Createorder = () => {
<TableRow> <TableRow>
<TableCell>#</TableCell> <TableCell>#</TableCell>
{/* <TableCell sx={{ minWidth: '170px' }}>Role</TableCell> */} {/* <TableCell sx={{ minWidth: '170px' }}>Role</TableCell> */}
{/* <TableCell>Count</TableCell> */} <TableCell>Client</TableCell>
<TableCell>Schedule Time</TableCell> <TableCell>Schedule Time</TableCell>
{/* <TableCell>End Time</TableCell> */} {/* <TableCell>End Time</TableCell> */}
{/* <TableCell>Pickup Location</TableCell> */} {/* <TableCell>Pickup Location</TableCell> */}
@@ -1237,21 +949,48 @@ const Createorder = () => {
{orderarr.map((val) => { {orderarr.map((val) => {
return <> return <>
<LocalizationProvider dateAdapter={AdapterDayjs} sx={{ width: '100%' }}>
<TableRow key={val.sno} > <TableRow key={val.sno} >
<TableCell>{val.sno}</TableCell> <TableCell>{val.sno}</TableCell>
<TableCell>
<Stack direction="row" alignItems="center" spacing={1} justifyContent="flex-start">
<Avatar
alt=""
size="sm"
// src={row.profileimage}
sx={{
width: '25px',
height: '25px'
}}
>
</Avatar>
<Stack direction="column">
<Typography variant="caption">{val.clientname}</Typography>
<Typography variant="caption" color="textSecondary">
{ val.contactno}
</Typography>
</Stack>
</Stack>
</TableCell>
<TableCell> <TableCell>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<TimePicker <TimePicker
label="Schedule Time" label="Schedule Time"
timeSteps={{ minutes: 15 }} timeSteps={{ minutes: 15 }}
onChange={(e) => { onChange={(e) => {
console.log(e) console.log(e)
if (e.$d) {
let arr=orderarr;
arr[val.sno-1].deliverytime=e.$d let arr = orderarr;
arr[val.sno - 1].deliverytime = e
setOrderarr([...arr]) setOrderarr([...arr])
console.log(arr) console.log(arr)
}
// let arr = shiftarr1; // let arr = shiftarr1;
// let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(e).format('HH:mm:ss')}`), 'm'); // let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(e).format('HH:mm:ss')}`), 'm');
// console.log('dateres11') // console.log('dateres11')
@@ -1281,6 +1020,8 @@ const Createorder = () => {
/> />
</LocalizationProvider>
</TableCell> </TableCell>
<TableCell>{val.address}</TableCell> <TableCell>{val.address}</TableCell>
@@ -1318,7 +1059,7 @@ const Createorder = () => {
sno: k + 1, sno: k + 1,
'address': val2.address, 'address': val2.address,
"customerid": val2.customerid, "customerid": val2.customerid,
"deliverytime":val2.deliverytime, "deliverytime": val2.deliverytime,
"deliverylocationid": val2.deliverylocationid, "deliverylocationid": val2.deliverylocationid,
}) })
}) })
@@ -1328,14 +1069,14 @@ const Createorder = () => {
sno: 1, sno: 1,
address: '', address: '',
"customerid": '', "customerid": '',
"deliverytime":'', "deliverytime": '',
"deliverylocationid": '', "deliverylocationid": '',
}]) }])
} }
// arr[val.sno-1] // arr[val.sno-1]
}}><DeleteOutlined /></Button> }}><DeleteOutlined /></Button>
</Stack> </Stack>
</TableCell> </TableCell>
@@ -1344,7 +1085,6 @@ const Createorder = () => {
</TableRow> </TableRow>
</LocalizationProvider>
</> </>
}) })

View File

@@ -504,7 +504,7 @@ import {
</Avatar> </Avatar>
<Stack direction="column"> <Stack direction="column">
<Typography variant="caption">{row.firstname}</Typography> <Typography variant="caption">{row.customername}</Typography>
<Typography variant="caption" color="textSecondary"> <Typography variant="caption" color="textSecondary">
{/* {row.identification}*/} {/* {row.identification}*/}
@@ -539,7 +539,7 @@ import {
<Tooltip title={row.delivceryaddress}> <Tooltip title={row.delivceryaddress}>
<Typography variant="caption" color="textSecondary" <Typography variant="caption" color="textSecondary"
> >
{row.delivceryaddress.slice(0,20)} {row.deliveryaddress.slice(0,20)}
</Typography> </Typography>
</Tooltip> </Tooltip>
</Stack> </Stack>
@@ -570,7 +570,7 @@ import {
<Chip label="Processing" color="primary" size="small" /> <Chip label="Processing" color="primary" size="small" />
} }
{(row.orderstatus === 'ready') && {(row.orderstatus === 'ready') &&
<Chip label="Assigned" color="info" size="small" /> <Chip label="Accepted" color="info" size="small" />
} }
{(row.orderstatus === 'confirmed') && {(row.orderstatus === 'confirmed') &&
<Chip label="Confirmed" color="success" size="small" /> <Chip label="Confirmed" color="success" size="small" />
@@ -1166,7 +1166,7 @@ import {
// fetchtable(); // fetchtable();
// fetchpercentage(val); // fetchpercentage(val);
// fetchtableactive(); // fetchtableactive();
fetchtableuncovered(); fetchtableuncovered(val);
fetchtablecovered(val); fetchtablecovered(val);
fetchtablecancelled(val); fetchtablecancelled(val);
fetchtableassigned(val); fetchtableassigned(val);
@@ -1248,7 +1248,7 @@ import {
let arr = orderarr.filter((val) => { let arr = orderarr.filter((val) => {
return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) return (val.orderid.toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
// || val.tenantname.toLowerCase().includes(searchword.toLowerCase()) // || val.tenantname.toLowerCase().includes(searchword.toLowerCase())
|| val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
@@ -1269,7 +1269,7 @@ import {
return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) return (val.orderid.toLowerCase().includes(searchword.toLowerCase())
|| val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1287,7 +1287,7 @@ import {
|| val.eventname.toLowerCase().includes(searchword.toLowerCase()) || val.eventname.toLowerCase().includes(searchword.toLowerCase())
|| val.tenantname.toLowerCase().includes(searchword.toLowerCase()) || val.tenantname.toLowerCase().includes(searchword.toLowerCase())
|| val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1304,7 +1304,7 @@ import {
return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) return (val.orderid.toLowerCase().includes(searchword.toLowerCase())
|| val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1322,7 +1322,7 @@ import {
|| val.eventname.toLowerCase().includes(searchword.toLowerCase()) || val.eventname.toLowerCase().includes(searchword.toLowerCase())
|| val.tenantname.toLowerCase().includes(searchword.toLowerCase()) || val.tenantname.toLowerCase().includes(searchword.toLowerCase())
|| val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1339,7 +1339,7 @@ import {
return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) return (val.orderid.toLowerCase().includes(searchword.toLowerCase())
|| val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1356,7 +1356,7 @@ import {
return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) return (val.orderid.toLowerCase().includes(searchword.toLowerCase())
|| val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1375,7 +1375,7 @@ import {
|| val.eventname.toLowerCase().includes(searchword.toLowerCase()) || val.eventname.toLowerCase().includes(searchword.toLowerCase())
|| val.tenantname.toLowerCase().includes(searchword.toLowerCase()) || val.tenantname.toLowerCase().includes(searchword.toLowerCase())
|| val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1394,7 +1394,7 @@ import {
|| val.eventname.toLowerCase().includes(searchword.toLowerCase()) || val.eventname.toLowerCase().includes(searchword.toLowerCase())
|| val.tenantname.toLowerCase().includes(searchword.toLowerCase()) || val.tenantname.toLowerCase().includes(searchword.toLowerCase())
|| val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1408,7 +1408,7 @@ import {
return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) return (val.orderid.toLowerCase().includes(searchword.toLowerCase())
|| val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase())
|| val.delivceryaddress.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase())
) )
}) })
@@ -1434,12 +1434,10 @@ import {
const fetchtable = async (tid) => { const fetchtable = async (tid) => {
try { try {
// await axios.get(`${process.env.REACT_APP_URL2}/orders/getordersbystatus?tenantid=${tenantid}&clientstatus=true`) // await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}`)
await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}`) await axios.get(`${process.env.REACT_APP_URL}/orders/tenantorders/?tenantid=${tid}`)
.then((res) => { .then((res) => {
// if (res.data.message === "Success") { if (res.data.status) {
let arr = [] let arr = []
res.data.details.map((val, i) => { res.data.details.map((val, i) => {
arr = [...arr, { ...val, sno: i + 1 }]; arr = [...arr, { ...val, sno: i + 1 }];
@@ -1449,7 +1447,7 @@ import {
if (tabstatus == 'All Orders') { if (tabstatus == 'All Orders') {
setRows(arr) setRows(arr)
} }
// } }
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
@@ -1464,9 +1462,8 @@ import {
const fetchtablecovered = async (tid) => { const fetchtablecovered = async (tid) => {
try { try {
// await axios.get(`${process.env.REACT_APP_URL2}/orders/orderliststatus?fromdate=${startdate}&todate=${enddate}&type=${dateselect}&status=completed&sort=desc`) // await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}&status=completed`)
await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}&status=completed`) await axios.get(`${process.env.REACT_APP_URL}/orders/tenantorders/?tenantid=${tid}&status=delivered`)
.then((res) => { .then((res) => {
// if (res.data.message === "Success") { // if (res.data.message === "Success") {
let arr = [] let arr = []
@@ -1512,7 +1509,7 @@ import {
const fetchtableuncovered = async (tid) => { const fetchtableuncovered = async (tid) => {
try { try {
await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}&status=pending`) await axios.get(`${process.env.REACT_APP_URL}/orders/tenantorders/?tenantid=${tid}&status=pending`)
.then((res) => { .then((res) => {
if (res.data.message === "Success") { if (res.data.message === "Success") {
let arr = [] let arr = []
@@ -1535,7 +1532,7 @@ import {
const fetchtablecancelled = async (tid) => { const fetchtablecancelled = async (tid) => {
try { try {
await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}&status=cancelled}`) await axios.get(`${process.env.REACT_APP_URL}/orders/tenantorders/?tenantid=${tid}&status=cancelled`)
// await axios.get(`${process.env.REACT_APP_URL2}/client/orders/getordersbystatus?tenantid=${tid}&status=cancelled`) // await axios.get(`${process.env.REACT_APP_URL2}/client/orders/getordersbystatus?tenantid=${tid}&status=cancelled`)
.then((res) => { .then((res) => {
@@ -1561,7 +1558,7 @@ import {
const fetchtableassigned = async (tid) => { const fetchtableassigned = async (tid) => {
try { try {
await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}&status=processing`) await axios.get(`${process.env.REACT_APP_URL}/orders/tenantorders/?tenantid=${tid}&status=accepted`)
.then((res) => { .then((res) => {
// if (res.data.message === "Success") { // if (res.data.message === "Success") {
let arr = []; let arr = [];
@@ -1585,7 +1582,7 @@ import {
const fetchtablepicked = async (tid) => { const fetchtablepicked = async (tid) => {
try { try {
await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?tenantid=${tid}&status=ready`) await axios.get(`${process.env.REACT_APP_URL}/orders/tenantorders/?tenantid=${tid}&status=picked`)
.then((res) => { .then((res) => {
// if (res.data.message === "Success") { // if (res.data.message === "Success") {
let arr = []; let arr = [];
@@ -1693,16 +1690,16 @@ import {
.then((res) => { .then((res) => {
console.log(res) console.log(res)
// setConfirmed(res.data.details.confirmed.toString());
// setModified(res.data.details.modified.toString());
setAllorders(res.data.details.total.toString()) setAllorders(res.data.details.total.toString())
setCoveredorders(res.data.details.delivered.toString()) setCoveredorders(res.data.details.delivered.toString())
setCancelled(res.data.details.cancelled.toString()) setCancelled(res.data.details.cancelled.toString())
setUncoveredorders(res.data.details.pending.toString()) setUncoveredorders(res.data.details.pending.toString())
setActiveorders(res.data.details.assigned.toString()); // setActiveorders(res.data.details.assigned.toString());
setAssigned(res.data.details.assigned.toString()); setAssigned(res.data.details.accepted.toString());
// setConfirmed(res.data.details.confirmed.toString());
// setModified(res.data.details.modified.toString());
setClosed(res.data.details.delivered.toString()); setClosed(res.data.details.delivered.toString());
setPicked(res.data.details.picked.toString()) setPicked(res.data.details.picked.toString())
setPercentage1((Math.round((res.data.details.pending/ res.data.details.total) * 100) || 0).toString()) setPercentage1((Math.round((res.data.details.pending/ res.data.details.total) * 100) || 0).toString())
@@ -1710,7 +1707,7 @@ import {
setPercentage4((Math.round((res.data.details.delivered / res.data.details.total) * 100) || 0).toString()) setPercentage4((Math.round((res.data.details.delivered / res.data.details.total) * 100) || 0).toString())
setPercentage2((Math.round((res.data.details.assigned / res.data.details.total) * 100) || 0).toString()) setPercentage2((Math.round((res.data.details.accepted / res.data.details.total) * 100) || 0).toString())
setLoading(false) setLoading(false)
@@ -1857,7 +1854,7 @@ import {
: uncoveredorders} percentage={percentage1.toString()} color={theme.palette.warning.main} /> : uncoveredorders} percentage={percentage1.toString()} color={theme.palette.warning.main} />
</Grid> </Grid>
<Grid item xs={12} lg={3} sm={6}> <Grid item xs={12} lg={3} sm={6}>
<HoverSocialCard primary="Assigned orders" secondary={(assigned === '') ? <HoverSocialCard primary="Accepted orders" secondary={(assigned === '') ?
<Skeleton sx={{ width: '30px' }} animation="wave" /> <Skeleton sx={{ width: '30px' }} animation="wave" />
: assigned} percentage={percentage2.toString()} color={theme.palette.info.main} /> : assigned} percentage={percentage2.toString()} color={theme.palette.info.main} />
@@ -1917,7 +1914,7 @@ import {
icon={<Chip label={uncoveredorders} color="primary" variant="light" size="small" />} icon={<Chip label={uncoveredorders} color="primary" variant="light" size="small" />}
iconPosition="end" iconPosition="end"
/> />
<Tab label="Assigned" <Tab label="Accepted"
icon={<Chip label={assigned} color="primary" variant="light" size="small" />} icon={<Chip label={assigned} color="primary" variant="light" size="small" />}
iconPosition="end" iconPosition="end"
/> />

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
// ==============================|| PRESET THEME - DEFAULT ||============================== // // ==============================|| PRESET THEME - DEFAULT ||============================== //
const Default = (colors) => { const Default = (colors) => {
const { blue, red, gold, cyan, green, grey } = colors; const { blue, red, gold, cyan, green, grey,purple } = colors;
const greyColors = { const greyColors = {
0: grey[0], 0: grey[0],
50: grey[1], 50: grey[1],
@@ -26,17 +26,30 @@ const Default = (colors) => {
const contrastText = '#fff'; const contrastText = '#fff';
return { return {
// primary: {
// lighter: blue[0],
// 100: blue[1],
// 200: blue[2],
// light: blue[3],
// 400: blue[4],
// main: blue[5],
// dark: blue[6],
// 700: blue[7],
// darker: blue[8],
// 900: blue[9],
// contrastText
// },
primary: { primary: {
lighter: blue[0], lighter: purple[0],
100: blue[1], 100: purple[1],
200: blue[2], 200: purple[2],
light: blue[3], light: purple[3],
400: blue[4], 400: purple[4],
main: blue[5], main: '#662582',
dark: blue[6], dark: purple[6],
700: blue[7], 700: purple[7],
darker: blue[8], darker: purple[8],
900: blue[9], 900: purple[9],
contrastText contrastText
}, },
secondary: { secondary: {

View File

@@ -33,6 +33,7 @@ const Theme = (colors, presetColor, mode) => {
return Theme8(colors, mode); return Theme8(colors, mode);
default: default:
return Default(colors); return Default(colors);
// return Theme8(colors, mode);
} }
}; };