This commit is contained in:
Malai Raja
2023-12-30 18:29:42 +05:30
parent 51e4ea978f
commit 3ce0086e3c
12 changed files with 2316 additions and 150 deletions

Submodule nearlexpressbuild updated: c351223c49...0f12f16e5c

15
package-lock.json generated
View File

@@ -42,6 +42,7 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-geocode": "^0.2.3", "react-geocode": "^0.2.3",
"react-google-autocomplete": "^2.7.3", "react-google-autocomplete": "^2.7.3",
"react-icons": "^4.12.0",
"react-intl": "^6.4.1", "react-intl": "^6.4.1",
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"react-router": "^6.10.0", "react-router": "^6.10.0",
@@ -16772,6 +16773,14 @@
"react": ">=16.8.0" "react": ">=16.8.0"
} }
}, },
"node_modules/react-icons": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz",
"integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==",
"peerDependencies": {
"react": "*"
}
},
"node_modules/react-intl": { "node_modules/react-intl": {
"version": "6.4.1", "version": "6.4.1",
"resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz", "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz",
@@ -32037,6 +32046,12 @@
"prop-types": "^15.5.0" "prop-types": "^15.5.0"
} }
}, },
"react-icons": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz",
"integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==",
"requires": {}
},
"react-intl": { "react-intl": {
"version": "6.4.1", "version": "6.4.1",
"resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz", "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz",

View File

@@ -37,6 +37,7 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-geocode": "^0.2.3", "react-geocode": "^0.2.3",
"react-google-autocomplete": "^2.7.3", "react-google-autocomplete": "^2.7.3",
"react-icons": "^4.12.0",
"react-intl": "^6.4.1", "react-intl": "^6.4.1",
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"react-router": "^6.10.0", "react-router": "^6.10.0",

View File

@@ -42,7 +42,9 @@ const HoverSocialCard = ({ primary, secondary,
}} }}
> >
<Typography variant="h2" color="inherit"> <Typography variant="h2" color="inherit">
{percentage.toString()} % {/* {percentage.toString()} % */}
{(percentage)? `${percentage.toString()} %`:''}
</Typography> </Typography>
{/* {primaryIcon} */} {/* {primaryIcon} */}
</Box> </Box>

View File

@@ -173,9 +173,9 @@ const navigate = useNavigate()
/> />
</ListItemButton> */} </ListItemButton> */}
<ListItemButton <ListItemButton
selected={location.pathname === '/staff/create'} selected={location.pathname === '/customers/create'}
onClick={() => { onClick={() => {
navigate('/clients/create') navigate('/customers/create')
handleClickAway() handleClickAway()
}} > }} >
<ListItemText <ListItemText
@@ -184,7 +184,7 @@ const navigate = useNavigate()
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}> <ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
<UserOutlined /> <UserOutlined />
</ListItemIcon> </ListItemIcon>
<Typography color="textPrimary">Create Client</Typography> <Typography color="textPrimary">Create Customer</Typography>
</Grid> </Grid>
} }

View File

