orders
This commit is contained in:
@@ -780,96 +780,6 @@ const Createorder1 = () => {
|
||||
}
|
||||
|
||||
// =============================================== || 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 () => {
|
||||
let arr = {};
|
||||
@@ -878,7 +788,7 @@ const Createorder1 = () => {
|
||||
applocationid: tenant.applolcationid,
|
||||
cancellled: '',
|
||||
categoryid: +tenant.categoryid,
|
||||
configid: +localStorage.getItem('configid'),
|
||||
configid: 7,
|
||||
customerid: isNumChange1 == 0 ? +pickCust.customerid || 0 : 0,
|
||||
deliveryaddress: dropCust.address || '',
|
||||
deliverycharge: +totalCharge.toFixed(2) || 0,
|
||||
@@ -934,7 +844,7 @@ const Createorder1 = () => {
|
||||
address: pickCust.address || '',
|
||||
applocationid: tenant.applolcationid,
|
||||
city: pickCust.city || '',
|
||||
configid: parseInt(localStorage.getItem('configid')),
|
||||
configid: 7,
|
||||
contactno: pickCust.contactno || '',
|
||||
customertoken: '',
|
||||
customerid: isNumChange1 == 0 ? pickCust.customerid || 0 : 0,
|
||||
@@ -960,7 +870,7 @@ const Createorder1 = () => {
|
||||
address: dropCust.address || '',
|
||||
applocationid: tenant.applolcationid,
|
||||
city: dropCust.city || '',
|
||||
configid: parseInt(localStorage.getItem('configid')),
|
||||
configid: 7,
|
||||
contactno: dropCust.contactno || '',
|
||||
customertoken: '',
|
||||
customerid: isNumChange2 == 0 ? dropCust.customerid || 0 : 0,
|
||||
|
||||
Reference in New Issue
Block a user