From d1e2763022880c2548ba4416506c2af1072b2d65 Mon Sep 17 00:00:00 2001 From: dharaneesh-r Date: Mon, 21 Sep 2026 11:06:56 +0530 Subject: [PATCH] Revert "update on th redirection onte create order page" This reverts commit 0da1bd444bb59c37ecfc3af730207dbc3efca7a6. --- src/pages/nearle/orders/createorder1.js | 102 ++++++++++++++---------- 1 file changed, 58 insertions(+), 44 deletions(-) diff --git a/src/pages/nearle/orders/createorder1.js b/src/pages/nearle/orders/createorder1.js index c5e7137..2ccdcc1 100644 --- a/src/pages/nearle/orders/createorder1.js +++ b/src/pages/nearle/orders/createorder1.js @@ -571,48 +571,62 @@ const Createorder1 = () => { // =============================================== || createsubmitobj1 (create orders) || =============================================== const createsubmitobj2 = async () => { - 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, + let arr = {}; + arr = { + orders: { applocationid: tenant.applolcationid, - 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, + 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: '', // ordernotes: otherinstructions, orderstatus: 'created', - 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, + 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, tenantid: tenant.tenantid, - totaltax: 0, - totime: selectedtime.split('-')[1], - weight: weight, + tenantuserid: parseInt(localStorage.getItem('userid')), + collectionamt: +collectionamt || 0, quantity: +quantity || 1 }, @@ -631,8 +645,8 @@ const Createorder1 = () => { email: pickCust.email || '', firstname: pickCust.firstname || '', landmark: pickCust.landmark || '', - latitude: String(pickLat), - longitude: String(pickLng), + latitude: (pickCust.latitude || 0).toString(), + longitude: (pickCust.longitude || 0).toString(), locationid: pickCust.deliverylocationid || 0, postcode: pickCust.postcode || '', primaryaddress: 1, @@ -657,8 +671,8 @@ const Createorder1 = () => { email: dropCust.email || '', firstname: dropCust.firstname || '', landmark: dropCust.landmark || '', - latitude: String(dropLat), - longitude: String(dropLng), + latitude: (dropCust.latitude || 0).toString(), + longitude: (dropCust.longitude || 0).toString(), locationid: dropCust.deliverylocationid || 0, postcode: dropCust.postcode || '', primaryaddress: 1, @@ -683,7 +697,7 @@ const Createorder1 = () => { opentoast('Enter Pickup Postcode ', 'warning', 2000); } else if (!pickCust.landmark) { opentoast('Enter Pickup Landmark ', 'warning', 2000); - } else if (!Number(pickLat) || !Number(pickLng)) { + } else if (!pickCust.latitude || !pickCust.longitude) { 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); @@ -699,7 +713,7 @@ const Createorder1 = () => { opentoast('Enter Drop postcode ', 'warning', 2000); } else if (!dropCust.landmark) { opentoast('Enter Drop Landmark ', 'warning', 2000); - } else if (!Number(dropLat) || !Number(dropLng)) { + } else if (!dropCust.latitude || !dropCust.longitude) { opentoast('Could not locate Drop address on map, please recheck the address', 'error', 3000); } else if (!selectedtime) { opentoast('Choose deliverytime ', 'warning', 2000);