orders
This commit is contained in:
@@ -36,6 +36,10 @@ import {
|
|||||||
WindowsOutlined
|
WindowsOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
|
import { TbBoxMultiple1 } from 'react-icons/tb';
|
||||||
|
import { GrMultiple } from 'react-icons/gr';
|
||||||
|
import { FaUserPen } from 'react-icons/fa6';
|
||||||
|
import { TbUserEdit } from 'react-icons/tb';
|
||||||
|
|
||||||
// ==============================|| HEADER - CONTENT ||============================== //
|
// ==============================|| HEADER - CONTENT ||============================== //
|
||||||
|
|
||||||
@@ -164,7 +168,7 @@ const HeaderContent = () => {
|
|||||||
primary={
|
primary={
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
||||||
<MailOutlined />
|
<TbBoxMultiple1 />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<Typography color="textPrimary">Create Order</Typography>
|
<Typography color="textPrimary">Create Order</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -183,9 +187,9 @@ const HeaderContent = () => {
|
|||||||
primary={
|
primary={
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
||||||
<MailOutlined />
|
<GrMultiple />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<Typography color="textPrimary">Create Multiple Order</Typography>
|
<Typography color="textPrimary">Create Group Order</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -219,7 +223,7 @@ const HeaderContent = () => {
|
|||||||
primary={
|
primary={
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
<ListItemIcon sx={{ mr: 1, fontSize: '20px' }}>
|
||||||
<UserOutlined />
|
<TbUserEdit />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<Typography color="textPrimary">Create Customer</Typography>
|
<Typography color="textPrimary">Create Customer</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -780,96 +780,6 @@ const Createorder1 = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =============================================== || createsubmitobj1 (create orders) || ===============================================
|
// =============================================== || createsubmitobj1 (create orders) || ===============================================
|
||||||
const createsubmitobj1 = async () => {
|
|
||||||
let arr = [];
|
|
||||||
let timecheck = false;
|
|
||||||
let addresscheck = false;
|
|
||||||
arr = [
|
|
||||||
{
|
|
||||||
orderheaderid: 0,
|
|
||||||
tenantid: parseFloat(tid),
|
|
||||||
locationid: clientinfo.tenantlocationid ? clientinfo.tenantlocationid : tenantinfo.tenantlocationid,
|
|
||||||
moduleid: tenant.moduleid,
|
|
||||||
configid: 7,
|
|
||||||
orderid: '',
|
|
||||||
customerid: tenantinfo.customerid,
|
|
||||||
orderdate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
||||||
orderstatus: 'created',
|
|
||||||
pending: '',
|
|
||||||
processing: '',
|
|
||||||
ready: '',
|
|
||||||
delivered: '',
|
|
||||||
cancellled: '',
|
|
||||||
orderamount: totalCharge,
|
|
||||||
taxamount: 0,
|
|
||||||
ordercharges: 0,
|
|
||||||
ordervalue: totalCharge,
|
|
||||||
itemcount: 1,
|
|
||||||
paymenttype: 64,
|
|
||||||
paymentstatus: 0,
|
|
||||||
deliverycharge: totalCharge,
|
|
||||||
deliverytime: `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(selectedtime.$d).format('HH:mm:ss')}`,
|
|
||||||
deliverylocationid: clientinfo.deliverylocationid,
|
|
||||||
deliveryaddress: clientinfo.address,
|
|
||||||
deliverytype: deliverytype,
|
|
||||||
pickupaddress: tenantinfo.address,
|
|
||||||
pickuplat: startPoint.latitude.toString(),
|
|
||||||
pickuplong: startPoint.longitude.toString(),
|
|
||||||
ordernotes: otherinstructions,
|
|
||||||
remarks: '',
|
|
||||||
tenantuserid: parseInt(localStorage.getItem('userid')),
|
|
||||||
categoryid: tenant.categoryid,
|
|
||||||
subcategoryid: tenant.subcategoryid,
|
|
||||||
partnerid: tenant.partnerid,
|
|
||||||
deliverylat: endPoint.latitude.toString(),
|
|
||||||
deliverylong: endPoint.longitude.toString(),
|
|
||||||
applocationid: parseInt(localStorage.getItem('applocationid')),
|
|
||||||
deliveryid: clientinfo.customerid,
|
|
||||||
pickuplocationid: tenantinfo.deliverylocationid,
|
|
||||||
kms: distance.toString()
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!tid) {
|
|
||||||
opentoast('Choose Client ', 'warning');
|
|
||||||
} else if (!tenantinfo.address) {
|
|
||||||
opentoast('Choose Pickup Location', 'warning');
|
|
||||||
} else if (!clientinfo.address) {
|
|
||||||
opentoast('Choose Drop Location', 'warning');
|
|
||||||
} else if (!selectedtime) {
|
|
||||||
opentoast('Choose Schedule Time', 'warning');
|
|
||||||
} else {
|
|
||||||
setLoading(true);
|
|
||||||
|
|
||||||
await axios
|
|
||||||
.post(`${process.env.REACT_APP_URL}/orders/createorders`, arr)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data.status) {
|
|
||||||
enqueueSnackbar('Order Created Successfully', {
|
|
||||||
variant: 'success',
|
|
||||||
anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
|
||||||
autoHideDuration: 1000
|
|
||||||
});
|
|
||||||
if (admintoken) {
|
|
||||||
// notifyadmin(admintoken);
|
|
||||||
sendnotifications();
|
|
||||||
}
|
|
||||||
|
|
||||||
navigate('/orders');
|
|
||||||
} else {
|
|
||||||
opentoast(res.data.message, 'warning');
|
|
||||||
}
|
|
||||||
setLoading(false);
|
|
||||||
console.log(res);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
opentoast(err.data.message, 'warning');
|
|
||||||
setLoading(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.log(arr);
|
|
||||||
};
|
|
||||||
|
|
||||||
const createsubmitobj2 = async () => {
|
const createsubmitobj2 = async () => {
|
||||||
let arr = {};
|
let arr = {};
|
||||||
@@ -878,7 +788,7 @@ const Createorder1 = () => {
|
|||||||
applocationid: tenant.applolcationid,
|
applocationid: tenant.applolcationid,
|
||||||
cancellled: '',
|
cancellled: '',
|
||||||
categoryid: +tenant.categoryid,
|
categoryid: +tenant.categoryid,
|
||||||
configid: +localStorage.getItem('configid'),
|
configid: 7,
|
||||||
customerid: isNumChange1 == 0 ? +pickCust.customerid || 0 : 0,
|
customerid: isNumChange1 == 0 ? +pickCust.customerid || 0 : 0,
|
||||||
deliveryaddress: dropCust.address || '',
|
deliveryaddress: dropCust.address || '',
|
||||||
deliverycharge: +totalCharge.toFixed(2) || 0,
|
deliverycharge: +totalCharge.toFixed(2) || 0,
|
||||||
@@ -934,7 +844,7 @@ const Createorder1 = () => {
|
|||||||
address: pickCust.address || '',
|
address: pickCust.address || '',
|
||||||
applocationid: tenant.applolcationid,
|
applocationid: tenant.applolcationid,
|
||||||
city: pickCust.city || '',
|
city: pickCust.city || '',
|
||||||
configid: parseInt(localStorage.getItem('configid')),
|
configid: 7,
|
||||||
contactno: pickCust.contactno || '',
|
contactno: pickCust.contactno || '',
|
||||||
customertoken: '',
|
customertoken: '',
|
||||||
customerid: isNumChange1 == 0 ? pickCust.customerid || 0 : 0,
|
customerid: isNumChange1 == 0 ? pickCust.customerid || 0 : 0,
|
||||||
@@ -960,7 +870,7 @@ const Createorder1 = () => {
|
|||||||
address: dropCust.address || '',
|
address: dropCust.address || '',
|
||||||
applocationid: tenant.applolcationid,
|
applocationid: tenant.applolcationid,
|
||||||
city: dropCust.city || '',
|
city: dropCust.city || '',
|
||||||
configid: parseInt(localStorage.getItem('configid')),
|
configid: 7,
|
||||||
contactno: dropCust.contactno || '',
|
contactno: dropCust.contactno || '',
|
||||||
customertoken: '',
|
customertoken: '',
|
||||||
customerid: isNumChange2 == 0 ? dropCust.customerid || 0 : 0,
|
customerid: isNumChange2 == 0 ? dropCust.customerid || 0 : 0,
|
||||||
|
|||||||
@@ -537,7 +537,8 @@ const MultipleOrders = () => {
|
|||||||
deliverylocation: customer.suburb || '',
|
deliverylocation: customer.suburb || '',
|
||||||
deliverylocationid: customer.deliverylocationid || 0,
|
deliverylocationid: customer.deliverylocationid || 0,
|
||||||
deliverylong: customer.longitude.toString(),
|
deliverylong: customer.longitude.toString(),
|
||||||
deliverytime: `${dayjs(startdate).format('YYYY-MM-DD')} `,
|
// deliverytime: `${dayjs(startdate).format('YYYY-MM-DD HH:mm:ss')} `,
|
||||||
|
deliverytime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
deliverytype: 'B',
|
deliverytype: 'B',
|
||||||
delivered: '',
|
delivered: '',
|
||||||
itemcount: 1,
|
itemcount: 1,
|
||||||
@@ -579,15 +580,7 @@ const MultipleOrders = () => {
|
|||||||
|
|
||||||
if (!tenId) {
|
if (!tenId) {
|
||||||
opentoast('Choose Client ', 'warning');
|
opentoast('Choose Client ', 'warning');
|
||||||
}
|
} else {
|
||||||
// else if (!tenantinfo.address) {
|
|
||||||
// opentoast('Choose Pickup Location', 'warning');
|
|
||||||
// } else if (!clientinfo.address) {
|
|
||||||
// opentoast('Choose Drop Location', 'warning');
|
|
||||||
// } else if (!selectedtime) {
|
|
||||||
// opentoast('Choose Schedule Time', 'warning');
|
|
||||||
// }
|
|
||||||
else {
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
await axios
|
await axios
|
||||||
@@ -638,7 +631,7 @@ const MultipleOrders = () => {
|
|||||||
>
|
>
|
||||||
<Grid item xs={12} sx={{ width: '100%', mt: -1 }}>
|
<Grid item xs={12} sx={{ width: '100%', mt: -1 }}>
|
||||||
<Stack direction={'row'} alignItems={'center'} justifyContent={'space-between'}>
|
<Stack direction={'row'} alignItems={'center'} justifyContent={'space-between'}>
|
||||||
<Typography variant="h3"> Create Multiple Order</Typography>
|
<Typography variant="h3"> Group Orders</Typography>
|
||||||
{tenantLocations.length == 1 ? (
|
{tenantLocations.length == 1 ? (
|
||||||
<TextField
|
<TextField
|
||||||
// disabled={!isAppLocation || !isClient}
|
// disabled={!isAppLocation || !isClient}
|
||||||
|
|||||||
Reference in New Issue
Block a user