customers

This commit is contained in:
joshikannan
2025-11-27 18:33:08 +05:30
parent e71e44319c
commit d73c714290
19 changed files with 595 additions and 2070 deletions

View File

@@ -9,6 +9,8 @@ import Notistack from 'components/third-party/Notistack';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import { useEffect } from 'react'; import { useEffect } from 'react';
import InternetStatus from 'components/nearle_components/updateNetworkStatus'; import InternetStatus from 'components/nearle_components/updateNetworkStatus';
import { useDispatch, useSelector } from 'react-redux';
// auth-provider // auth-provider
// import { JWTProvider as AuthProvider } from 'contexts/JWTContext'; // import { JWTProvider as AuthProvider } from 'contexts/JWTContext';
@@ -21,6 +23,9 @@ const App = () => {
navigate('/login'); navigate('/login');
} }
}, []); }, []);
const { openItem } = useSelector((state) => state.menu);
console.log('openItem', openItem);
return ( return (
<> <>
<ThemeCustomization> <ThemeCustomization>

View File

@@ -19,18 +19,16 @@ export default function DateFilterDialog({ open, onClose, onApply }) {
const handleSelect = (range) => { const handleSelect = (range) => {
if (!range?.startDate || !range?.endDate) return; if (!range?.startDate || !range?.endDate) return;
onApply({ onApply({
startDate: dayjs(range.startDate).format('YYYY-MM-DD'), startDate: dayjs(range.startDate).format('YYYY-MM-DD'),
endDate: dayjs(range.endDate).format('YYYY-MM-DD'), endDate: dayjs(range.endDate).format('YYYY-MM-DD'),
label: range.label || '' label: range.label || ''
}); });
onClose(); onClose();
}; };
return ( return (
<Dialog open={open} onClose={onClose} fullWidth maxWidth="sm"> <Dialog open={open} onClose={() => onclose()} fullWidth maxWidth="sm">
<DialogTitle disableTypography> <DialogTitle disableTypography>
<Stack display="flex" flexDirection="row" justifyContent="space-between" alignItems="center" sx={{ width: '100%' }}> <Stack display="flex" flexDirection="row" justifyContent="space-between" alignItems="center" sx={{ width: '100%' }}>
<Typography variant="h4">Select Date Range</Typography> <Typography variant="h4">Select Date Range</Typography>

View File

@@ -0,0 +1,9 @@
import { enqueueSnackbar } from 'notistack';
export const OpenToast = (message, variant = 'default', time = 2000) => {
enqueueSnackbar(message, {
variant,
anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: time
});
};

View File

@@ -41,7 +41,7 @@ const SearchBar = ({ value, onChange, sx, placeholder = 'Search (Ctrl + K)' }) =
autoComplete="off" autoComplete="off"
size="large" size="large"
startAdornment={ startAdornment={
<InputAdornment position="start" sx={{ mr: -0.5, color: theme.palette.primary.main }}> <InputAdornment position="start" sx={{ mr: -0.5, color: theme.palette.secondary.main }}>
<SearchOutlined /> <SearchOutlined />
</InputAdornment> </InputAdornment>
} }

View File

@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { useEffect, useState, useMemo, useRef } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
// material-ui // material-ui
@@ -45,8 +45,7 @@ const PopperStyled = styled(Popper)(({ theme }) => ({
left: -5, left: -5,
width: 10, width: 10,
height: 10, height: 10,
// backgroundColor: theme.palette.background.paper, backgroundColor: theme.palette.background.paper,
backgroundColor: theme.palette.primary.main,
transform: 'translateY(-50%) rotate(45deg)', transform: 'translateY(-50%) rotate(45deg)',
zIndex: 120, zIndex: 120,
borderLeft: `1px solid ${theme.palette.grey.A800}`, borderLeft: `1px solid ${theme.palette.grey.A800}`,
@@ -117,7 +116,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
} }
} else { } else {
if (level === selectedLevel) { if (level === selectedLevel) {
// setOpen(false); setOpen(false);
if (!miniMenuOpened && !drawerOpen && !selected) { if (!miniMenuOpened && !drawerOpen && !selected) {
setSelected(null); setSelected(null);
} }
@@ -147,7 +146,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
}; };
useEffect(() => { useEffect(() => {
// setOpen(false); setOpen(false);
if (!miniMenuOpened) { if (!miniMenuOpened) {
setSelected(null); setSelected(null);
} }
@@ -211,23 +210,10 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
const isSelected = selected === menu.id; const isSelected = selected === menu.id;
const borderIcon = level === 1 ? <BorderOutlined style={{ fontSize: '1rem' }} /> : false; const borderIcon = level === 1 ? <BorderOutlined style={{ fontSize: '1rem' }} /> : false;
const Icon = menu.icon; const Icon = menu.icon;
const menuIcon = menu.icon ? ( const menuIcon = menu.icon ? <Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem' }} /> : borderIcon;
<Icon const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? theme.palette.text.primary : theme.palette.primary.main;
style={{
fontSize: drawerOpen ? '1rem' : '1.25rem'
// color: 'white'
}}
/>
) : (
borderIcon
);
// const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : 'text.primary';
// const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? theme.palette.text.primary : theme.palette.primary.main;
const popperId = miniMenuOpened ? `collapse-pop-${menu.id}` : undefined; const popperId = miniMenuOpened ? `collapse-pop-${menu.id}` : undefined;
const FlexBox = { display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%' }; const FlexBox = { display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%' };
const textColor = 'white';
const iconSelectedColor = 'white';
// const isSelected = true;
return ( return (
<> <>
@@ -237,19 +223,13 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
disableRipple disableRipple
selected={selected === menu.id} selected={selected === menu.id}
{...(!drawerOpen && { onMouseEnter: handleClick, onMouseLeave: handleClose })} {...(!drawerOpen && { onMouseEnter: handleClick, onMouseLeave: handleClose })}
onClick={() => { onClick={handleClick}
handleClick();
if (open == true) {
setOpen(false);
}
}}
sx={{ sx={{
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.light'
bgcolor: '#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
bgcolor: 'transparent', bgcolor: 'transparent',
@@ -258,14 +238,14 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
} }
}), }),
...(!drawerOpen && { ...(!drawerOpen && {
bgcolor: theme.palette.primary.main,
'&:hover': { '&:hover': {
bgcolor: theme.palette.primary.light bgcolor: 'primary.light'
}, },
'&.Mui-selected': { '&.Mui-selected': {
'&:hover': { '&:hover': {
bgcolor: theme.palette.primary.light bgcolor: 'white'
} },
bgcolor: 'white'
} }
}) })
}} }}
@@ -275,27 +255,22 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
onClick={handlerIconLink} onClick={handlerIconLink}
sx={{ sx={{
minWidth: 28, minWidth: 28,
// color: selected === menu.id ? 'primary.main' : textColor, color: selected === menu.id ? 'primary.main' : 'white',
// color: selected === menu.id ? textColor : textColor,
// bgcolor:'white',
color: 'white',
...(!drawerOpen && { ...(!drawerOpen && {
borderRadius: 1.5, borderRadius: 1.5,
width: 36, width: 36,
height: 36, height: 36,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
color: 'white',
'&:hover': { '&:hover': {
bgcolor: theme.palette.primary.light // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter'
} }
}), }),
...(!drawerOpen && ...(!drawerOpen &&
selected === menu.id && { selected === menu.id && {
bgcolor: theme.palette.primary.lighter, // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.900' : 'primary.lighter',
color: theme.palette.primary.main,
'&:hover': { '&:hover': {
bgcolor: theme.palette.primary.lighter // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.darker' : 'primary.lighter'
} }
}) })
}} }}
@@ -306,12 +281,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
{(drawerOpen || (!drawerOpen && level !== 1)) && ( {(drawerOpen || (!drawerOpen && level !== 1)) && (
<ListItemText <ListItemText
primary={ primary={
<Typography <Typography variant="h6" color={selected === menu.id ? 'white' : 'white'}>
variant="h6"
// color={selected === menu.id ? 'primary' : textColor}
// color={'white'}
color={selected === menu.id ? textColor : textColor}
>
{menu.title} {menu.title}
</Typography> </Typography>
} }
@@ -326,22 +296,9 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
)} )}
{(drawerOpen || (!drawerOpen && level !== 1)) && {(drawerOpen || (!drawerOpen && level !== 1)) &&
(miniMenuOpened || open ? ( (miniMenuOpened || open ? (
<UpOutlined <UpOutlined style={{ fontSize: '0.625rem', marginLeft: 1, color: theme.palette.primary.main }} />
style={{
fontSize: '0.625rem',
marginLeft: 1,
// color: theme.palette.primary.main
color: 'white'
}}
/>
) : ( ) : (
<DownOutlined <DownOutlined style={{ fontSize: '0.625rem', marginLeft: 1, color: 'white' }} />
style={{
fontSize: '0.625rem',
marginLeft: 1,
color: 'white'
}}
/>
))} ))}
{!drawerOpen && ( {!drawerOpen && (
@@ -371,8 +328,8 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
mt: 1.5, mt: 1.5,
boxShadow: theme.customShadows.z1, boxShadow: theme.customShadows.z1,
backgroundImage: 'none', backgroundImage: 'none',
// border: `1px solid ${theme.palette.divider}`, border: `1px solid ${theme.palette.primary.main}`,
background: theme.palette.primary.main bgcolor: 'primary.main'
}} }}
> >
<ClickAwayListener onClickAway={handleClose}> <ClickAwayListener onClickAway={handleClose}>
@@ -416,14 +373,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
> >
<Box onClick={handlerIconLink} sx={FlexBox}> <Box onClick={handlerIconLink} sx={FlexBox}>
{menuIcon && ( {menuIcon && (
<ListItemIcon <ListItemIcon sx={{ my: 'auto', minWidth: !menu.icon ? 18 : 36, color: theme.palette.secondary.dark }}>
sx={{
my: 'auto',
minWidth: !menu.icon ? 18 : 36
// color: theme.palette.secondary.dark
// color:'white'
}}
>
{menuIcon} {menuIcon}
</ListItemIcon> </ListItemIcon>
)} )}
@@ -436,12 +386,7 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
)} )}
<ListItemText <ListItemText
primary={ primary={
<Typography <Typography variant="body1" color="inherit" sx={{ my: 'auto' }}>
variant="body1"
// color="inherit"
// color="white"
sx={{ my: 'auto' }}
>
{menu.title} {menu.title}
</Typography> </Typography>
} }

View File

@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { forwardRef, useEffect, useState } from 'react'; import { forwardRef, useEffect } 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,10 +9,8 @@ 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 ||============================== //
@@ -20,9 +18,9 @@ import { activeItem, openDrawer } from 'store/reducers/menu';
const NavItem = ({ item, level }) => { const NavItem = ({ item, level }) => {
const theme = useTheme(); const theme = useTheme();
const dispatch = useDispatch(); const dispatch = useDispatch();
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'));
@@ -37,13 +35,9 @@ 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;
@@ -68,7 +62,7 @@ const NavItem = ({ item, level }) => {
// eslint-disable-next-line // eslint-disable-next-line
}, [pathname]); }, [pathname]);
const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : '#fff'; const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : 'text.primary';
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 (
@@ -78,20 +72,14 @@ const NavItem = ({ item, level }) => {
{...listItemProps} {...listItemProps}
disabled={item.disabled} disabled={item.disabled}
selected={isSelected} selected={isSelected}
onMouseEnter={(e) => {
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 && {
// bgcolor: 'primary.light',
'&:hover': { '&:hover': {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter' bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.light'
bgcolor: '#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter', bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter',
@@ -104,9 +92,8 @@ const NavItem = ({ item, level }) => {
} }
}), }),
...(!drawerOpen && { ...(!drawerOpen && {
bgcolor: theme.palette.primary.main,
'&:hover': { '&:hover': {
bgcolor: theme.palette.primary.light bgcolor: 'primary.light'
}, },
'&.Mui-selected': { '&.Mui-selected': {
'&:hover': { '&:hover': {
@@ -124,28 +111,23 @@ const NavItem = ({ item, level }) => {
<ListItemIcon <ListItemIcon
sx={{ sx={{
minWidth: 28, minWidth: 28,
'&:hover': { color: isSelected ? iconSelectedColor : 'white',
color: isSelected ? '#fff' : iconSelectedColor
},
color: isSelected ? iconSelectedColor : textColor,
...(!drawerOpen && { ...(!drawerOpen && {
// borderRadius: 1.5,
width: 36, width: 36,
height: 36, height: 36,
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' : 'primary.lighter'
// bgcolor: theme.palette.primary.light // }
}
}), }),
...(!drawerOpen && ...(!drawerOpen &&
isSelected && { isSelected && {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.900' : 'primary.lighter', // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.900' : 'primary.lighter',
'&:hover': { '&:hover': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.darker' : 'primary.lighter' // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.darker' : 'primary.lighter'
}, }
borderRadius: 2
}) })
}} }}
> >
@@ -157,13 +139,9 @@ const NavItem = ({ item, level }) => {
primary={ primary={
<Typography <Typography
variant="h6" variant="h6"
// sx={{ color: isSelected ? iconSelectedColor : textColor }}
sx={{ sx={{
color: isSelected && !drawerOpen ? theme.palette.primary.main : !isSelected ? 'white' : theme.palette.primary.main, ml: 1,
bgcolor: isSelected && theme.palette.primary.lighter, color: isSelected ? theme.palette.primary.main : 'white'
padding: isSelected && !drawerOpen ? 0.8 : 'none',
borderRadius: isSelected && !drawerOpen ? 2 : 'none',
ml: isSelected && !drawerOpen ? 0.5 : 'none'
}} }}
> >
{item.title} {item.title}

View File

@@ -7,13 +7,13 @@ const Footer = () => (
<Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: '24px 16px 0px', mt: 'auto' }}> <Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: '24px 16px 0px', mt: 'auto' }}>
<Typography variant="caption">&copy; All rights reserved</Typography> <Typography variant="caption">&copy; All rights reserved</Typography>
<Stack spacing={1.5} direction="row" justifyContent="space-between" alignItems="center"> <Stack spacing={1.5} direction="row" justifyContent="space-between" alignItems="center">
<Link component={RouterLink} to="#" target="_blank" variant="caption" color="textPrimary"> <Link component={RouterLink} to="https://nearle.in/aboutus" target="_blank" variant="caption" color="textPrimary">
About us About us
</Link> </Link>
<Link component={RouterLink} to="#" target="_blank" variant="caption" color="textPrimary"> <Link component={RouterLink} to="https://nearle.in/privacy" target="_blank" variant="caption" color="textPrimary">
Privacy Privacy
</Link> </Link>
<Link component={RouterLink} to="#" target="_blank" variant="caption" color="textPrimary"> <Link component={RouterLink} to="https://nearle.in/terms" target="_blank" variant="caption" color="textPrimary">
Terms Terms
</Link> </Link>
</Stack> </Stack>

View File

@@ -5,55 +5,31 @@ import { useState } from 'react';
import { List, ListItemButton, ListItemIcon, ListItemText } from '@mui/material'; import { List, ListItemButton, ListItemIcon, ListItemText } from '@mui/material';
// assets // assets
import { EditOutlined, ProfileOutlined, LogoutOutlined, UserOutlined, WalletOutlined, CommentOutlined } from '@ant-design/icons'; import { LogoutOutlined, UserOutlined } from '@ant-design/icons';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
// ==============================|| HEADER PROFILE - PROFILE TAB ||============================== // // ==============================|| HEADER PROFILE - PROFILE TAB ||============================== //
const ProfileTab = ({ handleLogout }) => { const ProfileTab = ({ handleLogout }) => {
const [selectedIndex, setSelectedIndex] = useState(0); const [selectedIndex, setSelectedIndex] = useState(null);
const navigate = useNavigate(); const navigate = useNavigate();
const handleListItemClick = (event, index) => { const handleListItemClick = (event, index) => {
setSelectedIndex(index); setSelectedIndex(index);
if (index == 1) { if (index == 0) {
navigate('/accountsettings'); navigate('/accountsettings');
} }
}; };
return ( return (
<List component="nav" sx={{ p: 0, '& .MuiListItemIcon-root': { minWidth: 32 } }}> <List component="nav" sx={{ p: 0, '& .MuiListItemIcon-root': { minWidth: 32 } }}>
{/* <ListItemButton selected={selectedIndex === 0} onClick={(event) => handleListItemClick(event, 0)}> <ListItemButton selected={selectedIndex === 0} onClick={(event) => handleListItemClick(event, 0)}>
<ListItemIcon>
<EditOutlined />
</ListItemIcon>
<ListItemText primary="Edit Profile" />
</ListItemButton> */}
<ListItemButton selected={selectedIndex === 0} onClick={(event) => handleListItemClick(event, 1)}>
<ListItemIcon> <ListItemIcon>
<UserOutlined /> <UserOutlined />
</ListItemIcon> </ListItemIcon>
<ListItemText primary="View Profile" /> <ListItemText primary="View Profile" />
</ListItemButton> </ListItemButton>
{/* <ListItemButton selected={selectedIndex === 1} onClick={(event) => handleListItemClick(event, 2)}> <ListItemButton selected={selectedIndex === 1} onClick={handleLogout}>
<ListItemIcon>
<CommentOutlined />
</ListItemIcon>
<ListItemText primary="Support Ticket" />
</ListItemButton> */}
{/* <ListItemButton selected={selectedIndex === 4} onClick={(event) => handleListItemClick(event, 4)}>
<ListItemIcon>
<WalletOutlined />
</ListItemIcon>
<ListItemText primary="Billing" />
</ListItemButton> */}
<ListItemButton
selected={selectedIndex === 1}
onClick={handleLogout}
// onClick={()=>{
// navigate('/login')
// }}
>
<ListItemIcon> <ListItemIcon>
<LogoutOutlined /> <LogoutOutlined />
</ListItemIcon> </ListItemIcon>

View File

@@ -214,7 +214,7 @@ const HeaderContent = () => {
<ListItemButton <ListItemButton
selected={location.pathname === 'nearle/customers/create'} selected={location.pathname === 'nearle/customers/create'}
onClick={() => { onClick={() => {
navigate('nearle/customers/create'); navigate('nearle/customers');
handleClickAway(); handleClickAway();
}} }}
> >

View File

@@ -58,7 +58,7 @@ const MainLayout = () => {
> >
{/* <Breadcrumbs navigation={navigation} title titleBottom card={false} divider={false} /> */} {/* <Breadcrumbs navigation={navigation} title titleBottom card={false} divider={false} /> */}
<Outlet /> <Outlet />
<Footer /> {/* <Footer /> */}
</Container> </Container>
</Box> </Box>
</Box> </Box>

View File

@@ -77,21 +77,21 @@ const nearle = {
icon: AiOutlineBarChart, icon: AiOutlineBarChart,
children: [ children: [
{ {
id: 'OrderSummary', id: 'orderSummary',
title: <FormattedMessage id="OrderSummary" />, title: <FormattedMessage id="OrderSummary" />,
type: 'item', type: 'item',
url: '/nearle/reports/ordersummary', url: '/nearle/reports/ordersummary',
icon: TbListDetails icon: TbListDetails
}, },
{ {
id: 'OrdersDetails', id: 'ordersDetails',
title: <FormattedMessage id="OrdersDetails" />, title: <FormattedMessage id="OrdersDetails" />,
type: 'item', type: 'item',
url: '/nearle/reports/ordersdetails', url: '/nearle/reports/ordersdetails',
icon: AiOutlineDashboard icon: AiOutlineDashboard
}, },
{ {
id: 'RiderSummary', id: 'riderSummary',
title: <FormattedMessage id="RiderSummary" />, title: <FormattedMessage id="RiderSummary" />,
type: 'item', type: 'item',
url: '/nearle/reports/ridersummary', url: '/nearle/reports/ridersummary',

View File

@@ -1,298 +1,151 @@
import { import { Grid, List, ListItem, Stack, Typography, useMediaQuery } from '@mui/material';
Box, Tab, Tabs,
Chip,
Divider,
Grid,
Link,
List,
ListItem,
ListItemIcon,
ListItemSecondaryAction,
Stack,
Typography,
useMediaQuery,
Avatar,
} from '@mui/material';
import { enqueueSnackbar } from 'notistack'; import { enqueueSnackbar } from 'notistack';
import LinearWithLabel from 'components/@extended/progress/LinearWithLabel';
// import { PatternFormat } from 'react-number-format';
import axios from 'axios'; import axios from 'axios';
// project import // project import
import MainCard from 'components/MainCard'; import MainCard from 'components/MainCard';
import { AimOutlined, EnvironmentOutlined, MailOutlined, PhoneOutlined } from '@ant-design/icons'; import { useEffect, useState } from 'react';
import { useEffect ,useState} from 'react';
import Loader from 'components/Loader'; import Loader from 'components/Loader';
import Footer from 'layout/MainLayout/Footer';
import TitleCard from './titleCard';
const Accountsettings = () => { const Accountsettings = () => {
const matchDownMD = useMediaQuery((theme) => theme.breakpoints.down('md')); const matchDownMD = useMediaQuery((theme) => theme.breakpoints.down('md'));
const [info, setInfo] = useState({}); const [info, setInfo] = useState({});
const [loading,setLoading]=useState(false) const [loading, setLoading] = useState(false);
useEffect(() => { useEffect(() => {
if (localStorage.getItem('tenantid')) { if (localStorage.getItem('tenantid')) {
fetchaccount(localStorage.getItem('tenantid')); fetchaccount(localStorage.getItem('tenantid'));
}
}, []);
const fetchaccount = async (tid) => {
setLoading(true);
await axios
.get(`${process.env.REACT_APP_URL}/tenants/gettenantinfo/?tenantid=${tid}`)
.then((res) => {
console.log(res);
if (res.data.status) {
setInfo(res.data.details);
} }
}, []); setLoading(false);
})
.catch((err) => {
console.log(err);
enqueueSnackbar(err.message, {
variant: 'error',
anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
});
setLoading(false);
});
};
const fetchaccount = async (tid) => { return (
setLoading(true) <>
await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenantinfo/?tenantid=${tid}`) {loading && <Loader />}
.then((res) => { <TitleCard title={'Profile'} />
console.log(res)
if (res.data.status) {
setInfo(res.data.details);
}
setLoading(false)
}).catch((err) => {
console.log(err)
enqueueSnackbar(err.message, {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
setLoading(false)
})
<Grid container spacing={3}>
} <Grid item xs={12}>
<MainCard>
return <> <List sx={{ py: 0 }}>
{loading && <ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Loader /> <Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
} <Typography color="secondary">Name</Typography>
<Grid container rowSpacing={4.5} columnSpacing={2.75}> <Typography>{info.tenantname || ''}</Typography>
<Grid item xs={12} sx={{ mb: -2.25 }}> </Stack>
<Stack direction={{ xs: 'column', md: 'row' }} justifyContent='space-between' alignItems='center' spacing={2}> </Grid>
<Stack direction='column' alignItems='flex-start' spacing={1}> <Grid item xs={12} sm={6}>
<Typography variant="h3">Account Settings</Typography> <Stack spacing={0.5}>
</Stack> <Typography color="secondary">Company Name</Typography>
</Stack> <Typography>{info.companyname || ''}</Typography>
</Grid> </Stack>
<Grid item xs={12}> </Grid>
<MainCard border={false} boxShadow sx={{height:'100%'}}>
<Box sx={{ borderBottom: 1, borderColor: 'divider', width: '100%',height:'100%' }}>
<Tabs value={0}
// onChange={handleChange}
variant="scrollable" scrollButtons="auto" aria-label="account profile tab">
<Tab label="Account"
// component={Link} to="/apps/profiles/account/basic" icon={<UserOutlined />} iconPosition="start"
/>
</Tabs>
<Grid container spacing={3}
sx={{ mt: 1,height:'100%'}}
>
{/* <Grid item xs={12} sm={5} md={4} xl={3}>
<Grid container spacing={3} sx={{height:'100%'}}>
<Grid item xs={12} sx={{height:'100%'}}>
<MainCard sx={{height:'100%'}}>
<Grid container spacing={3} sx={{height:'100%'}}>
<Grid item xs={12} sx={{height:'100%'}}>
<Stack direction="row" justifyContent="flex-end">
</Stack>
<Stack spacing={2.5} alignItems="center">
<Avatar alt="Avatar 1"
sx={{width:80,height:80}}
/>
<Stack spacing={0.5} alignItems="center">
<Typography variant="h5">{info.companyname || ''}</Typography>
<Typography color="secondary">{info.registrationno || ''}</Typography>
</Stack>
</Stack>
</Grid>
<Grid item xs={12}>
<Divider />
</Grid>
<Grid item xs={12} sx={{height:'100%'}}>
<List component="nav" aria-label="main mailbox folders" sx={{ py: 0, '& .MuiListItem-root': { p: 0, py: 1 } }}>
<ListItem>
<ListItemIcon>
<MailOutlined />
</ListItemIcon>
<ListItemSecondaryAction>
<Typography align="right">{info.primaryemail || ''}</Typography>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<PhoneOutlined />
</ListItemIcon>
<ListItemSecondaryAction>
<Typography align="right">
{info.primarycontact || ''}
</Typography>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<AimOutlined />
</ListItemIcon>
<ListItemSecondaryAction>
<Typography align="right">
{info.city}
</Typography>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<EnvironmentOutlined />
</ListItemIcon>
<ListItemSecondaryAction>
{info.state}
</ListItemSecondaryAction>
</ListItem>
</List>
</Grid>
</Grid>
</MainCard>
</Grid>
</Grid>
</Grid> */}
<Grid item
// xs={12} sm={7} md={8} xl={9}
xs={12}
// sm={7} md={8} xl={9}
>
<Grid container spacing={3} >
<Grid item xs={12} >
<MainCard
// title={ <Stack direction="row" alignItems="center" spacing={1} justifyContent="flex-start">
// <Avatar
// alt=""
// size="sm"
// sx={{
// width: '25px',
// height: '25px'
// }}
// >
// </Avatar>
// <Stack direction="column">
// <Typography variant="caption">{info.companyname}</Typography>
// </Stack>
// </Stack>}
>
<List sx={{ py: 0 }}>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Name</Typography>
<Typography>{info.tenantname || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Company Name</Typography>
<Typography>{info.companyname || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Registration No</Typography>
<Typography>{info.registrationno || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Info</Typography>
<Typography>{info.info || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Phone</Typography>
<Typography>
{info.primarycontact || ''}
</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">State</Typography>
<Typography>{info.state || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Email</Typography>
<Typography>{info.primaryemail || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">City</Typography>
<Typography>{info.city || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Suburb</Typography>
<Typography>{info.suburb || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Zip Code</Typography>
<Typography>{info.postcode || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem>
<Stack spacing={0.5}>
<Typography color="secondary">Address</Typography>
<Typography>{info.address || ''}</Typography>
</Stack>
</ListItem>
</List>
</MainCard>
</Grid>
{/* <Grid item xs={12}>
<MainCard title="Info">
<Typography color="secondary">
{info.info || ''}
</Typography>
</MainCard>
</Grid> */}
</Grid>
</Grid>
</Grid> </Grid>
</Box> </ListItem>
</MainCard> <ListItem divider={!matchDownMD}>
</Grid> <Grid container spacing={3}>
</Grid> <Grid item xs={12} sm={6}>
</> <Stack spacing={0.5}>
} <Typography color="secondary">Registration No</Typography>
<Typography>{info.registrationno || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Info</Typography>
<Typography>{info.info || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Phone</Typography>
<Typography>{info.primarycontact || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">State</Typography>
<Typography>{info.state || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
export default Accountsettings; <ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Email</Typography>
<Typography>{info.primaryemail || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">City</Typography>
<Typography>{info.city || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Suburb</Typography>
<Typography>{info.suburb || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Zip Code</Typography>
<Typography>{info.postcode || ''}</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem>
<Stack spacing={0.5}>
<Typography color="secondary">Address</Typography>
<Typography>{info.address || ''}</Typography>
</Stack>
</ListItem>
</List>
</MainCard>
</Grid>
</Grid>
<Footer />
</>
);
};
export default Accountsettings;

View File

@@ -1,4 +1,5 @@
import axios from 'axios'; import axios from 'axios';
import { OpenToast } from 'components/nearle_components/OpenToast';
const tenid = localStorage.getItem('tenantid'); const tenid = localStorage.getItem('tenantid');
export const fetchOrders = async ({ pageParam = 1, queryKey }) => { export const fetchOrders = async ({ pageParam = 1, queryKey }) => {
@@ -103,6 +104,28 @@ export const fetchCustomersList = async ({ queryKey }) => {
console.log('fetchCustomersList', response.data.details); console.log('fetchCustomersList', response.data.details);
return response.data.details; return response.data.details;
}; };
// ==============================|| gettenantcustomers (customers)||============================== //
export const gettenantcustomers = async ({ pageParam = 1, queryKey }) => {
const [, rowsPerPage, customerSearch] = queryKey;
try {
const response = await axios.get(
`${process.env.REACT_APP_URL}/customers/gettenantcustomers/?tenantid=${tenid}&pageno=${pageParam}&pagesize=${rowsPerPage}&keyword=${customerSearch}`
);
const details = response.data.details ?? [];
return {
details,
nextPage: details.length === rowsPerPage ? pageParam + 1 : undefined
};
} catch (err) {
OpenToast(err.message, 'error', 1000);
return { details: [], nextPage: undefined };
}
};
// ==============================|| fetchCustomersListBySearch (customers)||============================== // // ==============================|| fetchCustomersListBySearch (customers)||============================== //
export const fetchCustomersListBySearch = async ({ queryKey }) => { export const fetchCustomersListBySearch = async ({ queryKey }) => {
const [search] = queryKey; const [search] = queryKey;

View File

@@ -31,6 +31,7 @@ import Geocode from 'react-geocode';
import { enqueueSnackbar } from 'notistack'; import { enqueueSnackbar } from 'notistack';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import CloseIcon from '@mui/icons-material/Close'; import CloseIcon from '@mui/icons-material/Close';
import TitleCard from '../titleCard';
const CreateCustomer = () => { const CreateCustomer = () => {
const appId = localStorage.getItem('applocationid'); const appId = localStorage.getItem('applocationid');
@@ -356,11 +357,15 @@ const CreateCustomer = () => {
return ( return (
<> <>
{loading && <Loader />} {loading && <Loader />}
<Grid item xs={12} sx={{ mb: 2 }}> <TitleCard
<Stack direction="row" justifyContent="space-between" alignItems="center"> title={'Create Customer'}
<Typography variant="h3">Create Customer</Typography> secondary={
</Stack> <Button variant="contained" color="secondary" onClick={() => navigate('/nearle/customers')}>
</Grid> Back
</Button>
}
/>
<MainCard> <MainCard>
<Grid container spacing={3}> <Grid container spacing={3}>
<Grid item xs={12}> <Grid item xs={12}>

File diff suppressed because it is too large Load Diff

View File

@@ -150,7 +150,7 @@ const ResponsiveLocationDrawer = () => {
currentStatus, currentStatus,
startdate, startdate,
enddate, enddate,
debouncedSearchLocation, debouncedSearchword,
rowsPerPage rowsPerPage
], ],
queryFn: fetchOrders1, queryFn: fetchOrders1,
@@ -302,17 +302,17 @@ const ResponsiveLocationDrawer = () => {
sx={{ sx={{
width: 'auto', width: 'auto',
height: 60, height: 60,
bgcolor: theme.palette.primary.lighter, bgcolor: 'white',
'& .MuiOutlinedInput-notchedOutline': { '& .MuiOutlinedInput-notchedOutline': {
border: 'none', border: 'none',
borderBottom: '1px solid ', borderBottom: '1px solid',
borderColor: theme.palette.secondary.light borderColor: theme.palette.secondary.light
} }
}} }}
/> />
</Box> </Box>
<List sx={{ mt: -1 }}> <List sx={{ border: 'none', mt: -1 }}>
{locations?.map((row, index) => ( {locations?.map((row, index) => (
<React.Fragment key={index}> <React.Fragment key={index}>
<ListItem <ListItem
@@ -354,12 +354,14 @@ const ResponsiveLocationDrawer = () => {
width: open && isDesktop ? `calc(100% - ${drawerWidth}px)` : '100%', width: open && isDesktop ? `calc(100% - ${drawerWidth}px)` : '100%',
transition: 'left 0.3s ease, width 0.3s ease', transition: 'left 0.3s ease, width 0.3s ease',
zIndex: 1100, // BELOW drawer, ABOVE content zIndex: 1100, // BELOW drawer, ABOVE content
backgroundColor: theme.palette.primary.lighter backgroundColor: 'white',
borderBottom: '1px solid',
borderColor: theme.palette.secondary.light
}} }}
> >
<Toolbar> <Toolbar>
<Stack <Stack
sx={{ width: '100%' }} sx={{ width: '100%', borderBottom: '1px soild red' }}
display={'flex'} display={'flex'}
flexDirection={'row'} flexDirection={'row'}
alignItems={'center'} alignItems={'center'}
@@ -375,7 +377,7 @@ const ResponsiveLocationDrawer = () => {
{selectedLocation?.locationname} {selectedLocation?.locationname}
</Typography> </Typography>
</Stack> </Stack>
<Stack flexGrow={1} sx={{ mx: { xs: 0, custom600: 3 } }}> <Stack>
<SearchBar <SearchBar
value={searchword} value={searchword}
placeholder={'Search Order Details'} placeholder={'Search Order Details'}
@@ -383,12 +385,12 @@ const ResponsiveLocationDrawer = () => {
sx={{ sx={{
width: 'auto', width: 'auto',
height: 40, height: 40,
bgcolor: theme.palette.primary.lighter, bgcolor: 'white',
'& .MuiOutlinedInput-notchedOutline': { maxWidth: 800,
border: 'none', borderRadius: 1
borderBottom: '1px solid ', // '& .MuiOutlinedInput-notchedOutline': {
borderColor: theme.palette.secondary.light // border: 'none'
} // }
}} }}
/> />
</Stack> </Stack>

View File

@@ -6,17 +6,15 @@ import {
Grid, Grid,
Card, Card,
CardContent, CardContent,
// CardHeader,
Stack, Stack,
// Divider,
// InputLabel,
// OutlinedInput,
TextField, TextField,
Button, Button,
Typography, Typography,
CardHeader, CardHeader,
Container, Container,
Link Link,
InputAdornment,
IconButton
} from '@mui/material'; } from '@mui/material';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import AnimateButton from 'components/@extended/AnimateButton'; import AnimateButton from 'components/@extended/AnimateButton';
@@ -25,181 +23,80 @@ 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';
// import { openSnackbar } from 'store/reducers/snackbar';
// import { useDispatch } from 'react-redux';
import Loader from 'components/Loader'; import Loader from 'components/Loader';
import { enqueueSnackbar } from 'notistack'; import { OpenToast } from 'components/nearle_components/OpenToast';
import { Formik } from 'formik';
import * as Yup from 'yup';
import { Visibility, VisibilityOff } from '@mui/icons-material';
const Login = () => { const Login = () => {
const theme = useTheme(); const theme = useTheme();
const [username, setUsername] = useState(''); const [showPassword, setShowPassword] = useState(false);
const [password, setPassword] = useState('');
const [alertmessage, setAlertmessage] = useState('');
const [checkusername, setCheckusername] = useState(false);
// const [toast, setToast] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
let navigate = useNavigate(); let navigate = useNavigate();
// let dispatch = useDispatch();
const [submitting, setSubmitting] = useState(false); const [submitting, setSubmitting] = useState(false);
const LoginSchema = Yup.object().shape({
username: Yup.string().email('Enter a valid email address').required('Email is required'),
password: Yup.string().required('Password is required')
});
useEffect(() => { useEffect(() => {
if ( if (localStorage.getItem('authname')) {
localStorage.getItem('authname')
// || localStorage.getItem("appuserid")
) {
navigate('/nearle/orders'); navigate('/nearle/orders');
} }
// console.log(alertmessage)
}, []); }, []);
const usernamecheck = async (e) => { const loginsend = async (values) => {
e.preventDefault(); console.log('values', values);
setUsername(e.target.value);
if (e.target.value) {
try {
// await axios.post(`${process.env.REACT_APP_URL}/auth/login`, {
// "authname": e.target.value
// })
await axios
// .post(`${process.env.REACT_APP_URL}/users/login`, {
.post(`${process.env.REACT_APP_URL}/users/tenant/login`, {
authname: e.target.value,
configid: 1,
password: 'admin'
})
.then((res) => {
console.log(res.data);
if (res.data.details.authname === e.target.value) {
setUsername(e.target.value);
setCheckusername(false);
} else {
setCheckusername(true);
}
// if (res.data.authname === e.target.value) {
// setUsername(e.target.value);
// setCheckusername(false);
// }
})
.catch((err) => {
// if (err.response.data.message === 'No user found') {
setCheckusername(true);
// }
});
} catch (err) {
console.log(err);
}
}
};
const loginsend = async () => {
// e.preventDefault();
setLoading(true); setLoading(true);
setSubmitting(true);
if (password && username) { try {
if (password == 'admin') { const res = await axios.post(`${process.env.REACT_APP_URL}/users/tenant/weblogin`, {
setSubmitting(true); authname: values.username,
try { configid: 1,
await axios roleid: 1,
// .post(`${process.env.REACT_APP_URL}/users/login`, { password: values.password
.post(`${process.env.REACT_APP_URL}/users/tenant/login`, { });
authname: username, console.log(res.data);
configid: 1, if (res.data.code == 200 && res.data.status == true) {
password: password OpenToast('Login Successful', 'success', 1000);
}) // save to localStorage
.then((res) => { const d = res.data.details;
console.log(res.data); localStorage.setItem('tenantname', d.tenantname);
if (res.data.details.authname === username) { localStorage.setItem('firstname', d.tenantname);
// setAlertmessage('login Successfull'); localStorage.setItem('authname', d.authname);
setLoading(false); localStorage.setItem('appuserid', d.userid);
// dispatch( localStorage.setItem('roleid', d.roleid);
// openSnackbar({ localStorage.setItem('tenantid', d.tenantid);
// open: true, localStorage.setItem('applocationid', d.applocationid);
// message: 'login Successfull', localStorage.setItem('fullname', d.fullname);
// variant: 'alert', localStorage.setItem('configid', d.configid);
// anchorOrigin: { vertical: 'top', horizontal: 'right' }, localStorage.setItem('locationid', d.locationid);
// alert: { localStorage.setItem('moduleid', d.moduleid);
// color: 'success' localStorage.setItem('userid', d.userid);
// }
// })
// )
enqueueSnackbar('login Successfull', {
variant: 'success',
anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 1000
});
setUsername('');
setPassword('');
localStorage.setItem('tenantname', res.data.details.tenantname);
localStorage.setItem('firstname', res.data.details.tenantname);
localStorage.setItem('authname', res.data.details.authname);
localStorage.setItem('appuserid', res.data.details.userid);
localStorage.setItem('roleid', res.data.details.roleid);
localStorage.setItem('tenantid', res.data.details.tenantid);
localStorage.setItem('applocationid', res.data.details.applocationid);
localStorage.setItem('fullname', res.data.details.fullname);
localStorage.setItem('configid', res.data.details.configid);
localStorage.setItem('locationid', res.data.details.locationid);
localStorage.setItem('moduleid', res.data.details.moduleid);
localStorage.setItem('userid', res.data.details.userid);
navigate('/nearle/orders'); setSubmitting(false);
setSubmitting(false);
} else {
opentoast('Login Error');
setLoading(false);
setSubmitting(false);
}
})
.catch((err) => {
console.log(err);
// setAlertmessage('Invalid Data');
// if(err.message == 'Network Error'){
opentoast(err.message);
// }else{
// opentoast('Invalid Data');
// }
setLoading(false);
setSubmitting(false);
console.log(err.message);
});
} catch (err) {
console.log(err);
setLoading(false);
setSubmitting(false);
}
} else {
opentoast('Password is Incorrect');
setLoading(false); setLoading(false);
navigate('/nearle/orders');
} else {
OpenToast(res.data.message, 'warning', 2000);
setLoading(false);
setSubmitting(false);
} }
} else { } catch (err) {
// let el2 = document.getElementById('toastid'); console.log(err);
// el2.classList.add('d-block'); setSubmitting(false);
// el2.classList.remove('d-none');
setAlertmessage('Fill All required fields');
opentoast('Fill All required fields');
setLoading(false); setLoading(false);
} }
}; };
const opentoast = (message) => {
enqueueSnackbar(message, {
variant: 'error',
anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
});
};
return ( return (
<> <>
{/* <AuthWrapper> */} {/* <AuthWrapper> */}
<Box sx={{ minHeight: '100vh' }}> <Box sx={{ minHeight: '100vh' }}>
{loading && <Loader />} {loading && <Loader />}
<Grid <Grid
container container
direction="column" direction="column"
@@ -208,117 +105,119 @@ const Login = () => {
minHeight: '100vh' minHeight: '100vh'
}} }}
> >
<Grid <Grid item xs={12} sx={{ ml: 3, mt: 1 }}>
item
xs={12}
// sx={{ ml: 3, mt: 3 }}
sx={{ ml: 3, mt: 1 }}
>
<img src={logo} alt="legendary" width="200px" /> <img src={logo} alt="legendary" width="200px" />
</Grid> </Grid>
<Grid item xs={12}> <Grid
<Grid container
item justifyContent="center"
xs={12} alignItems="center"
container sx={{
justifyContent="center" minHeight: {
alignItems="center" xs: 'calc(100vh - 180px)',
// sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 112px)' } }} sm: 'calc(100vh - 120px)',
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 140px)' } }} md: 'calc(100vh - 130px)'
},
px: 2
}}
>
<Box
sx={{
width: '100%',
maxWidth: { xs: 380, sm: 420, md: 450 }
}}
> >
<Grid item> <Card
{/* <AuthCard>{children}</AuthCard> */} sx={{
<Box border: '1px solid',
sx={{ borderColor: theme.palette.divider,
maxWidth: { xs: 400, lg: 475 }, borderRadius: 1.5,
margin: { xs: 2.5, md: 3 }, boxShadow: 'inherit',
'& > *': { p: 2.5
flexGrow: 1, }}
flexBasis: '50%' >
} <CardHeader
}} title={
> <Typography variant="h3" color={'primary'}>
<Card Login
sx={{ </Typography>
position: 'relative', }
border: '1px solid', sx={{ textAlign: 'center', pb: 3 }}
borderRadius: 1, />
borderColor: theme.palette.divider, <CardContent sx={{ pt: 1 }}>
boxShadow: 'inherit', <Formik
p: 2, initialValues={{ username: '', password: '' }}
width: '100%' validationSchema={LoginSchema}
}} onSubmit={(values) => loginsend(values)}
> >
<Grid container spacing={3}> {({ values, errors, touched, handleChange, handleSubmit, handleBlur }) => (
<Grid item xs={12}> <form noValidate onSubmit={handleSubmit}>
<Stack direction="row" justifyContent="flex-start" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}> <Grid container gap={3}>
<CardHeader title={<Typography variant="h3">Login</Typography>} /> {/* USERNAME */}
</Stack>
</Grid>
</Grid>
<CardContent>
<form
noValidate
onSubmit={(e) => {
e.preventDefault();
}}
>
<Grid container spacing={2}>
<Grid item xs={12}> <Grid item xs={12}>
<TextField <TextField
margin="normal"
fullWidth fullWidth
id="username1" id="username"
name="username"
label="E-mail Address" label="E-mail Address"
variant="outlined" variant="outlined"
autoComplete="email" autoComplete="email"
required value={values.username}
onChange={usernamecheck} onChange={handleChange}
error={checkusername} onBlur={handleBlur}
error={touched.username && Boolean(errors.username)}
helperText={touched.username && errors.username}
/> />
<TextField
margin="normal"
fullWidth
required
autoComplete="current-password"
onChange={(e) => setPassword(e.target.value)}
type="password"
id="password1"
label="Password"
variant="outlined"
/>
</Grid>
<Grid item xs={12}>
<Link href="#" variant="h6">
Forgot password?
</Link>
</Grid> </Grid>
{/* PASSWORD */}
<Grid item xs={12}>
<TextField
fullWidth
id="password"
name="password"
label="Password"
type={showPassword ? 'text' : 'password'}
variant="outlined"
autoComplete="current-password"
value={values.password}
onChange={handleChange}
onBlur={handleBlur}
error={touched.password && Boolean(errors.password)}
helperText={touched.password && errors.password}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={() => setShowPassword((prev) => !prev)}
edge="end"
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
)
}}
/>
</Grid>
{/* SUBMIT BUTTON */}
<Grid item xs={12}> <Grid item xs={12}>
<AnimateButton> <AnimateButton>
<Button <Button disabled={submitting} fullWidth size="large" type="submit" variant="contained" color="primary">
disabled={submitting}
onClick={() => {
loginsend();
}}
fullWidth
size="large"
type="submit"
variant="contained"
color="primary"
>
Login Login
</Button> </Button>
</AnimateButton> </AnimateButton>
</Grid> </Grid>
</Grid> </Grid>
</form> </form>
</CardContent> )}
</Card> </Formik>
</Box> </CardContent>
</Grid> </Card>
</Grid> </Box>
</Grid> </Grid>
<Grid item xs={12} sx={{ mb: 1 }}> <Grid item xs={12} sx={{ mb: 1 }}>
<Container maxWidth="xl"> <Container maxWidth="xl">
<Stack <Stack
@@ -345,8 +244,8 @@ const Login = () => {
variant="subtitle2" variant="subtitle2"
color="secondary" color="secondary"
component={Link} component={Link}
href="#" href="https://nearle.in/terms"
// target="_blank" target="_blank"
underline="hover" underline="hover"
textAlign="center" textAlign="center"
> >
@@ -356,8 +255,8 @@ const Login = () => {
variant="subtitle2" variant="subtitle2"
color="secondary" color="secondary"
component={Link} component={Link}
href="#" href="https://nearle.in/privacy"
// target="_blank" target="_blank"
underline="hover" underline="hover"
textAlign="center" textAlign="center"
> >

View File

@@ -108,6 +108,7 @@ export default function OrdersReport() {
const [ridersdata, setRidersdata] = useState(null); const [ridersdata, setRidersdata] = useState(null);
const [selectedLocation, setSelectedLocation] = useState(null); const [selectedLocation, setSelectedLocation] = useState(null);
const [locationId, setLocationId] = useState(0); const [locationId, setLocationId] = useState(0);
const [searchLocation, setSearchLocation] = useState('');
useEffect(() => { useEffect(() => {
console.log('openRow', openRow); console.log('openRow', openRow);
@@ -142,7 +143,7 @@ export default function OrdersReport() {
isError: tenantLocationsIsError, isError: tenantLocationsIsError,
error: tenantLocationsError error: tenantLocationsError
} = useQuery({ } = useQuery({
queryKey: ['tenantlocations'], queryKey: ['tenantlocations', searchLocation],
queryFn: gettenantlocations queryFn: gettenantlocations
}); });
@@ -725,7 +726,6 @@ export default function OrdersReport() {
<Typography variant="h5"> {totalDeliCancel}</Typography> <Typography variant="h5"> {totalDeliCancel}</Typography>
</TableCell> </TableCell>
<TableCell></TableCell> <TableCell></TableCell>
<TableCell></TableCell>
<TableCell align="right" sx={{ pr: -2 }}> <TableCell align="right" sx={{ pr: -2 }}>
<Typography variant="h5">{formatNumberToRupees(total)}</Typography> <Typography variant="h5">{formatNumberToRupees(total)}</Typography>
</TableCell>{' '} </TableCell>{' '}

View File

@@ -34,7 +34,8 @@ import {
Badge, Badge,
Autocomplete, Autocomplete,
TextField, TextField,
CircularProgress CircularProgress,
Box
} from '@mui/material'; } from '@mui/material';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@@ -105,7 +106,8 @@ export default function OrdersDetails() {
{ id: 4, status: 'Picked', statusLow: 'picked' }, { id: 4, status: 'Picked', statusLow: 'picked' },
{ id: 5, status: 'Active', statusLow: 'active' }, { id: 5, status: 'Active', statusLow: 'active' },
{ id: 6, status: 'Delivered', statusLow: 'delivered' }, { id: 6, status: 'Delivered', statusLow: 'delivered' },
{ id: 7, status: 'Cancelled', statusLow: 'cancelled' } { id: 7, status: 'Skipped', statusLow: 'skipped' },
{ id: 8, status: 'Cancelled', statusLow: 'cancelled' }
]; ];
// ============================================= || gettenantlocations (branches) || ============================================= // ============================================= || gettenantlocations (branches) || =============================================
@@ -405,12 +407,11 @@ export default function OrdersDetails() {
) : ( ) : (
<Autocomplete <Autocomplete
fullWidth fullWidth
// disabled={!isAppLocation || !isClient} sx={{ minWidth: 250, maxWidth: 400, flex: 1 }}
id="combo-box-demo" id="combo-box-demo"
options={tenantLocations || []} options={tenantLocations || []}
getOptionLabel={(option) => `${option.locationname} (${option.suburb})` || ''} getOptionLabel={(option) => `${option.locationname} (${option.suburb})` || ''}
renderInput={(params) => <TextField {...params} label={locoName} color="primary" />} renderInput={(params) => <TextField {...params} label={locoName} color="primary" />}
sx={{ minWidth: 250, maxWidth: 400, flex: 1 }}
onChange={(event, value, reason) => { onChange={(event, value, reason) => {
if (value) { if (value) {
console.log('Business Locations', value); console.log('Business Locations', value);
@@ -426,8 +427,8 @@ export default function OrdersDetails() {
)} )}
<Autocomplete <Autocomplete
fullWidth
sx={{ minWidth: 250, maxWidth: 400, flex: 1 }} sx={{ minWidth: 250, maxWidth: 400, flex: 1 }}
disablePortal
id="combo-box-demo" id="combo-box-demo"
options={status} options={status}
getOptionLabel={(option) => `${option.status}`} getOptionLabel={(option) => `${option.status}`}
@@ -575,12 +576,17 @@ export default function OrdersDetails() {
<Typography variant="body2" noWrap> <Typography variant="body2" noWrap>
{row.orderid} {row.orderid}
</Typography> </Typography>
<Typography noWrap sx={{ fontSize: '11px' }}> <Tooltip title="Delivery Date">
{dayjs(row.orderdate).utc().format('DD/MM/YYYY')} <Box sx={{ cursor: 'pointer' }}>
</Typography> <Typography noWrap sx={{ fontSize: '11px' }}>
<Typography noWrap sx={{ fontSize: '11px' }} variant="h5"> {dayjs(row.deliverydate).utc().format('DD/MM/YYYY')}
{dayjs(row.orderdate).utc().format('hh:mm A')} </Typography>
</Typography>
<Typography noWrap sx={{ fontSize: '11px' }}>
{dayjs(row.deliverydate).utc().format('hh:mm A')}
</Typography>
</Box>
</Tooltip>
</TableCell> </TableCell>
<TableCell align="left"> <TableCell align="left">
<Stack direction={'row'} spacing={1}> <Stack direction={'row'} spacing={1}>
@@ -626,6 +632,7 @@ export default function OrdersDetails() {
{row.orderstatus === 'picked' && <Chip label="Picked" color="info" size="small" sx={{ minWidth: 80 }} />} {row.orderstatus === 'picked' && <Chip label="Picked" color="info" size="small" sx={{ minWidth: 80 }} />}
{row.orderstatus === 'active' && <Chip label="Active" color="info" size="small" sx={{ minWidth: 80 }} />} {row.orderstatus === 'active' && <Chip label="Active" color="info" size="small" sx={{ minWidth: 80 }} />}
{row.orderstatus === 'delivered' && <Chip label="Delivered" color="success" size="small" sx={{ minWidth: 80 }} />} {row.orderstatus === 'delivered' && <Chip label="Delivered" color="success" size="small" sx={{ minWidth: 80 }} />}
{row.orderstatus === 'skipped' && <Chip label="Skipped" color="secondary" size="small" sx={{ minWidth: 80 }} />}
{row.orderstatus === 'cancelled' && <Chip label="Cancelled" color="error" size="small" sx={{ minWidth: 80 }} />} {row.orderstatus === 'cancelled' && <Chip label="Cancelled" color="error" size="small" sx={{ minWidth: 80 }} />}
</Stack> </Stack>