diff --git a/src/assets/images/logo-nearle.png b/src/assets/images/logo-nearle.png index 87ca867..30e412c 100644 Binary files a/src/assets/images/logo-nearle.png and b/src/assets/images/logo-nearle.png differ diff --git a/src/assets/images/logo-nearle2.png b/src/assets/images/logo-nearle2.png new file mode 100644 index 0000000..87ca867 Binary files /dev/null and b/src/assets/images/logo-nearle2.png differ diff --git a/src/assets/images/logo-nearle3.png b/src/assets/images/logo-nearle3.png new file mode 100644 index 0000000..6e88892 Binary files /dev/null and b/src/assets/images/logo-nearle3.png differ diff --git a/src/assets/images/logo-nearle4.png b/src/assets/images/logo-nearle4.png new file mode 100644 index 0000000..9c5150b Binary files /dev/null and b/src/assets/images/logo-nearle4.png differ diff --git a/src/assets/images/logo-nearle5.png b/src/assets/images/logo-nearle5.png new file mode 100644 index 0000000..1301320 Binary files /dev/null and b/src/assets/images/logo-nearle5.png differ diff --git a/src/assets/images/logo-nearle6.png b/src/assets/images/logo-nearle6.png new file mode 100644 index 0000000..6f5154c Binary files /dev/null and b/src/assets/images/logo-nearle6.png differ diff --git a/src/assets/images/logo-nearle7.png b/src/assets/images/logo-nearle7.png new file mode 100644 index 0000000..dca2971 Binary files /dev/null and b/src/assets/images/logo-nearle7.png differ diff --git a/src/assets/images/logo-nearle8.png b/src/assets/images/logo-nearle8.png new file mode 100644 index 0000000..9c5150b Binary files /dev/null and b/src/assets/images/logo-nearle8.png differ diff --git a/src/assets/images/logo-nearle9.png b/src/assets/images/logo-nearle9.png new file mode 100644 index 0000000..95a004a Binary files /dev/null and b/src/assets/images/logo-nearle9.png differ diff --git a/src/assets/images/logo-sm1.png b/src/assets/images/logo-sm1.png new file mode 100644 index 0000000..408651c Binary files /dev/null and b/src/assets/images/logo-sm1.png differ diff --git a/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavGroup.js b/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavGroup.js index 763fa9a..4cb2d4e 100644 --- a/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavGroup.js +++ b/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavGroup.js @@ -227,7 +227,10 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele item.title && drawerOpen && ( - + {item.title} {item.caption && ( diff --git a/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavItem.js b/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavItem.js index a662ed4..292eb6d 100644 --- a/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavItem.js +++ b/src/layout/MainLayout/Drawer/DrawerContent/Navigation/NavItem.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import { forwardRef, useEffect } from 'react'; +import { forwardRef, useEffect,useState } from 'react'; import { Link } from 'react-router-dom'; import { useDispatch, useSelector } from 'react-redux'; @@ -9,8 +9,10 @@ import { Avatar, Chip, ListItemButton, ListItemIcon, ListItemText, Typography, u // project import import Dot from 'components/@extended/Dot'; + import { MenuOrientation, ThemeMode } from 'config'; import useConfig from 'hooks/useConfig'; +// import { dispatch, useSelector } from 'store'; import { activeItem, openDrawer } from 'store/reducers/menu'; // ==============================|| NAVIGATION - LIST ITEM ||============================== // @@ -21,9 +23,11 @@ const NavItem = ({ item, level }) => { const { menuOrientation } = useConfig(); const { drawerOpen, openItem } = useSelector((state) => state.menu); + const [ishover,setIshover]=useState('') const downLG = useMediaQuery(theme.breakpoints.down('lg')); + let itemTarget = '_self'; if (item.target) { itemTarget = '_blank'; @@ -35,9 +39,10 @@ const NavItem = ({ item, level }) => { } const Icon = item.icon; - const itemIcon = item.icon ? : false; const isSelected = openItem.findIndex((id) => id === item.id) > -1; + const itemIcon = item.icon ? : false; // const { pathname } = useLocation(); const pathname = document.location.pathname; @@ -62,7 +67,7 @@ const NavItem = ({ item, level }) => { // eslint-disable-next-line }, [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'; return ( @@ -72,13 +77,20 @@ const NavItem = ({ item, level }) => { {...listItemProps} disabled={item.disabled} selected={isSelected} + onMouseEnter={(e,val)=>{ + console.log(e) + }} + onMouseLeave={()=>{ +setIshover('') + }} sx={{ zIndex: 1201, pl: drawerOpen ? `${level * 28}px` : 1.5, py: !drawerOpen && level === 1 ? 1.25 : 1, ...(drawerOpen && { '&:hover': { - bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter' + // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter' + bgcolor:'#7b1fa2' }, '&.Mui-selected': { bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter', @@ -92,7 +104,10 @@ const NavItem = ({ item, level }) => { }), ...(!drawerOpen && { '&:hover': { - bgcolor: 'transparent' + bgcolor: 'transparent', + // bgcolor:'#7b1fa2' + + }, '&.Mui-selected': { '&:hover': { @@ -110,7 +125,11 @@ const NavItem = ({ item, level }) => { { alignItems: 'center', justifyContent: 'center', '&:hover': { - bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter' + // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter' + bgcolor:'#7b1fa2' + } }), ...(!drawerOpen && diff --git a/src/layout/MainLayout/Drawer/DrawerContent/index.js b/src/layout/MainLayout/Drawer/DrawerContent/index.js index 4cbadc8..a67ce82 100644 --- a/src/layout/MainLayout/Drawer/DrawerContent/index.js +++ b/src/layout/MainLayout/Drawer/DrawerContent/index.js @@ -22,7 +22,8 @@ const DrawerContent = () => { '& .simplebar-content': { display: 'flex', flexDirection: 'column' - } + }, + }} > diff --git a/src/layout/MainLayout/Drawer/DrawerHeader/index.js b/src/layout/MainLayout/Drawer/DrawerHeader/index.js index 093873e..fab34d9 100644 --- a/src/layout/MainLayout/Drawer/DrawerHeader/index.js +++ b/src/layout/MainLayout/Drawer/DrawerHeader/index.js @@ -11,8 +11,8 @@ import Logo from 'components/logo'; import { MenuOrientation } from 'config'; import useConfig from 'hooks/useConfig'; -import logo from 'assets/images/logo-nearle.png' -import logo1 from 'assets/images/logo-sm.png' +import logo from 'assets/images/logo-nearle9.png' +import logo1 from 'assets/images/logo-sm1.png' // ==============================|| DRAWER HEADER ||============================== // const DrawerHeader = ({ open }) => { @@ -39,12 +39,14 @@ const DrawerHeader = ({ open }) => { {(open) && logo } {(!open) && - logo + logo } ); diff --git a/src/layout/MainLayout/Drawer/MiniDrawerStyled.js b/src/layout/MainLayout/Drawer/MiniDrawerStyled.js index 5fc1efa..3b5e1d9 100644 --- a/src/layout/MainLayout/Drawer/MiniDrawerStyled.js +++ b/src/layout/MainLayout/Drawer/MiniDrawerStyled.js @@ -13,7 +13,8 @@ const openedMixin = (theme) => ({ duration: theme.transitions.duration.enteringScreen }), 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) => ({ @@ -24,7 +25,8 @@ const closedMixin = (theme) => ({ overflowX: 'hidden', width: theme.spacing(7.5), borderRight: 'none', - boxShadow: theme.customShadows.z1 + boxShadow: theme.customShadows.z1, + backgroundColor:'#662582', }); // ==============================|| DRAWER - MINI STYLED ||============================== // @@ -34,6 +36,7 @@ const MiniDrawerStyled = styled(Drawer, { shouldForwardProp: (prop) => prop !== flexShrink: 0, whiteSpace: 'nowrap', boxSizing: 'border-box', + ...(open && { ...openedMixin(theme), '& .MuiDrawer-paper': openedMixin(theme) diff --git a/src/layout/MainLayout/Drawer/index.js b/src/layout/MainLayout/Drawer/index.js index bc790c4..8c19ce5 100644 --- a/src/layout/MainLayout/Drawer/index.js +++ b/src/layout/MainLayout/Drawer/index.js @@ -33,7 +33,7 @@ const MainDrawer = ({ window }) => { return ( {!matchDownMD ? ( - + {drawerHeader} {drawerContent} @@ -51,7 +51,8 @@ const MainDrawer = ({ window }) => { width: DRAWER_WIDTH, borderRight: `1px solid ${theme.palette.divider}`, backgroundImage: 'none', - boxShadow: 'inherit' + boxShadow: 'inherit', + bgcolor:'#662582' } }} > diff --git a/src/layout/MainLayout/Header/HeaderContent/Notification.js b/src/layout/MainLayout/Header/HeaderContent/Notification.js index d11234a..da0e2b1 100644 --- a/src/layout/MainLayout/Header/HeaderContent/Notification.js +++ b/src/layout/MainLayout/Header/HeaderContent/Notification.js @@ -53,7 +53,7 @@ const Notification = () => { const matchesXs = useMediaQuery(theme.breakpoints.down('md')); const anchorRef = useRef(null); - const [read, setRead] = useState(2); + const [read, setRead] = useState(0); const [open, setOpen] = useState(false); const handleToggle = () => { setOpen((prevOpen) => !prevOpen); @@ -72,16 +72,34 @@ const Notification = () => { return ( - + diff --git a/src/layout/MainLayout/Header/HeaderContent/Profile/index.js b/src/layout/MainLayout/Header/HeaderContent/Profile/index.js index 06edae8..cfd1447 100644 --- a/src/layout/MainLayout/Header/HeaderContent/Profile/index.js +++ b/src/layout/MainLayout/Header/HeaderContent/Profile/index.js @@ -99,13 +99,13 @@ navigate('/login') } */} + direction='row' justifyContent='space-between' spacing={2} alignItems='center'> {/* {!matchesXs && megaMenu} */} + {localStorage.getItem('firstname') || ''} {matchesXs && } + } {matchesXs && } + ); }; diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index edd5bf4..c8fe4e9 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -43,9 +43,14 @@ const Header = () => { aria-label="open drawer" onClick={() => dispatch(openDrawer(!drawerOpen))} edge="start" - color="secondary" - variant="light" - sx={{ color: 'text.primary', bgcolor: drawerOpen ? iconBackColorOpen : iconBackColor, ml: { xs: 0, lg: -2 } }} + // color="secondary" + // variant="light" + // 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 ? : } @@ -62,8 +67,9 @@ const Header = () => { sx: { borderBottom: `1px solid ${theme.palette.divider}`, 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 + bgcolor:'#662582' } }; diff --git a/src/menu-items/other.js b/src/menu-items/other.js index c157be0..3730b2c 100644 --- a/src/menu-items/other.js +++ b/src/menu-items/other.js @@ -42,13 +42,13 @@ const other = { title: , type: 'group', children: [ - { - id: 'dashboard', - title: , - type: 'item', - url: '/dashboard', - icon: icons.DashboardOutlined - }, + // { + // id: 'dashboard', + // title: , + // type: 'item', + // url: '/dashboard', + // icon: icons.DashboardOutlined + // }, { id: 'orders', title: , diff --git a/src/pages/nearle/clients/client.js b/src/pages/nearle/clients/client.js index 55c6d34..340d3f8 100644 --- a/src/pages/nearle/clients/client.js +++ b/src/pages/nearle/clients/client.js @@ -143,7 +143,7 @@ const Client = () => { await axios.get(`${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}`) .then((res) => { - if (res.data.message === "Successful") { + if (res.data.message === "Success") { let arr = [] res.data.details.map((val, i) => { arr = [...arr, { ...val, sno: i + 1 }]; diff --git a/src/pages/nearle/login.js b/src/pages/nearle/login.js index 8150936..d18e18d 100644 --- a/src/pages/nearle/login.js +++ b/src/pages/nearle/login.js @@ -20,7 +20,7 @@ import { useTheme } from '@mui/material/styles'; 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 { useNavigate } from 'react-router-dom' @@ -66,7 +66,7 @@ const Login = () => { if (localStorage.getItem("authname") // || localStorage.getItem("appuserid") ) { - navigate('/dashboard') + navigate('/orders') } // console.log(alertmessage) @@ -118,63 +118,70 @@ const Login = () => { setLoading(true) if (password && username) { - setSubmitting(true) - try { - await axios.post(`${process.env.REACT_APP_URL}/users/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: 3000 - }) - setUsername(''); - setPassword(''); - localStorage.setItem("firstname", res.data.details.firstname); - 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); + if (password == 'admin') { - navigate('/dashboard'); - setSubmitting(false) - } - }).catch((err) => { - console.log(err); + setSubmitting(true) + try { + await axios.post(`${process.env.REACT_APP_URL}/users/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: 3000 + }) + setUsername(''); + setPassword(''); + localStorage.setItem("firstname", res.data.details.tenantname); + localStorage.setItem("authname", res.data.details.authname); - // setAlertmessage('Invalid Data'); - // if(err.message == 'Network Error'){ + localStorage.setItem("appuserid", res.data.details.userid); + localStorage.setItem("roleid", res.data.details.roleid); + localStorage.setItem("tenantid", res.data.details.tenantid); + + + navigate('/orders'); + setSubmitting(false) + } + }).catch((err) => { + console.log(err); + + // setAlertmessage('Invalid Data'); + // if(err.message == 'Network Error'){ opentoast(err.message) - // }else{ - // opentoast('Invalid Data'); + // }else{ + // opentoast('Invalid Data'); - // } + // } + setLoading(false) + setSubmitting(false) + console.log(err.message) + }) + } catch (err) { + console.log(err) setLoading(false) setSubmitting(false) - console.log(err.message) - }) - } catch (err) { - console.log(err) + } + }else{ + opentoast('Password is Incorrect'); setLoading(false) - setSubmitting(false) } } else { // let el2 = document.getElementById('toastid'); @@ -226,7 +233,7 @@ const Login = () => { > @@ -437,8 +444,8 @@ const Login = () => { {/* */} diff --git a/src/pages/nearle/orders/createorder.js b/src/pages/nearle/orders/createorder.js index 5c74aa5..ab127a1 100644 --- a/src/pages/nearle/orders/createorder.js +++ b/src/pages/nearle/orders/createorder.js @@ -47,6 +47,8 @@ import { // LinkOutlined } from '@mui/material'; import { useNavigate } from 'react-router'; +import CheckCircleIcon from '@mui/icons-material/CheckCircle'; + import { PopupTransition } from 'components/@extended/Transitions'; // var utc = require('dayjs/plugin/utc') @@ -150,7 +152,9 @@ const Createorder = () => { const [alertmessage, setAlertmessage] = useState(''); const [tabstatus, setTabstatus] = useState('') - const [tenantinfo, setTenantinfo] = useState({}) + const [tenantinfo, setTenantinfo] = useState({}); + const [searchword, setSearchword] = useState(''); + const [clientdetailarr, setClientdetailarr] = useState([]) useEffect(() => { @@ -161,10 +165,34 @@ const Createorder = () => { "customerid": '', "deliverytime": "", "deliverylocationid": '', + "clientname": '', + "contactno": '' }]) 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) => { await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenantinfo/?tenantid=${tid}`) @@ -192,420 +220,69 @@ const Createorder = () => { function closeAddressModal() { 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 = () => { - let arr=[] - let timecheck=false; - let addresscheck=false; - orderarr.map((val)=>{ - if(!val.address){ - addresscheck=true; - } + let arr = [] + let timecheck = false; + let addresscheck = false; + orderarr.map((val) => { + if (!val.address) { + addresscheck = true; + } - if(!val.deliverytime){ - timecheck=true; - } + if (!val.deliverytime) { + timecheck = true; + } arr.push({ "orderheaderid": 0, - "tenantid": parseInt(localStorage.getItem('tenantid')), - "locationid": 784, - "moduleid": 6, - "configid": 5, - "orderid": "", - "customerid": 1332, - "orderdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), - "orderstatus": "created", - "pending": "", - "processing": "", - "ready": "", - "delivered": "", - "cancellled": "", - "promoid": 0, - "promoname": "", - "promoterms": "", - "promovalue": 0, - "promoamount": 0, - "orderamount": 48, - "taxamount": 0, - "ordercharges": 0, - "ordervalue": 48, - "itemcount": 1, - "paymenttype": 64, - "paymentstatus": 2, - "deliverycharge":34.6, - "deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime).format('HH:mm:ss')}`, - "deliverylocationid": 1597, - "delivceryaddress": val.address, - "pickupaddress": "3rd Cross Rd, Jeeva Nagar, Kuppakonam Pudur, K K Pudur, Coimbatore, Tamil Nadu 641038", - "pickuplat": "11.033176", - "pickuplong": "76.946232", - "ordernotes":otherinstructions, - "remarks": "", - "tenantuserid": 0 + "tenantid": parseInt(localStorage.getItem('tenantid')), + "locationid": tenantinfo.locationid, + "moduleid": tenantinfo.moduleid, + "configid": 7, + "orderid": "", + "customerid": val.customerid, // + "orderdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), + "orderstatus": "created", + "pending": "", + "processing": "", + "ready": "", + "delivered": "", + "cancellled": "", + "promoid": 0, + "promoname": "", + "promoterms": "", + "promovalue": 0, + "promoamount": 0, + "orderamount": 0, + "taxamount": 0, + "ordercharges": 0, + "ordervalue": 0, + "itemcount": 1, + "paymenttype": 64, + "paymentstatus": 0, + "deliverycharge": 0, + "deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime.$d).format('HH:mm:ss')}`, + "deliverylocationid": val.deliverylocationid, // + "delivceryaddress": val.address, + "pickupaddress": tenantinfo.address, + "pickuplat": tenantinfo.latitude, + "pickuplong": tenantinfo.longitude, + "ordernotes": otherinstructions, + "remarks": "", + "tenantuserid": parseInt(localStorage.getItem('tenantid')) }) }) - if(timecheck){ + if (timecheck) { opentoast('Choose Schedule Time') - }else if(addresscheck){ + } else if (addresscheck) { opentoast('Choose Client') - }else{ + } else { opentoast('success') } @@ -697,28 +374,28 @@ const Createorder = () => { const clientdetails = async (tid) => { - // setClientdetail([{ - // "address": 'ttt uuu vvvv', - // "customerid":10, - // "deliverylocationid": 20, - // "contactno":4444, - // "firstname":'test1', - // }, - // { - // "address": '2ttt uuu vvvv', - // "customerid":11, - // "deliverylocationid": 21, - // "contactno":5555, - // "firstname":'test2', - // }, - // { - // "address": '3ttt uuu vvvv', - // "customerid":12, - // "deliverylocationid": 22, - // "contactno":6666, - // "firstname":'test3', - // } - // ]) + // setClientdetail([{ + // "address": 'ttt uuu vvvv', + // "customerid":10, + // "deliverylocationid": 20, + // "contactno":4444, + // "firstname":'test1', + // }, + // { + // "address": '2ttt uuu vvvv', + // "customerid":11, + // "deliverylocationid": 21, + // "contactno":5555, + // "firstname":'test2', + // }, + // { + // "address": '3ttt uuu vvvv', + // "customerid":12, + // "deliverylocationid": 22, + // "contactno":6666, + // "firstname":'test3', + // } + // ]) setLoading2(true) try { @@ -728,7 +405,9 @@ const Createorder = () => { if (res.data.status) { setClientdetail(res.data.details) - + if (!searchword) { + setClientdetailarr(res.data.details) + } } setLoading2(false) @@ -785,7 +464,9 @@ const Createorder = () => { address: '', "customerid": '', "deliverytime": "", - "deliverylocationid": '' + "deliverylocationid": '', + "clientname": '', + "contactno": '' }]) }}>Single @@ -850,7 +533,7 @@ const Createorder = () => { - {' '}{tenantinfo.address1 || ''} + {' '}{tenantinfo.address || ''} {/* {'123, Tamil Kudimagan Nagar Rd, Vadakkuppattu, Kulattur, Chennai, Tamil Nadu 600117, India'} */} @@ -906,26 +589,26 @@ const Createorder = () => { - - + + - + - {/* Shift {result.sno} */} + {/* Shift {result.sno} */} - + - {/* */} - - + + - + - {/* + {/* { /> */} - + - - {/* + + {/* @@ -1020,58 +703,58 @@ const Createorder = () => { */} - - - - + }} color="success" startIcon={}>ADD Clients + + - - - - Select Address - {/* */} + + + + + {(loading2) ? + + <> + + - - - - {(loading2) ? - - <> - - - - - : - <> + + : + <> - {/* + { }} placeholder="Search" fullWidth + onChange={(e) => { + setSearchword(e.target.value) + }} - /> - */} - - {/*
*/} + + + {/*
*/} - {clientdetail.map((address) => ( - handlerAddress(address)} - onClick={() => { - if (tabstatus == 1) { - if (orderarr[0].address == '') { + {clientdetailarr.map((address) => ( + handlerAddress(address)} + onClick={() => { + if (tabstatus == 1) { + if (orderarr[0].address == '') { + setOrderarr([{ + sno: 1, + address: address.address, + "customerid": '', + "deliverytime": "", + "deliverylocationid": '', + "clientname": address.firstname, + "contactno": address.contactno + }]) + } else { + if (orderarr.find((val2) => val2.address == address.address)) { + if (orderarr.length > 1) { + let arr = orderarr; + arr.splice(address.sno - 1, 1); + let arr1 = [] + arr.map((val2, k) => { + arr1.push({ + sno: k + 1, + 'address': val2.address, + "customerid": val2.customerid, + "deliverytime": val2.deliverytime, + "deliverylocationid": val2.deliverylocationid, + "clientname": val2.clientname, + "contactno": val2.contactno + }) + }) + setOrderarr([...arr1]) + } else { setOrderarr([{ sno: 1, - address: address.address, + address: '', "customerid": '', "deliverytime": "", "deliverylocationid": '', + "clientname": '', + "contactno": '' }]) - } else { - if (orderarr.find((val2) => val2.address == address.address)) { - if (orderarr.length > 1) { - let arr = orderarr; - arr.splice(address.sno - 1, 1); - let arr1 = [] - arr.map((val2, k) => { - arr1.push({ - sno: k + 1, - 'address': val2.address - }) - }) - setOrderarr([...arr1]) - } else { - setOrderarr([{ - sno: 1, - address: '', - "customerid": '', - "deliverytime": "", - "deliverylocationid": '', - }]) - } - } else { - console.log(clientdetail) - let arr = orderarr; - arr.push({ - sno: arr.length + 1, - 'address': address.address, - "customerid": '', - "deliverytime": "", - "deliverylocationid": '', - }) - setOrderarr([...arr]) - } - } - - } - - if (tabstatus == 0) { - setOrderarr([{ - sno: 1, - address: address.address, - "customerid": '', + } else { + console.log(clientdetail) + let arr = orderarr; + arr.push({ + sno: arr.length + 1, + 'address': address.address, + "customerid": address.customerid, "deliverytime": "", - "deliverylocationid": '', - }]) + "deliverylocationid": address.deliverylocationid, + "clientname":address.firstname, + "contactno": address.contactno + }) + setOrderarr([...arr]) } - }} - key={address.contactno} - sx={{ - width: '100%', - border: '1px solid', - borderColor: 'grey.200', - borderRadius: 1, - cursor: 'pointer', - p: 1.25, - '&:hover': { - bgcolor: theme.palette.primary.lighter, - borderColor: theme.palette.primary.lighter - }, - bgcolor: (orderarr.find((val2) => val2.address == address.address)) ? theme.palette.primary.lighter : '' - }} - > - - {address.firstname} - - - - {address.address} - - - {address.contactno} - - - {/* {address.email} */} - - - - ))} + } + + } + + if (tabstatus == 0) { + setOrderarr([{ + sno: 1, + address: address.address, + "customerid": address.customerid, + "deliverytime": "", + "deliverylocationid": address.deliverylocationid, + "clientname":address.firstname, + "contactno": address.contactno + }]) + + // console.log({ + // sno: 1, + // address: address.address, + // "customerid": address.customerid, + // "deliverytime": "", + // "deliverylocationid": address.deliverylocationid, + // }) + } + + }} + key={address.contactno} + sx={{ + width: '100%', + border: '1px solid', + borderColor: 'grey.200', + borderRadius: 1, + cursor: 'pointer', + p: 1.25, + '&:hover': { + bgcolor: theme.palette.primary.lighter, + borderColor: theme.palette.primary.lighter + }, + bgcolor: (orderarr.find((val2) => val2.address == address.address)) ? '#e1bee7' : '' + }} + > + + + {address.firstname} + + {(orderarr.find((val2) => val2.address == address.address)) && + + } + + + + + {address.address} + + + {address.contactno} + + + {/* {address.email} */} + + + + ))} + + + } + + + + + + +
+
+ +
+ + + + + + + # + {/* Role */} + Client + Schedule Time + {/* End Time */} + {/* Pickup Location */} + {/* Break */} + Drop Location + {/* Value */} + Action + + + + + + {orderarr.map((val) => { + return <> + + + + {val.sno} + + + + + + + {val.clientname} + + + + { val.contactno} + - - } - - - - - - - - + + - + + + { + console.log(e) + if (e.$d) { - -
- - - # - {/* Role */} - {/* Count */} - Schedule Time - {/* End Time */} - {/* Pickup Location */} - {/* Break */} - Drop Location - {/* Value */} - Action - - - - - - {orderarr.map((val) => { - return <> - - - - {val.sno} - - - { - console.log(e) - - let arr=orderarr; - arr[val.sno-1].deliverytime=e.$d - setOrderarr([...arr]) - console.log(arr) - // let arr = shiftarr1; - // let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(e).format('HH:mm:ss')}`), 'm'); - // console.log('dateres11') - // console.log(dateres11) - // if (dateres11 < 0) { + let arr = orderarr; + arr[val.sno - 1].deliverytime = e + setOrderarr([...arr]) + console.log(arr) + } + // let arr = shiftarr1; + // let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(e).format('HH:mm:ss')}`), 'm'); + // console.log('dateres11') + // console.log(dateres11) + // if (dateres11 < 0) { - // arr[result.sno - 1].details[val.sno - 1].starttime = dayjs(e.$d); + // arr[result.sno - 1].details[val.sno - 1].starttime = dayjs(e.$d); - // arr[result.sno - 1].details[val.sno - 1].endtime = dayjs(dayjs(e.$d).add(4, 'hours').$d); + // arr[result.sno - 1].details[val.sno - 1].endtime = dayjs(dayjs(e.$d).add(4, 'hours').$d); - // } + // } @@ -1273,19 +1012,21 @@ const Createorder = () => { - } - } + } + } - sx={{ width: '150px' }} - value={val.deliverytime || null} + sx={{ width: '150px' }} + value={val.deliverytime || null} - /> - - {val.address} + /> + + + + {val.address} - {/* + {/* {(val.cost) && <> {`${val.cost}/hr`} @@ -1295,7 +1036,7 @@ const Createorder = () => { */} - {/* {(val.role && val.position) && + {/* {(val.role && val.position) && <> {val.landingamount} @@ -1305,55 +1046,54 @@ const Createorder = () => { } */} - + - - - + // arr[val.sno-1] + }}> + - + - - - - - }) - } + + + }) - -
-
- {/* + } + + + + + {/* */} -
+
-
+
- {/* + {/* }) */} {/* } */} diff --git a/src/pages/nearle/orders/orders.js b/src/pages/nearle/orders/orders.js index 6fcf91b..ccbf3fa 100644 --- a/src/pages/nearle/orders/orders.js +++ b/src/pages/nearle/orders/orders.js @@ -504,7 +504,7 @@ import { - {row.firstname} + {row.customername} {/* {row.identification}*/} @@ -539,7 +539,7 @@ import { - {row.delivceryaddress.slice(0,20)} + {row.deliveryaddress.slice(0,20)} @@ -570,7 +570,7 @@ import { } {(row.orderstatus === 'ready') && - + } {(row.orderstatus === 'confirmed') && @@ -1166,7 +1166,7 @@ import { // fetchtable(); // fetchpercentage(val); // fetchtableactive(); - fetchtableuncovered(); + fetchtableuncovered(val); fetchtablecovered(val); fetchtablecancelled(val); fetchtableassigned(val); @@ -1248,7 +1248,7 @@ import { let arr = orderarr.filter((val) => { 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.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) @@ -1269,7 +1269,7 @@ import { return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.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.tenantname.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()) || val.pickupaddress.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.tenantname.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()) || val.pickupaddress.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()) || val.pickupaddress.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.tenantname.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.tenantname.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()) || val.pickupaddress.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) => { 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) => { - // if (res.data.message === "Success") { + if (res.data.status) { let arr = [] res.data.details.map((val, i) => { arr = [...arr, { ...val, sno: i + 1 }]; @@ -1449,7 +1447,7 @@ import { if (tabstatus == 'All Orders') { setRows(arr) } - // } + } }).catch((err) => { console.log(err) @@ -1464,9 +1462,8 @@ import { const fetchtablecovered = async (tid) => { 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) => { // if (res.data.message === "Success") { let arr = [] @@ -1512,7 +1509,7 @@ import { const fetchtableuncovered = async (tid) => { 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) => { if (res.data.message === "Success") { let arr = [] @@ -1535,7 +1532,7 @@ import { const fetchtablecancelled = async (tid) => { 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`) .then((res) => { @@ -1561,7 +1558,7 @@ import { const fetchtableassigned = async (tid) => { 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) => { // if (res.data.message === "Success") { let arr = []; @@ -1585,7 +1582,7 @@ import { const fetchtablepicked = async (tid) => { 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) => { // if (res.data.message === "Success") { let arr = []; @@ -1693,16 +1690,16 @@ import { .then((res) => { console.log(res) - + // setConfirmed(res.data.details.confirmed.toString()); + // setModified(res.data.details.modified.toString()); setAllorders(res.data.details.total.toString()) setCoveredorders(res.data.details.delivered.toString()) setCancelled(res.data.details.cancelled.toString()) setUncoveredorders(res.data.details.pending.toString()) - setActiveorders(res.data.details.assigned.toString()); - setAssigned(res.data.details.assigned.toString()); - // setConfirmed(res.data.details.confirmed.toString()); - // setModified(res.data.details.modified.toString()); + // setActiveorders(res.data.details.assigned.toString()); + setAssigned(res.data.details.accepted.toString()); + setClosed(res.data.details.delivered.toString()); setPicked(res.data.details.picked.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()) - 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) @@ -1857,7 +1854,7 @@ import { : uncoveredorders} percentage={percentage1.toString()} color={theme.palette.warning.main} /> - : assigned} percentage={percentage2.toString()} color={theme.palette.info.main} /> @@ -1917,7 +1914,7 @@ import { icon={} iconPosition="end" /> - } iconPosition="end" /> diff --git a/src/themes/theme/default.js b/src/themes/theme/default.js index cd944aa..655a567 100644 --- a/src/themes/theme/default.js +++ b/src/themes/theme/default.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; // ==============================|| PRESET THEME - DEFAULT ||============================== // const Default = (colors) => { - const { blue, red, gold, cyan, green, grey } = colors; + const { blue, red, gold, cyan, green, grey,purple } = colors; const greyColors = { 0: grey[0], 50: grey[1], @@ -26,17 +26,30 @@ const Default = (colors) => { const contrastText = '#fff'; 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: { - 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], + lighter: purple[0], + 100: purple[1], + 200: purple[2], + light: purple[3], + 400: purple[4], + main: '#662582', + dark: purple[6], + 700: purple[7], + darker: purple[8], + 900: purple[9], contrastText }, secondary: { diff --git a/src/themes/theme/index.js b/src/themes/theme/index.js index 0a5ea72..961f509 100644 --- a/src/themes/theme/index.js +++ b/src/themes/theme/index.js @@ -33,6 +33,7 @@ const Theme = (colors, presetColor, mode) => { return Theme8(colors, mode); default: return Default(colors); + // return Theme8(colors, mode); } };