import React from 'react'; import { Avatar, Pagination, Tooltip, stepContentClasses } from '@mui/material'; import { useEffect, useRef, useState, Fragment, useMemo } from 'react'; import { useTheme } from '@mui/material/styles'; import Skeleton from '@mui/material/Skeleton'; import HeartFilled from '@mui/icons-material/Favorite'; // import dayjs from "dayjs"; import Loader from 'components/Loader'; import CloseIcon from '@mui/icons-material/Close'; import { FilterList } from '@mui/icons-material'; import { FaRegEdit } from 'react-icons/fa'; import { RiEdit2Fill } from 'react-icons/ri'; import { enqueueSnackbar } from 'notistack'; import { Box, Button, IconButton, ClickAwayListener, Collapse, Dialog, Grid, Menu, MenuItem, Popper, Stack, TextField, Typography, useMediaQuery, Chip, OutlinedInput, InputAdornment, List, Divider, ListItemButton, ListItemAvatar, ListItemText, DialogTitle, DialogContent, DialogActions, InputLabel, Table, TableContainer, TableHead, TableCell, TableBody, TableRow, Autocomplete } from '@mui/material'; import Geocode from 'react-geocode'; import LocationOnIcon from '@mui/icons-material/LocationOn'; import parse from 'autosuggest-highlight/parse'; import { debounce } from '@mui/material/utils'; import ClearIcon from '@mui/icons-material/Clear'; import { MdPersonAdd } from 'react-icons/md'; // import { MdAccountCircle } from "react-icons/md"; import { MdPersonAddDisabled } from 'react-icons/md'; // import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; // import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; // import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { ThemeMode } from 'config'; // import { FaUserLarge } from "react-icons/fa6"; import { MoreOutlined, SearchOutlined, DeleteFilled } from '@ant-design/icons'; // import ChatDrawer from "sections/apps/chat/ChatDrawer"; // import ChatHistory from "sections/apps/chat/ChatHistory"; // import UserAvatar from "sections/apps/chat/UserAvatar"; // import UserDetails from "sections/apps/chat/UserDetails"; import MainCard from 'components/MainCard'; // import IconButton from "components/@extended/IconButton"; // import SimpleBar from "components/third-party/SimpleBar"; import { PopupTransition } from 'components/@extended/Transitions'; import axios from 'axios'; // import HoverSocialCard from "../../pages/reports/HoverSocialCard"; import HoverSocialCard from 'components/cards/statistics/HoverSocialCard'; // import TasksCard from "sections/widget/data/TasksCard"; // import ApplicationSales from "sections/widget/data/ApplicationSales"; // import Button from "themes/overrides/Button"; import { styled } from '@mui/material/styles'; // import TableRow from "themes/overrides/TableRow"; import dayjs from 'dayjs'; var utc = require('dayjs/plugin/utc'); dayjs.extend(utc); import { DateRangePicker } from 'mui-daterange-picker'; import { addDays, addMonths, addWeeks, // addYears, endOfMonth, endOfWeek, // endOfYear, startOfMonth, startOfWeek // startOfYear, } from 'date-fns'; const drawerWidth = 320; // const Main = styled("main", { shouldForwardProp: (prop) => prop !== "open" })( // ({ theme, open }) => ({ // flexGrow: 1, // transition: theme.transitions.create("margin", { // easing: theme.transitions.easing.sharp, // duration: theme.transitions.duration.shorter, // }), // marginLeft: `-${drawerWidth}px`, // [theme.breakpoints.down("lg")]: { // paddingLeft: 0, // marginLeft: 0, // }, // ...(open && { // transition: theme.transitions.create("margin", { // easing: theme.transitions.easing.easeOut, // duration: theme.transitions.duration.shorter, // }), // marginLeft: 0, // }), // }) // ); // ==============================|| google address ||============================== // const GOOGLE_MAPS_API_KEY = process.env.REACT_APP_GOOGLE_MAPS_API_KEY; function loadScript(src, position, id) { if (!position) { return; } const script = document.createElement('script'); script.setAttribute('async', ''); script.setAttribute('id', id); script.src = src; position.appendChild(script); } const autocompleteService = { current: null }; const BootstrapDialog = styled(Dialog)(({ theme }) => ({ '& .MuiDialog-paperWidthSm': { maxWidth: '60%', width: '100%', margin: 0 }, '& .MuiDialogContent-root': { padding: theme.spacing(2) }, '& .MuiDialogActions-root': { padding: theme.spacing(1) } })); const Customers = () => { const theme = useTheme(); const [search, setSearch] = useState(''); const [loading, setLoading] = useState(false); const [data, setData] = useState([]); const [users, setUsers] = useState([]); const [userName, setUserName] = useState(''); const [usernameload, setUsernameload] = useState(false); const [customerId, setCustomerId] = useState(''); const [custVisits, setCustVisits] = useState([]); const [custService, setCustService] = useState([]); const [custMembership, setCustMembership] = useState({}); const [visits, setvisits] = useState(0); const [billAmount, setBillAmount] = useState(0); const [promotions, setPromotions] = useState(0); const [discount, setDiscount] = useState(0); const [pageno, setPageno] = useState(1); const [contactno, setContactno] = useState(''); const ref = useRef(null); const [open, setOpen] = React.useState(false); const [open3, setOpen3] = React.useState(false); const [open4, setOpen4] = React.useState(false); const [selectedCustomer, setSelectedCustomer] = useState({}); // to edit const [packDays, setPackDays] = useState(0); const [startDate, setStartDate] = useState(''); const [validDate, setValidDate] = useState(''); const [orderlist, setOrderlist] = useState([]); const [allorders, setAllorders] = useState(''); const [coveredorders, setCoveredorders] = useState(''); const [uncoveredorders, setUncoveredorders] = useState(''); const [cancelled, setCancelled] = useState(''); const [percentage1, setPercentage1] = useState('0'); const [percentage2, setPercentage2] = useState('0'); const [percentage3, setPercentage3] = useState('0'); const [percentage4, setPercentage4] = useState('0'); const [tempusers, setTempusers] = useState([]); const [startdate, setStartdate] = useState(dayjs().format('YYYY-MM-DD')); const [enddate, setEnddate] = useState(dayjs().format('YYYY-MM-DD')); const [datestatus, setDatestatus] = useState('Today'); const [tenid, setTenid] = useState(''); const [loading1, setLoading1] = useState(false); const [currentcustomerid, setCurrentcustomerid] = useState(''); const [address, setAddress] = useState(''); const [latlong, setLatlong] = useState({}); // ==============================|| for google address ||============================== // const [value, setValue] = useState(null); const [inputValue, setInputValue] = useState(''); const [options, setOptions] = useState([]); const loaded = useRef(false); if (typeof window !== 'undefined' && !loaded.current) { if (!document.querySelector('#google-maps')) { loadScript( `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=places`, document.querySelector('head'), 'google-maps' ); } loaded.current = true; } const fetch = useMemo( () => debounce((request, callback) => { autocompleteService.current.getPlacePredictions(request, callback); }, 400), [] ); useEffect(() => { let active = true; if (!autocompleteService.current && window.google) { autocompleteService.current = new window.google.maps.places.AutocompleteService(); } if (!autocompleteService.current) { return undefined; } if (inputValue === '') { setOptions(value ? [value] : []); return undefined; } fetch({ input: inputValue }, (results) => { if (active) { let newOptions = []; if (value) { newOptions = [value]; } if (results) { newOptions = [...newOptions, ...results]; } setOptions(newOptions); } }); return () => { active = false; }; }, [value, inputValue, fetch]); Geocode.setApiKey(process.env.REACT_APP_GOOGLE_MAPS_API_KEY); useEffect(() => { try { console.log('selected address =>', address); Geocode.fromAddress(address).then( (response) => { console.log('lat long response =>', response.results[0]); if (response.status == 'OK') { const { lat, lng } = response.results[0].geometry.location; setLatlong({ lat, lng }); setSelectedCustomer({ ...selectedCustomer, latitude: lat, longitude: lng }); } }, (error) => { console.log(error); } ); } catch (err) { console.log(err); } }, [address]); useEffect(() => { selectedCustomer && setLatlong({ lat: selectedCustomer.latitude, lng: selectedCustomer.longitude }); }, [selectedCustomer]); const openToast = (message, variant, duration) => { enqueueSnackbar(message, { variant: variant, anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: duration }); }; useEffect(() => { console.log('selectedCustomer', selectedCustomer); }, [selectedCustomer]); // ==============================|| for dialog ||============================== // const handleClickOpen4 = () => { setOpen4(true); }; const handleClose4 = () => { setOpen4(false); }; /* ============================================= || handleKeyPress (ctrl+k)| ============================================= */ const textFieldRef = useRef(null); useEffect(() => { const handleKeyPress = (event) => { if (event.key === 'k' && (event.metaKey || event.ctrlKey)) { event.preventDefault(); textFieldRef.current.focus(); } if (event.key === 'Escape' && document.activeElement === textFieldRef.current) { // Remove focus from the TextField textFieldRef.current.blur(); } }; document.addEventListener('keydown', handleKeyPress); return () => { document.removeEventListener('keydown', handleKeyPress); }; }, []); const handleClickOpen = () => { setOpen(true); }; const handleClose = () => { setOpen3(false); }; const handleClose3 = () => { setOpen3(false); }; // const [anchorEl]=useState(null) // const tenid = window.localStorage.getItem("tenantid"); useEffect(() => { // setUsernameload(false); console.log('username', userName); }, [userName]); const [anchorEl, setAnchorEl] = useState(); const handleClickRightMenu = (event) => { setAnchorEl(event?.currentTarget); }; const handleCloseRightMenu = () => { setAnchorEl(null); }; const handleClickSort = (event) => { setAnchorEl(event?.currentTarget); }; const handleCloseSort = () => { setAnchorEl(null); }; useEffect(() => { if (localStorage.getItem('tenantid')) { fetchtable(localStorage.getItem('tenantid')); } }, []); useEffect(() => { if (tenid && !search) { // fetchData1(); } }, [pageno]); useEffect(() => { const fetchsearch = async () => { setLoading(true); try { await axios .get(`${process.env.REACT_APP_URL}/customers/search?tenantid=${tenid}&keyword=${search}`) .then((response) => { if (response.data.status) { setUsers(response.data.details || []); setLoading(false); } }) .catch((err) => { console.log(err); setLoading(false); }); } catch (error) { console.error('Error fetching data:', error); setLoading(false); } }; if (search.length > 2) { // fetchsearch(); } else if (!search) { // fetchData1(); setPageno(1); } }, [search]); useEffect(() => { if (search) { let arr = tempusers.filter((val) => { return ( val.firstname.toLowerCase().includes(search.toLowerCase()) || // || val.deliveryaddress.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(search.toLowerCase()) ); }); console.log(arr); setUsers([...arr]); } else { setUsers([...tempusers]); } }, [search]); useEffect(() => { if (tenid) { fetchData(tenid); } }, [startdate, enddate]); const fetchpercentage = async (tid) => { setLoading(true); try { // await axios.get(`${process.env.REACT_APP_URL}/orders/getordersummary/?tenantid=${tid}&fromdate=${startdate}&todate=${enddate}`) await axios .get(`${process.env.REACT_APP_URL}/orders/getordersummary/?customerid=${tid}`) .then((res) => { console.log(res); // setConfirmed(res.data.details.confirmed.toString()); // setModified(res.data.details.modified.toString()); setAllorders(res.data.details.total.toString()); setCoveredorders(res.data.details.delivered.toString()); setCancelled(res.data.details.cancelled.toString()); setUncoveredorders(res.data.details.pending.toString()); // setActiveorders(res.data.details.assigned.toString()); // setAssigned(res.data.details.accepted.toString()); // setCreated(res.data.details.created.toString()) // setClosed(res.data.details.delivered.toString()); // setPicked(res.data.details.picked.toString()) setPercentage1((Math.round((res.data.details.total / res.data.details.total) * 100) || 0).toString()); setPercentage3((Math.round((res.data.details.delivered / res.data.details.total) * 100) || 0).toString()); setPercentage4((Math.round((res.data.details.cancelled / res.data.details.total) * 100) || 0).toString()); setPercentage2((Math.round((res.data.details.pending / res.data.details.total) * 100) || 0).toString()); setLoading(false); }) .catch((err) => { console.log(err); setLoading(false); // enqueueSnackbar(err.message, { // variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, // autoHideDuration: 2000 // }) }); } catch (err) { console.log(err); setLoading(false); } }; const removeclient = async () => { setLoading(true); try { await axios .delete(`${process.env.REACT_APP_URL}/customers/delete/?customerid=${currentcustomerid}`) .then((res) => { if (res.data.status) { enqueueSnackbar('Deleted Successfully', { variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }); setCurrentcustomerid(''); // fetchtable(localStorage.getItem('tenantid')) } else { enqueueSnackbar(res.data.message, { variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }); } setLoading(false); }) .catch((err) => { console.log(err); enqueueSnackbar(err.message, { variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }); setLoading(false); }); } catch (err) { console.log(err); setLoading(false); } }; const fetchtable = async (tid) => { setLoading1(true); try { // await axios.get(`${process.env.REACT_APP_URL}/tenants/gettenants/?partnerid=${tid}&status=active`) await axios .get(`${process.env.REACT_APP_URL}/customers/getbytid/?tenantid=${tid}`) .then((res) => { if (res.data.message === 'Success') { let arr = []; res.data.details.map((val, i) => { arr = [...arr, { ...val, sno: i + 1 }]; }); // setArr(arr) // setRows([...arr]) // setStafflist([...arr]) setSelectedCustomer(arr[0]); setUsers([...arr]); setTempusers([...arr]); // if(arr[0].customerid){ setTenid(arr[0].customerid); setUserName(arr[0].firstname || ''); setContactno(arr[0].contactno || ''); fetchpercentage(arr[0].customerid); fetchData(arr[0].customerid); // } console.log(res.data.Details); console.log(arr); setLoading1(false); } }) .catch((err) => { console.log(err); setLoading1(false); enqueueSnackbar(err.message, { variant: 'error', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }); }); } catch (err) { console.log(err); setLoading1(false); } }; const fetchData1 = async () => { setLoading(true); try { await axios .get(`${process.env.REACT_APP_URL}/customers/getbytid?tenantid=${tenid}&pageno=${pageno}&pagesize=20`) .then((response) => { if (response.data.status) { setUsers( response.data.details // .slice(0, 10) ); setUserName(response.data.details[0].firstname || ''); setContactno(response.data.details[0].contactno || ''); fetchData(response.data.details[0].customerid); // fetchData(user.customerid); } setLoading(false); }) .catch((err) => { console.log(err); setLoading(false); }); } catch (error) { console.error('Error fetching data:', error); setLoading(false); } }; const fetchData = async (tid) => { try { await axios .get( `${process.env.REACT_APP_URL}/orders/customer/getorders/?customerid=${tid}&status=delivered&fromdate=${startdate}&todate=${enddate}` ) .then((res) => { if (res.data.message === 'Success') { let arr = []; res.data.details.map((val, i) => { arr = [...arr, { ...val, sno: i + 1 }]; }); // setArruncovered(arr) setOrderlist([...arr]); } }) .catch((err) => { console.log(err); }); } catch (err) { console.log(err); } }; useEffect(() => { console.log('packDays', packDays); console.log('startDate', startDate); const formattedDate = dayjs(startDate, 'DD/MM/YYYY').add(packDays, 'day').format('DD/MM/YYYY'); setValidDate(formattedDate); }, [packDays, startDate]); function AlertCustomerDelete({ // title, open, handleClose }) { // const [deletepassword, setDeletepassword] = useState(''); return ( handleClose(false)} maxWidth="xs"> {/* */} Are you sure you want to Remove this Customer? {/* Please type in the order number to confirm. */} {/* { console.log(e.target.value) setDeletepassword(e.target.value) }} error={deletepassword !== orderid.slice(4)} value={deletepassword} /> */} ); } // ==============================|| updateCustomer (post)||============================== // const updateCustomer = async () => { if (!selectedCustomer.firstname) { openToast('Enter Door NO', 'warning', 1500); } else if (!selectedCustomer.contactno) { openToast('Enter Contact Number ', 'warning', 1500); } else if (!selectedCustomer.address) { openToast('Enter Valid Address', 'warning', 1500); } else if (!selectedCustomer.doorno) { openToast('Enter Door Number ', 'warning', 1500); } else if (!selectedCustomer.suburb) { openToast('Enter Suburb', 'warning', 1500); } else if (!selectedCustomer.city) { openToast('Enter City ', 'warning', 1500); } else if (!selectedCustomer.state) { openToast('Enter State', 'warning', 1500); } else if (!selectedCustomer.postcode) { openToast('Enter PostCode', 'warning', 1500); } else if (!selectedCustomer.landmark) { openToast('Enter Landmark', 'warning', 1500); } else if (!selectedCustomer.latitude) { openToast('Enter Latitude', 'warning', 1500); } else if (!selectedCustomer.longitude) { openToast('Enter Longitude', 'warning', 1500); } else { try { const postUpdateResponse = await axios.put(`${process.env.REACT_APP_URL}/customers/update`, { customerid: selectedCustomer.customerid, configid: 1, firstname: selectedCustomer.firstname, applocationid: selectedCustomer.applocationid, profileimage: '', dialcode: '+91', contactno: selectedCustomer.contactno, devicetype: '', deviceid: '', customertoken: '123', address: selectedCustomer.address, suburb: selectedCustomer.suburb, city: selectedCustomer.city, state: selectedCustomer.state, postcode: selectedCustomer.postcode, landmark: selectedCustomer.landmark, doorno: selectedCustomer.doorno, latitude: selectedCustomer.latitude.toString(), longitude: selectedCustomer.longitude.toString() }); console.log('postUpdateResponse', postUpdateResponse); if (postUpdateResponse.data.status) { openToast(postUpdateResponse.data.message, 'success', 1500); handleClose4(); fetchtable(localStorage.getItem('tenantid')); } } catch (error) { console.log('postUpdate error', error); } } }; return ( <> {(loading || usernameload) && } Customers {/* Customers */} setSearch(e.target.value)} // onChange={handleSearch} sx={{ '& .MuiOutlinedInput-input': { p: '10.5px 0px 12px' } }} startAdornment={ } endAdornment={ { setSearch(''); }} > } /> {/* */} {/* */} {loading1 ? ( <> {[1, 2, 3, 4, 5, 6, 7, 8, 9].map((val1) => { return ( <> ); })} {/* */} ) : ( {users.map((user, index) => ( { setTenid(user.customerid); setUserName(user.firstname); setContactno(user.contactno); fetchData(user.customerid); fetchpercentage(user.customerid); setSelectedCustomer(user); }} > {user.firstname} {/* {user.lastMessage} */} } secondary={ {user.contactno} {/* {user.unReadChatCount ? ( ) : ( // chance.bool() - use for last send msg was read or unread )} */} } /> ))} )} {/* { let val = pageno; if (val > 1) { val = val - 1; setPageno(val); } }} > {pageno} { let val = pageno; if (val > 0 && !search) { val = val + 1; setPageno(val); } }} > */} {/* */} {users.length} Customers {/* */} {/*
*/} {userName ? ( {userName} {contactno} ) : ( )} {custMembership.membershipid == 0 && custMembership.startdate == '' ? ( <>{/*

No Membership Found

*/} ) : ( <> {custMembership.membershipid && ( <> } variant="caption" label={custMembership.membershipno || ''} style={{ width: 'auto', height: 'auto', color: 'black', background: 'white' }} /> {/* {/* {custMembership.validityperiod || ''} Days */} {/* {` ${custMembership.string}` || ''} */} )}{' '} )} {/* ======================================== || Add Membership dialog|| ======================================== */} {/* {" "}
{" "} {`${userName} (${contactno})`}
Membership Number Select Package { setPackDays(e.target.value); console.log(e.target.value); }} > Trendy (30 days) {" "} Premiun (60 days) {" "} Gold (90 days) {" "} Platinum (365 days) Start Date ( )} onChange={(e) => { setStartDate( e.format("DD/MM/YYYY") ); console.log( e.format("DD/MM/YYYY") ); }} /> Validity ( )} />
*/}
{/* */} {/* Delete */}
{/* ======================================== || Edit Dialog || ======================================== */} Edit Customer Customer Name { setSelectedCustomer({ ...selectedCustomer, firstname: e.target.value }); }} /> {' '} Contact Number { setSelectedCustomer({ ...selectedCustomer, contactno: e.target.value }); }} inputProps={{ maxLength: 10 }} /> {' '} Address (typeof option === 'string' ? option : option.description)} filterOptions={(x) => x} options={options} autoComplete includeInputInList filterSelectedOptions value={selectedCustomer.address} noOptionsText="No locations" onChange={(event, newValue) => { setOptions(newValue ? [newValue, ...options] : options); setValue(newValue); console.log('newValue', newValue.description); setAddress(newValue.description); setSelectedCustomer({ ...selectedCustomer, address: newValue.description }); }} onInputChange={(event, newInputValue) => { setInputValue(newInputValue); }} renderInput={(params) => } renderOption={(props, option) => { const matches = option.structured_formatting.main_text_matched_substrings || []; const parts = parse( option.structured_formatting.main_text, matches.map((match) => [match.offset, match.offset + match.length]) ); return (
  • {parts.map((part, index) => ( {part.text} ))} {option.structured_formatting.secondary_text}
  • ); }} />
    {' '} Door No { setSelectedCustomer({ ...selectedCustomer, doorno: e.target.value }); }} /> Suburb { setSelectedCustomer({ ...selectedCustomer, suburb: e.target.value }); }} /> {' '} City { setSelectedCustomer({ ...selectedCustomer, city: e.target.value }); }} /> {' '} State { setSelectedCustomer({ ...selectedCustomer, state: e.target.value }); }} /> {' '} Postcode { setSelectedCustomer({ ...selectedCustomer, postcode: e.target.value }); }} /> {' '} Landmark { setSelectedCustomer({ ...selectedCustomer, landmark: e.target.value }); }} /> {' '} Latitude {' '} Longitude
    {/* ======================================== || Cards || ======================================== */} {/* */} {/* */} : allorders} // percentage={percentage1.toString()} color={theme.palette.primary.main} /> : uncoveredorders} // percentage={percentage2.toString()} color={theme.palette.warning.main} /> : coveredorders} // percentage={percentage3.toString()} color={theme.palette.success.main} /> : cancelled} // percentage={percentage4.toString()} color={theme.palette.secondary[600]} /> {/* */} // 'View all' // {/* */} // } secondary={ setOpen(true)} > } > {/* # Sales Avg. Price Total */} # CUSTOMER ORDER ID PICKUP DELIVERY STATUS {orderlist.map((row, index) => ( <> {/* {row.customername} {row.contactno} */} {/* {row.product} {row.date} {row.badgeText} */} {row.sno} {row.customername} {row.contactno} {row.orderid} {dayjs(row.deliverytime).utc().format('DD/MM/YYYY')} {dayjs(row.deliverytime).utc().format('hh:mm A')} {/* {row.pickupaddress.slice(0, 20)} */} {row.locationsuburb || row.pickupaddress.slice(0, 20)} {/* {row.deliveryaddress.slice(0, 20)} */} {row.customersuburb || row.deliveryaddress.slice(0, 20)} {/* {row.ordernotes} */} {row.orderstatus === 'pending' && } {row.orderstatus === 'modified' && } {row.orderstatus === 'cancelled' && } {row.orderstatus === 'delivered' && } {row.orderstatus === 'processing' && ( )} {row.orderstatus === 'ready' && } {row.orderstatus === 'confirmed' && } {row.orderstatus === 'active' && } {row.orderstatus === 'closed' && } {row.orderstatus === 'created' && } ))}
    {/* # CUSTOMER ORDER ID PICKUP DELIVERY STATUS {orderlist.map((row)=>{ return <> {row.sno} {row.customername} {row.contactno} {row.orderid} {dayjs(row.deliverytime).utc().format('DD/MM/YYYY')} {dayjs(row.deliverytime).utc().format('hh:mm A')} {row.pickupaddress.slice(0, 20)} {row.deliveryaddress.slice(0, 20)} {row.ordernotes} {(row.orderstatus === 'pending') && } {(row.orderstatus === 'modified') && } {(row.orderstatus === 'cancelled') && } {(row.orderstatus === 'delivered') && } {(row.orderstatus === 'processing') && } {(row.orderstatus === 'ready') && } {(row.orderstatus === 'confirmed') && } {(row.orderstatus === 'active') && } {(row.orderstatus === 'closed') && } {(row.orderstatus === 'created') && } }) }
    */}
    {/*
    */}
    {/* */}
    {/* */}
    {/*
    */}
    Select Filter Options setOpen(!open)} id="daterange1" onChange={(range) => { if (range.label === 'All') { // setDateselect('all'); setStartdate(''); setEnddate(''); setOpen(false); } else { // setDateselect('select'); setStartdate(dayjs(range.startDate).format('YYYY-MM-DD')); setEnddate(dayjs(range.endDate).format('YYYY-MM-DD')); if (range.label) { setDatestatus(range.label); } else { setDatestatus(`[${dayjs(range.startDate).format('DD-MM-YYYY')} to ${dayjs(range.endDate).format('DD-MM-YYYY')}]`); } } console.log(range); }} definedRanges={[ { label: 'Today', startDate: new Date(), endDate: new Date() }, { label: 'Yesterday', startDate: addDays(new Date(), -1), endDate: addDays(new Date(), -1) }, { label: 'Tomorrow', startDate: addDays(new Date(), +1), endDate: addDays(new Date(), +1) }, { label: 'This Week', startDate: startOfWeek(new Date()), endDate: endOfWeek(new Date()) }, { label: 'Last Week', startDate: startOfWeek(addWeeks(new Date(), -1)), endDate: endOfWeek(addWeeks(new Date(), -1)) }, { label: 'Last 7 Days', startDate: addWeeks(new Date(), -1), endDate: new Date() }, { label: 'This Month', startDate: startOfMonth(new Date()), endDate: endOfMonth(new Date()) }, { label: 'Last Month', startDate: startOfMonth(addMonths(new Date(), -1)), endDate: endOfMonth(addMonths(new Date(), -1)) } // { // label: 'All', // startDate: new Date(), // endDate: addDays(new Date(), -1), // }, ]} /> ); }; export default Customers;