update on th redirection onte create order page

This commit is contained in:
2026-09-11 12:13:12 +05:30
parent c85f57324a
commit 0da1bd444b

View File

@@ -571,62 +571,48 @@ const Createorder1 = () => {
// =============================================== || createsubmitobj1 (create orders) || ===============================================
const createsubmitobj2 = async () => {
let arr = {};
arr = {
orders: {
const pickLat = pickCust.latitude || startPoint.latitude || 0;
const pickLng = pickCust.longitude || startPoint.longitude || 0;
const dropLat = dropCust.latitude || endPoint.latitude || 0;
const dropLng = dropCust.longitude || endPoint.longitude || 0;
let arr = {
order: {
amount: Math.round(totalCharge) || 0,
applocationid: tenant.applolcationid,
cancellled: '',
categoryid: +tenant.categoryid,
configid: 7,
customerid: isNumChange1 == 0 ? +pickCust.customerid || 0 : 0,
deliveryaddress: dropCust.address || '',
deliverycharge: +totalCharge.toFixed(2) || 0,
deliverycity: dropCust.city || '',
deliverycontactno: dropCust.contactno || '',
deliverycustomer: dropCust.firstname || '',
deliveryid: isNumChange2 == 0 ? +dropCust.customerid || 0 : 0,
deliverylandmark: dropCust.landmark || '',
deliverylat: (dropCust.latitude || 0).toString(),
deliverylocation: dropCust.suburb || '',
deliverylocationid: dropCust.deliverylocationid || 0,
deliverylong: (dropCust.longitude || 0).toString(),
deliverytime: `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(selectedtime.$d).format('HH:mm:ss')}`,
deliverytype: pickCust.customerid !== 0 || dropCust.customerid !== 0 ? 'B' : 'C',
delivered: '',
itemcount: 1,
kms: distance.toString() || 0,
locationid: +tenanatLocoId, //main or branch
moduleid: +tenant.moduleid,
orderamount: +totalCharge.toFixed(2) || 0,
ordercharges: 0.0,
orderdate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
orderheaderid: 0,
orderid: '', //
categoryid: selectedCatChip,
collectionamount: +collectionamt || 0,
distance: distance || 0,
driverbatchcharge: 0,
drivercommissiontype: 'F',
drivercommissionvalue: 0,
enddate: startdate,
estimatedtime: 0,
eventsno: 0,
fromtime: selectedtime.split('-')[0],
initialdistance: minKm,
initialfare: basePrice,
locationid: 0,
minimumfare: basePrice,
ordernotes: otherinstructions,
orderstatus: 'created',
ordervalue: +totalCharge.toFixed(2) || 0,
partnerid: tenant.partnerid,
paymentstatus: 1,
paymenttype: 42,
pending: '',
pickupaddress: pickCust.address || '',
pickupcity: pickCust.city || '',
pickupcontactno: pickCust.contactno || '',
pickupcustomer: pickCust.firstname || '',
pickuplandmark: pickCust.landmark || '',
pickuplat: (pickCust.latitude || 0).toString(),
pickuplocation: pickCust.suburb || '',
pickuplocationid: pickCust.deliverylocationid || 0,
pickuplong: (pickCust.longitude || 0).toString(),
processing: '',
ready: '',
remarks: '',
smsdelivery: isSms,
subcategoryid: +subCatId,
taxamount: 0.0,
ordertype: deliverytype,
ordervalue: Math.round(totalCharge) || 0,
paymentmode: 'C',
perkmdistance: 0,
priceperkm: pricePerKm,
promocode: '',
promodiscount: 0,
serviceid: 0,
shiftsno: 0,
startdate: startdate,
status: 1,
subcategoryid: subCatId,
tax: 0,
tenantid: tenant.tenantid,
tenantuserid: parseInt(localStorage.getItem('userid')),
collectionamt: +collectionamt || 0,
totaltax: 0,
totime: selectedtime.split('-')[1],
weight: weight,
quantity: +quantity || 1
},
@@ -645,8 +631,8 @@ const Createorder1 = () => {
email: pickCust.email || '',
firstname: pickCust.firstname || '',
landmark: pickCust.landmark || '',
latitude: (pickCust.latitude || 0).toString(),
longitude: (pickCust.longitude || 0).toString(),
latitude: String(pickLat),
longitude: String(pickLng),
locationid: pickCust.deliverylocationid || 0,
postcode: pickCust.postcode || '',
primaryaddress: 1,
@@ -671,8 +657,8 @@ const Createorder1 = () => {
email: dropCust.email || '',
firstname: dropCust.firstname || '',
landmark: dropCust.landmark || '',
latitude: (dropCust.latitude || 0).toString(),
longitude: (dropCust.longitude || 0).toString(),
latitude: String(dropLat),
longitude: String(dropLng),
locationid: dropCust.deliverylocationid || 0,
postcode: dropCust.postcode || '',
primaryaddress: 1,
@@ -697,7 +683,7 @@ const Createorder1 = () => {
opentoast('Enter Pickup Postcode ', 'warning', 2000);
} else if (!pickCust.landmark) {
opentoast('Enter Pickup Landmark ', 'warning', 2000);
} else if (!pickCust.latitude || !pickCust.longitude) {
} else if (!Number(pickLat) || !Number(pickLng)) {
opentoast('Could not locate Pickup address on map, please recheck the address', 'error', 3000);
} else if (!dropCust.firstname) {
opentoast('Enter Drop Contact Name ', 'warning', 2000);
@@ -713,7 +699,7 @@ const Createorder1 = () => {
opentoast('Enter Drop postcode ', 'warning', 2000);
} else if (!dropCust.landmark) {
opentoast('Enter Drop Landmark ', 'warning', 2000);
} else if (!dropCust.latitude || !dropCust.longitude) {
} else if (!Number(dropLat) || !Number(dropLng)) {
opentoast('Could not locate Drop address on map, please recheck the address', 'error', 3000);
} else if (!selectedtime) {
opentoast('Choose deliverytime ', 'warning', 2000);