import { useEffect, useState, Fragment } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import axios from 'axios'; import { EnvironmentOutlined, EditTwoTone, DeleteFilled, NotificationOutlined, CloseOutlined, WarningOutlined } from '@ant-design/icons'; var utc = require('dayjs/plugin/utc') import MainCard from 'components/MainCard'; import Loader from 'components/Loader'; import dayjs from 'dayjs'; dayjs.extend(utc) import { enqueueSnackbar } from 'notistack'; import { MdLocalShipping, MdHourglassEmpty, MdCheckCircle, MdCancel, MdAccessTime, MdHistoryToggleOff, MdAssignmentTurnedIn, MdEdit, MdArrowBack, MdReceiptLong, MdDirectionsCar, MdKeyboardArrowUp, MdKeyboardArrowDown } from 'react-icons/md'; import { Button } from '@astryxdesign/core/Button'; import { IconButton } from '@astryxdesign/core/IconButton'; import { Tooltip } from '@astryxdesign/core/Tooltip'; import { Stack } from '@astryxdesign/core/Stack'; import { Layout, LayoutHeader, LayoutContent, LayoutFooter } from '@astryxdesign/core/Layout'; import { Dialog as AstryxDialog } from '@astryxdesign/core/Dialog'; import { TextInput } from '@astryxdesign/core/TextInput'; import { CheckboxInput } from '@astryxdesign/core/CheckboxInput'; import { Skeleton } from '@astryxdesign/core/Skeleton'; import { Spinner } from '@astryxdesign/core/Spinner'; import { Banner } from '@astryxdesign/core/Banner'; import { Link as AstryxLink } from '@astryxdesign/core/Link'; import logger from 'utils/logger'; // ============================================================================ // Design tokens — shared with the rest of the redesigned operator pages. // ============================================================================ const DT = { radiusPill: 999, radiusCard: 16, shadowSoft: '0 14px 40px rgba(15, 23, 42, 0.10)', shadowMd: '0 8px 24px rgba(15, 23, 42, 0.08)', shadowPop: '0 18px 50px rgba(15, 23, 42, 0.18)', textPrimary: '#0f172a', textSecondary: '#64748b', textMuted: '#94a3b8', borderSubtle: '#e2e8f0', divider: '#f1f5f9', surface: '#ffffff', surfaceAlt: '#f8fafc' }; const dtA = (c, suffix) => `${c}${suffix}`; const tint = (c) => dtA(c, '08'); const edge = (c) => dtA(c, '55'); const ring = (c) => dtA(c, '26'); const BRAND = '#C01227'; const BRAND_LIGHT = '#D25463'; // Legacy MUI palette names used throughout this page's chips/badges — mapped // to real hex so the visual result matches the previous theme.palette.* colors. const LEGACY_COLOR_MAP = { primary: BRAND, secondary: '#8c8c8c', success: '#52c41a', error: '#ff4d4f', warning: '#faad14', info: '#13c2c2', default: DT.textMuted }; const resolveColor = (c) => LEGACY_COLOR_MAP[c] || c || DT.textMuted; // Semantic per-status palette — also drives StatusBadge. const STATUS_META = { pending: { label: 'Pending', color: '#f59e0b', icon: MdHourglassEmpty }, assigned: { label: 'Assigned', color: '#0ea5e9', icon: MdAssignmentTurnedIn }, confirmed: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle }, modified: { label: 'Modified', color: '#06b6d4', icon: MdHistoryToggleOff }, processing: { label: 'Processing', color: BRAND, icon: MdAccessTime }, active: { label: 'Active', color: '#8b5cf6', icon: MdLocalShipping }, closed: { label: 'Closed', color: '#06b6d4', icon: MdCheckCircle }, completed: { label: 'Completed', color: '#10b981', icon: MdCheckCircle }, cancelled: { label: 'Cancelled', color: '#ef4444', icon: MdCancel } }; const StatusBadge = ({ status, size = 'md' }) => { if (!status) return null; const meta = STATUS_META[String(status).toLowerCase()] || { label: status, color: DT.textMuted, icon: MdHistoryToggleOff }; const Icon = meta.icon; const px = size === 'lg' ? 10 : 8; const py = size === 'lg' ? 4 : 3; const fs = size === 'lg' ? 12 : 11; return ( {meta.label} ); }; // ---------------------------------------------------------------------------- // Txt — lightweight typography helper replacing MUI Typography variants. // Keeps the pixel-level sizing this page relies on without adopting the full // Astryx Text/Heading API for every single label on a very dense page. // ---------------------------------------------------------------------------- const TYPOGRAPHY_STYLES = { h3: { fontSize: '1.5rem', fontWeight: 500, lineHeight: 1.2 }, h4: { fontSize: '1.25rem', fontWeight: 500, lineHeight: 1.2 }, h5: { fontSize: '1.0625rem', fontWeight: 400, lineHeight: 1.3 }, subtitle1: { fontSize: '0.95rem', fontWeight: 400, lineHeight: 1.3 }, body1: { fontSize: '0.875rem', fontWeight: 400, lineHeight: 1.4 }, body2: { fontSize: '0.8125rem', fontWeight: 400, lineHeight: 1.4 }, caption: { fontSize: '0.75rem', fontWeight: 400, lineHeight: 1.4 } }; const Txt = ({ variant = 'body1', color, align, style = {}, children, ...rest }) => { const base = TYPOGRAPHY_STYLES[variant] || TYPOGRAPHY_STYLES.body1; const resolvedColor = color === 'secondary' || color === 'textSecondary' ? DT.textSecondary : color || DT.textPrimary; return (
{children}
); }; // ---------------------------------------------------------------------------- // Pill — lightweight chip helper replacing MUI Chip (Astryx has no Chip; // Token's fixed color set doesn't cover the arbitrary legacy palette used // here, so this mirrors the tint/edge pattern already used by StatusBadge). // ---------------------------------------------------------------------------- const Pill = ({ label, color = 'default', variant = 'filled', size = 'medium', icon, style = {} }) => { const c = resolveColor(color); const isSmall = size === 'small'; const base = { display: 'inline-flex', alignItems: 'center', gap: 4, borderRadius: 999, fontWeight: 400, whiteSpace: 'nowrap', fontSize: isSmall ? 11 : 12.5, padding: isSmall ? '2px 8px' : '4px 10px', lineHeight: 1.6 }; const variantStyle = variant === 'outlined' ? { backgroundColor: '#fff', border: `1px solid ${edge(c)}`, color: c } : variant === 'light' ? { backgroundColor: tint(c), border: `1px solid ${edge(c)}`, color: c } : { backgroundColor: c, color: '#fff' }; return ( {icon} {label} ); }; // ---------------------------------------------------------------------------- // CircleAvatar — plain circular avatar replacing MUI Avatar (icon avatars & // initials avatars). Matches the AccentAvatar pattern used elsewhere. // ---------------------------------------------------------------------------- const CircleAvatar = ({ size = 32, bg = DT.textMuted, color = '#fff', style = {}, children }) => (
{children}
); const Details = () => { // const [searchParams] = useSearchParams(); const [orderarr, setOrderarr] = useState([]); const [loading, setLoading] = useState(true); const location = useLocation(); const [orderid, setOrderid] = useState(''); const [eventlocation, setEventlocation] = useState(''); const [orderdate, setOrderdate] = useState(''); const [eventname, setEventname] = useState(''); const [open, setOpen] = useState(false); const [clientname, setClientname] = useState(''); // const [duedate, setDuedate] = useState(''); const [tenantaddress, setTenantaddress] = useState(''); const [dialogopen, setDialogopen] = useState(false); const [orderstatus, setOrderstatus] = useState(''); const [currentrole, setCurrentrole] = useState(''); const [taxamount, setTaxamount] = useState(''); const [subtotal, setSubtotal] = useState(''); const [grandtotal, setGrandtotal] = useState(''); const [venuetype, setVenuetype] = useState(''); const [orderaddons, setOrderaddons] = useState([]); const [otherinstructions, setOtherinstructions] = useState(''); const [cancelleddate, setCancelleddate] = useState(''); const [stafflist, setStafflist] = useState([]); const [staffarr, setStaffarr] = useState([]); const [orderheaderid, setOrderheaderid] = useState(''); const [tenantid, setTenantid] = useState(''); const [starttime, setStarttime] = useState(''); const [endtime, setEndtime] = useState(''); // const [orderstatus,setOrderstatus]=useStatus(''); const [pendingtime, setPendingtime] = useState(''); // const [processdate,setProcessdate]=useState(''); const [orderdetailid, setOrderdetailid] = useState(''); const [productid, setProductid] = useState(''); const [categoryarr, setcategoryarr] = useState([]) const [currentshiftobj, setCurrentshiftobj] = useState({ shifts: 0, assigned: 0, remaining: 0, shiftid: 0, price: 0 }); const [tabstatus, setTabstatus] = useState(0) const { state } = useLocation(); const [assignedpendingcount, setAssignedpendingcount] = useState(''); // const [, forceUpdate] = useReducer(x => x + 1, 0); // const dispatch = useDispatch(); const navigate = useNavigate(); const [expandopen, setExpandopen] = useState(['', '']); const [startdate, setStartdate] = useState('') const [invoiceeligible, setInvoiceeligible] = useState(false) useEffect(() => { logger.info("categoryarr") logger.info(orderarr, eventlocation, venuetype, starttime, endtime); // forceUpdate(); }, [categoryarr]) // const navigate = useNavigate(); useEffect(() => { if (state) { setOrderheaderid(state.orderheaderid); setTenantid(state.tenantid); } logger.info(state) // fetchroleslist(1) logger.info(Date.now()) }, []) useEffect(() => { if (state) { setOrderheaderid(state.orderheaderid ); setTenantid(state.tenantid ); } logger.info(state) // fetchroleslist(1) logger.info(Date.now()) }, [ state.orderheaderid, state.tenantid ]) // const fetchorderdetails = async () => { // setLoading(true); // await axios // .get(`${process.env.REACT_APP_URL}/orders/orderbyid/?orderheaderid=${orderheaderid}`) // .then((res) => { // logger.info(res); // setLoading(false); // }) // .catch((err) => { // logger.error(err); // setLoading(false); // }); // }; const fetchorderaddons = async () => { setLoading(true); await axios .get(`${process.env.REACT_APP_URL2}/orders/getordersbystatus?tenantid=${tenantid}`) .then((res) => { logger.info(res); let result = res.data.Details.find((res1) => res1.orderheaderid == orderheaderid) // orderheaderid logger.info("result") logger.info(result) setOrderaddons(result.orderaddons); setVenuetype(result.venuetype) setOtherinstructions(result.remarks) setStartdate(result.startdate) setClientname(result.tenantname); setEventlocation(''); setTenantaddress(result.tenantaddress); setEventname(result.eventname); setOrderdate(dayjs(result.orderdate).format('MM/DD/YYYY') || ''); setOrderid(result.orderid); setOrderstatus(result.orderstatus); setTaxamount(result.taxamount); setSubtotal(result.orderamount) setGrandtotal(result.ordervalue); setCancelleddate(dayjs(result.cancelled).format('MM/DD/YYYY') || ''); // if (result.orderstatus === 'pending') { setPendingtime(result.pending) // } setLoading(false); }) .catch((err) => { logger.error(err); setLoading(false); }); } const fetchorderattires = async () => { setLoading(true); await axios .get(`${process.env.REACT_APP_URL}/orders/getorderdetails?orderheaderid=${orderheaderid}`) .then((res) => { logger.info('res'); logger.info(res); setOrderarr(res.data.details || []); // let result = res.data.Details.find((res1) => res1.orderheaderid == searchParams.get('id')) // orderheaderid // logger.info(result) // setOrderaddons(result.orderaddons); // setVenuetype(result.venuetype) // setOtherinstructions(result.remarks) // logger.info("res"); // let result = _.chain(res.data.Details) // .groupBy("shiftid") // .map((value, key) => ({shiftid:key, locationaddress: value[0].locationaddress, roles: value })) // .value() // setcategoryarr(result); logger.info('categoryarr'); setcategoryarr(res.data.details) logger.info(res.data.details); setLoading(false); }) .catch((err) => { logger.error(err); setLoading(false); }); } const fetchroleslist = async (cid, starttime1, endtime1, hid, sid) => { let fromdate = dayjs(starttime1).subtract(59, 'minutes') .format('YYYY-MM-DD HH:mm:ss'); // let todate = dayjs(endtime1).utc().format('YYYY-MM-DD HH:mm:ss'); // let fromdate = dayjs(starttime1).utc().format('YYYY-MM-DD HH:mm:ss'); let todate = dayjs(endtime1) .format('YYYY-MM-DD HH:mm:ss'); let url1; if (starttime1) { url1 = `${process.env.REACT_APP_URL2}/staffs/pools/getstaffs/?categoryid=${cid}&headerid=${hid}&shiftid=${sid}&starttime=${fromdate}&endtime=${todate}`; } else { url1 = `${process.env.REACT_APP_URL2}/staffs/pools/getstaffs/?categoryid=${cid}&headerid=${hid}&shiftid=${sid}` } setLoading(true); setStafflist([]) await axios // .get(`${process.env.REACT_APP_URL2}/staffs/pools/getstaffs/?categoryid=${cid}&headerid=${hid}&starttime=${fromdate}&endtime=${todate}`) .get(url1) .then((res) => { logger.info('rolelist'); logger.info(res); // logger.info(fromdate, todate) // logger.info(dayjs(starttime1).format('YYYY-MM-DD HH:mm:ss')) // logger.info(dayjs(endtime1).format('HH:mm:ss')) setStafflist(res.data.Details || []) // let result = res.data.Details.find((res1) => res1.orderheaderid == searchParams.get('id')) // orderheaderid // logger.info(result) // setOrderaddons(result.orderaddons); // setVenuetype(result.venuetype) // setOtherinstructions(result.remarks) setLoading(false); }) .catch((err) => { logger.error(err); setLoading(false); }); } const fetchstafflist = async (odid) => { setLoading(true) try { // await axios.get(`${process.env.REACT_APP_URL}/orders/orderanalytics?orderdate=${chosendate}`) await axios.get(`${process.env.REACT_APP_URL2}/orders/getassignedinfo?orderdetailid=${odid}`) .then((res) => { logger.info(res) if (res.data.status) { setStafflist(res.data.Details) } setLoading(false) }).catch((err) => { logger.error(err) setLoading(false) }) } catch (err) { logger.error(err); setLoading(false) } } const cancelorder = async () => { await axios.put(`${process.env.REACT_APP_URL2}/orders/cancel`, { // "Orderheaderid": parseInt(orderheaderid), // "Tenantid": parseInt(tenantid), // "Orderstatus": "cancelled", // "Currentdatetime": dayjs().format('YYYY-MM-DD HH:mm:ss'), // "Cod": false, // "Remarks": "", "orderheaderid": parseInt(orderheaderid), // "orderdetailid":78, // "shiftid":788, "orderstatus": "cancelled", "cancelled": dayjs().format('YYYY-MM-DD HH:mm:ss'), "unserviceable": (invoiceeligible) ? 0 : 1, }) .then((res) => { logger.info(res) if (res.data.status) { if (orderheaderid && tenantid) { // fetchorderdetails(); fetchorderaddons(); fetchorderattires(); } } }).catch((err) => { logger.error(err) }) } const unassign = async (val) => { let obj = { orderheaderid: orderheaderid, orderprocessid: val.orderprocessid, orderdetailid: val.orderdetailid, orderstatus: "pending", pending: dayjs().format('YYYY-MM-DD HH:mm:ss'), // processing:0, // cancelled:0, // completed:0, // accepted:0, status: 1 } logger.info(obj) await axios.put(`${process.env.REACT_APP_URL2}/orders/updateprocessstatus`, obj) .then((res) => { logger.info(res) if (res.data.message === "Successful") { // if (orderheaderid && tenantid) { enqueueSnackbar('Role unassigned successfully', { variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }) if (currentshiftobj.assigned > currentshiftobj.shifts) { sendunassignnotification(val) } fetchorderaddons(); fetchorderattires(); setOpen(false); fetchassignedcount(); dialogclose() setTimeout(() => { fetchassignedcount(); }, 2000) } }).catch((err) => { logger.error(err) }) } const sendunassignnotification = (val) => { logger.info(val) let data2; let tokenarr = [val.userfcmtoken] let arr1 = [{ "notificationid": 0, "notificationdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), "Title": "Staff Un-Asigned", "message": `${val.firstname} has been Un-assigned to the order ${orderid}`, "configid": 2, "tenantid": tenantid, "orderheaderid": orderheaderid, "orderprocessid": val.orderprocessid, "shiftid": val.shiftid, "userid": val.userid, "orderid": orderid, "success": 0, "orderstatus": 'assigned', "processing": dayjs().format('YYYY-MM-DD HH:mm:ss'), "notifytype": 2, "notifyreason": 'Staff Un-Assigned' // "sound": "ring", // "click_action": "FLUTTER_NOTIFICATION_CLICK", // "firstname": val.firstname }]; data2 = { "Title": "Staff Un-Asigned", "message": `A Staff has been Un-assigned to the order ${orderid}`, "tenantid": tenantid, "orderheaderid": orderheaderid, "orderid": orderid, "configid": 2, // "click_action": "FLUTTER_NOTIFICATION_CLICK" } let fcmmodel = { "priority": "high", "registration_ids": tokenarr, "data": data2, "notification": { "body": `An order has been Un-assigned ${orderid}`, "title": "Legendary", "sound": "ring", "content_available": true, "click_action": "FLUTTER_NOTIFICATION_CLICK" } } let grpnotifyobj = { "notifications": arr1, "fcmmodel": fcmmodel } logger.info("grpnotifyobj unassign") logger.info(grpnotifyobj) sendgroupnotification(grpnotifyobj) } useEffect(() => { logger.info(orderheaderid); if (orderheaderid && tenantid) { // fetchorderdetails(); fetchorderaddons(); fetchorderattires(); fetchassignedcount() // fetchuserdetails(); logger.info(location.state || ''); // setOrderid(location.state.orderid || ''); // setEventlocation(location.state.eventlocation || ''); // setEventlocation(address || []); // setOrderdate(dayjs(location.state.orderdate.substring(0, 10)).format('MM/DD/YYYY') || ''); // setDuedate(dayjs(location.state.orderdate.substring(0, 10)).format('MM/DD/YYYY') || '') // setEventname(location.state.eventname || ''); // setClientname(location.state.tenantname || '') } else { setLoading(false); } // fetchorderdetails(); logger.info(orderheaderid, tenantid) }, [orderheaderid, tenantid, assignedpendingcount]); const handleClose = () => { setOpen(false); }; const dialogclose = () => { setDialogopen(false); setStaffarr([]); setExpandopen(['', '']) }; useEffect(() => { logger.info(currentshiftobj) }) const assignok = async () => { let arr = [] let arr1 = []; staffarr.map((val) => { arr.push({ "orderprocessid": 0, // "processdate": `${dayjs(new Date()).format('YYYY-MM-DD')} ${dayjs(new Date()).format('HH:mm:ss')}`, //current date "processdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), //current date "tenantid": tenantid, "orderheaderid": orderheaderid, "orderdetailid": val.orderdetailid,//// "productid": val.productid,///// "userid": val.userid, "orderstatus": "pending", "pending": `${dayjs(pendingtime).format('YYYY-MM-DD')} ${dayjs(pendingtime).format('HH:mm:ss')}`, // if pending "starttime": `${dayjs(starttime).format('YYYY-MM-DD')} ${dayjs(starttime).format('HH:mm:ss')}`, "endtime": `${dayjs(endtime).format('YYYY-MM-DD')} ${dayjs(endtime).format('HH:mm:ss')}`, "appuserid": parseInt(localStorage.getItem("appuserid")), //loginuserid "shiftid": val.shiftid, "userrate": val.userrate, "productrate": val.productrate }) staffarr.map((val) => { arr1.push({ "notificationid": 0, "notificationdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), "Title": "Staff Asigned", "message": `A Staff has been assigned to the order ${orderid}`, "configid": 2, "tenantid": tenantid, "orderheaderid": orderheaderid, "orderprocessid": 0, "shiftid": val.shiftid, "userid": val.userid, "orderid": orderid, "sound": "ring", "click_action": "FLUTTER_NOTIFICATION_CLICK", "firstname": val.firstname }) }) }) logger.info('arr') logger.info(arr) await axios.post(`${process.env.REACT_APP_URL2}/orders/createorderprocess`, arr) .then((res) => { logger.info(res) if (res.data.message === "Successfully created") { // if (orderheaderid && tenantid) { // fetchorderdetails(); // fetchorderaddons(); // fetchorderattires(); // } enqueueSnackbar('Roles assigned successfully', { variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }) // fetchroleslist(productid, '', '', orderheaderid, arr1[0].shiftid); logger.info(productid, '', '', orderheaderid, arr1[0].shiftid) // arr1.map((val2) => { // notificationpush(val2,val2.Title); // }) setDialogopen(false); fetchorderattires(); fetchassignedcount(); } }).catch((err) => { logger.error(err) }) logger.info(arr) } const notificationpush = async (val) => { let fcmtoken = val.userfcmtoken let obj1 = { "notificationid": 0, "notificationdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), "Title": "Staff Asigned", "message": `A Staff has been assigned to the order ${orderid}`, "configid": 2, "tenantid": tenantid, "orderheaderid": orderheaderid, "orderprocessid": val.orderprocessid, "shiftid": val.shiftid, "userid": val.userid, "orderid": orderid, "sound": "ring", "click_action": "FLUTTER_NOTIFICATION_CLICK", // "firstname": val.firstname }; logger.info(obj1, fcmtoken) await axios.post(`${process.env.REACT_APP_URL2}/utils/notification/send`, { "priority": "high", "registration_ids": [fcmtoken], "data": obj1, "notification": { "body": `A Staff has been assigned to ${orderid}`, "title": "Legendary", "sound": "ring", "content_available": true } } , { headers: { 'Authorization': `Bearer ${process.env.REACT_APP_STAFF_TOKEN}` } } ) .then((res) => { logger.info(res) // if(res.data.status){ enqueueSnackbar('Notification sent successfully', { variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }) // } }) .catch((err) => { logger.error(err) }) } const fetchassignedstaffs = async () => { // logger.info(obj1) await axios.get(`${process.env.REACT_APP_URL2}/orders/getnotificationusers?orderheaderid=${orderheaderid}`) .then((res) => { if (res.data.status) { let arr1 = []; let data2; let tokenarr = [] logger.info(res) res.data.details.map((val) => { arr1.push({ "notificationid": 0, "notificationdate": dayjs().format('YYYY-MM-DD HH:mm:ss'), "Title": "Staff Asigned", "message": `${val.staffname} has been assigned to the order ${orderid}`, "configid": 2, "tenantid": tenantid, "orderheaderid": orderheaderid, "orderprocessid": val.orderprocessid, "shiftid": val.shiftid, "userid": val.userid, "orderid": orderid, "success": 0, "orderstatus": 'assigned', "processing": dayjs().format('YYYY-MM-DD HH:mm:ss'), "notifytype": 1, "notifyreason": 'Staff Assigned' // "sound": "ring", // "click_action": "FLUTTER_NOTIFICATION_CLICK", // "firstname": val.firstname }); tokenarr.push(val.userfcmtoken); }) data2 = { "Title": "Staff Asigned", "message": `A Staff has been assigned to the order ${orderid}`, "tenantid": tenantid, "orderheaderid": orderheaderid, "orderid": orderid, "configid": 2, // "click_action": "FLUTTER_NOTIFICATION_CLICK" } let fcmmodel = { "priority": "high", "registration_ids": tokenarr, "data": data2, "notification": { "body": `An order has been assigned ${orderid}`, "title": "Legendary", "sound": "ring", "content_available": true, "click_action": "FLUTTER_NOTIFICATION_CLICK" } } let grpnotifyobj = { "notifications": arr1, "fcmmodel": fcmmodel } logger.info("grpnotifyobj") logger.info(grpnotifyobj) sendgroupnotification(grpnotifyobj) // notificationpush(obj2, val.userfcmtoken); // notificationpush(arr1,tokenarr); // enqueueSnackbar('Notifications sent successfully', { // variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, // autoHideDuration: 2000 // }) } }) .catch((err) => { logger.error(err) }) } const sendgroupnotification = async (obj1) => { logger.info(obj1) await axios.post(`${process.env.REACT_APP_URL2}/utils/notification/sendall`, obj1, { headers: { 'Authorization': `Bearer ${process.env.REACT_APP_STAFF_TOKEN}` } } ) .then((res) => { logger.info(res) if (res.data.status) { // updateorderstatus(); enqueueSnackbar('Notification sent successfully', { variant: 'success', anchorOrigin: { vertical: 'top', horizontal: 'right' }, autoHideDuration: 2000 }) fetchorderaddons(); } }) .catch((err) => { logger.error(err) }) } // const updateorderstatus = async () => { // await axios.put(`${process.env.REACT_APP_URL2}/orders/updateorderstatus`,{ // "orderheaderid":orderheaderid, // "tenantid":tenantid, // "orderstatus":"processing", // "pending":"", // "processing":dayjs().format('YYYY-MM-DD HH:mm:ss'), // "completed":"" // }) // .then((res) => { // logger.info(res) // fetchorderdetails(); // fetchorderaddons(); // fetchorderattires(); // }) // .catch((err) => { // logger.error(err) // fetchorderdetails(); // fetchorderaddons(); // fetchorderattires(); // }) // } const fetchassignedcount = async () => { // logger.info(obj1) await axios.get(`${process.env.REACT_APP_URL2}/orders/getorderstatuscount?orderheaderid=${orderheaderid}`) .then((res) => { if (res.data.status) { // let arr1=[]; logger.info(res) setAssignedpendingcount(res.data.pendingcount) fetchorderaddons() } else { setAssignedpendingcount(res.data.pendingcount) fetchorderaddons() } }) .catch((err) => { logger.error(err) }) } function AlertCustomerDelete({ open, handleClose }) { const [deletepassword, setDeletepassword] = useState(''); const isMatch = deletepassword === orderid.slice(4); return ( !o && handleClose(false)} purpose="form" width={420} >
Cancel Order Confirm to permanently cancel this order
} content={ } /> {invoiceeligible && ( Terms & Condition link )} Please type in the order number to confirm. setDeletepassword(v)} status={isMatch ? undefined : { type: 'error' }} value={deletepassword} placeholder={orderid.slice(4)} /> } footer={