From c0273fcf6930a868ca3ca86bf32768ea8b0237fc Mon Sep 17 00:00:00 2001 From: joshikannan Date: Fri, 26 Apr 2024 11:22:56 +0530 Subject: [PATCH] orders --- .../MainLayout/Header/HeaderContent/index.js | 12 ++- src/pages/nearle/orders/createorder1.js | 96 +------------------ src/pages/nearle/orders/multipleOrders.js | 15 +-- 3 files changed, 15 insertions(+), 108 deletions(-) diff --git a/src/layout/MainLayout/Header/HeaderContent/index.js b/src/layout/MainLayout/Header/HeaderContent/index.js index cb41d1e..0d054d5 100644 --- a/src/layout/MainLayout/Header/HeaderContent/index.js +++ b/src/layout/MainLayout/Header/HeaderContent/index.js @@ -36,6 +36,10 @@ import { WindowsOutlined } from '@ant-design/icons'; 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 ||============================== // @@ -164,7 +168,7 @@ const HeaderContent = () => { primary={ - + Create Order @@ -183,9 +187,9 @@ const HeaderContent = () => { primary={ - + - Create Multiple Order + Create Group Order } /> @@ -219,7 +223,7 @@ const HeaderContent = () => { primary={ - + Create Customer diff --git a/src/pages/nearle/orders/createorder1.js b/src/pages/nearle/orders/createorder1.js index 1922cf2..34096c2 100644 --- a/src/pages/nearle/orders/createorder1.js +++ b/src/pages/nearle/orders/createorder1.js @@ -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, diff --git a/src/pages/nearle/orders/multipleOrders.js b/src/pages/nearle/orders/multipleOrders.js index a483a86..e3d384a 100644 --- a/src/pages/nearle/orders/multipleOrders.js +++ b/src/pages/nearle/orders/multipleOrders.js @@ -537,7 +537,8 @@ const MultipleOrders = () => { deliverylocation: customer.suburb || '', deliverylocationid: customer.deliverylocationid || 0, 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', delivered: '', itemcount: 1, @@ -579,15 +580,7 @@ const MultipleOrders = () => { if (!tenId) { 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 { + } else { setLoading(true); await axios @@ -638,7 +631,7 @@ const MultipleOrders = () => { > - Create Multiple Order + Group Orders {tenantLocations.length == 1 ? (