30122023
This commit is contained in:
Submodule nearlexpressbuild updated: c351223c49...0f12f16e5c
15
package-lock.json
generated
15
package-lock.json
generated
@@ -42,6 +42,7 @@
|
||||
"react-dom": "^18.2.0",
|
||||
"react-geocode": "^0.2.3",
|
||||
"react-google-autocomplete": "^2.7.3",
|
||||
"react-icons": "^4.12.0",
|
||||
"react-intl": "^6.4.1",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router": "^6.10.0",
|
||||
@@ -16772,6 +16773,14 @@
|
||||
"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": {
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz",
|
||||
@@ -32037,6 +32046,12 @@
|
||||
"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": {
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz",
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"react-dom": "^18.2.0",
|
||||
"react-geocode": "^0.2.3",
|
||||
"react-google-autocomplete": "^2.7.3",
|
||||
"react-icons": "^4.12.0",
|
||||
"react-intl": "^6.4.1",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router": "^6.10.0",
|
||||
|
||||
@@ -42,7 +42,9 @@ const HoverSocialCard = ({ primary, secondary,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h2" color="inherit">
|
||||
{percentage.toString()} %
|
||||
{/* {percentage.toString()} % */}
|
||||
{(percentage)? `${percentage.toString()} %`:''}
|
||||
|
||||
</Typography>
|
||||
{/* {primaryIcon} */}
|
||||
</Box>
|
||||
|
||||
@@ -173,9 +173,9 @@ const navigate = useNavigate()
|
||||
/>
|
||||
</ListItemButton> */}
|
||||
<ListItemButton
|
||||
selected={location.pathname === '/staff/create'}
|
||||
selected={location.pathname === '/customers/create'}
|
||||
onClick={() => {
|
||||
navigate('/clients/create')
|
||||
navigate('/customers/create')
|
||||
handleClickAway()
|
||||
}} >
|
||||
<ListItemText
|
||||
@@ -184,7 +184,7 @@ const navigate = useNavigate()
|
||||
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
||||
<UserOutlined />
|
||||
</ListItemIcon>
|
||||
<Typography color="textPrimary">Create Client</Typography>
|
||||
<Typography color="textPrimary">Create Customer</Typography>
|
||||
|
||||
</Grid>
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ const other = {
|
||||
},
|
||||
{
|
||||
id: 'clients',
|
||||
title: <FormattedMessage id="Clients" />,
|
||||
title: <FormattedMessage id="Customers" />,
|
||||
type: 'item',
|
||||
url: '/clients',
|
||||
url: '/customers',
|
||||
icon: icons.UserOutlined
|
||||
},
|
||||
{
|
||||
|
||||
1844
src/pages/nearle/clients/clients1.js
Normal file
1844
src/pages/nearle/clients/clients1.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -338,7 +338,7 @@ const Createclient = () => {
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center">
|
||||
<Typography variant="h3">Create Client</Typography>
|
||||
<Typography variant="h3">Create Customer</Typography>
|
||||
</Stack>
|
||||
</Grid>
|
||||
<MainCard>
|
||||
|
||||
@@ -43,12 +43,13 @@ import {
|
||||
DialogActions,
|
||||
CircularProgress,
|
||||
ButtonGroup,
|
||||
FormLabel
|
||||
FormLabel,
|
||||
IconButton
|
||||
// LinkOutlined
|
||||
} from '@mui/material';
|
||||
import { useNavigate } from 'react-router';
|
||||
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
||||
|
||||
import AccessTimeOutlinedIcon from '@mui/icons-material/AccessTimeOutlined';
|
||||
import { PopupTransition } from 'components/@extended/Transitions';
|
||||
// var utc = require('dayjs/plugin/utc')
|
||||
|
||||
@@ -103,7 +104,8 @@ import dayjs from 'dayjs';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
// import { CheckBox } from '@mui/icons-material';
|
||||
// dayjs.extend(utc)
|
||||
|
||||
var utc = require('dayjs/plugin/utc')
|
||||
dayjs.extend(utc)
|
||||
|
||||
|
||||
|
||||
@@ -117,6 +119,8 @@ const Createorder = () => {
|
||||
const [open, setOpen] = useState({});
|
||||
const [open1, setOpen1] = useState('')
|
||||
const [open2, setOpen2] = useState(false)
|
||||
const [open3, setOpen3] = useState(false)
|
||||
|
||||
const [shift, setShift] = useState(1);
|
||||
const [clientlist, setClientlist] = useState([])
|
||||
const [clientdetail, setClientdetail] = useState([]);
|
||||
@@ -124,6 +128,11 @@ const Createorder = () => {
|
||||
|
||||
const [startdate, setStartdate] = useState(dayjs().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('');
|
||||
|
||||
|
||||
|
||||
@@ -157,24 +166,58 @@ const Createorder = () => {
|
||||
const [searchword, setSearchword] = useState('');
|
||||
const [clientdetailarr, setClientdetailarr] = useState([])
|
||||
const [admintoken, setAdmintoken] = useState('');
|
||||
const [tenantlocationlist, setTenantlocationlist] = useState([])
|
||||
const [tenant, setTenant] = useState({})
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (localStorage.getItem('tenantid')) {
|
||||
// setOrderarr([{
|
||||
// sno: 1,
|
||||
// address: '',
|
||||
// "customerid": '',
|
||||
// "deliverytime": dayjs(),
|
||||
// "deliverylocationid": '',
|
||||
// "clientname": '',
|
||||
// "contactno": '',
|
||||
// "latitude": '',
|
||||
// "longitude": ''
|
||||
// }])
|
||||
// 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(),
|
||||
"deliverytime": dayjs(arr[0]) || '',
|
||||
"deliverylocationid": '',
|
||||
"clientname": '',
|
||||
"contactno": '',
|
||||
"latitude": '',
|
||||
"longitude": ''
|
||||
}])
|
||||
// console.log(dayjs())
|
||||
}
|
||||
}, [])
|
||||
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}, [timeslotarr])
|
||||
|
||||
useEffect(() => {
|
||||
if (searchword) {
|
||||
@@ -204,8 +247,11 @@ const Createorder = () => {
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.data.status) {
|
||||
setTenantinfo(res.data.details);
|
||||
fetchadmintoken(res.data.details.partnerid)
|
||||
// setTenantinfo(res.data.details);
|
||||
setTenant(res.data.details)
|
||||
|
||||
fetchadmintoken(res.data.details.tenantid, res.data.details.partnerid)
|
||||
|
||||
}
|
||||
setLoading(false)
|
||||
}).catch((err) => {
|
||||
@@ -214,15 +260,48 @@ const Createorder = () => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const fetchadmintoken = async (tid) => {
|
||||
const fetchtenantlocation = async (tid) => {
|
||||
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) => {
|
||||
console.log(res)
|
||||
if (res.data.status) {
|
||||
// setTenantinfo(res.data.details);
|
||||
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)
|
||||
}).catch((err) => {
|
||||
@@ -245,7 +324,10 @@ const Createorder = () => {
|
||||
function closeAddressModal() {
|
||||
setOpen2(false);
|
||||
}
|
||||
|
||||
function closetimemodal() {
|
||||
setOpen3(false);
|
||||
setCurrentsno('')
|
||||
}
|
||||
|
||||
|
||||
const createsubmitobj1 = async () => {
|
||||
@@ -292,15 +374,15 @@ const Createorder = () => {
|
||||
"deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(val.deliverytime.$d).format('HH:mm:ss')}`,
|
||||
"deliverylocationid": val.deliverylocationid,
|
||||
"deliveryaddress": val.address,
|
||||
"pickupaddress": tenantinfo.address,
|
||||
"pickuplat": tenantinfo.latitude,
|
||||
"pickuplong": tenantinfo.longitude,
|
||||
"pickupaddress": tenantinfo.locationaddress,
|
||||
"pickuplat": tenantinfo.locationlatitude,
|
||||
"pickuplong": tenantinfo.locationlong,
|
||||
"ordernotes": otherinstructions,
|
||||
"remarks": "",
|
||||
"tenantuserid": parseInt(localStorage.getItem('tenantid')),
|
||||
"categoryid": tenantinfo.categoryid,
|
||||
"subcategoryid": tenantinfo.subcategoryid,
|
||||
"partnerid": tenantinfo.partnerid,
|
||||
"categoryid": tenant.categoryid,
|
||||
"subcategoryid": tenant.subcategoryid,
|
||||
"partnerid": tenant.partnerid,
|
||||
"deliverylat": val.latitude,
|
||||
"deliverylong": val.longitude,
|
||||
"applocationid": parseInt(localStorage.getItem('applocationid'))
|
||||
@@ -308,12 +390,16 @@ const Createorder = () => {
|
||||
})
|
||||
|
||||
})
|
||||
if(!orderarr[0]){
|
||||
opentoast('Choose Customer')
|
||||
}else if (!tenantinfo.tenantid) {
|
||||
opentoast('Choose Location')
|
||||
|
||||
if (timecheck) {
|
||||
opentoast('Choose Schedule Time')
|
||||
} else if (addresscheck) {
|
||||
opentoast('Choose Client')
|
||||
opentoast('Choose Customer')
|
||||
|
||||
} else if (timecheck) {
|
||||
opentoast('Choose Schedule Time')
|
||||
} else {
|
||||
setLoading(true)
|
||||
await axios.post(`${process.env.REACT_APP_URL}/orders/createorders`, arr)
|
||||
@@ -557,31 +643,51 @@ const Createorder = () => {
|
||||
<ButtonGroup variant="outlined" >
|
||||
<Button variant={(tabstatus == 0) ? 'contained' : 'outlined'} onClick={() => {
|
||||
setTabstatus(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]) {
|
||||
setOrderarr([{
|
||||
sno: 1,
|
||||
address: '',
|
||||
"customerid": '',
|
||||
"deliverytime": dayjs(),
|
||||
"deliverytime": dayjs(arr[0]) || '',
|
||||
"deliverylocationid": '',
|
||||
"clientname": '',
|
||||
"contactno": '',
|
||||
"latitude": '',
|
||||
"longitude": ''
|
||||
}])
|
||||
} else {
|
||||
setOrderarr([])
|
||||
}
|
||||
}}>Single</Button>
|
||||
<Button variant={(tabstatus == 1) ? 'contained' : 'outlined'} onClick={() => {
|
||||
setTabstatus(1)
|
||||
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]) {
|
||||
setOrderarr([{
|
||||
sno: 1,
|
||||
address: '',
|
||||
"customerid": '',
|
||||
"deliverytime": dayjs(),
|
||||
"deliverytime": dayjs(arr[0]) || '',
|
||||
"deliverylocationid": '',
|
||||
"clientname": '',
|
||||
"contactno": '',
|
||||
"latitude": '',
|
||||
"longitude": ''
|
||||
}])
|
||||
} else {
|
||||
setOrderarr([])
|
||||
}
|
||||
}}>Multiple</Button>
|
||||
</ButtonGroup>
|
||||
<Grid container spacing={1}>
|
||||
@@ -630,18 +736,38 @@ const Createorder = () => {
|
||||
<Typography variant="body2" align="right">{`${eventname.length}/50`}</Typography>
|
||||
</Stack>
|
||||
</Grid> */}
|
||||
<Grid item xs={12} md={8} sx={{ height: '100%' }} >
|
||||
<Grid item xs={12} md={6} sx={{ height: '100%' }} >
|
||||
<FormLabel>Pickup Location</FormLabel>
|
||||
|
||||
{/*
|
||||
<Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1 }}>
|
||||
|
||||
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.address || ''}
|
||||
{/* {'123, Tamil Kudimagan Nagar Rd, Vadakkuppattu, Kulattur, Chennai, Tamil Nadu 600117, India'} */}
|
||||
</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 item xs={12} md={4} sx={{ height: '100%' }}>
|
||||
|
||||
<Grid item xs={12} md={6} sx={{ height: '100%' }}>
|
||||
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs} sx={{ width: '100%' }}>
|
||||
<FormLabel>Date</FormLabel>
|
||||
@@ -657,6 +783,29 @@ const Createorder = () => {
|
||||
setStartdate(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 {
|
||||
setAlertmessage('choose Upcoming Date');
|
||||
opentoast('choose Upcoming Date')
|
||||
@@ -665,7 +814,7 @@ const Createorder = () => {
|
||||
|
||||
}}
|
||||
value={dayjs(startdate)}
|
||||
sx={{ width: '100%' }}
|
||||
sx={{ width: '100%', mt: 2 }}
|
||||
disablePast
|
||||
// minDate={dayjs().add(1, 'day')}
|
||||
|
||||
@@ -674,6 +823,17 @@ const Createorder = () => {
|
||||
|
||||
</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>
|
||||
</MainCard>
|
||||
@@ -684,6 +844,8 @@ const Createorder = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{/* {shiftarr1.map((result) => {
|
||||
|
||||
return <> */}
|
||||
@@ -805,23 +967,32 @@ const Createorder = () => {
|
||||
</Stack>
|
||||
|
||||
</Grid> */}
|
||||
<Grid item>
|
||||
{/* <Grid item> */}
|
||||
<Button variant="outlined" onClick={() => {
|
||||
// if (clientdetail.tenantid) {
|
||||
// fetchtenantstaffs(clientdetail.tenantid)
|
||||
|
||||
// setOpen1(result.sno)
|
||||
// } else {
|
||||
// opentoast('choose client')
|
||||
// if (localStorage.getItem('tenantid')) {
|
||||
// clientdetails(localStorage.getItem('tenantid'));
|
||||
// }
|
||||
if (localStorage.getItem('tenantid')) {
|
||||
clientdetails(localStorage.getItem('tenantid'));
|
||||
// fetchtenantinfo(localStorage.getItem('tenantid'))
|
||||
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]) {
|
||||
if (tenantinfo.tenantid) {
|
||||
clientdetails(tenant.tenantid);
|
||||
setOpen2(true)
|
||||
|
||||
}} color="success" startIcon={<PlusOutlined />}>ADD Clients</Button>
|
||||
</Grid>
|
||||
} else {
|
||||
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>
|
||||
|
||||
|
||||
@@ -883,12 +1054,21 @@ const Createorder = () => {
|
||||
// onClick={() => handlerAddress(address)}
|
||||
onClick={() => {
|
||||
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 == '') {
|
||||
setOrderarr([{
|
||||
sno: 1,
|
||||
address: address.address,
|
||||
"customerid": address.customerid,
|
||||
"deliverytime": dayjs(),
|
||||
"deliverytime": dayjs(arr5[0]) || '',
|
||||
"deliverylocationid": address.deliverylocationid,
|
||||
"clientname": address.firstname,
|
||||
"contactno": address.contactno,
|
||||
@@ -899,8 +1079,9 @@ const Createorder = () => {
|
||||
if (orderarr.find((val2) => val2.customerid == address.customerid)) {
|
||||
if (orderarr.length > 1) {
|
||||
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);
|
||||
console.log(arr)
|
||||
let arr1 = []
|
||||
arr.map((val2, k) => {
|
||||
arr1.push({
|
||||
@@ -921,7 +1102,7 @@ const Createorder = () => {
|
||||
sno: 1,
|
||||
address: '',
|
||||
"customerid": '',
|
||||
"deliverytime": dayjs(),
|
||||
"deliverytime": dayjs(arr5[0]) || '',
|
||||
"deliverylocationid": '',
|
||||
"clientname": '',
|
||||
"contactno": '',
|
||||
@@ -936,7 +1117,7 @@ const Createorder = () => {
|
||||
sno: arr.length + 1,
|
||||
'address': address.address,
|
||||
"customerid": address.customerid,
|
||||
"deliverytime": dayjs(),
|
||||
"deliverytime": dayjs(arr5[0]) || '',
|
||||
"deliverylocationid": address.deliverylocationid,
|
||||
"clientname": address.firstname,
|
||||
"contactno": address.contactno,
|
||||
@@ -947,15 +1128,25 @@ const Createorder = () => {
|
||||
}
|
||||
|
||||
}
|
||||
console.log(orderarr)
|
||||
|
||||
}
|
||||
|
||||
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([{
|
||||
sno: 1,
|
||||
address: address.address,
|
||||
"customerid": address.customerid,
|
||||
"deliverytime": dayjs(),
|
||||
"deliverytime": dayjs(arr[0]) || '',
|
||||
"deliverylocationid": address.deliverylocationid,
|
||||
"clientname": address.firstname,
|
||||
"contactno": address.contactno,
|
||||
@@ -984,9 +1175,9 @@ const Createorder = () => {
|
||||
'&:hover': {
|
||||
// bgcolor: 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'}>
|
||||
@@ -1034,6 +1225,83 @@ const Createorder = () => {
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</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>
|
||||
@@ -1091,7 +1359,7 @@ const Createorder = () => {
|
||||
</TableCell>
|
||||
|
||||
<TableCell>
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||
{/* <LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||
<TimePicker
|
||||
label="Schedule Time"
|
||||
timeSteps={{ minutes: 15 }}
|
||||
@@ -1105,25 +1373,6 @@ const Createorder = () => {
|
||||
setOrderarr([...arr])
|
||||
console.log(arr)
|
||||
}
|
||||
// let arr = shiftarr1;
|
||||
// let dateres11 = dayjs().diff(dayjs(`${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(e).format('HH:mm:ss')}`), 'm');
|
||||
// console.log('dateres11')
|
||||
// console.log(dateres11)
|
||||
// if (dateres11 < 0) {
|
||||
|
||||
|
||||
// arr[result.sno - 1].details[val.sno - 1].starttime = dayjs(e.$d);
|
||||
|
||||
// arr[result.sno - 1].details[val.sno - 1].endtime = dayjs(dayjs(e.$d).add(4, 'hours').$d);
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1131,11 +1380,29 @@ const Createorder = () => {
|
||||
|
||||
sx={{ width: '150px' }}
|
||||
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>{val.address}</TableCell>
|
||||
|
||||
@@ -1165,17 +1432,33 @@ const Createorder = () => {
|
||||
<Stack direction={'row'} justifyContent={'center'}>
|
||||
<Button sx={{ minWidth: '10px !important' }} color="error" onClick={() => {
|
||||
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) {
|
||||
arr.splice(val.sno - 1, 1);
|
||||
let arr1 = []
|
||||
arr.map((val2, k) => {
|
||||
|
||||
|
||||
arr1.push({
|
||||
sno: k + 1,
|
||||
'address': val2.address,
|
||||
"customerid": val2.customerid,
|
||||
"deliverytime": val2.deliverytime,
|
||||
"deliverylocationid": val2.deliverylocationid,
|
||||
"clientname": val2.clientname,
|
||||
"contactno": val2.contactno,
|
||||
"latitude": val2.latitude,
|
||||
"longitude": val2.longitude
|
||||
})
|
||||
|
||||
})
|
||||
setOrderarr([...arr1])
|
||||
} else {
|
||||
@@ -1183,8 +1466,12 @@ const Createorder = () => {
|
||||
sno: 1,
|
||||
address: '',
|
||||
"customerid": '',
|
||||
"deliverytime": '',
|
||||
"deliverytime": arr5[0],
|
||||
"deliverylocationid": '',
|
||||
"clientname": '',
|
||||
"contactno": '',
|
||||
"latitude": '',
|
||||
"longitude": ''
|
||||
}])
|
||||
}
|
||||
|
||||
@@ -1256,7 +1543,9 @@ const Createorder = () => {
|
||||
<Grid container spacing={1}>
|
||||
|
||||
<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'
|
||||
value={otherinstructions} onChange={(e) => setOtherinstructions(e.target.value)} />
|
||||
|
||||
@@ -646,7 +646,9 @@ const Orders = () => {
|
||||
<Tooltip title={row.pickupaddress}>
|
||||
<Typography variant="caption" color="textSecondary"
|
||||
>
|
||||
{row.pickupaddress.slice(0, 20)}
|
||||
{/* {row.pickupaddress.slice(0, 20)} */}
|
||||
{row.locationsuburb || row.pickupaddress.slice(0, 20)}
|
||||
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</Stack>
|
||||
@@ -658,7 +660,9 @@ const Orders = () => {
|
||||
<Tooltip title={row.deliveryaddress}>
|
||||
<Typography variant="caption" color="textSecondary"
|
||||
>
|
||||
{row.deliveryaddress.slice(0, 20)}
|
||||
{/* {row.deliveryaddress.slice(0, 20)} */}
|
||||
{row.customersuburb || row.deliveryaddress.slice(0, 20)}
|
||||
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</Stack>
|
||||
|
||||
@@ -18,6 +18,8 @@ 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 Client1 = Loadable(lazy(() => import('pages/nearle/clients/clients1')));
|
||||
|
||||
const Orders = Loadable(lazy(() => import('pages/nearle/orders/orders')));
|
||||
const Details = Loadable(lazy(() => import('pages/nearle/orders/details')));
|
||||
|
||||
@@ -51,9 +53,13 @@ const MainRoutes = {
|
||||
element: <Dashboard />
|
||||
},
|
||||
{
|
||||
path: 'clients',
|
||||
element: <Client />
|
||||
path: 'customers',
|
||||
element: <Client1 />
|
||||
},
|
||||
// {
|
||||
// path: 'clients1',
|
||||
// element: <Client1 />
|
||||
// },
|
||||
{
|
||||
path: 'orders',
|
||||
element: <Orders />
|
||||
@@ -71,7 +77,7 @@ const MainRoutes = {
|
||||
element: <Details />
|
||||
},
|
||||
{
|
||||
path: 'clients/create',
|
||||
path: 'customers/create',
|
||||
element: <Createclient />
|
||||
},
|
||||
|
||||
|
||||
@@ -9116,6 +9116,11 @@ react-google-autocomplete@^2.7.3:
|
||||
lodash.debounce "^4.0.8"
|
||||
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:
|
||||
version "6.4.1"
|
||||
resolved "https://registry.npmjs.org/react-intl/-/react-intl-6.4.1.tgz"
|
||||
|
||||
Reference in New Issue
Block a user