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