@@ -58,9 +58,9 @@ const other = {
}, },
{ {
id: 'clients', id: 'clients',
title: <FormattedMessage id="Clients" />, title: <FormattedMessage id="Customers" />,
type: 'item', type: 'item',
url: '/clients', url: '/customers',
icon: icons.UserOutlined icon: icons.UserOutlined
}, },
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -338,7 +338,7 @@ const Createclient = () => {
sx={{ mb: 2 }} sx={{ mb: 2 }}
> >
<Stack direction="row" justifyContent="space-between" alignItems="center"> <Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="h3">Create Client</Typography> <Typography variant="h3">Create Customer</Typography>
</Stack> </Stack>
</Grid> </Grid>
<MainCard> <MainCard>

View File

@@ -43,12 +43,13 @@ import {
DialogActions, DialogActions,
CircularProgress, CircularProgress,
ButtonGroup, ButtonGroup,
FormLabel FormLabel,
IconButton
// LinkOutlined // LinkOutlined
} from '@mui/material'; } from '@mui/material';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import AccessTimeOutlinedIcon from '@mui/icons-material/AccessTimeOutlined';
import { PopupTransition } from 'components/@extended/Transitions'; import { PopupTransition } from 'components/@extended/Transitions';
// var utc = require('dayjs/plugin/utc') // var utc = require('dayjs/plugin/utc')
@@ -103,7 +104,8 @@ import dayjs from 'dayjs';
import { enqueueSnackbar } from 'notistack'; import { enqueueSnackbar } from 'notistack';
// import { CheckBox } from '@mui/icons-material'; // import { CheckBox } from '@mui/icons-material';
// dayjs.extend(utc) // dayjs.extend(utc)
var utc = require('dayjs/plugin/utc')
dayjs.extend(utc)
@@ -117,6 +119,8 @@ const Createorder = () => {
const [open, setOpen] = useState({}); const [open, setOpen] = useState({});
const [open1, setOpen1] = useState('') const [open1, setOpen1] = useState('')
const [open2, setOpen2] = useState(false) const [open2, setOpen2] = useState(false)
const [open3, setOpen3] = useState(false)
const [shift, setShift] = useState(1); const [shift, setShift] = useState(1);
const [clientlist, setClientlist] = useState([]) const [clientlist, setClientlist] = useState([])
const [clientdetail, setClientdetail] = useState([]); const [clientdetail, setClientdetail] = useState([]);
@@ -124,6 +128,11 @@ const Createorder = () => {
const [startdate, setStartdate] = useState(dayjs().format('MM-DD-YYYY')); const [startdate, setStartdate] = useState(dayjs().format('MM-DD-YYYY'));
const [enddate, setEnddate] = useState(dayjs().add(1, 'day').format('MM-DD-YYYY')); const [enddate, setEnddate] = useState(dayjs().add(1, 'day').format('MM-DD-YYYY'));
const [starttime, setStatrttime] = useState(`${dayjs().format('MM-DD-YYYY')} 08:00:00`);
const [endtime, setEndtime] = useState(`${dayjs().format('MM-DD-YYYY')} 20:00:00`);
const [timeslotarr, setTimeslotarr] = useState([]);
const [currentsno, setCurrentsno] = useState('');
@@ -156,26 +165,60 @@ const Createorder = () => {
const [tenantinfo, setTenantinfo] = useState({}); const [tenantinfo, setTenantinfo] = useState({});
const [searchword, setSearchword] = useState(''); const [searchword, setSearchword] = useState('');
const [clientdetailarr, setClientdetailarr] = useState([]) const [clientdetailarr, setClientdetailarr] = useState([])
const [admintoken,setAdmintoken]=useState(''); const [admintoken, setAdmintoken] = useState('');
const [tenantlocationlist, setTenantlocationlist] = useState([])
const [tenant, setTenant] = useState({})
useEffect(() => { useEffect(() => {
if (localStorage.getItem('tenantid')) { if (localStorage.getItem('tenantid')) {
setOrderarr([{ // setOrderarr([{
sno: 1, // sno: 1,
address: '', // address: '',
"customerid": '', // "customerid": '',
"deliverytime": dayjs(), // "deliverytime": dayjs(),
"deliverylocationid": '', // "deliverylocationid": '',
"clientname": '', // "clientname": '',
"contactno": '', // "contactno": '',
"latitude": '', // "latitude": '',
"longitude": '' // "longitude": ''
}]) // }])
// console.log(dayjs()) // console.log(dayjs())
fetchtenantlocation(localStorage.getItem('tenantid'))
} }
}, []) }, [])
useEffect(() => {
if (timeslotarr[0]) {
let arr = [];
timeslotarr.map((val) => {
if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
arr.push(val)
}
})
// if(!arr[0]){
// setStartdate(dayjs().add(1,'day').format('MM/DD/YYYY'))
// }else{
if (arr[0]) {
setOrderarr([{
sno: 1,
address: '',
"customerid": '',
"deliverytime": dayjs(arr[0]) || '',
"deliverylocationid": '',
"clientname": '',
"contactno": '',
"latitude": '',
"longitude": ''
}])
}
// }
}
}, [timeslotarr])
useEffect(() => { useEffect(() => {
if (searchword) { if (searchword) {
// setClientdetailarr() // setClientdetailarr()
@@ -204,8 +247,11 @@ const Createorder = () => {
.then((res) => { .then((res) => {
console.log(res) console.log(res)
if (res.data.status) { if (res.data.status) {
setTenantinfo(res.data.details); // setTenantinfo(res.data.details);
fetchadmintoken(res.data.details.partnerid) setTenant(res.data.details)
fetchadmintoken(res.data.details.tenantid, res.data.details.partnerid)
} }
setLoading(false) setLoading(false)
}).catch((err) => { }).catch((err) => {
@@ -214,15 +260,48 @@ const Createorder = () => {
}) })
} }
const fetchtenantlocation = async (tid) => {
const fetchadmintoken = async (tid) => {
setLoading(true) setLoading(true)
await axios.get(`${process.env.REACT_APP_URL}/partners/getadmintoken/?partnerid=${tid}`) await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenantlocations/?tenantid=${tid}`)
.then((res) => {
console.log(res)
if (res.data.status) {
// setTenantinfo(res.data.details);
let arr = []
res.data.details.map((val) => {
arr.push({
...val,
label: ` ${val.locationname}`
})
})
setTenantlocationlist(arr)
}
setLoading(false)
}).catch((err) => {
console.log(err)
setLoading(false)
})
}
const fetchadmintoken = async (tid, pid) => {
setLoading(true)
await axios.get(`${process.env.REACT_APP_URL}/partners/getadmintoken/?tenantid=${tid}&partnerid=${pid}`)
.then((res) => { .then((res) => {
console.log(res) console.log(res)
if (res.data.status) { if (res.data.status) {
// setTenantinfo(res.data.details); // setTenantinfo(res.data.details);
setAdmintoken(res.data.details.userfcmtokem) setAdmintoken(res.data.details.userfcmtokem)
// setEndtime(res.data.details.closetime)
let arr = [];
for (let i = starttime, j = 0; dayjs(endtime).diff(i, 'm') >= 0; j++, i = dayjs(i).add(30, 'm')) {
console.log(dayjs(endtime).diff(i, 'm'))
console.log(dayjs(i).format('hh:mm A'))
arr.push(i)
}
console.log(arr)
setTimeslotarr(arr)
// console.log(dayjs(starttime))
} }
setLoading(false) setLoading(false)
}).catch((err) => { }).catch((err) => {
@@ -245,7 +324,10 @@ const Createorder = () => {
function closeAddressModal() { function closeAddressModal() {
setOpen2(false); setOpen2(false);
} }
function closetimemodal() {
setOpen3(false);
setCurrentsno('')
}
const createsubmitobj1 = async () => { const createsubmitobj1 = async () => {
@@ -292,28 +374,32 @@ const Createorder = () => {
"deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime.$d).format('HH:mm:ss')}`, "deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime.$d).format('HH:mm:ss')}`,
"deliverylocationid": val.deliverylocationid, "deliverylocationid": val.deliverylocationid,
"deliveryaddress": val.address, "deliveryaddress": val.address,
"pickupaddress": tenantinfo.address, "pickupaddress": tenantinfo.locationaddress,
"pickuplat": tenantinfo.latitude, "pickuplat": tenantinfo.locationlatitude,
"pickuplong": tenantinfo.longitude, "pickuplong": tenantinfo.locationlong,
"ordernotes": otherinstructions, "ordernotes": otherinstructions,
"remarks": "", "remarks": "",
"tenantuserid": parseInt(localStorage.getItem('tenantid')), "tenantuserid": parseInt(localStorage.getItem('tenantid')),
"categoryid": tenantinfo.categoryid, "categoryid": tenant.categoryid,
"subcategoryid": tenantinfo.subcategoryid, "subcategoryid": tenant.subcategoryid,
"partnerid": tenantinfo.partnerid, "partnerid": tenant.partnerid,
"deliverylat":val.latitude, "deliverylat": val.latitude,
"deliverylong":val.longitude, "deliverylong": val.longitude,
"applocationid":parseInt(localStorage.getItem('applocationid')) "applocationid": parseInt(localStorage.getItem('applocationid'))
}) })
}) })
if(!orderarr[0]){
opentoast('Choose Customer')
}else if (!tenantinfo.tenantid) {
opentoast('Choose Location')
if (timecheck) {
opentoast('Choose Schedule Time')
} else if (addresscheck) { } else if (addresscheck) {
opentoast('Choose Client') opentoast('Choose Customer')
} else if (timecheck) {
opentoast('Choose Schedule Time')
} else { } else {
setLoading(true) setLoading(true)
await axios.post(`${process.env.REACT_APP_URL}/orders/createorders`, arr) await axios.post(`${process.env.REACT_APP_URL}/orders/createorders`, arr)
@@ -323,11 +409,11 @@ const Createorder = () => {
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000 autoHideDuration: 2000
}) })
if(admintoken){ if (admintoken) {
notifyadmin(admintoken) notifyadmin(admintoken)
} }
navigate('/orders') navigate('/orders')
} else { } else {
opentoast(res.data.message) opentoast(res.data.message)
@@ -488,38 +574,38 @@ const Createorder = () => {
const notifyadmin = async (id1) => { const notifyadmin = async (id1) => {
setLoading(true) setLoading(true)
await axios.post(`${process.env.REACT_APP_URL}/utils/notifyuser`, { await axios.post(`${process.env.REACT_APP_URL}/utils/notifyuser`, {
"sender": localStorage.getItem('firstname'), "sender": localStorage.getItem('firstname'),
"accessid": process.env.REACT_APP_RIDER_ACCESS_ID, "accessid": process.env.REACT_APP_RIDER_ACCESS_ID,
"notification": {
"priority": "high",
"to": id1,
"notification": { "notification": {
"title": "Nearle Admin", "priority": "high",
"body": "Orders has been placed for delivery.Kindly accept and process deliveries", "to": id1,
"sound": "ring" "notification": {
"title": "Nearle Admin",
"body": "Orders has been placed for delivery.Kindly accept and process deliveries",
"sound": "ring"
}
} }
}
}) })
.then((res) => { .then((res) => {
console.log(res) console.log(res)
if (res.data.message == 'Success') { if (res.data.message == 'Success') {
enqueueSnackbar("Notification sent Successfully", { enqueueSnackbar("Notification sent Successfully", {
variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000 autoHideDuration: 2000
}) })
} }
setLoading(false) setLoading(false)
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
enqueueSnackbar(err.message, { enqueueSnackbar(err.message, {
variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' },
autoHideDuration: 2000 autoHideDuration: 2000
})
setLoading(false)
}) })
setLoading(false) }
})
}
@@ -557,31 +643,51 @@ const Createorder = () => {
<ButtonGroup variant="outlined" > <ButtonGroup variant="outlined" >
<Button variant={(tabstatus == 0) ? 'contained' : 'outlined'} onClick={() => { <Button variant={(tabstatus == 0) ? 'contained' : 'outlined'} onClick={() => {
setTabstatus(0) setTabstatus(0)
setOrderarr([{ let arr = [];
sno: 1, timeslotarr.map((val) => {
address: '', if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
"customerid": '', arr.push(val)
"deliverytime": dayjs(), }
"deliverylocationid": '', })
"clientname": '', if (arr[0]) {
"contactno": '', setOrderarr([{
"latitude": '', sno: 1,
"longitude": '' address: '',
}]) "customerid": '',
"deliverytime": dayjs(arr[0]) || '',
"deliverylocationid": '',
"clientname": '',
"contactno": '',
"latitude": '',
"longitude": ''
}])
} else {
setOrderarr([])
}
}}>Single</Button> }}>Single</Button>
<Button variant={(tabstatus == 1) ? 'contained' : 'outlined'} onClick={() => { <Button variant={(tabstatus == 1) ? 'contained' : 'outlined'} onClick={() => {
setTabstatus(1) setTabstatus(1)
setOrderarr([{ let arr = [];
sno: 1, timeslotarr.map((val) => {
address: '', if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
"customerid": '', arr.push(val)
"deliverytime": dayjs(), }
"deliverylocationid": '', })
"clientname": '', if (arr[0]) {
"contactno": '', setOrderarr([{
"latitude": '', sno: 1,
"longitude": '' address: '',
}]) "customerid": '',
"deliverytime": dayjs(arr[0]) || '',
"deliverylocationid": '',
"clientname": '',
"contactno": '',
"latitude": '',
"longitude": ''
}])
} else {
setOrderarr([])
}
}}>Multiple</Button> }}>Multiple</Button>
</ButtonGroup> </ButtonGroup>
<Grid container spacing={1}> <Grid container spacing={1}>
@@ -630,18 +736,38 @@ const Createorder = () => {
<Typography variant="body2" align="right">{`${eventname.length}/50`}</Typography> <Typography variant="body2" align="right">{`${eventname.length}/50`}</Typography>
</Stack> </Stack>
</Grid> */} </Grid> */}
<Grid item xs={12} md={8} sx={{ height: '100%' }} > <Grid item xs={12} md={6} sx={{ height: '100%' }} >
<FormLabel>Pickup Location</FormLabel> <FormLabel>Pickup Location</FormLabel>
{/*
<Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1 }}> <Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1 }}>
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.address || ''} <Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.address || ''}
{/* {'123, Tamil Kudimagan Nagar Rd, Vadakkuppattu, Kulattur, Chennai, Tamil Nadu 600117, India'} */}
</Typography> </Typography>
</Box> </Box> */}
<Autocomplete
id="free-solo-demo"
sx={{ mt: 2 }}
options={tenantlocationlist}
renderInput={(params) => <TextField {...params} label="Choose Location" />}
onChange={(e, val) => {
if (val) {
setTenantinfo(val)
} else {
setTenantinfo({})
}
// if (reason === 'reset'){
// setTenantinfo({})
// }
console.log(val)
}}
// value={tenantinfo}
disabled={(tenant.tenantid) ? false : true}
/>
</Grid> </Grid>
<Grid item xs={12} md={4} sx={{ height: '100%' }}>
<Grid item xs={12} md={6} sx={{ height: '100%' }}>
<LocalizationProvider dateAdapter={AdapterDayjs} sx={{ width: '100%' }}> <LocalizationProvider dateAdapter={AdapterDayjs} sx={{ width: '100%' }}>
<FormLabel>Date</FormLabel> <FormLabel>Date</FormLabel>
@@ -657,6 +783,29 @@ const Createorder = () => {
setStartdate(e); setStartdate(e);
setEnddate(e); setEnddate(e);
let arr = [];
timeslotarr.map((val) => {
if ((dayjs().diff(dayjs(`${dayjs(e).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
arr.push(val)
}
})
if (arr[0]) {
setOrderarr([{
sno: 1,
address: '',
"customerid": '',
"deliverytime": dayjs(arr[0]) || '',
"deliverylocationid": '',
"clientname": '',
"contactno": '',
"latitude": '',
"longitude": ''
}])
} else {
setOrderarr([])
}
} else { } else {
setAlertmessage('choose Upcoming Date'); setAlertmessage('choose Upcoming Date');
opentoast('choose Upcoming Date') opentoast('choose Upcoming Date')
@@ -665,7 +814,7 @@ const Createorder = () => {
}} }}
value={dayjs(startdate)} value={dayjs(startdate)}
sx={{ width: '100%' }} sx={{ width: '100%', mt: 2 }}
disablePast disablePast
// minDate={dayjs().add(1, 'day')} // minDate={dayjs().add(1, 'day')}
@@ -674,6 +823,17 @@ const Createorder = () => {
</Grid> </Grid>
<Grid item xs={12}>
{/* <MainCard> */}
<Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1, mt: 2 }}>
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.locationaddress || ''}
</Typography>
</Box>
{/* </MainCard> */}
</Grid>
</Grid> </Grid>
</MainCard> </MainCard>
@@ -684,6 +844,8 @@ const Createorder = () => {
{/* {shiftarr1.map((result) => { {/* {shiftarr1.map((result) => {
return <> */} return <> */}
@@ -805,23 +967,32 @@ const Createorder = () => {
</Stack> </Stack>
</Grid> */} </Grid> */}
<Grid item> {/* <Grid item> */}
<Button variant="outlined" onClick={() => { <Button variant="outlined" onClick={() => {
// if (clientdetail.tenantid) {
// fetchtenantstaffs(clientdetail.tenantid)
// setOpen1(result.sno) // if (localStorage.getItem('tenantid')) {
// } else { // clientdetails(localStorage.getItem('tenantid'));
// opentoast('choose client') // }
// } let arr = [];
if (localStorage.getItem('tenantid')) { timeslotarr.map((val) => {
clientdetails(localStorage.getItem('tenantid')); if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
// fetchtenantinfo(localStorage.getItem('tenantid')) arr.push(val)
} }
setOpen2(true) })
if (arr[0]) {
if (tenantinfo.tenantid) {
clientdetails(tenant.tenantid);
setOpen2(true)
}} color="success" startIcon={<PlusOutlined />}>ADD Clients</Button> } else {
</Grid> opentoast('Choose Location')
}
} else {
opentoast('We are unable to process the order at this time. Kindly schedule it for an other day')
}
}} color="success" startIcon={<PlusOutlined />}>ADD Customers</Button>
{/* </Grid> */}
</Grid> </Grid>
@@ -883,12 +1054,21 @@ const Createorder = () => {
// onClick={() => handlerAddress(address)} // onClick={() => handlerAddress(address)}
onClick={() => { onClick={() => {
if (tabstatus == 1) { if (tabstatus == 1) {
let arr5 = [];
timeslotarr.map((val) => {
if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
arr5.push(val)
}
})
if (orderarr[0].address == '') { if (orderarr[0].address == '') {
setOrderarr([{ setOrderarr([{
sno: 1, sno: 1,
address: address.address, address: address.address,
"customerid": address.customerid, "customerid": address.customerid,
"deliverytime": dayjs(), "deliverytime": dayjs(arr5[0]) || '',
"deliverylocationid": address.deliverylocationid, "deliverylocationid": address.deliverylocationid,
"clientname": address.firstname, "clientname": address.firstname,
"contactno": address.contactno, "contactno": address.contactno,
@@ -899,8 +1079,9 @@ const Createorder = () => {
if (orderarr.find((val2) => val2.customerid == address.customerid)) { if (orderarr.find((val2) => val2.customerid == address.customerid)) {
if (orderarr.length > 1) { if (orderarr.length > 1) {
let arr = orderarr; let arr = orderarr;
let res = orderarr.find((val2) => val2.customerid == address.customerid) let res = orderarr.find((val2) => val2.address == address.address)
arr.splice(res.sno - 1, 1); arr.splice(res.sno - 1, 1);
console.log(arr)
let arr1 = [] let arr1 = []
arr.map((val2, k) => { arr.map((val2, k) => {
arr1.push({ arr1.push({
@@ -921,7 +1102,7 @@ const Createorder = () => {
sno: 1, sno: 1,
address: '', address: '',
"customerid": '', "customerid": '',
"deliverytime": dayjs(), "deliverytime": dayjs(arr5[0]) || '',
"deliverylocationid": '', "deliverylocationid": '',
"clientname": '', "clientname": '',
"contactno": '', "contactno": '',
@@ -936,7 +1117,7 @@ const Createorder = () => {
sno: arr.length + 1, sno: arr.length + 1,
'address': address.address, 'address': address.address,
"customerid": address.customerid, "customerid": address.customerid,
"deliverytime": dayjs(), "deliverytime": dayjs(arr5[0]) || '',
"deliverylocationid": address.deliverylocationid, "deliverylocationid": address.deliverylocationid,
"clientname": address.firstname, "clientname": address.firstname,
"contactno": address.contactno, "contactno": address.contactno,
@@ -947,15 +1128,25 @@ const Createorder = () => {
} }
} }
console.log(orderarr)
} }
if (tabstatus == 0) { if (tabstatus == 0) {
let arr = [];
timeslotarr.map((val) => {
if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
arr.push(val)
}
})
setOrderarr([{ setOrderarr([{
sno: 1, sno: 1,
address: address.address, address: address.address,
"customerid": address.customerid, "customerid": address.customerid,
"deliverytime": dayjs(), "deliverytime": dayjs(arr[0]) || '',
"deliverylocationid": address.deliverylocationid, "deliverylocationid": address.deliverylocationid,
"clientname": address.firstname, "clientname": address.firstname,
"contactno": address.contactno, "contactno": address.contactno,
@@ -984,9 +1175,9 @@ const Createorder = () => {
'&:hover': { '&:hover': {
// bgcolor: theme.palette.primary.lighter, // bgcolor: theme.palette.primary.lighter,
// borderColor: theme.palette.primary.lighter // borderColor: theme.palette.primary.lighter
bgcolor: (orderarr.find((val2) => val2.customerid == address.customerid)) ? '#e1bee7' : '' bgcolor: ((orderarr.find((val2) => val2.address == address.address))) ? '#e1bee7' : ''
}, },
bgcolor: (orderarr.find((val2) => val2.customerid == address.customerid)) ? '#e1bee7' : '' bgcolor: ((orderarr.find((val2) => val2.address == address.address))) ? '#e1bee7' : ''
}} }}
> >
<Stack direction={'row'} justifyContent={'space-between'}> <Stack direction={'row'} justifyContent={'space-between'}>
@@ -1034,6 +1225,83 @@ const Createorder = () => {
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<Dialog
// maxWidth="sm"
// minWidth='md'
open={open3}
onClose={closetimemodal}
sx={{ '& .MuiDialog-paper': { p: 0 }, '& .MuiBackdrop-root': { opacity: '0.5 !important' } }}
>
<DialogTitle>
<Stack direction="row" justifyContent="space-between" alignItems="center">
<Typography variant="h5">Select Time</Typography>
</Stack>
</DialogTitle>
<Divider />
<DialogContent sx={{ p: 2.5 }}>
<Grid container spacing={2}>
{timeslotarr.map((val) => {
if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)
&& currentsno
) {
return <>
<Grid item>
<Chip
sx={{ cursor: 'pointer' }}
color={(dayjs(orderarr[currentsno - 1].deliverytime).format('HH:mm') == dayjs(val).format('HH:mm')) ? 'primary' : 'default'}
label={dayjs(val).format('hh:mm A')}
onClick={() => {
let arr = orderarr;
arr[currentsno - 1].deliverytime = val
setOrderarr([...arr])
console.log(arr)
}}
/>
</Grid>
{/* <p>{dayjs().diff(dayjs(val),'m')}</p> */}
</>
}
})
}
</Grid>
</DialogContent>
<Divider />
<DialogActions sx={{ p: 2.5, minWidth: '300px' }}>
<Button variant='contained' color="error"
onClick={() => {
closetimemodal()
}}
>
Cancel
</Button>
<Button
onClick={closetimemodal}
color="primary" variant="contained">
OK
</Button>
</DialogActions>
</Dialog>
</Grid> </Grid>
</Grid> </Grid>
@@ -1091,7 +1359,7 @@ const Createorder = () => {
</TableCell> </TableCell>
<TableCell> <TableCell>
<LocalizationProvider dateAdapter={AdapterDayjs}> {/* <LocalizationProvider dateAdapter={AdapterDayjs}>
<TimePicker <TimePicker
label="Schedule Time" label="Schedule Time"
timeSteps={{ minutes: 15 }} timeSteps={{ minutes: 15 }}
@@ -1105,37 +1373,36 @@ const Createorder = () => {
setOrderarr([...arr]) setOrderarr([...arr])
console.log(arr) console.log(arr)
} }
// let arr = shiftarr1;
// let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(e).format('HH:mm:ss')}`), 'm');
// console.log('dateres11')
// console.log(dateres11)
// if (dateres11 < 0) {
// arr[result.sno - 1].details[val.sno - 1].starttime = dayjs(e.$d);
// arr[result.sno - 1].details[val.sno - 1].endtime = dayjs(dayjs(e.$d).add(4, 'hours').$d);
// }
} }
} }
sx={{ width: '150px' }} sx={{ width: '150px' }}
value={val.deliverytime || null} value={val.deliverytime || null}
disabled
/> />
</LocalizationProvider> </LocalizationProvider> */}
<Stack direction={'row'} alignItems={'center'} spacing={1}>
{dayjs(val.deliverytime).format('hh:mm A')}
<IconButton
color='primary'
onClick={() => {
if (tenantinfo.tenantid && orderarr[0].address) {
setCurrentsno(val.sno)
setOpen3(true)
} else {
opentoast('Choose Location & Client')
}
}}
>
<AccessTimeOutlinedIcon />
</IconButton>
</Stack>
</TableCell> </TableCell>
<TableCell>{val.address}</TableCell> <TableCell>{val.address}</TableCell>
@@ -1165,17 +1432,33 @@ const Createorder = () => {
<Stack direction={'row'} justifyContent={'center'}> <Stack direction={'row'} justifyContent={'center'}>
<Button sx={{ minWidth: '10px !important' }} color="error" onClick={() => { <Button sx={{ minWidth: '10px !important' }} color="error" onClick={() => {
let arr = orderarr; let arr = orderarr;
let arr5 = [];
timeslotarr.map((val) => {
if ((dayjs().diff(dayjs(`${dayjs(startdate).format('MM-DD-YYYY')} ${dayjs(val).format('HH:mm:ss')}`), 'm') <= 0)) {
arr5.push(val)
}
})
if (orderarr.length > 1) { if (orderarr.length > 1) {
arr.splice(val.sno - 1, 1); arr.splice(val.sno - 1, 1);
let arr1 = [] let arr1 = []
arr.map((val2, k) => { arr.map((val2, k) => {
arr1.push({ arr1.push({
sno: k + 1, sno: k + 1,
'address': val2.address, 'address': val2.address,
"customerid": val2.customerid, "customerid": val2.customerid,
"deliverytime": val2.deliverytime, "deliverytime": val2.deliverytime,
"deliverylocationid": val2.deliverylocationid, "deliverylocationid": val2.deliverylocationid,
"clientname": val2.clientname,
"contactno": val2.contactno,
"latitude": val2.latitude,
"longitude": val2.longitude
}) })
}) })
setOrderarr([...arr1]) setOrderarr([...arr1])
} else { } else {
@@ -1183,8 +1466,12 @@ const Createorder = () => {
sno: 1, sno: 1,
address: '', address: '',
"customerid": '', "customerid": '',
"deliverytime": '', "deliverytime": arr5[0],
"deliverylocationid": '', "deliverylocationid": '',
"clientname": '',
"contactno": '',
"latitude": '',
"longitude": ''
}]) }])
} }
@@ -1256,7 +1543,9 @@ const Createorder = () => {
<Grid container spacing={1}> <Grid container spacing={1}>
<Grid item xs={12}> <Grid item xs={12}>
<MainCard title='Notes' sx={{ height: '100%' }}> <MainCard
// title='Notes'
sx={{ height: '100%' }}>
<TextField id="outlined-multiline-static" sx={{ width: '100%', height: '100%' }} multiline rows={4} placeholder='Notes' <TextField id="outlined-multiline-static" sx={{ width: '100%', height: '100%' }} multiline rows={4} placeholder='Notes'
value={otherinstructions} onChange={(e) => setOtherinstructions(e.target.value)} /> value={otherinstructions} onChange={(e) => setOtherinstructions(e.target.value)} />

View File

@@ -646,7 +646,9 @@ const Orders = () => {
<Tooltip title={row.pickupaddress}> <Tooltip title={row.pickupaddress}>
<Typography variant="caption" color="textSecondary" <Typography variant="caption" color="textSecondary"
> >
{row.pickupaddress.slice(0, 20)} {/* {row.pickupaddress.slice(0, 20)} */}
{row.locationsuburb || row.pickupaddress.slice(0, 20)}
</Typography> </Typography>
</Tooltip> </Tooltip>
</Stack> </Stack>
@@ -658,7 +660,9 @@ const Orders = () => {
<Tooltip title={row.deliveryaddress}> <Tooltip title={row.deliveryaddress}>
<Typography variant="caption" color="textSecondary" <Typography variant="caption" color="textSecondary"
> >
{row.deliveryaddress.slice(0, 20)} {/* {row.deliveryaddress.slice(0, 20)} */}
{row.customersuburb || row.deliveryaddress.slice(0, 20)}
</Typography> </Typography>
</Tooltip> </Tooltip>
</Stack> </Stack>

View File

@@ -18,6 +18,8 @@ const Login = Loadable(lazy(() => import('pages/nearle/login')));
const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard'))); const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard')));
const Client = Loadable(lazy(() => import('pages/nearle/clients/client'))); const Client = Loadable(lazy(() => import('pages/nearle/clients/client')));
const Client1 = Loadable(lazy(() => import('pages/nearle/clients/clients1')));
const Orders = Loadable(lazy(() => import('pages/nearle/orders/orders'))); const Orders = Loadable(lazy(() => import('pages/nearle/orders/orders')));
const Details = Loadable(lazy(() => import('pages/nearle/orders/details'))); const Details = Loadable(lazy(() => import('pages/nearle/orders/details')));
@@ -51,9 +53,13 @@ const MainRoutes = {
element: <Dashboard /> element: <Dashboard />
}, },
{ {
path: 'clients', path: 'customers',
element: <Client /> element: <Client1 />
}, },
// {
// path: 'clients1',
// element: <Client1 />
// },
{ {
path: 'orders', path: 'orders',
element: <Orders /> element: <Orders />
@@ -71,7 +77,7 @@ const MainRoutes = {
element: <Details /> element: <Details />
}, },
{ {
path: 'clients/create', path: 'customers/create',
element: <Createclient /> element: <Createclient />
}, },

View File

@@ -9116,6 +9116,11 @@ react-google-autocomplete@^2.7.3:
lodash.debounce "^4.0.8" lodash.debounce "^4.0.8"
prop-types "^15.5.0" prop-types "^15.5.0"
react-icons@^4.12.0:
version "4.12.0"
resolved "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz"
integrity sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==
react-intl@^6.4.1: react-intl@^6.4.1:
version "6.4.1" version "6.4.1"
resolved "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz" resolved "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz"