09012024
This commit is contained in:
@@ -57,6 +57,7 @@ import AccessTimeOutlinedIcon from '@mui/icons-material/AccessTimeOutlined';
|
||||
import { PopupTransition } from 'components/@extended/Transitions';
|
||||
// var utc = require('dayjs/plugin/utc')
|
||||
import * as React from 'react';
|
||||
import SwapVertIcon from '@mui/icons-material/SwapVert';
|
||||
|
||||
import axios from 'axios';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
@@ -757,6 +758,7 @@ const Createorder1 = () => {
|
||||
if (localStorage.getItem('tenantid')) {
|
||||
|
||||
fetchtenantlocation(localStorage.getItem('tenantid'))
|
||||
clientdetails(localStorage.getItem('tenantid'))
|
||||
}
|
||||
}, [])
|
||||
|
||||
@@ -948,11 +950,11 @@ const Createorder1 = () => {
|
||||
arr = [{
|
||||
"orderheaderid": 0,
|
||||
"tenantid": parseInt(localStorage.getItem('tenantid')),
|
||||
"locationid": tenantinfo.locationid,
|
||||
"moduleid": tenantinfo.moduleid,
|
||||
"locationid": tenant.locationid,
|
||||
"moduleid": tenant.moduleid,
|
||||
"configid": 7,
|
||||
"orderid": "",
|
||||
"customerid": clientinfo.customerid,
|
||||
"customerid": tenantinfo.customerid,
|
||||
"orderdate": dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
"orderstatus": "created",
|
||||
"pending": "",
|
||||
@@ -960,11 +962,11 @@ const Createorder1 = () => {
|
||||
"ready": "",
|
||||
"delivered": "",
|
||||
"cancellled": "",
|
||||
"promoid": 0,
|
||||
"promoname": "",
|
||||
"promoterms": "",
|
||||
"promovalue": 0,
|
||||
"promoamount": 0,
|
||||
// "promoid": 0,
|
||||
// "promoname": "",
|
||||
// "promoterms": "",
|
||||
// "promovalue": 0,
|
||||
// "promoamount": 0,
|
||||
"orderamount": 0,
|
||||
"taxamount": 0,
|
||||
"ordercharges": 0,
|
||||
@@ -976,9 +978,12 @@ const Createorder1 = () => {
|
||||
"deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(selectedtime.$d).format('HH:mm:ss')}`,
|
||||
"deliverylocationid": clientinfo.deliverylocationid,
|
||||
"deliveryaddress": clientinfo.address,
|
||||
"pickupaddress": tenantinfo.locationaddress,
|
||||
"pickuplat": tenantinfo.locationlatitude,
|
||||
"pickuplong": tenantinfo.locationlong,
|
||||
// "pickupaddress": tenantinfo.locationaddress,//
|
||||
// "pickuplat": tenantinfo.locationlatitude,//
|
||||
// "pickuplong": tenantinfo.locationlong,//
|
||||
"pickupaddress": tenantinfo.address,//
|
||||
"pickuplat": tenantinfo.latitude,//
|
||||
"pickuplong": tenantinfo.longitude,//
|
||||
"ordernotes": otherinstructions,
|
||||
"remarks": "",
|
||||
"tenantuserid": parseInt(localStorage.getItem('tenantid')),
|
||||
@@ -987,20 +992,29 @@ const Createorder1 = () => {
|
||||
"partnerid": tenant.partnerid,
|
||||
"deliverylat": clientinfo.latitude,
|
||||
"deliverylong": clientinfo.longitude,
|
||||
"applocationid": parseInt(localStorage.getItem('applocationid'))
|
||||
"applocationid": parseInt(localStorage.getItem('applocationid')),
|
||||
|
||||
"deliveryid":clientinfo.customerid,
|
||||
"pickuplocationid":tenantinfo.deliverylocationid
|
||||
|
||||
}]
|
||||
if (!tenantinfo.tenantid) {
|
||||
opentoast('Choose Location')
|
||||
// if (!tenantinfo.tenantid) {
|
||||
// opentoast('Choose Location')
|
||||
|
||||
} else if (!clientinfo.address) {
|
||||
opentoast('Choose Customer')
|
||||
// }
|
||||
// else
|
||||
if(!tenantinfo.address){
|
||||
opentoast('Choose Pickup Location')
|
||||
|
||||
}else
|
||||
if (!clientinfo.address) {
|
||||
opentoast('Choose Drop Location')
|
||||
|
||||
} else if (!selectedtime) {
|
||||
opentoast('Choose Schedule Time')
|
||||
} else {
|
||||
setLoading(true)
|
||||
await axios.post(`${process.env.REACT_APP_URL}/orders/createorders1`, arr)
|
||||
await axios.post(`${process.env.REACT_APP_URL}/orders/createorders`, arr)
|
||||
.then((res) => {
|
||||
if (res.data.status) {
|
||||
enqueueSnackbar('Order Created Successfully', {
|
||||
@@ -1171,14 +1185,14 @@ const Createorder1 = () => {
|
||||
>
|
||||
<Grid item xs={12}
|
||||
>
|
||||
<Stack
|
||||
// direction={{ md: 'row', xs: 'column' }}
|
||||
direction={'row'}
|
||||
sx={{ p: 1, ml: 1,mt:1 }} justifyContent="space-between" alignItems="center" width="100%">
|
||||
<Stack
|
||||
// direction={{ md: 'row', xs: 'column' }}
|
||||
direction={'row'}
|
||||
sx={{ p: 1, ml: 1, mt: 1 }} justifyContent="space-between" alignItems="center" width="100%">
|
||||
<Typography variant="h3">Create Order</Typography>
|
||||
<Button variant="outlined" onClick={() => {
|
||||
setOpen4(true)
|
||||
}} color="success" startIcon={<PlusOutlined />} >Create Customer</Button>
|
||||
<Button variant="outlined" onClick={() => {
|
||||
setOpen4(true)
|
||||
}} color="success" startIcon={<PlusOutlined />} >Create Customer</Button>
|
||||
</Stack>
|
||||
</Grid>
|
||||
</CardActions>
|
||||
@@ -1204,7 +1218,7 @@ const Createorder1 = () => {
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={2} sx={{ height: '100%' }}>
|
||||
<Grid item xs={12} sm={6}
|
||||
sx={{ height: '100%' }}
|
||||
// sx={{ height: '100%' }}
|
||||
>
|
||||
|
||||
<MainCard
|
||||
@@ -1218,13 +1232,22 @@ const Createorder1 = () => {
|
||||
<Autocomplete
|
||||
id="free-solo-demo"
|
||||
sx={{ mt: 2 }}
|
||||
options={tenantlocationlist}
|
||||
// options={tenantlocationlist}
|
||||
options={clientdetailarr}
|
||||
renderInput={(params) => <TextField {...params} label="Choose Location" />}
|
||||
onChange={(e, val) => {
|
||||
if (val) {
|
||||
|
||||
setTenantinfo(val)
|
||||
clientdetails(val.tenantid)
|
||||
|
||||
// clientdetails(val.tenantid)
|
||||
if(clientinfo.customerid == val.customerid){
|
||||
opentoast('choose different Location')
|
||||
setTenantinfo({})
|
||||
|
||||
}else{
|
||||
setTenantinfo(val)
|
||||
|
||||
}
|
||||
} else {
|
||||
setTenantinfo({})
|
||||
}
|
||||
@@ -1235,18 +1258,28 @@ const Createorder1 = () => {
|
||||
disabled={(tenant.tenantid) ? false : true}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Grid item xs={12} >
|
||||
|
||||
<Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1, mt: 2 }}>
|
||||
|
||||
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{tenantinfo.locationaddress || ''}
|
||||
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}
|
||||
{/* {tenantinfo.locationaddress || ''} */}
|
||||
{tenantinfo.address || ''}
|
||||
|
||||
</Typography>
|
||||
|
||||
</Box>
|
||||
|
||||
</Grid>
|
||||
{/* <Grid item xs={12} >
|
||||
<IconButton sx={{p:1,fontSize:'30px',border:'1px solid grey'}}>
|
||||
<SwapVertIcon
|
||||
fontSize='18px'
|
||||
/>
|
||||
</IconButton>
|
||||
</Grid> */}
|
||||
|
||||
<Grid item xs={12} sx={{ height: '100%' }} >
|
||||
<Grid item xs={12} sx={{ height: '100%',mt:5 }} >
|
||||
<FormLabel>Drop Location</FormLabel>
|
||||
|
||||
<Autocomplete
|
||||
@@ -1257,7 +1290,14 @@ const Createorder1 = () => {
|
||||
onChange={(e, val) => {
|
||||
if (val) {
|
||||
|
||||
setClientinfo(val)
|
||||
if(tenantinfo.customerid == val.customerid){
|
||||
opentoast('choose different Location')
|
||||
setClientinfo({})
|
||||
|
||||
}else{
|
||||
setClientinfo(val)
|
||||
|
||||
}
|
||||
} else {
|
||||
setClientinfo({})
|
||||
}
|
||||
@@ -1272,7 +1312,7 @@ const Createorder1 = () => {
|
||||
|
||||
<Box sx={{ border: '1px solid #bdbdbd', p: 1, borderRadius: 1, my: 2 }}>
|
||||
|
||||
<Typography color="secondary" sx={{ mr: 1 }}><EnvironmentOutlined />{' '}{clientinfo.address || ''}
|
||||
<Typography color="secondary" sx={{ mr: 1 }} ><EnvironmentOutlined />{' '}{clientinfo.address || ''}
|
||||
</Typography>
|
||||
|
||||
</Box>
|
||||
@@ -1283,11 +1323,13 @@ const Createorder1 = () => {
|
||||
</MainCard>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} sm={6} sx={{ height: '100%' }}>
|
||||
<Grid item xs={12} sm={6}
|
||||
// sx={{ height: '100%' }}
|
||||
>
|
||||
<MainCard
|
||||
sx={{ height: '100%' }}
|
||||
>
|
||||
<Grid container spacing={2}>
|
||||
<Grid container spacing={2} sx={{ height: '100%' }}>
|
||||
<Grid item xs={12} >
|
||||
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs} sx={{ width: '100%' }}>
|
||||
@@ -1350,7 +1392,17 @@ const Createorder1 = () => {
|
||||
{/* <p>{selectedtime}</p> */}
|
||||
<MainCard sx={{
|
||||
mt: 1,
|
||||
// height: { md: '270px', xs: '100%' }
|
||||
height: { md: '150px' },
|
||||
|
||||
overflowY: "scroll",
|
||||
scrollbarWidth: "thin", // Hide scrollbar in Firefox
|
||||
"&::-webkit-scrollbar": {
|
||||
width: "3px", // Customize the width of the scrollbar
|
||||
},
|
||||
"&::-webkit-scrollbar-thumb": {
|
||||
backgroundColor: "#65387A", // Customize the scrollbar thumb color
|
||||
borderRadius: "6px", // Round the scrollbar thumb
|
||||
},
|
||||
}}>
|
||||
<Grid container spacing={2} >
|
||||
|
||||
@@ -1413,19 +1465,19 @@ const Createorder1 = () => {
|
||||
</Stack>
|
||||
</Box> */}
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Grid item xs={12} >
|
||||
|
||||
|
||||
|
||||
<Grid item xs={12}>
|
||||
{/* <Grid item xs={12}> */}
|
||||
|
||||
|
||||
<TextField id="outlined-multiline-static" sx={{ width: '100%', height: '100%',mb:2 }} multiline rows={1} placeholder='Notes'
|
||||
value={otherinstructions} onChange={(e) => setOtherinstructions(e.target.value)} />
|
||||
<TextField id="outlined-multiline-static" sx={{ width: '100%', height: '100%', mb: 2 }} multiline rows={1} placeholder='Notes'
|
||||
value={otherinstructions} onChange={(e) => setOtherinstructions(e.target.value)} />
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
{/* </Grid> */}
|
||||
|
||||
|
||||
|
||||
@@ -1435,20 +1487,22 @@ const Createorder1 = () => {
|
||||
|
||||
</MainCard>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
<Stack direction='row' justifyContent='flex-end' sx={{ mt: 2, backgroundColor: '#fff' }} >
|
||||
<Button variant='contained' onClick={() => {
|
||||
|
||||
createsubmitobj1()
|
||||
|
||||
}}>Create</Button>
|
||||
|
||||
|
||||
</Stack>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
<Stack direction='row' justifyContent='flex-end' sx={{ mt: 2, backgroundColor: '#fff' }} >
|
||||
<Button variant='contained' onClick={() => {
|
||||
|
||||
createsubmitobj1()
|
||||
|
||||
}}>Create</Button>
|
||||
|
||||
|
||||
</Stack>
|
||||
</Grid>
|
||||
</Grid >
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user