This commit is contained in:
Malai Raja
2023-12-02 19:22:27 +05:30
parent 2aab086a66
commit 2d7eb690a1
21 changed files with 7495 additions and 146 deletions

View File

@@ -0,0 +1,74 @@
import PropTypes from 'prop-types';
// material-ui
import { Box, Card, CardContent, Grid, Typography } from '@mui/material';
// ===========================|| HOVER SOCIAL CARD ||=========================== //
const HoverSocialCard = ({ primary, secondary,
percentage,
// iconPrimary,
color
}) => {
// const IconPrimary = iconPrimary;
// const primaryIcon = iconPrimary ? <IconPrimary /> : null;
return (
<Card
elevation={0}
sx={{
background: color,
position: 'relative',
color: '#fff',
// '&:hover svg': {
// opacity: 1,
// transform: 'scale(1.1)'
// }
}}
>
<CardContent>
<Box
sx={{
position: 'absolute',
right: 15,
top: 25,
color: '#fff',
// '& svg': {
// width: 36,
// height: 36,
// opacity: 0.5,
// transition: 'all .3s ease-in-out'
// }
}}
>
<Typography variant="h2" color="inherit">
{percentage.toString()} %
</Typography>
{/* {primaryIcon} */}
</Box>
<Grid container spacing={0}>
<Grid item xs={12}>
<Typography variant="h3" color="inherit">
{secondary}
</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle2" color="inherit">
{primary}
</Typography>
</Grid>
</Grid>
</CardContent>
</Card>
);
};
HoverSocialCard.propTypes = {
primary: PropTypes.string,
secondary: PropTypes.string,
// iconPrimary: PropTypes.object,
percentage:PropTypes.string,
color: PropTypes.string
};
export default HoverSocialCard;

View File

