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

@@ -1,298 +1,151 @@
import {
Box, Tab, Tabs,
Chip,
Divider,
Grid,
Link,
List,
ListItem,
ListItemIcon,
ListItemSecondaryAction,
Stack,
Typography,
useMediaQuery,
Avatar,
} from '@mui/material';
import { Grid, List, ListItem, Stack, Typography, useMediaQuery } from '@mui/material';
import { enqueueSnackbar } from 'notistack';
import LinearWithLabel from 'components/@extended/progress/LinearWithLabel';
// import { PatternFormat } from 'react-number-format';
import axios from 'axios';
// project import
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 Footer from 'layout/MainLayout/Footer';
import TitleCard from './titleCard';
const Accountsettings = () => {
const matchDownMD = useMediaQuery((theme) => theme.breakpoints.down('md'));
const [info, setInfo] = useState({});
const [loading,setLoading]=useState(false)
const matchDownMD = useMediaQuery((theme) => theme.breakpoints.down('md'));
const [info, setInfo] = useState({});
const [loading, setLoading] = useState(false);
useEffect(() => {
if (localStorage.getItem('tenantid')) {
fetchaccount(localStorage.getItem('tenantid'));
useEffect(() => {
if (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) => {
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)
})
return (
<>
{loading && <Loader />}
<TitleCard title={'Profile'} />
}
return <>
{loading &&
<Loader />
}
<Grid container rowSpacing={4.5} columnSpacing={2.75}>
<Grid item xs={12} sx={{ mb: -2.25 }}>
<Stack direction={{ xs: 'column', md: 'row' }} justifyContent='space-between' alignItems='center' spacing={2}>
<Stack direction='column' alignItems='flex-start' spacing={1}>
<Typography variant="h3">Account Settings</Typography>
</Stack>
</Stack>
</Grid>
<Grid item xs={12}>
<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 container spacing={3}>
<Grid item xs={12}>
<MainCard>
<List sx={{ py: 0 }}>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Name</Typography>
<Typography>{info.tenantname || ''}</Typography>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Company Name</Typography>
<Typography>{info.companyname || ''}</Typography>
</Stack>
</Grid>
</Grid>
</Box>
</MainCard>
</Grid>
</Grid>
</>
}
</ListItem>
<ListItem divider={!matchDownMD}>
<Grid container spacing={3}>
<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 { OpenToast } from 'components/nearle_components/OpenToast';
const tenid = localStorage.getItem('tenantid');
export const fetchOrders = async ({ pageParam = 1, queryKey }) => {
@@ -103,6 +104,28 @@ export const fetchCustomersList = async ({ queryKey }) => {
console.log('fetchCustomersList', 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)||============================== //
export const fetchCustomersListBySearch = async ({ queryKey }) => {
const [search] = queryKey;

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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