From 4e0606ef599d36b1fe75bb0fdbebdcd13ea6f39b Mon Sep 17 00:00:00 2001 From: Malai Raja Date: Tue, 9 Jan 2024 15:58:22 +0530 Subject: [PATCH] 09012024 --- nearlexpressbuild | 2 +- .../HeaderContent/Profile/ProfileTab.js | 3 + .../Header/HeaderContent/Profile/index.js | 3 +- src/menu-items/other.js | 14 +- src/pages/nearle/clients/createclient.js | 8 +- src/pages/nearle/orders/createorder.js | 15 +- src/pages/nearle/orders/createorder1.js | 156 ++++++++----- src/pages/nearle/orders/orders.js | 214 +++++++++++------- src/routes/MainRoutes.js | 4 +- 9 files changed, 266 insertions(+), 153 deletions(-) diff --git a/nearlexpressbuild b/nearlexpressbuild index 7bbcc45..4148053 160000 --- a/nearlexpressbuild +++ b/nearlexpressbuild @@ -1 +1 @@ -Subproject commit 7bbcc4548e49a186218b17e89fec283bdf8a9627 +Subproject commit 41480533667588fd538f34339cf3e81aaa9a8846 diff --git a/src/layout/MainLayout/Header/HeaderContent/Profile/ProfileTab.js b/src/layout/MainLayout/Header/HeaderContent/Profile/ProfileTab.js index 4c571b7..62f22c1 100644 --- a/src/layout/MainLayout/Header/HeaderContent/Profile/ProfileTab.js +++ b/src/layout/MainLayout/Header/HeaderContent/Profile/ProfileTab.js @@ -15,6 +15,9 @@ const ProfileTab = ({ handleLogout }) => { const navigate=useNavigate(); const handleListItemClick = (event, index) => { setSelectedIndex(index); + if(index == 1){ + navigate('/accountsettings'); + } }; return ( diff --git a/src/layout/MainLayout/Header/HeaderContent/Profile/index.js b/src/layout/MainLayout/Header/HeaderContent/Profile/index.js index af713d1..1cf7699 100644 --- a/src/layout/MainLayout/Header/HeaderContent/Profile/index.js +++ b/src/layout/MainLayout/Header/HeaderContent/Profile/index.js @@ -194,7 +194,8 @@ navigate('/login') sx={{ display: 'flex', flexDirection: 'row', - justifyContent: 'center', + // justifyContent: 'center', + justifyContent: 'flex-start', alignItems: 'center', textTransform: 'capitalize' }} diff --git a/src/menu-items/other.js b/src/menu-items/other.js index 38526bb..be7279a 100644 --- a/src/menu-items/other.js +++ b/src/menu-items/other.js @@ -63,13 +63,13 @@ const other = { url: '/customers', icon: icons.UserOutlined }, - { - id: 'account', - title: , - type: 'item', - url: '/accountsettings', - icon: icons.SettingOutlined - }, + // { + // id: 'account', + // title: , + // type: 'item', + // url: '/accountsettings', + // icon: icons.SettingOutlined + // }, // { // id: 'documentation', // title: , diff --git a/src/pages/nearle/clients/createclient.js b/src/pages/nearle/clients/createclient.js index 064a91a..c5002bc 100644 --- a/src/pages/nearle/clients/createclient.js +++ b/src/pages/nearle/clients/createclient.js @@ -254,9 +254,11 @@ const Createclient = () => { opentoast('Fill post code') } else if (!suburb) { opentoast('Fill suburb') - } else if (!emailaddress) { - opentoast('Fill emailaddress') - } else if (!latlong.lat || !latlong.lng) { + } + // else if (!emailaddress) { + // opentoast('Fill emailaddress') + // } + else if (!latlong.lat || !latlong.lng) { opentoast('Choose valid address') } else { let obj = { diff --git a/src/pages/nearle/orders/createorder.js b/src/pages/nearle/orders/createorder.js index fb72665..21abed4 100644 --- a/src/pages/nearle/orders/createorder.js +++ b/src/pages/nearle/orders/createorder.js @@ -185,6 +185,7 @@ const Createorder = () => { // }]) // console.log(dayjs()) fetchtenantlocation(localStorage.getItem('tenantid')) + clientdetails(localStorage.getItem('tenantid')) } }, []) @@ -550,7 +551,14 @@ const Createorder = () => { setClientdetail(res.data.details) if (!searchword) { - setClientdetailarr(res.data.details) + let arr=[]; + res.data.details.map((val)=>{ + arr.push({ + ...val, + label:`${val.firstname} | ${val.contactno}` + }) + }) + setClientdetailarr(arr) } } @@ -748,7 +756,8 @@ const Createorder = () => { } onChange={(e, val) => { if (val) { @@ -981,7 +990,7 @@ const Createorder = () => { }) if (arr[0]) { if (tenantinfo.tenantid) { - clientdetails(tenant.tenantid); + // clientdetails(tenant.tenantid); setOpen2(true) } else { diff --git a/src/pages/nearle/orders/createorder1.js b/src/pages/nearle/orders/createorder1.js index 3a2cda0..19ad962 100644 --- a/src/pages/nearle/orders/createorder1.js +++ b/src/pages/nearle/orders/createorder1.js @@ -57,6 +57,7 @@ import AccessTimeOutlinedIcon from '@mui/icons-material/AccessTimeOutlined'; import { PopupTransition } from 'components/@extended/Transitions'; // var utc = require('dayjs/plugin/utc') import * as React from 'react'; +import SwapVertIcon from '@mui/icons-material/SwapVert'; import axios from 'axios'; import { useTheme } from '@mui/material/styles'; @@ -757,6 +758,7 @@ const Createorder1 = () => { if (localStorage.getItem('tenantid')) { fetchtenantlocation(localStorage.getItem('tenantid')) + clientdetails(localStorage.getItem('tenantid')) } }, []) @@ -948,11 +950,11 @@ const Createorder1 = () => { arr = [{ "orderheaderid": 0, "tenantid": parseInt(localStorage.getItem('tenantid')), - "locationid": tenantinfo.locationid, - "moduleid": tenantinfo.moduleid, + "locationid": tenant.locationid, + "moduleid": tenant.moduleid, "configid": 7, "orderid": "", - "customerid": clientinfo.customerid, + "customerid": tenantinfo.customerid, "orderdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), "orderstatus": "created", "pending": "", @@ -960,11 +962,11 @@ const Createorder1 = () => { "ready": "", "delivered": "", "cancellled": "", - "promoid": 0, - "promoname": "", - "promoterms": "", - "promovalue": 0, - "promoamount": 0, + // "promoid": 0, + // "promoname": "", + // "promoterms": "", + // "promovalue": 0, + // "promoamount": 0, "orderamount": 0, "taxamount": 0, "ordercharges": 0, @@ -976,9 +978,12 @@ const Createorder1 = () => { "deliverytime": `${dayjs(startdate).format('YYYY-MM-DD')} ${dayjs(selectedtime.$d).format('HH:mm:ss')}`, "deliverylocationid": clientinfo.deliverylocationid, "deliveryaddress": clientinfo.address, - "pickupaddress": tenantinfo.locationaddress, - "pickuplat": tenantinfo.locationlatitude, - "pickuplong": tenantinfo.locationlong, + // "pickupaddress": tenantinfo.locationaddress,// + // "pickuplat": tenantinfo.locationlatitude,// + // "pickuplong": tenantinfo.locationlong,// + "pickupaddress": tenantinfo.address,// + "pickuplat": tenantinfo.latitude,// + "pickuplong": tenantinfo.longitude,// "ordernotes": otherinstructions, "remarks": "", "tenantuserid": parseInt(localStorage.getItem('tenantid')), @@ -987,20 +992,29 @@ const Createorder1 = () => { "partnerid": tenant.partnerid, "deliverylat": clientinfo.latitude, "deliverylong": clientinfo.longitude, - "applocationid": parseInt(localStorage.getItem('applocationid')) + "applocationid": parseInt(localStorage.getItem('applocationid')), + + "deliveryid":clientinfo.customerid, + "pickuplocationid":tenantinfo.deliverylocationid }] - if (!tenantinfo.tenantid) { - opentoast('Choose Location') + // if (!tenantinfo.tenantid) { + // opentoast('Choose Location') - } else if (!clientinfo.address) { - opentoast('Choose Customer') + // } + // else + if(!tenantinfo.address){ + opentoast('Choose Pickup Location') + + }else + if (!clientinfo.address) { + opentoast('Choose Drop Location') } else if (!selectedtime) { opentoast('Choose Schedule Time') } else { setLoading(true) - await axios.post(`${process.env.REACT_APP_URL}/orders/createorders1`, arr) + await axios.post(`${process.env.REACT_APP_URL}/orders/createorders`, arr) .then((res) => { if (res.data.status) { enqueueSnackbar('Order Created Successfully', { @@ -1171,14 +1185,14 @@ const Createorder1 = () => { > - + Create Order - + @@ -1204,7 +1218,7 @@ const Createorder1 = () => { { } onChange={(e, val) => { if (val) { - setTenantinfo(val) - clientdetails(val.tenantid) + + // clientdetails(val.tenantid) + if(clientinfo.customerid == val.customerid){ + opentoast('choose different Location') + setTenantinfo({}) + + }else{ + setTenantinfo(val) + + } } else { setTenantinfo({}) } @@ -1235,18 +1258,28 @@ const Createorder1 = () => { disabled={(tenant.tenantid) ? false : true} /> - + - {' '}{tenantinfo.locationaddress || ''} + {' '} + {/* {tenantinfo.locationaddress || ''} */} + {tenantinfo.address || ''} + + {/* + + + + */} - + Drop Location { onChange={(e, val) => { if (val) { - setClientinfo(val) + if(tenantinfo.customerid == val.customerid){ + opentoast('choose different Location') + setClientinfo({}) + + }else{ + setClientinfo(val) + + } } else { setClientinfo({}) } @@ -1272,7 +1312,7 @@ const Createorder1 = () => { - {' '}{clientinfo.address || ''} + {' '}{clientinfo.address || ''} @@ -1283,11 +1323,13 @@ const Createorder1 = () => { - + - + @@ -1350,7 +1392,17 @@ const Createorder1 = () => { {/*

{selectedtime}

*/} @@ -1413,19 +1465,19 @@ const Createorder1 = () => { */} - + - + {/* */} - setOtherinstructions(e.target.value)} /> + setOtherinstructions(e.target.value)} /> - + {/* */} @@ -1435,20 +1487,22 @@ const Createorder1 = () => {
+ + + + + + + +
- - - - - - -
diff --git a/src/pages/nearle/orders/orders.js b/src/pages/nearle/orders/orders.js index 84f7ec3..e69f7e4 100644 --- a/src/pages/nearle/orders/orders.js +++ b/src/pages/nearle/orders/orders.js @@ -191,12 +191,12 @@ const Orders = () => { label: 'S NO', }, - { - id: 'tenantname', - numeric: false, - disablePadding: false, - label: 'CUSTOMER', - }, + // { + // id: 'tenantname', + // numeric: false, + // disablePadding: false, + // label: 'CUSTOMER', + // }, { id: 'orderid', numeric: false, @@ -206,12 +206,12 @@ const Orders = () => { { id: 'eventname', disablePadding: false, - label: 'Pickup Location', + label: 'Pickup', }, { id: 'eventname4', disablePadding: false, - label: 'Delivery Location', + label: 'Delivery', }, // { // id: 'ordervalue', @@ -603,31 +603,8 @@ const Orders = () => { - - - - - - - {row.customername} - - - {/* {row.identification}*/} - {row.contactno} - - - - - + {row.orderid} @@ -640,31 +617,98 @@ const Orders = () => { {dayjs(row.deliverytime).utc().format('hh:mm A')} - - - {/* {row.eventname} */} - - - {/* {row.pickupaddress.slice(0, 20)} */} - {row.locationsuburb || row.pickupaddress.slice(0, 20)} + {/* + + + + + + + {row.customername} + + + {row.contactno} - + + */} + + + + + + + {row.pickupcustomer} + + + {row.pickupcontactno} + + + + {/* {row.pickupaddress.slice(0, 20)} */} + {row.pickupsuburb || row.pickupaddress.slice(0, 20)} + + + + + + {/* + + */} - - {/* {row.eventname} */} + {/* - {/* {row.deliveryaddress.slice(0, 20)} */} - {row.customersuburb || row.deliveryaddress.slice(0, 20)} + {row.customersuburb || row.deliveryaddress.slice(0, 20)} + */} + + + + + + {row.deliverycustomer} + + + {row.deliverycontactno} + + + + {/* {row.pickupaddress.slice(0, 20)} */} + {row.deliverysuburb || row.deliveryaddress.slice(0, 20)} + + + + @@ -1399,10 +1443,10 @@ const Orders = () => { return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1421,8 +1465,8 @@ const Orders = () => { || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1438,10 +1482,10 @@ const Orders = () => { return (val.orderid.toLowerCase().includes(searchword.toLowerCase()) || val.eventname.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) || val.ordervalue.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1459,8 +1503,8 @@ const Orders = () => { || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1478,8 +1522,8 @@ const Orders = () => { || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1497,8 +1541,8 @@ const Orders = () => { || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1516,8 +1560,8 @@ const Orders = () => { || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -1592,8 +1636,8 @@ const Orders = () => { || val.pickupaddress.toString().toLowerCase().includes(searchword.toLowerCase()) || val.ordernotes.toString().toLowerCase().includes(searchword.toLowerCase()) || val.deliveryaddress.toLowerCase().includes(searchword.toLowerCase()) - || val.customername.toLowerCase().includes(searchword.toLowerCase()) - || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) + // || val.customername.toLowerCase().includes(searchword.toLowerCase()) + // || val.contactno.toString().toLowerCase().includes(searchword.toLowerCase()) ) }) @@ -2072,44 +2116,44 @@ const Orders = () => { {/* */} - + - {(startdate && enddate) && - - - {dayjs(startdate).format('DD/MM/YYYY')} - {dayjs(enddate).format('DD/MM/YYYY')}} variant="combined" color='warning' size='small' /> - - - - } - {(!startdate || !enddate) && - <> + {(startdate && enddate) && - + + {dayjs(startdate).format('DD/MM/YYYY')} - {dayjs(enddate).format('DD/MM/YYYY')}} variant="combined" color='warning' size='small' /> + + - - } + } + {(!startdate || !enddate) && + <> + + + + + } - - + setOpen(true)} > - - - + onClick={() => setOpen(true)} > + + + diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index 208764c..3766556 100644 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -70,11 +70,11 @@ const MainRoutes = { element: }, { - path: 'orders/create', + path: 'orders/create1', element: }, { - path: 'orders/create1', + path: 'orders/create', element: }, {