@@ -37,7 +37,11 @@ const DrawerHeader = ({ open }) => {
{/* <Logo isIcon={!open} sx={{ width: open ? 'auto' : 35, height: 35 }} /> */}
{(open) &&
<img src={logo} width='160px' height='45px' alt='logo'/>
<img src={logo}
// width='160px'
height='45px'
width='170px'
alt='logo'/>
}
{(!open) &&
<img src={logo1} width='40px' alt='logo'/>

View File

@@ -64,7 +64,7 @@ const MegaMenuSection = () => {
ref={anchorRef}
aria-controls={open ? 'profile-grow' : undefined}
aria-haspopup="true"
onClick={handleToggle}
// onClick={handleToggle}
>
<WindowsOutlined />
</IconButton>

View File

@@ -5,7 +5,7 @@ import { useState } from 'react';
import { List, ListItemButton, ListItemIcon, ListItemText } from '@mui/material';
// assets
import { EditOutlined, ProfileOutlined, LogoutOutlined, UserOutlined, WalletOutlined } from '@ant-design/icons';
import { EditOutlined, ProfileOutlined, LogoutOutlined, UserOutlined, WalletOutlined,CommentOutlined } from '@ant-design/icons';
import { useNavigate } from 'react-router';
// ==============================|| HEADER PROFILE - PROFILE TAB ||============================== //
@@ -32,11 +32,11 @@ const ProfileTab = ({ handleLogout }) => {
<ListItemText primary="View Profile" />
</ListItemButton>
<ListItemButton selected={selectedIndex === 3} onClick={(event) => handleListItemClick(event, 3)}>
<ListItemButton selected={selectedIndex === 2} onClick={(event) => handleListItemClick(event, 2)}>
<ListItemIcon>
<ProfileOutlined />
<CommentOutlined />
</ListItemIcon>
<ListItemText primary="Account Settings" />
<ListItemText primary="Support Ticket" />
</ListItemButton>
{/* <ListItemButton selected={selectedIndex === 4} onClick={(event) => handleListItemClick(event, 4)}>
<ListItemIcon>
@@ -44,7 +44,7 @@ const ProfileTab = ({ handleLogout }) => {
</ListItemIcon>
<ListItemText primary="Billing" />
</ListItemButton> */}
<ListItemButton selected={selectedIndex === 2}
<ListItemButton selected={selectedIndex === 3}
onClick={handleLogout}
// onClick={()=>{
// navigate('/login')

View File

@@ -63,6 +63,8 @@ const Profile = () => {
localStorage.removeItem('appuserid');
localStorage.removeItem('authname');
localStorage.removeItem('roleid');
localStorage.removeItem('tenantid');
navigate('/login')

View File

@@ -1,7 +1,12 @@
import { useMemo } from 'react';
import { useMemo ,useState} from 'react';
// material-ui
import { Box, useMediaQuery ,Stack} from '@mui/material';
import { Box, useMediaQuery ,Stack,Tooltip,IconButton,Popper,
ClickAwayListener,List,ListItem,ListItemButton,ListItemText,
Grid,ListItemIcon,Typography
} from '@mui/material';
import Transitions from 'components/@extended/Transitions';
// project import
import Search from './Search';
@@ -10,6 +15,15 @@ import Profile from './Profile';
import Notification from './Notification';
import MobileSection from './MobileSection';
import MegaMenuSection from './MegaMenuSection';
import { useNavigate } from 'react-router';
import {
MailOutlined,
// DashboardOutlined,
UserOutlined,
CustomerServiceOutlined,
WindowsOutlined
} from '@ant-design/icons';
import { useTheme } from '@mui/material/styles';
// ==============================|| HEADER - CONTENT ||============================== //
@@ -19,14 +33,200 @@ const HeaderContent = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
const megaMenu = useMemo(() => <MegaMenuSection />, []);
const [open, setOpen] = useState(false)
const [anchorEl, setAnchorEl] = useState(null);
const theme = useTheme();
// eslint-disable-next-line react-hooks/exhaustive-deps
// const megaMenu = useMemo(() => <MegaMenuSection />, []);
const iconBackColorOpen = 'grey.300';
const iconBackColor = 'grey.100';
const navigate = useNavigate()
const handleToggle = (e) => {
setOpen(!open);
setAnchorEl(e.currentTarget);
}
const handleClickAway = () => {
setOpen(false);
};
return (
<>
{/* {!matchesXs && <Search />} */}
<Stack
width='100%'
direction='row' justifyContent='flex-end' spacing={2} alignItems='center'>
{!matchesXs && megaMenu}
{/* {!matchesXs && megaMenu} */}
{matchesXs && <Box sx={{ width: '100%', ml: 1 }} />}
<Box sx={{ flexShrink: 0, ml: 0.75 }}>
<Tooltip title='Quick Menu'>
<IconButton
color="secondary"
variant="light"
sx={{
color: 'text.primary',
bgcolor: open ? iconBackColorOpen : iconBackColor
}}
aria-label="open profile"
// ref={anchorRef}
// aria-controls={open ? 'profile-grow' : undefined}
aria-haspopup="true"
onClick={handleToggle}
>
<WindowsOutlined />
</IconButton>
</Tooltip>
<Popper open={open} placement='bottom' anchorEl={anchorEl}
role={undefined}
// transition
disablePortal
popperOptions={{
modifiers: [
{
name: 'offset',
options: {
offset: 0
}
}
]
}}
sx={{
// backgroundColor:'white',
// border:1,
p: 0,
zIndex: 5000,
boxShadow: theme.customShadows.z1,
}}>
<Transitions type="grow" position='top' sx={{ overflow: 'hidden' }} in={open}>
{/* <Box sx={{
backgroundColor: 'white',
border: '1px solid #e0e0e0 !important',
borderRadius: 1,
}}> */}
<Box sx={{
// boxShadow: theme.customShadows.z1,
}}>
<ClickAwayListener onClickAway={handleClickAway}>
{/* <List disablePadding> */}
<List
component="nav"
sx={{
p: 0,
width: '100%',
minWidth: 200,
maxWidth: 290,
bgcolor: theme.palette.background.paper,
borderRadius: 0.5,
[theme.breakpoints.down('md')]: {
maxWidth: 250
}
}}
>
<ListItemButton selected={location.pathname === '/orders/create'} onClick={() => {
// console.log(const location = useLocation();)
navigate('/orders/create')
handleClickAway()
}} >
<ListItemText
primary={
<Grid container>
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<MailOutlined />
</ListItemIcon>
<Typography color="textPrimary">Create Order</Typography>
</Grid>
}
/>
</ListItemButton>
{/* <ListItemButton
selected={location.pathname === '/clients/create'}
onClick={() => {
navigate('/clients/create')
handleClickAway()
}} >
<ListItemText
primary={
<Grid container>
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<CustomerServiceOutlined />
</ListItemIcon>
<Typography color="textPrimary">Create Client</Typography>
</Grid>
}
/>
</ListItemButton> */}
<ListItemButton
selected={location.pathname === '/staff/create'}
onClick={() => {
navigate('/clients/create')
handleClickAway()
}} >
<ListItemText
primary={
<Grid container>
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<UserOutlined />
</ListItemIcon>
<Typography color="textPrimary">Create Client</Typography>
</Grid>
}
/>
</ListItemButton>
{/* <ListItem disablePadding>
<ListItemButton sx={{ p: 2 }} onClick={() => {
navigate('/create_order')
handleClickAway()
}}>
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<MailOutlined />
</ListItemIcon>
<ListItemText primary="Create Order" />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton sx={{ p: 2 }} onClick={() => {
navigate('/create_client')
handleClickAway()
}}>
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<CustomerServiceOutlined />
</ListItemIcon>
<ListItemText primary="Create Client" />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton sx={{ p: 2 }} onClick={() => {
navigate('/create_staff')
handleClickAway()
}}>
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<UserOutlined />
</ListItemIcon>
<ListItemText primary="Create Staff" />
</ListItemButton>
</ListItem> */}
</List>
</ClickAwayListener>
{/* </Box> */}
</Box>
</Transitions>
</Popper>
</Box>
<Notification />
{/* <Message /> */}

View File

@@ -53,7 +53,7 @@ const MainLayout = () => {
flexDirection: 'column'
}}
>
<Breadcrumbs navigation={navigation} title titleBottom card={false} divider={false} />
{/* <Breadcrumbs navigation={navigation} title titleBottom card={false} divider={false} /> */}
<Outlet />
<Footer />
</Container>

View File

@@ -11,7 +11,11 @@ import {
MenuUnfoldOutlined,
QuestionOutlined,
SmileOutlined,
StopOutlined
StopOutlined,
DashboardOutlined,
ClockCircleOutlined,
UserOutlined,
SettingOutlined
} from '@ant-design/icons';
// icons
@@ -24,14 +28,18 @@ const icons = {
SmileOutlined,
GatewayOutlined,
QuestionOutlined,
DeploymentUnitOutlined
DeploymentUnitOutlined,
DashboardOutlined,
ClockCircleOutlined,
UserOutlined,
SettingOutlined
};
// ==============================|| MENU ITEMS - SUPPORT ||============================== //
const other = {
id: 'other',
title: <FormattedMessage id="others" />,
title: <FormattedMessage id="MENU" />,
type: 'group',
children: [
{
@@ -39,7 +47,28 @@ const other = {
title: <FormattedMessage id="Dashboard" />,
type: 'item',
url: '/dashboard',
icon: icons.ChromeOutlined
icon: icons.DashboardOutlined
},
{
id: 'orders',
title: <FormattedMessage id="Orders" />,
type: 'item',
url: '/orders',
icon: icons.ClockCircleOutlined
},
{
id: 'clients',
title: <FormattedMessage id="Clients" />,
type: 'item',
url: '/clients',
icon: icons.UserOutlined
},
{
id: 'account',
title: <FormattedMessage id="Settings" />,
type: 'item',
url: '/accountsettings',
icon: icons.SettingOutlined
},
// {
// id: 'documentation',

View File

@@ -0,0 +1,409 @@
import {
Box, Tab, Tabs,
Chip,
Divider,
Grid,
Link,
List,
ListItem,
ListItemIcon,
ListItemSecondaryAction,
Stack,
Typography,
useMediaQuery,
Avatar,
} from '@mui/material';
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';
const Accountsettings = () => {
const matchDownMD = useMediaQuery((theme) => theme.breakpoints.down('md'));
const [info, setInfo] = useState({})
useEffect(() => {
if (localStorage.getItem('tenantid')) {
fetchaccount(localStorage.getItem('tenantid'));
}
}, []);
const fetchaccount = async (tid) => {
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);
}
}).catch((err) => {
console.log(err)
})
}
return <>
<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">
{/* <Chip label="Pro" size="small" color="primary" /> */}
</Stack>
<Stack spacing={2.5} alignItems="center">
<Avatar alt="Avatar 1"
// size="xl"
sx={{width:80,height:80}}
// src={avatarImage(`./default.png`)}
/>
<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}>
<Stack direction="row" justifyContent="space-around" alignItems="center">
<Stack spacing={0.5} alignItems="center">
<Typography variant="h5">86</Typography>
<Typography color="secondary">Post</Typography>
</Stack>
<Divider orientation="vertical" flexItem />
<Stack spacing={0.5} alignItems="center">
<Typography variant="h5">40</Typography>
<Typography color="secondary">Project</Typography>
</Stack>
<Divider orientation="vertical" flexItem />
<Stack spacing={0.5} alignItems="center">
<Typography variant="h5">4.5K</Typography>
<Typography color="secondary">Members</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">
{/* (+1-876) 8654 239 581 */}
{info.primarycontact || ''}
</Typography>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<AimOutlined />
</ListItemIcon>
<ListItemSecondaryAction>
<Typography align="right">
{/* New York */}
{info.city}
</Typography>
</ListItemSecondaryAction>
</ListItem>
<ListItem>
<ListItemIcon>
<EnvironmentOutlined />
</ListItemIcon>
<ListItemSecondaryAction>
{/* <Link align="right" href="https://google.com" target="_blank">
https://anshan.dh.url
</Link> */}
{info.state}
</ListItemSecondaryAction>
</ListItem>
</List>
</Grid>
</Grid>
</MainCard>
</Grid>
{/* <Grid item xs={12}>
<MainCard title="Skills">
<Grid container spacing={1.25}>
<Grid item xs={6}>
<Typography color="secondary">Junior</Typography>
</Grid>
<Grid item xs={6}>
<LinearWithLabel value={30} />
</Grid>
<Grid item xs={6}>
<Typography color="secondary">UX Reseacher</Typography>
</Grid>
<Grid item xs={6}>
<LinearWithLabel value={80} />
</Grid>
<Grid item xs={6}>
<Typography color="secondary">Wordpress</Typography>
</Grid>
<Grid item xs={6}>
<LinearWithLabel value={90} />
</Grid>
<Grid item xs={6}>
<Typography color="secondary">HTML</Typography>
</Grid>
<Grid item xs={6}>
<LinearWithLabel value={30} />
</Grid>
<Grid item xs={6}>
<Typography color="secondary">Graphic Design</Typography>
</Grid>
<Grid item xs={6}>
<LinearWithLabel value={95} />
</Grid>
<Grid item xs={6}>
<Typography color="secondary">Code Style</Typography>
</Grid>
<Grid item xs={6}>
<LinearWithLabel value={75} />
</Grid>
</Grid>
</MainCard>
</Grid> */}
</Grid>
</Grid>
<Grid item xs={12} sm={7} md={8} xl={9} >
<Grid container spacing={3} >
<Grid item xs={12} >
<MainCard title="Other Details" >
<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">Registration No</Typography>
<Typography>{info.registrationno || ''}</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>
{/* (+1-876) <PatternFormat value={8654239581} displayType="text" type="text" format="#### ### ###" /> */}
{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 item xs={12}>
<MainCard title="Education">
<List sx={{ py: 0 }}>
<ListItem divider>
<Grid container spacing={matchDownMD ? 0.5 : 3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Master Degree (Year)</Typography>
<Typography>2014-2017</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Institute</Typography>
<Typography>-</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem divider>
<Grid container spacing={matchDownMD ? 0.5 : 3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Bachelor (Year)</Typography>
<Typography>2011-2013</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Institute</Typography>
<Typography>Imperial College London</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
<ListItem>
<Grid container spacing={matchDownMD ? 0.5 : 3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">School (Year)</Typography>
<Typography>2009-2011</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Institute</Typography>
<Typography>School of London, England</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
</List>
</MainCard>
</Grid> */}
{/* <Grid item xs={12}>
<MainCard title="Emplyment">
<List sx={{ py: 0 }}>
<ListItem divider>
<Grid container spacing={matchDownMD ? 0.5 : 3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Senior</Typography>
<Typography color="secondary">Senior UI/UX designer (Year)</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Job Responsibility</Typography>
<Typography>
Perform task related to project manager with the 100+ team under my observation. Team management is key role in
this company.
</Typography>
</Stack>
</Grid>
</Grid>f
</ListItem>
<ListItem>
<Grid container spacing={matchDownMD ? 0.5 : 3}>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Trainee cum Project Manager (Year)</Typography>
<Typography>2017-2019</Typography>
</Stack>
</Grid>
<Grid item xs={12} md={6}>
<Stack spacing={0.5}>
<Typography color="secondary">Job Responsibility</Typography>
<Typography>Team management is key role in this company.</Typography>
</Stack>
</Grid>
</Grid>
</ListItem>
</List>
</MainCard>
</Grid> */}
</Grid>
</Grid>
</Grid>
</Box>
</MainCard>
</Grid>
</Grid>
</>
}
export default Accountsettings;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,602 @@
import { useEffect, useState } from 'react';
// material-ui
import { useTheme } from '@mui/material/styles';
import {
Box, Button, FormLabel, Grid, InputLabel,
MenuItem,
Select, Stack, TextField, Typography
} from '@mui/material';
// third-party
// import { PatternFormat } from 'react-number-format';
// project import
import Avatar from 'components/@extended/Avatar';
import MainCard from 'components/MainCard';
import {
// facebookColor, linkedInColor, twitterColor
ThemeMode
} from 'config';
import axios from 'axios';
// assets
import {
// FacebookFilled, LinkedinFilled, TwitterSquareFilled,
CameraOutlined
} from '@ant-design/icons';
import { usePlacesWidget } from "react-google-autocomplete";
import Loader from 'components/Loader';
import Geocode from "react-geocode";
import { enqueueSnackbar } from 'notistack';
import { useNavigate } from 'react-router';
// import { setLocationType } from 'react-geocode';
// const avatarImage = require.context('assets/images/users', true);
// styles & constant
// const ITEM_HEIGHT = 48;
// const ITEM_PADDING_TOP = 8;
// const MenuProps = {
// PaperProps: {
// style: {
// maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP
// }
// }
// };
const Createclient = () => {
const theme = useTheme();
const [selectedImage, setSelectedImage] = useState(undefined);
const [avatar, setAvatar] = useState(
// avatarImage(`./default.png`)
);
const [businessname, setBusinessname] = useState('');
const [businessno, setBusinessno] = useState('');
// const [role, setRole] = useState('');
const [mobilenumber, setMobilenumber] = useState('')
const [emailaddress, setEmailaddress] = useState('')
const [city, setCity] = useState('')
const [zipcode, setZipcode] = useState('');
const [address, setAddress] = useState('');
const [state, setState] = useState('');
const [suburb, setSuburb] = useState('');
const [latlong, setLatlong] = useState({});
const [profiledetails, setProfiledetails] = useState({});
const [primarycontact,setPrimarycontact]=useState('')
const [firstname,setFirstname]=useState('');
const [doorno,setDoorno]=useState('');
const [landmark,setLandmark]=useState('')
const navigate = useNavigate();
Geocode.setApiKey(process.env.REACT_APP_GOOGLE_MAPS_API_KEY);
// Geocode.setApiKey('AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8');
const [loading, setLoading] = useState(false)
useEffect(() => {
// fetchprofiledetails(localStorage.getItem('appuserid'));
// fetchprofiledetails(181);
}, [])
useEffect(() => {
try {
Geocode.fromAddress(address).then(
(response) => {
if (response.status == 'OK') {
const { lat, lng } = response.results[0].geometry.location;
setLatlong({
lat, lng
})
console.log(response);
}
}, (error) => {
console.log(error)
}
);
} catch (err) {
console.log(err)
}
}, [address])
const opentoast = (message) => {
enqueueSnackbar(message, {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
// console.log(alertmessage)
}
const fetchprofiledetails = async (userid) => {
if (userid) {
setLoading(true)
try {
await axios.get(`${process.env.REACT_APP_URL2}/tenants/getclient?id=${userid}`)
.then((res) => {
console.log(res)
if (res.data.message === 'Successful') {
let res1 = res.data.details;
setProfiledetails(res1)
setBusinessname(res1.tenantname)
setBusinessno(res1.registrationno);
setMobilenumber(res1.contactno);
setPrimarycontact(res1.primarycontact)
setEmailaddress(res1.primaryemail);
setAddress(res1.address);
setCity(res1.city);
setZipcode(res1.postcode);
setState(res1.state);
setSuburb(res1.suburb);
setLatlong({
lat: res1.latitude,
lng: res1.longitude
})
}
setLoading(false)
}).catch((err) => {
console.log(err)
setLoading(false)
})
} catch (err) {
console.log(err)
setLoading(false)
}
}
}
useEffect(() => {
if (selectedImage) {
setAvatar(URL.createObjectURL(selectedImage));
}
}, [selectedImage]);
const { ref: materialRef } = usePlacesWidget({
apiKey: process.env.REACT_APP_GOOGLE_MAPS_API_KEY,
onPlaceSelected: (place) => {
console.log(place)
setAddress(place.formatted_address)
let city1, zipcode1, state1,suburb1;
for (let i = 0; i < place.address_components.length; i++) {
for (let j = 0; j < place.address_components[i].types.length; j++) {
switch (place.address_components[i].types[j]) {
case "locality":
city1 = place.address_components[i].long_name;
break;
case "administrative_area_level_1":
state1 = place.address_components[i].long_name;
break;
case "postal_code":
zipcode1 = place.address_components[i].long_name;
break;
case "sublocality":
suburb1 = place.address_components[i].long_name;
break;
}
}
}
setCity(city1 || '')
setState(state1 || '');
setZipcode(zipcode1 || '');
setSuburb(suburb1 || '')
// setAddress(place.formatted_address)
},
// inputAutocompleteValue: "country",
options: {
// componentRestrictions: 'us',
// types: ["establishment"]
types: ['address' || 'geocode']
},
});
const createprofile = async () => {
console.log('res', businessname, businessno, mobilenumber, emailaddress, address, city, zipcode)
if (!businessname) {
opentoast('Fill Business name')
} else if (!businessno) {
opentoast('Fill Registration No')
} else if (!businessno) {
opentoast('Fill Registration No')
} else if (!firstname) {
opentoast('Fill Full name')
} else if (!mobilenumber) {
opentoast('Fill Mobile Number')
}else if (!emailaddress) {
opentoast('Fill emailaddress')
} else if (!address) {
opentoast('Fill Address')
} else if (!city) {
opentoast('Fill City')
} else if (!zipcode) {
opentoast('Fill post code')
} else if (!suburb) {
opentoast('Fill suburb')
} else if (!emailaddress) {
opentoast('Fill emailaddress')
} else if (!latlong.lat || !latlong.lng) {
opentoast('Choose valid address')
} else {
let obj={
"customerid":0,
"configid":1,
"firstname":firstname,
"applocationid":3,
"profileimage":"",
"dialcode":"+91",
"contactno":mobilenumber,
"devicetype":"",
"deviceid":"",
"customertoken":"",
"address":address,
"suburb":suburb,
"city":city,
"state":state,
"postcode":zipcode,
"landmark":landmark,
"doorno":doorno,
"latitude":latlong.lat.toString(),
"longitude":latlong.lng.toString(),
"tenantid":parseInt(localStorage.getItem('tenantid'))
}
console.log(obj)
setLoading(true)
try {
await axios.post(`${process.env.REACT_APP_URL}/customers/create`,obj)
.then((res) => {
console.log(res)
if (res.data.status) {
enqueueSnackbar(' Created Successfully ', {
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
navigate('/clients')
// setTimeout(()=>{
// fetchprofiledetails(localStorage.getItem('appuserid'));
// },2000)
}else if(res.data.message == "Customer Already available"){
enqueueSnackbar("Customer Already available", {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000
})
}
setLoading(false)
}).catch((err) => {
console.log(err)
setLoading(false)
})
} catch (err) {
console.log(err)
setLoading(false)
}
}
}
// const [experience, setExperience] = useState('0');
// const handleChange = (event) => {
// setExperience(event.target.value);
// };
return <>
{(loading) && <Loader />}
<Grid item xs={12}
sx={{ mb: 2 }}
>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="h3">Create Client</Typography>
</Stack>
</Grid>
<MainCard>
<Grid container spacing={3}>
<Grid item xs={12} sm={4} >
<MainCard title="Personal Information" sx={{ height: '100%' }}>
<Grid container spacing={3}>
<Grid item xs={12}>
<Stack spacing={2.5} alignItems="center" sx={{ m: 3 }}>
<FormLabel
htmlFor="change-avtar"
sx={{
position: 'relative',
borderRadius: '50%',
overflow: 'hidden',
'&:hover .MuiBox-root': { opacity: 1 },
cursor: 'pointer'
}}
>
<Avatar alt="Avatar 1"
src={avatar}
sx={{ width: 76, height: 76 }} />
<Box
sx={{
position: 'absolute',
top: 0,
left: 0,
backgroundColor: theme.palette.mode === ThemeMode.DARK ? 'rgba(255, 255, 255, .75)' : 'rgba(0,0,0,.65)',
width: '100%',
height: '100%',
opacity: 0,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
>
<Stack spacing={0.5} alignItems="center">
<CameraOutlined style={{ color: theme.palette.secondary.lighter, fontSize: '1.5rem' }} />
<Typography sx={{ color: 'secondary.lighter' }} variant="caption">
Upload
</Typography>
</Stack>
</Box>
</FormLabel>
<TextField
type="file"
accept="image/*"
id="change-avtar"
placeholder="Outlined"
variant="outlined"
sx={{ display: 'none' }}
onChange={(e) => setSelectedImage(e.target.files?.[0])}
/>
</Stack>
</Grid>
<Grid item xs={12}
>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-first-name">Business Name</InputLabel>
<TextField fullWidth
id="personal-first-name" placeholder="Business Name" autoFocus
onChange={(e) => setBusinessname(e.target.value)}
value={businessname}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12}
>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-last-name">Registration No</InputLabel>
<TextField fullWidth
id="personal-last-name" placeholder="Registration No"
onChange={(e) => setBusinessno(e.target.value)}
value={businessno}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12}
>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-last-name">Name</InputLabel>
<TextField fullWidth
id="personal-last-name" placeholder="Name"
onChange={(e) => setFirstname(e.target.value)}
value={firstname}
autoComplete='off'
/>
</Stack>
</Grid>
{/* <Grid item xs={12}
>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-role-name">Role</InputLabel>
<TextField fullWidth
id="personal-role-name" placeholder="Role Name" autoFocus
onChange={(e) => setRole(e.target.value)}
value={role}
autoComplete='off'
/>
</Stack>
</Grid> */}
</Grid>
</MainCard>
</Grid>
<Grid item xs={12} sm={8} >
<MainCard title="Contact Information" sx={{ height: '100%' }}>
<Grid container spacing={3}>
<Grid item xs={12}
>
<Stack spacing={1.25} >
<InputLabel htmlFor="personal-phone">Phone Number</InputLabel>
<Stack direction="row" justifyContent="space-between" alignItems="center"
spacing={2}>
<Select defaultValue="+1" disabled sx={{cursor: 'not-allowed'}}>
<MenuItem value="+1">+91</MenuItem>
</Select>
<TextField
type='number'
id='personal-phone'
// format="##########"
// mask="_"
fullWidth
// customInput={TextField}
placeholder="Phone Number"
// defaultValue="8654239581"
// onBlur={() => { }}
onChange={(e) => {
if(e.target.value.toString().length <= 10){
setMobilenumber(e.target.value)
}
}}
value={mobilenumber}
autoComplete='off'
// disabled
sx={{cursor: 'not-allowed'}}
/>
</Stack>
</Stack>
</Grid>
<Grid item xs={12}
// sm={6}
>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-email">Email Address</InputLabel>
<TextField type="email" fullWidth
// defaultValue="stebin.ben@gmail.com"
id="personal-email" placeholder="Email Address"
onChange={(e) => setEmailaddress(e.target.value)}
value={emailaddress}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-address">Address</InputLabel>
<TextField
fullWidth
// defaultValue="Street 110-B Kalians Bag, Dewan, M.P. New York"
id="personal-address"
placeholder="Address"
value={address}
onChange={(e) => setAddress(e.target.value)}
inputRef={materialRef}
/>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-location">Suburb</InputLabel>
<TextField fullWidth
// defaultValue="New York"
id="personal-location" placeholder="Location"
onChange={(e) => setSuburb(e.target.value)}
value={suburb}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-zipcode">City</InputLabel>
<TextField fullWidth
// defaultValue="956754"
// type='number'
id="personal-zipcode" placeholder="City"
onChange={(e) => setCity(e.target.value)}
value={city}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-location">State</InputLabel>
<TextField fullWidth
// defaultValue="New York"
id="personal-location" placeholder="State"
onChange={(e) => setState(e.target.value)}
value={state}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-zipcode">Post Code</InputLabel>
<TextField fullWidth
// defaultValue="956754"
type='number'
id="personal-zipcode" placeholder="Zipcode"
onChange={(e) => setZipcode(e.target.value)}
value={zipcode}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-location">Door No</InputLabel>
<TextField fullWidth
// defaultValue="New York"
id="personal-location" placeholder="Door No"
onChange={(e) => setDoorno(e.target.value)}
value={doorno}
autoComplete='off'
/>
</Stack>
</Grid>
<Grid item xs={12} sm={6}>
<Stack spacing={1.25}>
<InputLabel htmlFor="personal-email">Landmark</InputLabel>
<TextField type="email" fullWidth
// defaultValue="stebin.ben@gmail.com"
id="personal-email" placeholder="Landmark"
onChange={(e) => setLandmark(e.target.value)}
value={landmark}
autoComplete='off'
/>
</Stack>
</Grid>
</Grid>
</MainCard>
</Grid>
<Grid item xs={12}>
<Stack direction="row" justifyContent="flex-end" alignItems="center" spacing={2}>
<Button variant="contained"
onClick={() => createprofile()}
>Create</Button>
</Stack>
</Grid>
</Grid>
</MainCard>
</>
}
export default Createclient;

View File

@@ -64,7 +64,7 @@ const Login = () => {
useEffect(() => {
if (localStorage.getItem("authname")
// || localStorage.getItem("appuserid")
// || localStorage.getItem("appuserid")
) {
navigate('/dashboard')
}
@@ -82,30 +82,30 @@ const Login = () => {
// })
await axios.post(`${process.env.REACT_APP_URL}/users/login`, {
"authname": e.target.value,
"configid":1,
"password":'admin'
"configid": 1,
"password": 'admin'
})
.then((res) => {
console.log(res.data)
if (res.data.details.authname === e.target.value) {
.then((res) => {
console.log(res.data)
if (res.data.details.authname === e.target.value) {
setUsername(e.target.value);
setCheckusername(false);
}else{
setCheckusername(true);
setUsername(e.target.value);
setCheckusername(false);
} else {
setCheckusername(true);
}
// if (res.data.authname === e.target.value) {
}
// if (res.data.authname === e.target.value) {
// setUsername(e.target.value);
// setCheckusername(false);
// }
}).catch((err) => {
// if (err.response.data.message === 'No user found') {
// setUsername(e.target.value);
// setCheckusername(false);
// }
}).catch((err) => {
// if (err.response.data.message === 'No user found') {
setCheckusername(true);
// }
})
// }
})
} catch (err) {
console.log(err)
@@ -122,7 +122,7 @@ const Login = () => {
try {
await axios.post(`${process.env.REACT_APP_URL}/users/login`, {
"authname": username,
"configid":1,
"configid": 1,
"password": password
}).then((res) => {
console.log(res.data)
@@ -151,6 +151,7 @@ const Login = () => {
localStorage.setItem("appuserid", res.data.details.userid);
localStorage.setItem("roleid", res.data.details.roleid);
localStorage.setItem("tenantid", res.data.details.tenantid);
navigate('/dashboard');
@@ -218,7 +219,8 @@ const Login = () => {
}}
>
<Grid item xs={12}
sx={{ ml: 3, mt: 3 }}
// sx={{ ml: 3, mt: 3 }}
sx={{ml:3,mt:1}}
>
@@ -234,7 +236,7 @@ const Login = () => {
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 - 132px)' } }}
sx={{ minHeight: { xs: 'calc(100vh - 210px)', sm: 'calc(100vh - 134px)', md: 'calc(100vh - 140px)' } }}
>
<Grid item>
@@ -406,7 +408,7 @@ const Login = () => {
<Button
disabled={submitting}
onClick={()=>{
onClick={() => {
loginsend()
// navigate('/dashboard')
}}
@@ -430,6 +432,7 @@ const Login = () => {
</Grid>
<Grid item xs={12}
// sx={{ m: 3, mt: 1 }}
sx={{mb:1}}
>
{/* <AuthFooter /> */}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,14 @@ const SamplePage = Loadable(lazy(() => import('pages/extra-pages/sample-page')))
const Login = Loadable(lazy(() => import('pages/nearle/login')));
const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard')));
const Client = Loadable(lazy(() => import('pages/nearle/clients/client')));
const Orders = Loadable(lazy(() => import('pages/nearle/orders/orders')));
const Accountsettings = Loadable(lazy(() => import('pages/nearle/accountsettings')));
const Createorder = Loadable(lazy(() => import('pages/nearle/orders/createorder')));
const Createclient = Loadable(lazy(() => import('pages/nearle/clients/createclient')));
// ==============================|| MAIN ROUTING ||============================== //
@@ -40,6 +48,26 @@ const MainRoutes = {
path: 'dashboard',
element: <Dashboard />
},
{
path: 'clients',
element: <Client />
},
{
path: 'orders',
element: <Orders />
},
{
path: 'accountsettings',
element: <Accountsettings />
},
{
path: 'orders/create',
element: <Createorder />
},
{
path: 'clients/create',
element: <Createclient />
},
]
},