Compare commits

...

9 Commits

19 changed files with 3594 additions and 1293 deletions

View File

@@ -0,0 +1,9 @@
{
"permissions": {
"allow": [
"Bash(node -e \"require\\('@babel/parser'\\).parse\\(require\\('fs'\\).readFileSync\\('src/pages/nearle/reports/orderSummary.js','utf8'\\), { sourceType: 'module', plugins: ['jsx', 'optionalChaining', 'nullishCoalescingOperator', 'classProperties', 'objectRestSpread'] }\\); console.log\\('OK'\\)\")",
"Bash(node -e \"require\\('@babel/parser'\\).parse\\(require\\('fs'\\).readFileSync\\('src/pages/nearle/reports/ridersummary.js','utf8'\\), { sourceType: 'module', plugins: ['jsx', 'optionalChaining', 'nullishCoalescingOperator', 'classProperties', 'objectRestSpread'] }\\); console.log\\('OK'\\)\")",
"Bash(node -e \"require\\('@babel/parser'\\).parse\\(require\\('fs'\\).readFileSync\\('src/pages/nearle/invoice/invoice.js','utf8'\\), { sourceType: 'module', plugins: ['jsx', 'optionalChaining', 'nullishCoalescingOperator', 'classProperties', 'objectRestSpread'] }\\); console.log\\('OK'\\)\")"
]
}
}

View File

@@ -210,10 +210,14 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
const isSelected = selected === menu.id; const isSelected = selected === menu.id;
const borderIcon = level === 1 ? <BorderOutlined style={{ fontSize: '1rem' }} /> : false; const borderIcon = level === 1 ? <BorderOutlined style={{ fontSize: '1rem' }} /> : false;
const Icon = menu.icon; const Icon = menu.icon;
const menuIcon = menu.icon ? <Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem' }} /> : borderIcon; const menuIcon = menu.icon ? <Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem', color: 'white' }} /> : borderIcon;
const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? theme.palette.text.primary : theme.palette.primary.main; // const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : 'text.primary';
// const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? theme.palette.text.primary : theme.palette.primary.main;
const popperId = miniMenuOpened ? `collapse-pop-${menu.id}` : undefined; const popperId = miniMenuOpened ? `collapse-pop-${menu.id}` : undefined;
const FlexBox = { display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%' }; const FlexBox = { display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%' };
const textColor = 'white';
const iconSelectedColor = 'white';
// const isSelected = true;
return ( return (
<> <>
@@ -227,9 +231,11 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
sx={{ sx={{
pl: drawerOpen ? `${level * 28}px` : 1.5, pl: drawerOpen ? `${level * 28}px` : 1.5,
py: !drawerOpen && level === 1 ? 1.25 : 1, py: !drawerOpen && level === 1 ? 1.25 : 1,
...(drawerOpen && { ...(drawerOpen && {
'&:hover': { '&:hover': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.light' // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter'
bgcolor: '#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
bgcolor: 'transparent', bgcolor: 'transparent',
@@ -239,13 +245,14 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
}), }),
...(!drawerOpen && { ...(!drawerOpen && {
'&:hover': { '&:hover': {
bgcolor: 'primary.light' bgcolor: 'transparent'
// bgcolor:'#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
'&:hover': { '&:hover': {
bgcolor: 'white' bgcolor: 'transparent'
}, },
bgcolor: 'white' bgcolor: 'transparent'
} }
}) })
}} }}
@@ -255,7 +262,10 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
onClick={handlerIconLink} onClick={handlerIconLink}
sx={{ sx={{
minWidth: 28, minWidth: 28,
color: selected === menu.id ? 'primary.main' : 'white', // color: selected === menu.id ? 'primary.main' : textColor,
// color: selected === menu.id ? textColor : textColor,
// bgcolor:'white',
// color:'white',
...(!drawerOpen && { ...(!drawerOpen && {
borderRadius: 1.5, borderRadius: 1.5,
width: 36, width: 36,
@@ -264,13 +274,17 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
justifyContent: 'center', justifyContent: 'center',
'&:hover': { '&:hover': {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter' // bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'secondary.lighter'
bgcolor: '#7b1fa2',
color: 'white'
} }
}), }),
...(!drawerOpen && ...(!drawerOpen &&
selected === menu.id && { selected === menu.id && {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.900' : 'primary.lighter', bgcolor: 'primary.light',
color: 'primary.main',
'&:hover': { '&:hover': {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.darker' : 'primary.lighter' bgcolor: '#7b1fa2',
color: 'primary.main'
} }
}) })
}} }}
@@ -281,7 +295,12 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
{(drawerOpen || (!drawerOpen && level !== 1)) && ( {(drawerOpen || (!drawerOpen && level !== 1)) && (
<ListItemText <ListItemText
primary={ primary={
<Typography variant="h6" color={selected === menu.id ? 'white' : 'white'}> <Typography
variant="h6"
// color={selected === menu.id ? 'primary' : textColor}
// color={'white'}
color={selected === menu.id ? textColor : textColor}
>
{menu.title} {menu.title}
</Typography> </Typography>
} }
@@ -296,9 +315,22 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
)} )}
{(drawerOpen || (!drawerOpen && level !== 1)) && {(drawerOpen || (!drawerOpen && level !== 1)) &&
(miniMenuOpened || open ? ( (miniMenuOpened || open ? (
<UpOutlined style={{ fontSize: '0.625rem', marginLeft: 1, color: theme.palette.primary.main }} /> <UpOutlined
style={{
fontSize: '0.625rem',
marginLeft: 1,
// color: theme.palette.primary.main
color: 'white'
}}
/>
) : ( ) : (
<DownOutlined style={{ fontSize: '0.625rem', marginLeft: 1, color: 'white' }} /> <DownOutlined
style={{
fontSize: '0.625rem',
marginLeft: 1,
color: 'white'
}}
/>
))} ))}
{!drawerOpen && ( {!drawerOpen && (
@@ -328,8 +360,8 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
mt: 1.5, mt: 1.5,
boxShadow: theme.customShadows.z1, boxShadow: theme.customShadows.z1,
backgroundImage: 'none', backgroundImage: 'none',
border: `1px solid ${theme.palette.primary.main}`, border: `2px solid ${theme.palette.primary.main}`,
bgcolor: 'primary.main' width: 'auto'
}} }}
> >
<ClickAwayListener onClickAway={handleClose}> <ClickAwayListener onClickAway={handleClose}>
@@ -373,7 +405,14 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
> >
<Box onClick={handlerIconLink} sx={FlexBox}> <Box onClick={handlerIconLink} sx={FlexBox}>
{menuIcon && ( {menuIcon && (
<ListItemIcon sx={{ my: 'auto', minWidth: !menu.icon ? 18 : 36, color: theme.palette.secondary.dark }}> <ListItemIcon
sx={{
my: 'auto',
minWidth: !menu.icon ? 18 : 36
// color: theme.palette.secondary.dark
// color:'white'
}}
>
{menuIcon} {menuIcon}
</ListItemIcon> </ListItemIcon>
)} )}
@@ -386,7 +425,12 @@ const NavCollapse = ({ menu, level, parentId, setSelectedItems, selectedItems, s
)} )}
<ListItemText <ListItemText
primary={ primary={
<Typography variant="body1" color="inherit" sx={{ my: 'auto' }}> <Typography
variant="body1"
// color="inherit"
// color="white"
sx={{ my: 'auto' }}
>
{menu.title} {menu.title}
</Typography> </Typography>
} }

View File

@@ -26,7 +26,7 @@ import NavCollapse from './NavCollapse';
import SimpleBar from 'components/third-party/SimpleBar'; import SimpleBar from 'components/third-party/SimpleBar';
import Transitions from 'components/@extended/Transitions'; import Transitions from 'components/@extended/Transitions';
import { MenuOrientation, ThemeMode } from 'config'; import { MenuOrientation } from 'config';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
import { dispatch, useSelector } from 'store'; import { dispatch, useSelector } from 'store';
import { activeID } from 'store/reducers/menu'; import { activeID } from 'store/reducers/menu';
@@ -227,9 +227,9 @@ const NavGroup = ({ item, lastItem, remItems, lastItemId, setSelectedItems, sele
item.title && item.title &&
drawerOpen && ( drawerOpen && (
<Box sx={{ pl: 3, mb: 1.5 }}> <Box sx={{ pl: 3, mb: 1.5 }}>
<Typography variant="subtitle2" <Typography
// color={theme.palette.mode === ThemeMode.DARK ? 'textSecondary' : 'text.secondary'} variant="subtitle2"
sx={{color:'#fff'}} sx={{ color: '#fff' }}
> >
{item.title} {item.title}
</Typography> </Typography>

View File

@@ -9,9 +9,10 @@ import { Avatar, Chip, ListItemButton, ListItemIcon, ListItemText, Typography, u
// project import // project import
import Dot from 'components/@extended/Dot'; import Dot from 'components/@extended/Dot';
import { MenuOrientation, ThemeMode } from 'config'; import { MenuOrientation, ThemeMode } from 'config';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
import { activeItem, openDrawer } from 'store/reducers/menu'; import { activeItem, openDrawer, setSelectedMenu } from 'store/reducers/menu';
// ==============================|| NAVIGATION - LIST ITEM ||============================== // // ==============================|| NAVIGATION - LIST ITEM ||============================== //
@@ -35,10 +36,15 @@ const NavItem = ({ item, level }) => {
} }
const Icon = item.icon; const Icon = item.icon;
const itemIcon = item.icon ? <Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem' }} /> : false;
const isSelected = openItem.findIndex((id) => id === item.id) > -1; const isSelected = openItem.findIndex((id) => id === item.id) > -1;
const itemIcon = item.icon ? (
<Icon style={{ fontSize: drawerOpen ? '1rem' : '1.25rem', color: isSelected ? '#662582' : '#fff' }} />
) : (
false
);
// const { pathname } = useLocation(); // const { pathname } = useLocation();
const pathname = document.location.pathname; const pathname = document.location.pathname;
@@ -59,10 +65,15 @@ const NavItem = ({ item, level }) => {
if (pathname.includes(item.url)) { if (pathname.includes(item.url)) {
dispatch(activeItem({ openItem: [item.id] })); dispatch(activeItem({ openItem: [item.id] }));
} }
// eslint-disable-next-line // eslint-disable-next-line
}, [pathname]); }, [pathname]);
const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : 'text.primary'; useEffect(() => {
dispatch(setSelectedMenu(pathname));
}, [pathname]);
const textColor = theme.palette.mode === ThemeMode.DARK ? 'grey.400' : '#fff';
const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? 'text.primary' : 'primary.main'; const iconSelectedColor = theme.palette.mode === ThemeMode.DARK && drawerOpen ? 'text.primary' : 'primary.main';
return ( return (
@@ -72,14 +83,16 @@ const NavItem = ({ item, level }) => {
{...listItemProps} {...listItemProps}
disabled={item.disabled} disabled={item.disabled}
selected={isSelected} selected={isSelected}
onClick={() => {
// dispatch(setSelectedMenu(item));
}}
sx={{ sx={{
zIndex: 1201, zIndex: 1201,
pl: drawerOpen ? `${level * 28}px` : 1.5, pl: drawerOpen ? `${level * 28}px` : 1.5,
py: !drawerOpen && level === 1 ? 1.25 : 1, py: !drawerOpen && level === 1 ? 1.25 : 1,
...(drawerOpen && { ...(drawerOpen && {
// bgcolor: 'primary.light',
'&:hover': { '&:hover': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.light' bgcolor: '#7b1fa2'
}, },
'&.Mui-selected': { '&.Mui-selected': {
bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter', bgcolor: theme.palette.mode === ThemeMode.DARK ? 'divider' : 'primary.lighter',
@@ -92,41 +105,43 @@ const NavItem = ({ item, level }) => {
} }
}), }),
...(!drawerOpen && { ...(!drawerOpen && {
bgcolor: '#662582',
'&:hover': { '&:hover': {
bgcolor: 'primary.light' bgcolor: '#662582'
}, },
'&.Mui-selected': { '&.Mui-selected': {
'&:hover': { '&:hover': {
bgcolor: 'white' bgcolor: 'transparent'
}, },
bgcolor: 'white' bgcolor: 'transparent'
} }
}) })
}} }}
{...(downLG && { {...(downLG && {
onClick: () => dispatch(openDrawer(false)) onClick: () => {
dispatch(openDrawer(false));
}
})} })}
> >
{itemIcon && ( {itemIcon && (
<ListItemIcon <ListItemIcon
sx={{ sx={{
minWidth: 28, minWidth: 28,
color: isSelected ? iconSelectedColor : 'white',
...(!drawerOpen && { ...(!drawerOpen && {
// borderRadius: 1.5, borderRadius: 1.5,
width: 36, width: 36,
height: 36, height: 36,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center' justifyContent: 'center',
// '&:hover': { '&:hover': {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'secondary.light' : 'primary.lighter' bgcolor: '#7b1fa2'
// } }
}), }),
...(!drawerOpen && ...(!drawerOpen &&
isSelected && { isSelected && {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.900' : 'primary.lighter', bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.900' : 'primary.lighter',
'&:hover': { '&:hover': {
// bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.darker' : 'primary.lighter' bgcolor: theme.palette.mode === ThemeMode.DARK ? 'primary.darker' : 'primary.lighter'
} }
}) })
}} }}
@@ -137,13 +152,7 @@ const NavItem = ({ item, level }) => {
{(drawerOpen || (!drawerOpen && level !== 1)) && ( {(drawerOpen || (!drawerOpen && level !== 1)) && (
<ListItemText <ListItemText
primary={ primary={
<Typography <Typography variant="h6" sx={{ color: isSelected ? iconSelectedColor : textColor, whiteSpace: 'nowrap' }}>
variant="h6"
sx={{
ml: 1,
color: isSelected ? theme.palette.primary.main : 'white'
}}
>
{item.title} {item.title}
</Typography> </Typography>
} }

View File

@@ -9,7 +9,7 @@ import AppBarStyled from './AppBarStyled';
import HeaderContent from './HeaderContent'; import HeaderContent from './HeaderContent';
import IconButton from 'components/@extended/IconButton'; import IconButton from 'components/@extended/IconButton';
import { MenuOrientation, ThemeMode } from 'config'; import { MenuOrientation } from 'config';
import useConfig from 'hooks/useConfig'; import useConfig from 'hooks/useConfig';
import { dispatch, useSelector } from 'store'; import { dispatch, useSelector } from 'store';
import { openDrawer } from 'store/reducers/menu'; import { openDrawer } from 'store/reducers/menu';
@@ -32,9 +32,6 @@ const Header = () => {
// header content // header content
const headerContent = useMemo(() => <HeaderContent />, []); const headerContent = useMemo(() => <HeaderContent />, []);
const iconBackColorOpen = theme.palette.mode === ThemeMode.DARK ? 'grey.200' : 'grey.300';
const iconBackColor = theme.palette.mode === ThemeMode.DARK ? 'background.default' : 'grey.100';
// common header // common header
const mainHeader = ( const mainHeader = (
<Toolbar> <Toolbar>
@@ -43,9 +40,6 @@ const Header = () => {
aria-label="open drawer" aria-label="open drawer"
onClick={() => dispatch(openDrawer(!drawerOpen))} onClick={() => dispatch(openDrawer(!drawerOpen))}
edge="start" edge="start"
// color="secondary"
// variant="light"
// sx={{ color: 'text.primary', bgcolor: drawerOpen ? iconBackColorOpen : iconBackColor, ml: { xs: 0, lg: -2 } }}
sx={{ sx={{
color: '#fff', color: '#fff',
bgcolor: 'transparent', bgcolor: 'transparent',

View File

@@ -0,0 +1,341 @@
// ============================================================================
// ordersDesign.js — shared design-system primitives for the operator pages.
//
// Source of truth for the look-and-feel established on the Orders Details
// screen (src/pages/nearle/reports/ordersDetails.js). All other report and
// list pages import from here so the entire admin panel reads as one product.
//
// Exports:
// DT, BRAND, BRAND_LIGHT — palette tokens
// tint / soft / ring / edge — alpha helpers (08 / 18 / 26 / 55 hex)
// formatNumberToRupees — INR currency formatter
// STATUS_META — semantic per-status meta (label/color/icon)
// StatusBadge — filled pill, white text on solid color
// TimelineCell — time-dominant (bold) / date-secondary (muted)
// MetricPill — small money/number pill for table cells
// SoftPaper — autocomplete dropdown surface
// AccentAvatar — colored circular icon avatar
// pillFieldSx — rounded pill text-field styling
// PrimaryButtonSx / SecondaryButtonSx — unified 32-px action-button system
// ============================================================================
import React from 'react';
import { Avatar, Box, Paper, Stack, Typography } from '@mui/material';
import {
MdLocalShipping,
MdHourglassEmpty,
MdCheckCircle,
MdCancel,
MdAccessTime,
MdHistoryToggleOff,
MdAssignmentTurnedIn
} from 'react-icons/md';
import dayjs from 'dayjs';
// ----------------------------------------------------------------------------
// Design tokens
// ----------------------------------------------------------------------------
export 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'
};
export const BRAND = '#662582';
export const BRAND_LIGHT = '#9255AB';
const dtA = (c, suffix) => `${c}${suffix}`;
export const tint = (c) => dtA(c, '08');
export const soft = (c) => dtA(c, '18');
export const ring = (c) => dtA(c, '26');
export const edge = (c) => dtA(c, '55');
// ----------------------------------------------------------------------------
// Money formatter
// ----------------------------------------------------------------------------
export function formatNumberToRupees(value) {
return new Intl.NumberFormat('en-IN', {
style: 'currency',
currency: 'INR',
minimumFractionDigits: 2
}).format(value || 0);
}
// ----------------------------------------------------------------------------
// Status meta — colors per brand standard:
// green=delivered, amber=pending, blue=created/processing,
// red=cancelled, dark-red=failed, purple=on-hold.
// ----------------------------------------------------------------------------
export const STATUS_META = {
created: { label: 'Created', color: '#3b82f6', icon: MdLocalShipping },
pending: { label: 'Pending', color: '#f59e0b', icon: MdHourglassEmpty },
accepted: { label: 'Accepted', color: '#6366f1', icon: MdAssignmentTurnedIn },
ready: { label: 'Accepted', color: '#6366f1', icon: MdAssignmentTurnedIn },
arrived: { label: 'Arrived', color: '#06b6d4', icon: MdCheckCircle },
picked: { label: 'Picked', color: '#8b5cf6', icon: MdLocalShipping },
active: { label: 'Active', color: '#0ea5e9', icon: MdLocalShipping },
modified: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle },
confirmed: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle },
processing: { label: 'Processing', color: '#3b82f6', icon: MdAccessTime },
onhold: { label: 'On Hold', color: '#8b5cf6', icon: MdHistoryToggleOff },
'on hold': { label: 'On Hold', color: '#8b5cf6', icon: MdHistoryToggleOff },
closed: { label: 'Closed', color: '#06b6d4', icon: MdCheckCircle },
completed: { label: 'Completed', color: '#10b981', icon: MdCheckCircle },
delivered: { label: 'Delivered', color: '#10b981', icon: MdCheckCircle },
skipped: { label: 'Skipped', color: '#f97316', icon: MdCancel },
failed: { label: 'Failed', color: '#991b1b', icon: MdCancel },
cancelled: { label: 'Cancelled', color: '#ef4444', icon: MdCancel }
};
// ----------------------------------------------------------------------------
// StatusBadge — filled pill, white text on solid color, high-contrast.
// ----------------------------------------------------------------------------
export const StatusBadge = ({ status, minWidth = 86 }) => {
if (!status) return null;
const meta = STATUS_META[String(status).toLowerCase()] || {
label: status,
color: DT.textMuted,
icon: MdHistoryToggleOff
};
const Icon = meta.icon;
return (
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
gap: 0.5,
px: 1.125,
py: 0.375,
borderRadius: 999,
bgcolor: meta.color,
color: '#fff',
fontSize: 11,
fontWeight: 700,
letterSpacing: 0.2,
whiteSpace: 'nowrap',
minWidth,
justifyContent: 'center',
boxShadow: `0 1px 2px ${ring(meta.color)}`
}}
>
<Icon size={12} /> {meta.label}
</Box>
);
};
// ----------------------------------------------------------------------------
// TimelineCell — time large/bold/high-contrast, date small/muted/secondary.
// No decorative dot.
// ----------------------------------------------------------------------------
export const TimelineCell = ({ value, utc: useUtc = false }) => {
if (!value) {
return (
<Typography sx={{ fontSize: 12, color: DT.textMuted, fontWeight: 700 }}></Typography>
);
}
const d = useUtc ? dayjs(value).utc() : dayjs(value);
return (
<Stack spacing={0} sx={{ lineHeight: 1.1 }}>
<Typography
sx={{
fontSize: 12.5,
fontWeight: 800,
color: DT.textPrimary,
letterSpacing: 0.1,
lineHeight: 1.15
}}
noWrap
>
{d.format('hh:mm A')}
</Typography>
<Typography
sx={{
fontSize: 10.5,
fontWeight: 600,
color: DT.textMuted,
lineHeight: 1.2
}}
noWrap
>
{d.format('DD MMM YYYY')}
</Typography>
</Stack>
);
};
// ----------------------------------------------------------------------------
// MetricPill — small money / number pill used in table cells.
// ----------------------------------------------------------------------------
export const MetricPill = ({ value, color, icon, isMoney = false }) => {
const n = Number(value);
const display = isMoney ? formatNumberToRupees(n) : Number.isFinite(n) ? n : value || 0;
const isZero = !Number.isFinite(n) || n === 0;
if (isZero) {
return (
<Typography sx={{ fontSize: 11.5, color: DT.textMuted, fontWeight: 700 }}>
{display}
</Typography>
);
}
return (
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
gap: 0.5,
px: 0.875,
py: 0.25,
borderRadius: 999,
bgcolor: tint(color),
border: `1px solid ${edge(color)}`,
color,
fontSize: 12,
fontWeight: 800,
whiteSpace: 'nowrap'
}}
>
{icon}
{display}
</Box>
);
};
// ----------------------------------------------------------------------------
// SoftPaper — autocomplete dropdown surface.
// ----------------------------------------------------------------------------
export const SoftPaper = (props) => (
<Paper
{...props}
sx={{
mt: 0.75,
borderRadius: 2,
boxShadow: DT.shadowPop,
border: '1px solid',
borderColor: 'divider',
overflow: 'hidden'
}}
/>
);
// ----------------------------------------------------------------------------
// AccentAvatar — colored circular icon used inside filter chips & headers.
// ----------------------------------------------------------------------------
export const AccentAvatar = ({ color, selected, size = 24, children }) => (
<Avatar
sx={{
width: size,
height: size,
bgcolor: selected ? color : soft(color),
color: selected ? '#fff' : color,
transition: 'background-color 0.15s, color 0.15s'
}}
>
{children}
</Avatar>
);
// ----------------------------------------------------------------------------
// pillFieldSx — rounded pill style for Autocomplete/TextField inputs.
// ----------------------------------------------------------------------------
export const pillFieldSx = (color) => ({
'& .MuiOutlinedInput-root': {
borderRadius: DT.radiusPill + 'px',
bgcolor: tint(color),
fontWeight: 600,
'& fieldset': { borderColor: edge(color), borderWidth: 1.5 },
'&:hover fieldset': { borderColor: color },
'&.Mui-focused': { boxShadow: `0 0 0 3px ${ring(color)}` },
'&.Mui-focused fieldset': { borderColor: color, borderWidth: 2 }
}
});
// ----------------------------------------------------------------------------
// Unified action-button styles — both render at 32px height with same typography.
// SecondaryButtonSx → outlined (white bg, neutral border)
// PrimaryButtonSx → filled brand (purple bg, white text)
// ----------------------------------------------------------------------------
export const SecondaryButtonSx = (active = false) => ({
height: 32,
px: 1.25,
borderRadius: 1.5,
textTransform: 'none',
fontSize: 12.5,
fontWeight: 700,
letterSpacing: 0.1,
bgcolor: '#fff',
borderColor: active ? edge(BRAND) : DT.borderSubtle,
color: active ? BRAND : DT.textPrimary,
'&:hover': {
bgcolor: '#fff',
borderColor: BRAND,
color: BRAND,
boxShadow: `0 0 0 3px ${ring(BRAND)}`
},
'&:focus-visible': { boxShadow: `0 0 0 3px ${ring(BRAND)}` }
});
export const PrimaryButtonSx = {
height: 32,
minHeight: 32,
px: 1.5,
borderRadius: 1.5,
bgcolor: BRAND,
color: '#fff',
textTransform: 'none',
fontSize: 12.5,
fontWeight: 700,
letterSpacing: 0.1,
boxShadow: `0 2px 6px ${ring(BRAND)}`,
'&:hover': { bgcolor: BRAND_LIGHT, boxShadow: `0 4px 12px ${ring(BRAND)}` },
'&:focus-visible': { boxShadow: `0 0 0 3px ${ring(BRAND)}` },
'& .MuiButton-startIcon': { mr: 0.75, '& svg': { fontSize: 16 } }
};
// ----------------------------------------------------------------------------
// PageHeaderShellSx — the gradient header strip used by every operator page.
// Spread onto the outer <Paper> element.
// ----------------------------------------------------------------------------
export const PageHeaderShellSx = {
mb: { xs: 1, md: 1.25 },
px: { xs: 1.5, sm: 2 },
py: { xs: 1, sm: 1.25 },
borderRadius: 2,
border: '1px solid',
borderColor: DT.borderSubtle,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
boxShadow: DT.shadowMd
};
// ----------------------------------------------------------------------------
// CompactKpiCardSx — visual envelope for a compact KPI card.
// Caller supplies the colored left bar via the `accent` arg.
// ----------------------------------------------------------------------------
export const CompactKpiCardSx = (accentColor) => ({
position: 'relative',
overflow: 'hidden',
px: { xs: 1.25, sm: 1.5 },
py: { xs: 0.875, sm: 1.125 },
borderRadius: 2,
border: '1px solid',
borderColor: DT.borderSubtle,
background: '#fff',
transition: 'transform 0.15s, box-shadow 0.15s, border-color 0.15s',
'&:hover': {
transform: 'translateY(-1px)',
boxShadow: DT.shadowMd,
borderColor: edge(accentColor)
}
});
// MdAccessTime re-exported so callers can use the inline time icon
// without an extra react-icons import.
export { MdAccessTime };

View File

@@ -1532,6 +1532,92 @@
margin-left: 4px; margin-left: 4px;
} }
/* ─── Live bike marker (Swiggy/Zomato/Rapido-style) ───────────────────────
Center-anchored rounded badge carrying a motorbike glyph, a pulsing "live"
ring, and a side label. The container itself is click-through; only the
badge + label capture clicks so the wide label area doesn't block the map. */
.dispatch-container .live-rider-bike {
--pin-color: #16a34a;
position: relative;
width: 160px;
height: 44px;
pointer-events: none;
}
.dispatch-container .live-rider-bike-badge {
position: absolute;
left: 4px;
top: 4px;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
background: var(--pin-color);
border: 3px solid #fff;
border-radius: 50%;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
pointer-events: auto;
z-index: 2;
}
.dispatch-container .live-rider-bike-pulse {
position: absolute;
left: 4px;
top: 4px;
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--pin-color);
opacity: 0.45;
z-index: 1;
}
.dispatch-container .live-rider-bike.is-active .live-rider-bike-pulse {
animation: live-rider-bike-pulse 1.6s ease-out infinite;
}
@keyframes live-rider-bike-pulse {
0% {
transform: scale(1);
opacity: 0.5;
}
70% {
transform: scale(2.2);
opacity: 0;
}
100% {
transform: scale(2.2);
opacity: 0;
}
}
.dispatch-container .live-rider-bike.is-idle .live-rider-bike-badge {
opacity: 0.85;
}
.dispatch-container .live-rider-bike-label {
position: absolute;
left: 46px;
top: 9px;
background: var(--pin-color);
color: #fff;
font-size: 11px;
font-weight: 700;
padding: 3px 8px;
border-radius: 4px;
white-space: nowrap;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
line-height: 1.2;
pointer-events: auto;
}
.dispatch-container .live-rider-bike-label span {
font-weight: 500;
opacity: 0.85;
margin-left: 4px;
}
/* Body layout */ /* Body layout */
.dispatch-container #body { .dispatch-container #body {
flex: 1; flex: 1;
@@ -1949,6 +2035,46 @@
color: #16a34a; color: #16a34a;
} }
/* GPS-only rider (live on the road, no active delivery this slot). The card
collapses to just the live state — the badge mirrors the map's live bike
indicator so the operator reads "tracking position only" at a glance. */
.dispatch-container .rcard.is-gps-only {
border-style: dashed;
cursor: default;
}
/* GPS-only riders have no route to open, so the card is not interactive —
suppress the hover lift/shadow that signals "clickable". */
.dispatch-container .rcard.is-gps-only:hover {
transform: none;
box-shadow: var(--shadow);
border-color: var(--border);
}
.dispatch-container .rcard-badge.rcard-badge-live {
display: inline-flex;
align-items: center;
gap: 6px;
background: rgba(22, 163, 74, 0.12);
color: #16a34a;
letter-spacing: 0.04em;
}
.dispatch-container .rcard-live-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: #16a34a;
box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
animation: rcard-live-pulse 1.6s ease-out infinite;
}
@keyframes rcard-live-pulse {
0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.dispatch-container .bar-bg { .dispatch-container .bar-bg {
background: var(--bg-sub); background: var(--bg-sub);
border-radius: 4px; border-radius: 4px;
@@ -1987,6 +2113,214 @@
border: 1px solid var(--border); border: 1px solid var(--border);
} }
/* ── Active-delivery card (Active view sidebar) ─────────────────────────────
Clean monitoring card: rider avatar + customer/rider header + status pill, a
truncated drop-address line, and a footer with the pickup kitchen on the left
and distance + ETA-to-drop on the right. `--ad-accent` = owning rider color. */
.dispatch-container .adcard-list {
display: flex;
flex-direction: column;
gap: 12px;
padding: 4px 2px 12px;
}
.dispatch-container .adcard {
position: relative;
background: #fff;
border: 1px solid var(--border);
border-radius: 14px;
padding: 13px 14px 13px 16px;
cursor: pointer;
overflow: hidden;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.dispatch-container .adcard::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 3px;
height: 100%;
background: var(--ad-accent, var(--accent));
opacity: 0.9;
transition: width 0.18s ease;
}
.dispatch-container .adcard:hover {
transform: translateY(-2px);
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
border-color: var(--ad-accent, var(--accent));
}
.dispatch-container .adcard:hover::before {
width: 5px;
}
.dispatch-container .adcard.is-active {
border-color: var(--ad-accent, var(--accent));
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}
.dispatch-container .adcard.is-active::before {
width: 5px;
}
.dispatch-container .adcard-top {
display: flex;
align-items: center;
gap: 11px;
}
.dispatch-container .adcard-avatar {
width: 38px;
height: 38px;
border-radius: 11px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 13px;
font-weight: 800;
color: #fff;
letter-spacing: 0.02em;
}
.dispatch-container .adcard-titles {
flex: 1;
min-width: 0;
}
.dispatch-container .adcard-customer {
font-size: 14.5px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.01em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dispatch-container .adcard-rider {
display: flex;
align-items: center;
gap: 5px;
font-size: 12px;
font-weight: 600;
color: var(--text-muted);
margin-top: 2px;
min-width: 0;
}
.dispatch-container .adcard-status {
flex-shrink: 0;
align-self: flex-start;
font-size: 9.5px;
font-weight: 800;
padding: 4px 9px;
border-radius: 999px;
text-transform: uppercase;
letter-spacing: 0.05em;
white-space: nowrap;
}
.dispatch-container .adcard-addr {
display: flex;
align-items: center;
gap: 7px;
margin-top: 11px;
font-size: 12px;
color: var(--text-muted);
min-width: 0;
}
.dispatch-container .adcard-addr .adcard-ic {
color: #94a3b8;
}
.dispatch-container .adcard-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 11px;
padding-top: 10px;
border-top: 1px solid var(--border);
}
.dispatch-container .adcard-pickup {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
font-size: 12px;
font-weight: 600;
color: var(--text);
}
.dispatch-container .adcard-pickup .adcard-ic {
color: var(--kitchen);
}
.dispatch-container .adcard-metrics {
display: inline-flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
font-size: 12px;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.dispatch-container .adcard-m {
display: inline-flex;
align-items: center;
gap: 4px;
}
.dispatch-container .adcard-m-km {
color: var(--text-muted);
}
.dispatch-container .adcard-m-eta {
color: var(--ad-accent, var(--accent));
}
.dispatch-container .adcard-ic {
flex-shrink: 0;
display: inline-flex;
align-items: center;
font-size: 14px;
}
.dispatch-container .adcard-tx {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
/* Drop address: allow up to two lines instead of one truncated line so long
addresses stay readable; the location icon hugs the first line. */
.dispatch-container .adcard-addr {
align-items: flex-start;
}
.dispatch-container .adcard-addr .adcard-ic {
margin-top: 1px;
}
.dispatch-container .adcard-addr-tx {
white-space: normal;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 1.4;
}
.dispatch-container .zone-order-change-rider { .dispatch-container .zone-order-change-rider {
flex-shrink: 0; flex-shrink: 0;
width: 26px; width: 26px;
@@ -2166,6 +2500,8 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap;
row-gap: 10px;
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
background: #fff; background: #fff;
} }
@@ -2186,6 +2522,95 @@
gap: 12px; gap: 12px;
} }
/* Planned / By time segmented control inside the trip header. Wraps onto its
own full-width row below the badge + stats (the header is flex-wrap: wrap,
and flex-basis: 100% forces the break). Each pill = 50% of the row → a clear
"tab bar". Active pill is a white thumb; the mode's semantic color (indigo
for Planned, emerald for By time) lands on the active icon so the mode reads
at a glance. */
.dispatch-container .trip-sort-toggle {
display: flex;
align-items: stretch;
width: 100%;
flex-basis: 100%;
margin-left: 0;
padding: 3px;
background: #f1f5f9;
border-radius: 10px;
position: relative;
isolation: isolate;
}
.dispatch-container .trip-sort-pill {
flex: 1 1 0;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 6px 10px;
min-height: 28px;
font-size: 11.5px;
font-weight: 600;
letter-spacing: 0.01em;
line-height: 1;
color: #64748b;
background: transparent;
border: 0;
border-radius: 7px;
cursor: pointer;
white-space: nowrap;
transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
-webkit-appearance: none;
appearance: none;
}
.dispatch-container .trip-sort-pill svg {
width: 14px;
height: 14px;
flex: 0 0 auto;
display: block;
color: #94a3b8;
transition: color 0.18s ease, transform 0.18s ease;
}
.dispatch-container .trip-sort-pill:hover:not(.is-active) {
color: #0f172a;
}
.dispatch-container .trip-sort-pill:hover:not(.is-active) svg {
color: #475569;
}
.dispatch-container .trip-sort-pill:focus-visible {
outline: none;
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}
.dispatch-container .trip-sort-pill.is-active {
color: #0f172a;
background: #ffffff;
box-shadow:
0 1px 2px rgba(15, 23, 42, 0.08),
0 0 0 1px rgba(15, 23, 42, 0.04),
0 2px 6px rgba(15, 23, 42, 0.06);
}
.dispatch-container .trip-sort-toggle[data-mode='planned']
.trip-sort-pill.is-active svg {
color: #6366f1;
}
.dispatch-container .trip-sort-toggle[data-mode='time']
.trip-sort-pill.is-active svg {
color: #10b981;
}
/* Undelivered cards while By time is active — sunk to the bottom and dimmed
so "not yet delivered" reads at a glance without checking each status pill. */
.dispatch-container .zone-order-card.is-pending-time {
opacity: 0.72;
}
.dispatch-container .step-wrap { .dispatch-container .step-wrap {
padding: 16px; padding: 16px;
} }
@@ -5523,6 +5948,30 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
/* Customer (recipient) name — sits directly under the rider name as a
secondary, lighter line so the operator sees who the drop is for. */
.dispatch-container .dispatch-popup .pu-customer {
margin-top: 4px;
padding: 0;
font-size: 13px;
font-weight: 600;
color: rgba(255, 255, 255, 0.9) !important;
display: flex;
align-items: center;
gap: 6px;
}
.dispatch-container .dispatch-popup .pu-customer svg {
font-size: 15px;
opacity: 0.85;
}
.dispatch-container .dispatch-popup .pu-customer span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dispatch-container .dispatch-popup .pu-delivery-id { .dispatch-container .dispatch-popup .pu-delivery-id {
margin-top: 6px; margin-top: 6px;
font-size: 11px; font-size: 11px;

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,28 @@ export const getStatusStyle = (status) =>
export const FINAL_STATUSES = new Set(['delivered']); export const FINAL_STATUSES = new Set(['delivered']);
export const SKIPPED_STATUSES = new Set(['cancelled', 'skipped']); export const SKIPPED_STATUSES = new Set(['cancelled', 'skipped']);
// An order is "active" (currently in progress) when it's neither completed
// (delivered) nor skipped/cancelled. The Active view uses this to collapse a
// rider down to the single delivery they're working on right now.
export const isActiveDelivery = (o) => {
const s = String(o?.orderstatus || '').toLowerCase();
return !FINAL_STATUSES.has(s) && !SKIPPED_STATUSES.has(s);
};
// A rider's single in-progress delivery: the first non-final, non-skipped
// stop in (trip, step) order. Returns null when the rider has nothing active
// (everything delivered/cancelled, or GPS-only with no orders).
export const getActiveOrder = (orders) => {
if (!Array.isArray(orders) || !orders.length) return null;
const sorted = [...orders].sort((a, b) => {
const tA = a.trip_number || 1;
const tB = b.trip_number || 1;
if (tA !== tB) return tA - tB;
return (a.step || 0) - (b.step || 0);
});
return sorted.find(isActiveDelivery) || null;
};
// Per-step palette — wider and more deliberately spaced than the rider // Per-step palette — wider and more deliberately spaced than the rider
// palette so a 10-stop day reads as 10 distinct colors on the compare // palette so a 10-stop day reads as 10 distinct colors on the compare
// map's polylines + pins. // map's polylines + pins.

View File

@@ -173,54 +173,57 @@ const Invoice = () => {
<> <>
{isloader && <Loader />} {isloader && <Loader />}
{/* ============================================= || Header || ============================================= */} {/* ============================================= || Header (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mb: { xs: 1.5, md: 2 }, mb: { xs: 1, md: 1.25 },
p: { xs: 1.5, sm: 2, md: 2.5 }, px: { xs: 1.5, sm: 2 },
borderRadius: DT.radiusCard / 8, py: { xs: 1, sm: 1.25 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`, background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
boxShadow: DT.shadowMd boxShadow: DT.shadowMd
}} }}
> >
<Stack direction="row" alignItems="center" spacing={{ xs: 1.25, sm: 1.75 }}> <Stack direction="row" alignItems="center" spacing={1.25}>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 40, sm: 48 }, width: 36,
height: { xs: 40, sm: 48 }, height: 36,
bgcolor: BRAND, bgcolor: BRAND,
color: '#fff', color: '#fff',
boxShadow: `0 6px 18px ${ring(BRAND)}` borderRadius: 1.5,
boxShadow: `0 4px 12px ${ring(BRAND)}`
}} }}
> >
<MdReceiptLong size={22} /> <MdReceiptLong size={19} />
</Avatar> </Avatar>
<Stack> <Stack spacing={0.125}>
<Typography <Typography
variant="h3" variant="h3"
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.1,
fontSize: { xs: '1.25rem', sm: '1.5rem', md: '1.75rem' } fontSize: { xs: '1.1rem', sm: '1.25rem', md: '1.375rem' }
}} }}
> >
Invoices Invoices
</Typography> </Typography>
<Stack direction="row" alignItems="center" spacing={0.75} sx={{ mt: 0.5 }}> <Stack direction="row" alignItems="center" spacing={0.75}>
<Box <Box
sx={{ sx={{
width: 8, width: 7,
height: 8, height: 7,
borderRadius: '50%', borderRadius: '50%',
bgcolor: '#10b981', bgcolor: '#10b981',
boxShadow: '0 0 0 4px rgba(16,185,129,0.18)' boxShadow: '0 0 0 3px rgba(16,185,129,0.18)'
}} }}
/> />
<Typography variant="caption" sx={{ color: DT.textSecondary, fontWeight: 600 }}> <Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 600 }}>
Live · {INVOICE_STATUS_TABS[value].label} Live · {INVOICE_STATUS_TABS[value].label}
</Typography> </Typography>
</Stack> </Stack>
@@ -228,8 +231,8 @@ const Invoice = () => {
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || KPI Cards || ============================================= */} {/* ============================================= || KPI Cards (compact, clickable) || ============================================= */}
<Grid container spacing={{ xs: 1.25, sm: 1.5, md: 2 }}> <Grid container spacing={{ xs: 1, sm: 1.25, md: 1.5 }}>
{kpiCards.map((item) => { {kpiCards.map((item) => {
const Icon = item.icon; const Icon = item.icon;
const active = value === item.idx; const active = value === item.idx;
@@ -242,15 +245,16 @@ const Invoice = () => {
cursor: 'pointer', cursor: 'pointer',
position: 'relative', position: 'relative',
overflow: 'hidden', overflow: 'hidden',
p: { xs: 1.25, sm: 1.75, md: 2.25 }, px: { xs: 1.25, sm: 1.5 },
borderRadius: DT.radiusCard / 8, py: { xs: 0.875, sm: 1.125 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: active ? edge(item.color) : DT.borderSubtle, borderColor: active ? edge(item.color) : DT.borderSubtle,
background: '#fff', background: '#fff',
boxShadow: active ? `0 6px 24px ${ring(item.color)}` : 'none', boxShadow: active ? `0 4px 14px ${ring(item.color)}` : 'none',
transition: 'transform 0.2s, box-shadow 0.2s, border-color 0.2s', transition: 'transform 0.15s, box-shadow 0.15s, border-color 0.15s',
'&:hover': { '&:hover': {
transform: 'translateY(-3px)', transform: 'translateY(-1px)',
boxShadow: DT.shadowMd, boxShadow: DT.shadowMd,
borderColor: edge(item.color) borderColor: edge(item.color)
} }
@@ -261,21 +265,24 @@ const Invoice = () => {
position: 'absolute', position: 'absolute',
top: 0, top: 0,
left: 0, left: 0,
right: 0, bottom: 0,
height: 3, width: 3,
background: `linear-gradient(90deg, ${item.color} 0%, ${soft(item.color)} 100%)` background: item.color
}} }}
/> />
<Stack direction="row" alignItems="flex-start" justifyContent="space-between" spacing={1}> <Stack direction="row" alignItems="center" justifyContent="space-between" spacing={1} sx={{ pl: 0.5 }}>
<Stack spacing={0.5} sx={{ minWidth: 0, flex: 1 }}> <Stack spacing={0.125} sx={{ minWidth: 0, flex: 1 }}>
<Typography <Typography
variant="caption"
sx={{ sx={{
color: DT.textSecondary, color: DT.textSecondary,
fontWeight: 700, fontWeight: 700,
letterSpacing: 0.4, letterSpacing: 0.4,
textTransform: 'uppercase', textTransform: 'uppercase',
fontSize: { xs: 10, sm: 11 } fontSize: 10.5,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
lineHeight: 1.2
}} }}
> >
{item.label} Invoices {item.label} Invoices
@@ -284,9 +291,10 @@ const Invoice = () => {
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.15,
fontSize: { xs: '1.25rem', sm: '1.5rem', md: '1.75rem' } fontSize: { xs: '0.95rem', sm: '1.1rem', md: '1.2rem' }
}} }}
noWrap
> >
{insightdata && insightdata[item.countKey] != null ? ( {insightdata && insightdata[item.countKey] != null ? (
insightdata[item.countKey] insightdata[item.countKey]
@@ -296,16 +304,17 @@ const Invoice = () => {
</Typography> </Typography>
</Stack> </Stack>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 36, sm: 42, md: 48 }, width: 30,
height: { xs: 36, sm: 42, md: 48 }, height: 30,
bgcolor: soft(item.color), bgcolor: soft(item.color),
color: item.color, color: item.color,
boxShadow: `inset 0 0 0 1px ${edge(item.color)}`, borderRadius: 1.25,
flexShrink: 0 flexShrink: 0
}} }}
> >
<Icon size={20} /> <Icon size={15} />
</Avatar> </Avatar>
</Stack> </Stack>
</Paper> </Paper>
@@ -314,14 +323,14 @@ const Invoice = () => {
})} })}
</Grid> </Grid>
{/* ============================================= || Status Tabs + Search || ============================================= */} {/* ============================================= || Status Tabs + Search (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mt: { xs: 1.5, md: 2 }, mt: { xs: 1, md: 1.25 },
p: { xs: 1, md: 1.5 }, p: { xs: 0.875, md: 1.125 },
borderTopLeftRadius: DT.radiusCard / 8, borderTopLeftRadius: 2,
borderTopRightRadius: DT.radiusCard / 8, borderTopRightRadius: 2,
borderBottomLeftRadius: 0, borderBottomLeftRadius: 0,
borderBottomRightRadius: 0, borderBottomRightRadius: 0,
border: '1px solid', border: '1px solid',
@@ -452,14 +461,14 @@ const Invoice = () => {
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || Table || ============================================= */} {/* ============================================= || Table (dense, sticky header) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
borderTopLeftRadius: 0, borderTopLeftRadius: 0,
borderTopRightRadius: 0, borderTopRightRadius: 0,
borderBottomLeftRadius: DT.radiusCard / 8, borderBottomLeftRadius: 2,
borderBottomRightRadius: DT.radiusCard / 8, borderBottomRightRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
overflow: 'hidden', overflow: 'hidden',
@@ -468,7 +477,8 @@ const Invoice = () => {
> >
<TableContainer <TableContainer
sx={{ sx={{
maxHeight: 460, minHeight: 320,
maxHeight: { xs: 'calc(100vh - 380px)', md: 'calc(100vh - 350px)' },
overflow: 'auto', overflow: 'auto',
'&::-webkit-scrollbar': { width: 10, height: 10 }, '&::-webkit-scrollbar': { width: 10, height: 10 },
'&::-webkit-scrollbar-thumb': { '&::-webkit-scrollbar-thumb': {
@@ -479,21 +489,21 @@ const Invoice = () => {
'&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt } '&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt }
}} }}
> >
<Table stickyHeader sx={{ minWidth: 880 }}> <Table stickyHeader size="small" sx={{ minWidth: 880 }}>
<TableHead> <TableHead>
<TableRow <TableRow
sx={{ sx={{
'& th': { '& th': {
backgroundColor: DT.surfaceAlt, backgroundColor: DT.surfaceAlt,
color: DT.textSecondary, color: DT.textSecondary,
fontSize: { xs: 10, md: 11 }, fontSize: 10.5,
fontWeight: 800, fontWeight: 800,
letterSpacing: 0.6, letterSpacing: 0.5,
textTransform: 'uppercase', textTransform: 'uppercase',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
borderBottom: `1px solid ${DT.borderSubtle}`, borderBottom: `1px solid ${DT.borderSubtle}`,
py: { xs: 1, md: 1.25 }, py: 0.75,
px: { xs: 1, md: 1.5 } px: 1
} }
}} }}
> >
@@ -510,11 +520,11 @@ const Invoice = () => {
<TableBody> <TableBody>
{isloader && filteredList.length === 0 && ( {isloader && filteredList.length === 0 && (
[0, 1, 2, 3, 4].map((_, idx) => ( Array.from({ length: 10 }).map((_, idx) => (
<TableRow key={`sk-${idx}`}> <TableRow key={`sk-${idx}`}>
{Array.from({ length: 8 }).map((__, ci) => ( {Array.from({ length: 8 }).map((__, ci) => (
<TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}` }}> <TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}`, py: 0.625, px: 1 }}>
<Skeleton animation="wave" /> <Skeleton animation="wave" height={20} />
</TableCell> </TableCell>
))} ))}
</TableRow> </TableRow>
@@ -523,17 +533,50 @@ const Invoice = () => {
{!isloader && filteredList.length === 0 && ( {!isloader && filteredList.length === 0 && (
<TableRow> <TableRow>
<TableCell colSpan={8} sx={{ py: 6, borderBottom: 'none' }}> <TableCell colSpan={8} sx={{ py: 7, borderBottom: 'none' }}>
<Stack alignItems="center" spacing={1.5}> <Stack alignItems="center" spacing={1.25}>
<Avatar sx={{ width: 64, height: 64, bgcolor: soft('#94a3b8'), color: DT.textMuted }}> <Avatar
<MdReceiptLong size={28} /> variant="rounded"
sx={{
width: 56,
height: 56,
bgcolor: soft('#94a3b8'),
color: DT.textMuted,
borderRadius: 2
}}
>
<MdReceiptLong size={26} />
</Avatar> </Avatar>
<Typography variant="subtitle1" sx={{ fontWeight: 700, color: DT.textPrimary }}> <Typography sx={{ fontWeight: 700, color: DT.textPrimary, fontSize: 14 }}>
No {INVOICE_STATUS_TABS[value].label.toLowerCase()} invoices No {INVOICE_STATUS_TABS[value].label.toLowerCase()} invoices
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textSecondary }}> <Typography sx={{ color: DT.textSecondary, fontSize: 12 }}>
{search ? 'Try a different invoice number.' : 'Switch tabs above to load invoices.'} {search ? 'Try a different invoice number or clear the search.' : 'Switch tabs above to load invoices.'}
</Typography> </Typography>
{search && (
<Box
component="button"
onClick={() => setSearch('')}
sx={{
mt: 0.5,
border: 'none',
cursor: 'pointer',
display: 'inline-flex',
alignItems: 'center',
gap: 0.5,
height: 28,
px: 1,
fontSize: 12,
fontWeight: 700,
color: BRAND,
borderRadius: 1.25,
background: 'transparent',
'&:hover': { bgcolor: tint(BRAND) }
}}
>
<MdClear size={14} /> Clear search
</Box>
)}
</Stack> </Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
@@ -546,13 +589,17 @@ const Invoice = () => {
key={`${item.invoiceno}-${index}`} key={`${item.invoiceno}-${index}`}
sx={{ sx={{
cursor: 'pointer', cursor: 'pointer',
transition: 'background-color 0.15s', transition: 'background-color 0.12s, box-shadow 0.12s',
'& td': { '& td': {
borderBottom: `1px solid ${DT.divider}`, borderBottom: `1px solid ${DT.divider}`,
py: { xs: 1, md: 1.25 }, py: 0.5,
px: { xs: 1, md: 1.5 } px: 1,
verticalAlign: 'middle'
}, },
'&:hover': { backgroundColor: DT.surfaceAlt } '&:hover': {
backgroundColor: tint(BRAND),
boxShadow: `inset 3px 0 0 ${BRAND}`
}
}} }}
onClick={() => { onClick={() => {
setIsLoader(true); setIsLoader(true);
@@ -563,16 +610,16 @@ const Invoice = () => {
}} }}
> >
<TableCell> <TableCell>
<Typography sx={{ fontWeight: 700, color: DT.textSecondary }}> <Typography sx={{ fontWeight: 700, fontSize: 12, color: DT.textMuted }}>
{page * rowsPerPage + index + 1} {page * rowsPerPage + index + 1}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
<Typography variant="subtitle2" sx={{ fontWeight: 700, color: DT.textPrimary }} noWrap> <Typography sx={{ fontSize: 12.5, fontWeight: 700, color: DT.textPrimary, lineHeight: 1.25 }} noWrap>
{item.tenantname} {item.tenantname}
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textSecondary }} noWrap> <Typography sx={{ fontSize: 11, fontWeight: 600, color: DT.textSecondary, lineHeight: 1.3 }} noWrap>
{item.contactperson} {item.contactperson}
</Typography> </Typography>
</TableCell> </TableCell>
@@ -599,31 +646,33 @@ const Invoice = () => {
</TableCell> </TableCell>
<TableCell> <TableCell>
<Stack direction="row" alignItems="center" spacing={0.5}> {item.transactiondate ? (
<MdCalendarMonth size={12} style={{ color: DT.textMuted, flexShrink: 0 }} /> <Stack spacing={0} sx={{ lineHeight: 1.1 }}>
<Stack> <Typography sx={{ fontSize: 12.5, fontWeight: 800, color: DT.textPrimary, lineHeight: 1.15 }} noWrap>
<Typography variant="caption" sx={{ fontWeight: 700, color: DT.textPrimary }} noWrap> {dayjs(item.transactiondate).format('hh:mm A')}
{item.transactiondate ? dayjs(item.transactiondate).format('DD MMM YYYY') : '—'}
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textMuted, fontSize: 10 }} noWrap> <Typography sx={{ fontSize: 10.5, fontWeight: 600, color: DT.textMuted, lineHeight: 1.2 }} noWrap>
{item.transactiondate ? dayjs(item.transactiondate).format('hh:mm A') : ''} {dayjs(item.transactiondate).format('DD MMM YYYY')}
</Typography> </Typography>
</Stack> </Stack>
</Stack> ) : (
<Typography sx={{ fontSize: 12, color: DT.textMuted, fontWeight: 700 }}></Typography>
)}
</TableCell> </TableCell>
<TableCell> <TableCell>
<Stack direction="row" alignItems="center" spacing={0.5}> {item.duedate ? (
<MdAccessTime size={12} style={{ color: DT.textMuted, flexShrink: 0 }} /> <Stack spacing={0} sx={{ lineHeight: 1.1 }}>
<Stack> <Typography sx={{ fontSize: 12.5, fontWeight: 800, color: DT.textPrimary, lineHeight: 1.15 }} noWrap>
<Typography variant="caption" sx={{ fontWeight: 700, color: DT.textPrimary }} noWrap> {dayjs(item.duedate).format('hh:mm A')}
{item.duedate ? dayjs(item.duedate).format('DD MMM YYYY') : '—'}
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textMuted, fontSize: 10 }} noWrap> <Typography sx={{ fontSize: 10.5, fontWeight: 600, color: DT.textMuted, lineHeight: 1.2 }} noWrap>
{item.duedate ? dayjs(item.duedate).format('hh:mm A') : ''} {dayjs(item.duedate).format('DD MMM YYYY')}
</Typography> </Typography>
</Stack> </Stack>
</Stack> ) : (
<Typography sx={{ fontSize: 12, color: DT.textMuted, fontWeight: 700 }}></Typography>
)}
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">

View File

@@ -108,7 +108,7 @@ const InvoicePreview = () => {
<IconButton <IconButton
color="primary" color="primary"
onClick={() => { onClick={() => {
navigate('/invoice'); navigate('/nearle/invoice');
}} }}
> >
<FaArrowLeft size={'large'} /> <FaArrowLeft size={'large'} />

View File

@@ -1,43 +1,55 @@
import React, { useState, useEffect, Fragment, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import {
Box, Box,
Drawer, Drawer,
IconButton, IconButton,
Toolbar,
Typography, Typography,
AppBar,
useMediaQuery, useMediaQuery,
Divider,
List,
ListItem,
ListItemText,
useTheme, useTheme,
ListItemAvatar,
Avatar,
Tooltip, Tooltip,
TableCell, TableCell,
Chip,
Stack, Stack,
TableRow, TableRow,
TableBody, TableBody,
TableHead, TableHead,
Table, Table,
TableContainer, TableContainer,
Tabs, CircularProgress,
Tab, InputBase,
CircularProgress Paper,
Avatar,
ButtonBase
} from '@mui/material'; } from '@mui/material';
import MenuIcon from '@mui/icons-material/Menu'; import {
import SearchBar from 'components/nearle_components/SearchBar'; MdMenu,
MdSearch,
MdClear,
MdPlace,
MdStorefront,
MdMyLocation,
MdAccessTime,
MdLocalShipping,
MdHourglassEmpty,
MdCheckCircle,
MdCancel,
MdReceiptLong
} from 'react-icons/md';
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'; import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
import { fetchOrders1, gettenantlocations } from '../api/api'; import { fetchOrders1, gettenantlocations } from '../api/api';
import Loader from 'components/Loader'; import Loader from 'components/Loader';
import CircularLoader from 'components/nearle_components/CircularLoader'; import CircularLoader from 'components/nearle_components/CircularLoader';
import { Empty, Skeleton } from 'antd'; import { Empty, Skeleton } from 'antd';
import MainCard from 'components/MainCard'; import {
import AccessTimeIcon from '@mui/icons-material/AccessTime'; DT,
import LocalShippingOutlinedIcon from '@mui/icons-material/LocalShippingOutlined'; BRAND,
import { CancelOutlined, CheckCircleOutline } from '@mui/icons-material'; BRAND_LIGHT,
tint,
soft,
ring,
edge,
StatusBadge,
AccentAvatar
} from '../_shared/ordersDesign';
import axios from 'axios'; import axios from 'axios';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
var utc = require('dayjs/plugin/utc'); var utc = require('dayjs/plugin/utc');
@@ -45,6 +57,15 @@ dayjs.extend(utc);
const drawerWidth = 300; const drawerWidth = 300;
// Status filter tabs — colors aligned with STATUS_META in the shared design system
// (blue=created, amber=pending, green=delivered, red=cancelled).
const STATUS_TABS = [
{ label: 'Created', value: 'created', color: '#3b82f6', icon: MdLocalShipping },
{ label: 'Pending', value: 'pending', color: '#f59e0b', icon: MdHourglassEmpty },
{ label: 'Delivered', value: 'delivered', color: '#10b981', icon: MdCheckCircle },
{ label: 'Cancelled', value: 'cancelled', color: '#ef4444', icon: MdCancel }
];
const ResponsiveLocationDrawer = () => { const ResponsiveLocationDrawer = () => {
const loadMoreRef = useRef(); const loadMoreRef = useRef();
const containerRef = useRef(); const containerRef = useRef();
@@ -71,6 +92,14 @@ const ResponsiveLocationDrawer = () => {
const [searchword, setSearchword] = useState(''); const [searchword, setSearchword] = useState('');
const [debouncedSearchword, setDebouncedSearchword] = useState(''); const [debouncedSearchword, setDebouncedSearchword] = useState('');
// Per-status counts keyed by tab value, so the filter pills can show a badge.
const statusCounts = {
created: createdLenght,
pending: pendingLenght,
delivered: deliveredlenght,
cancelled: cancelledLenght
};
useEffect(() => { useEffect(() => {
const handler = setTimeout(() => { const handler = setTimeout(() => {
setDebouncedSearchLocation(searchLocation); setDebouncedSearchLocation(searchLocation);
@@ -87,38 +116,11 @@ const ResponsiveLocationDrawer = () => {
return () => clearTimeout(handler); return () => clearTimeout(handler);
}, [searchword]); }, [searchword]);
const statusMap = [ const handleChangetab = (i) => {
{
label: 'Created',
value: 'created',
count: createdLenght,
icon: <AccessTimeIcon color="primary" fontSize="small" />
},
{
label: 'Pending',
value: 'pending',
count: pendingLenght,
icon: <LocalShippingOutlinedIcon color="primary" fontSize="small" />
},
{
label: 'Delivered',
value: 'delivered',
count: deliveredlenght,
icon: <CheckCircleOutline color="primary" fontSize="small" />
},
{
label: 'Cancelled',
value: 'cancelled',
count: cancelledLenght,
icon: <CancelOutlined color="primary" fontSize="small" />
}
];
const handleChangetab = (e, i) => {
setSearchword(''); setSearchword('');
setRowsPerPage(10); setRowsPerPage(10);
setTabvalue(i); setTabvalue(i);
setCurrentStatus(statusMap[i].value); setCurrentStatus(STATUS_TABS[i].value);
setPage(0); setPage(0);
}; };
@@ -138,9 +140,7 @@ const ResponsiveLocationDrawer = () => {
// in the visible list, returning nothing and confusing the operator). // in the visible list, returning nothing and confusing the operator).
useEffect(() => { useEffect(() => {
if (!Array.isArray(locations) || locations.length === 0) return; if (!Array.isArray(locations) || locations.length === 0) return;
const stillVisible = const stillVisible = selectedLocation && locations.some((l) => l.locationid === selectedLocation.locationid);
selectedLocation &&
locations.some((l) => l.locationid === selectedLocation.locationid);
if (!stillVisible) setSelectedLocation(locations[0]); if (!stillVisible) setSelectedLocation(locations[0]);
}, [locations]); }, [locations]);
@@ -177,7 +177,7 @@ const ResponsiveLocationDrawer = () => {
} }
}, },
{ {
root: document.querySelector('.MuiTableContainer-root'), // 👈 or explicitly TableContainer root: document.querySelector('.MuiTableContainer-root'),
rootMargin: '0px', rootMargin: '0px',
threshold: 1.0 threshold: 1.0
} }
@@ -240,6 +240,139 @@ const ResponsiveLocationDrawer = () => {
errMessage && console.log(errMessage); errMessage && console.log(errMessage);
}, [errMessage]); }, [errMessage]);
// Brand-styled scrollbar reused on the sidebar + table.
const scrollbarSx = {
'&::-webkit-scrollbar': { width: 8, height: 8 },
'&::-webkit-scrollbar-thumb': {
backgroundColor: edge(BRAND),
borderRadius: 8,
'&:hover': { backgroundColor: BRAND }
},
'&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt }
};
// --------------------------------------------------------------------------
// Sidebar — searchable location list. Shared between the desktop persistent
// drawer and the mobile temporary drawer.
// --------------------------------------------------------------------------
const sidebarContent = (
<Stack sx={{ height: '100%', bgcolor: '#fff' }}>
{/* Sidebar header */}
<Box sx={{ px: 1.5, pt: 1.5, pb: 1 }}>
<Stack direction="row" alignItems="center" spacing={1} sx={{ mb: 1.25 }}>
<Avatar
variant="rounded"
sx={{ width: 30, height: 30, bgcolor: BRAND, color: '#fff', borderRadius: 1.5, boxShadow: `0 4px 12px ${ring(BRAND)}` }}
>
<MdStorefront size={16} />
</Avatar>
<Stack spacing={0}>
<Typography sx={{ fontSize: 13.5, fontWeight: 800, color: DT.textPrimary, lineHeight: 1.1 }}>Locations</Typography>
<Typography sx={{ fontSize: 10.5, fontWeight: 600, color: DT.textMuted }}>
{Array.isArray(locations) ? `${locations.length} active` : '—'}
</Typography>
</Stack>
</Stack>
{/* Search pill */}
<Box
sx={{
display: 'flex',
alignItems: 'center',
gap: 0.75,
px: 1.25,
py: 0.75,
borderRadius: 999,
bgcolor: tint(BRAND),
border: `1.5px solid ${edge(BRAND)}`,
transition: 'all 0.18s',
'&:focus-within': { borderColor: BRAND, boxShadow: `0 0 0 3px ${ring(BRAND)}` }
}}
>
<MdSearch size={16} style={{ color: BRAND, flexShrink: 0 }} />
<InputBase
placeholder="Search location"
value={searchLocation}
onChange={(e) => setSearchLocation(e.target.value)}
autoComplete="off"
sx={{
flex: 1,
fontSize: 13,
fontWeight: 600,
color: DT.textPrimary,
'& input::placeholder': { color: DT.textMuted, opacity: 1 }
}}
/>
{searchLocation && (
<IconButton size="small" onClick={() => setSearchLocation('')} sx={{ p: 0.25, color: BRAND }}>
<MdClear size={14} />
</IconButton>
)}
</Box>
</Box>
{/* Location list */}
<Box sx={{ flex: 1, overflowY: 'auto', px: 1, pb: 1, ...scrollbarSx }}>
{locationIsLoading &&
Array.from({ length: 8 }).map((_, i) => (
<Box key={i} sx={{ px: 1, py: 1 }}>
<Skeleton avatar active paragraph={{ rows: 1 }} title={false} />
</Box>
))}
{!locationIsLoading && Array.isArray(locations) && locations.length === 0 && (
<Box sx={{ py: 5 }}>
<Empty description="No locations" />
</Box>
)}
<Stack spacing={0.5}>
{locations?.map((row, index) => {
const isSelected = row.locationid === selectedLocation?.locationid;
return (
<ButtonBase
key={index}
onClick={() => setSelectedLocation(row)}
sx={{
width: '100%',
justifyContent: 'flex-start',
textAlign: 'left',
gap: 1,
px: 1,
py: 0.875,
borderRadius: 2,
position: 'relative',
transition: 'background-color 0.14s, box-shadow 0.14s',
bgcolor: isSelected ? tint(BRAND) : 'transparent',
boxShadow: isSelected ? `inset 3px 0 0 ${BRAND}` : 'none',
'&:hover': { bgcolor: isSelected ? tint(BRAND) : DT.surfaceAlt }
}}
>
<AccentAvatar color={BRAND} selected={isSelected} size={36}>
{row.locationname?.[0]?.toUpperCase() || '?'}
</AccentAvatar>
<Stack spacing={0} sx={{ minWidth: 0, flex: 1 }}>
<Typography
sx={{ fontSize: 13, fontWeight: 700, color: isSelected ? BRAND : DT.textPrimary, lineHeight: 1.2 }}
noWrap
>
{row.locationname}
</Typography>
<Stack direction="row" alignItems="center" spacing={0.375}>
<MdPlace size={11} style={{ color: DT.textMuted, flexShrink: 0 }} />
<Typography sx={{ fontSize: 11, fontWeight: 600, color: DT.textSecondary }} noWrap>
{row.suburb || '—'}
</Typography>
</Stack>
</Stack>
</ButtonBase>
);
})}
</Stack>
</Box>
</Stack>
);
return ( return (
<React.Fragment> <React.Fragment>
{locationIsLoading && ( {locationIsLoading && (
@@ -248,9 +381,8 @@ const ResponsiveLocationDrawer = () => {
</> </>
)} )}
<Box sx={{ display: 'flex', width: '100%', height: '100%', position: 'relative' }}> <Box sx={{ display: 'flex', width: '100%', height: '100%', position: 'relative', bgcolor: DT.surfaceAlt }}>
{/* ---------------- LOCAL DRAWER ---------------- */} {/* ---------------- LOCATION SIDEBAR ---------------- */}
<Drawer <Drawer
variant={isDesktop ? 'persistent' : 'temporary'} variant={isDesktop ? 'persistent' : 'temporary'}
open={open} open={open}
@@ -264,246 +396,252 @@ const ResponsiveLocationDrawer = () => {
left: 0, left: 0,
top: 0, top: 0,
height: '100%', height: '100%',
overflowY: 'auto', overflow: 'hidden',
borderRight: `1px solid ${DT.borderSubtle}`,
transition: 'transform 0.35s ease-in-out', transition: 'transform 0.35s ease-in-out',
zIndex: 10, zIndex: 10
/* vertical scrollbar */
'&::-webkit-scrollbar:vertical': {
width: '7px',
opacity: 0,
transition: 'opacity 0.3s'
},
/* horizontal scrollbar */
'&::-webkit-scrollbar:horizontal': {
height: '6px', // thinner horizontal bar
opacity: 0,
transition: 'opacity 0.3s'
},
/* show scrollbar when hovering drawer */
'&:hover::-webkit-scrollbar': {
opacity: 1
},
/* thumb styling */
'&::-webkit-scrollbar-thumb': {
backgroundColor: theme.palette.primary.main,
borderRadius: '8px'
},
'&::-webkit-scrollbar-thumb:hover': {
backgroundColor: theme.palette.primary.dark
},
/* track styling */
'&::-webkit-scrollbar-track': {
backgroundColor: theme.palette.primary.lighter
}
} }
}} }}
> >
<Box sx={{ position: 'sticky', top: 0, zIndex: 11, border: 'none' }}> {sidebarContent}
<SearchBar
value={searchLocation}
placeholder="Search Location"
onChange={(e) => setSearchLocation(e.target.value)}
sx={{
width: 'auto',
height: 60,
bgcolor: 'white',
'& .MuiOutlinedInput-notchedOutline': {
border: 'none',
borderBottom: '1px solid',
borderColor: theme.palette.secondary.light
}
}}
/>
</Box>
<List sx={{ border: 'none', mt: -1 }}>
{locations?.map((row, index) => (
<React.Fragment key={index}>
<ListItem
sx={{
cursor: 'pointer',
bgcolor: row.locationid == selectedLocation?.locationid ? theme.palette.secondary[200] : 'none',
'&:hover': {
bgcolor: theme.palette.secondary.lighter
}
}}
onClick={() => {
setSelectedLocation(row);
}}
>
<ListItemAvatar>
<Avatar
sx={{
bgcolor: 'primary.main', // background color
color: 'white' // text color
}}
>
{row.locationname?.[0]?.toUpperCase() || '?'}
</Avatar>{' '}
</ListItemAvatar>
<ListItemText primary={row.locationname} secondary={row.suburb} />
</ListItem>
<Divider />
</React.Fragment>
))}
</List>
</Drawer> </Drawer>
{/* -------------- LOCAL PAGE APPBAR -------------- */}
<AppBar
elevation={0}
position="absolute"
sx={{
top: 0,
left: open && isDesktop ? `${drawerWidth}px` : 0,
width: open && isDesktop ? `calc(100% - ${drawerWidth}px)` : '100%',
transition: 'left 0.3s ease, width 0.3s ease',
zIndex: 1100, // BELOW drawer, ABOVE content
backgroundColor: 'white',
borderBottom: '1px solid',
borderColor: theme.palette.secondary.light
}}
>
<Toolbar>
<Stack
sx={{ width: '100%', borderBottom: '1px soild red' }}
display={'flex'}
flexDirection={'row'}
alignItems={'center'}
justifyContent={'space-between'}
flexWrap={'wrap'}
>
<Stack display={'flex'} flexDirection={'row'} alignItems={'center'}>
<IconButton color="primary" onClick={toggleDrawer} sx={{ mr: 1 }}>
<MenuIcon />
</IconButton>
<Typography variant="h5" color={'primary'} sx={{ whiteSpace: 'nowrap', ml: 2 }}> {/* ---------------- MAIN PANEL ---------------- */}
{selectedLocation?.locationname}
</Typography>
</Stack>
<Stack>
<SearchBar
value={searchword}
placeholder={'Search Order Details'}
onChange={(e) => setSearchword(e.target.value)}
sx={{
width: 'auto',
height: 40,
bgcolor: 'white',
maxWidth: 800,
borderRadius: 1
// '& .MuiOutlinedInput-notchedOutline': {
// border: 'none'
// }
}}
/>
</Stack>
</Stack>
</Toolbar>
</AppBar>
{/* ---------------- PAGE SCROLLABLE CONTENT ---------------- */}
<Box <Box
sx={{ sx={{
flexGrow: 1, flexGrow: 1,
overflow: 'auto', height: '100%',
pt: '64px', // Height of AppBar display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
pl: isDesktop && open ? `${drawerWidth}px` : 0, pl: isDesktop && open ? `${drawerWidth}px` : 0,
transition: 'padding-left 0.3s ease', transition: 'padding-left 0.3s ease'
mt: -1 }}
>
{/* ---------------- GRADIENT HEADER ---------------- */}
<Paper
elevation={0}
sx={{
flexShrink: 0,
px: { xs: 1.25, sm: 1.75 },
py: { xs: 1, sm: 1.25 },
borderRadius: 0,
borderBottom: `1px solid ${DT.borderSubtle}`,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`
}} }}
> >
<Stack <Stack
display={'flex'} direction={{ xs: 'column', md: 'row' }}
flexDirection={'row'} alignItems={{ xs: 'stretch', md: 'center' }}
justifyContent={'space-between'} justifyContent="space-between"
alignItems={'center'} spacing={{ xs: 1, md: 1.5 }}
flexWrap={'wrap-reverse'} >
gap={2} <Stack direction="row" alignItems="center" spacing={1.25}>
<Tooltip title={open ? 'Hide locations' : 'Show locations'} arrow>
<IconButton
onClick={toggleDrawer}
sx={{ sx={{
border: '1px solid ', width: 34,
borderBottom: 0, height: 34,
borderColor: 'bg.main', borderRadius: 1.5,
p: 1.5 bgcolor: '#fff',
border: `1px solid ${DT.borderSubtle}`,
color: BRAND,
'&:hover': { bgcolor: tint(BRAND), borderColor: BRAND }
}} }}
> >
{/* Tabs Wrapper */} <MdMenu size={18} />
</IconButton>
</Tooltip>
<Tabs value={tabvalue} onChange={handleChangetab} variant="scrollable" scrollButtons="auto" allowScrollButtonsMobile> <Avatar
{statusMap.map((item, index) => ( variant="rounded"
<Tab sx={{ width: 36, height: 36, bgcolor: BRAND, color: '#fff', borderRadius: 1.5, boxShadow: `0 4px 12px ${ring(BRAND)}` }}
key={index} >
label={ <MdMyLocation size={19} />
<Stack direction="row" alignItems="center" spacing={1}> </Avatar>
{item.icon} <Stack spacing={0.125}>
<span>{item.label}</span> <Typography
<Chip label={item.count} color="primary" variant="light" size="small" /> variant="h3"
</Stack> sx={{
} fontWeight: 800,
/> color: DT.textPrimary,
))} lineHeight: 1.1,
</Tabs> fontSize: { xs: '1.05rem', sm: '1.2rem', md: '1.3rem' }
</Stack> }}
<MainCard noWrap
content={false} >
{selectedLocation?.locationname || 'Select a location'}
</Typography>
<Stack direction="row" alignItems="center" spacing={0.75}>
<Box sx={{ width: 7, height: 7, borderRadius: '50%', bgcolor: '#10b981', boxShadow: '0 0 0 3px rgba(16,185,129,0.18)' }} />
<Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 600 }} noWrap>
{selectedLocation?.suburb ? `${selectedLocation.suburb} · ` : ''}Live · {dayjs(startdate).format('DD MMM YYYY')}
</Typography>
</Stack>
</Stack>
</Stack>
{/* Order search pill */}
<Box
sx={{ sx={{
overflow: 'hidden',
height: 'calc(100vh - 200px)', // adjust as needed
display: 'flex', display: 'flex',
flexDirection: 'column' alignItems: 'center',
gap: 0.75,
px: 1.25,
py: 0.75,
borderRadius: 999,
bgcolor: '#fff',
border: `1.5px solid ${edge(BRAND)}`,
minWidth: { xs: '100%', md: 280 },
maxWidth: { md: 360 },
transition: 'all 0.18s',
'&:focus-within': { borderColor: BRAND, boxShadow: `0 0 0 3px ${ring(BRAND)}` }
}}
>
<MdSearch size={16} style={{ color: BRAND, flexShrink: 0 }} />
<InputBase
placeholder="Search order details"
value={searchword}
onChange={(e) => setSearchword(e.target.value)}
autoComplete="off"
sx={{
flex: 1,
fontSize: 13,
fontWeight: 600,
color: DT.textPrimary,
'& input::placeholder': { color: DT.textMuted, opacity: 1 }
}}
/>
{searchword && (
<IconButton size="small" onClick={() => setSearchword('')} sx={{ p: 0.25, color: BRAND }}>
<MdClear size={14} />
</IconButton>
)}
</Box>
</Stack>
</Paper>
{/* ---------------- STATUS FILTER PILLS ---------------- */}
<Box
sx={{
flexShrink: 0,
px: { xs: 1, sm: 1.5 },
py: 1,
bgcolor: '#fff',
borderBottom: `1px solid ${DT.borderSubtle}`,
display: 'flex',
gap: 0.75,
overflowX: 'auto',
...scrollbarSx
}}
>
{STATUS_TABS.map((item, index) => {
const isActive = tabvalue === index;
const Icon = item.icon;
const count = statusCounts[item.value];
return (
<ButtonBase
key={index}
onClick={() => handleChangetab(index)}
sx={{
flexShrink: 0,
gap: 0.75,
px: 1.25,
py: 0.625,
borderRadius: 999,
fontWeight: 700,
transition: 'all 0.15s',
border: `1.5px solid ${isActive ? item.color : DT.borderSubtle}`,
bgcolor: isActive ? item.color : '#fff',
color: isActive ? '#fff' : DT.textSecondary,
boxShadow: isActive ? `0 4px 12px ${ring(item.color)}` : 'none',
'&:hover': {
borderColor: item.color,
color: isActive ? '#fff' : item.color,
bgcolor: isActive ? item.color : tint(item.color)
}
}}
>
<Icon size={14} />
<Typography sx={{ fontSize: 12.5, fontWeight: 700, lineHeight: 1 }}>{item.label}</Typography>
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
minWidth: 20,
height: 18,
px: 0.625,
borderRadius: 999,
fontSize: 10.5,
fontWeight: 800,
bgcolor: isActive ? 'rgba(255,255,255,0.25)' : soft(item.color),
color: isActive ? '#fff' : item.color
}}
>
{count ?? 0}
</Box>
</ButtonBase>
);
})}
</Box>
{/* ---------------- ORDERS TABLE ---------------- */}
<Box sx={{ flex: 1, overflow: 'hidden', p: { xs: 1, sm: 1.5 } }}>
<Paper
elevation={0}
sx={{
height: '100%',
display: 'flex',
flexDirection: 'column',
borderRadius: 2,
border: `1px solid ${DT.borderSubtle}`,
overflow: 'hidden',
background: '#fff',
boxShadow: DT.shadowSoft
}} }}
> >
<Fragment>
{/* Scrollable table container */}
<TableContainer <TableContainer
onScroll={handleScroll} onScroll={handleScroll}
ref={containerRef} ref={containerRef}
sx={{ flex: 1, overflow: 'auto', ...scrollbarSx }}
>
<Table stickyHeader size="small">
<TableHead>
<TableRow
sx={{ sx={{
width: '100%', '& th': {
flex: 1, backgroundColor: DT.surfaceAlt,
overflow: 'auto', color: DT.textSecondary,
borderBottom: 1, fontSize: 10.5,
maxHeight: 'calc(100vh - 225px)', fontWeight: 800,
borderColor: 'divider', letterSpacing: 0.5,
'&::-webkit-scrollbar': { width: '12px' }, textTransform: 'uppercase',
'&::-webkit-scrollbar-thumb': { whiteSpace: 'nowrap',
backgroundColor: theme.palette.primary.main, borderBottom: `1px solid ${DT.borderSubtle}`,
borderRadius: '8px' py: 0.75,
}, px: 1
'&::-webkit-scrollbar-thumb:hover': {
backgroundColor: theme.palette.primary.dark
},
'&::-webkit-scrollbar-track': {
backgroundColor: theme.palette.primary.lighter
} }
}} }}
> >
<Table stickyHeader> <TableCell sx={{ width: 36 }}>#</TableCell>
{/* HEADER */} <TableCell sx={{ minWidth: 150 }}>Order</TableCell>
<TableHead> <TableCell sx={{ minWidth: 150 }}>Pickup</TableCell>
<TableRow> <TableCell sx={{ minWidth: 150 }}>Drop</TableCell>
<TableCell sx={{ backgroundColor: theme.palette.secondary.light, position: 'sticky !important' }}>S.No</TableCell> <TableCell sx={{ minWidth: 140 }}>Notes</TableCell>
<TableCell sx={{ backgroundColor: theme.palette.secondary.light, position: 'sticky !important' }}>Orders</TableCell> <TableCell sx={{ width: 120 }}>Status</TableCell>
<TableCell sx={{ backgroundColor: theme.palette.secondary.light, position: 'sticky !important' }}>Pickup</TableCell>
<TableCell sx={{ backgroundColor: theme.palette.secondary.light, position: 'sticky !important' }}>Drop</TableCell>
<TableCell sx={{ backgroundColor: theme.palette.secondary.light, position: 'sticky !important' }}>Notes</TableCell>
<TableCell sx={{ backgroundColor: theme.palette.secondary.light, position: 'sticky !important' }}>Status</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
{/* BODY */}
<TableBody> <TableBody>
{/* LOADING STATE */} {/* LOADING STATE */}
{loading && {loading &&
[...Array(10)].map((_, index) => ( Array.from({ length: 10 }).map((_, index) => (
<TableRow key={index}> <TableRow key={index}>
{[...Array(6)].map((__, i) => ( {Array.from({ length: 6 }).map((__, i) => (
<TableCell key={i}> <TableCell key={i} sx={{ borderBottom: `1px solid ${DT.divider}`, py: 0.625, px: 1 }}>
<Skeleton animation="wave" /> <Skeleton.Input active size="small" style={{ width: '100%', height: 18 }} />
</TableCell> </TableCell>
))} ))}
</TableRow> </TableRow>
@@ -512,8 +650,16 @@ const ResponsiveLocationDrawer = () => {
{/* EMPTY STATE */} {/* EMPTY STATE */}
{!loading && rows?.length === 0 && ( {!loading && rows?.length === 0 && (
<TableRow> <TableRow>
<TableCell colSpan={6} sx={{ minWidth: '100%', height: 500 }} align="center"> <TableCell colSpan={6} sx={{ py: 7, borderBottom: 'none' }}>
<Empty description={'No Orders'} /> <Stack alignItems="center" spacing={1.25}>
<Avatar variant="rounded" sx={{ width: 56, height: 56, bgcolor: soft('#94a3b8'), color: DT.textMuted, borderRadius: 2 }}>
<MdReceiptLong size={26} />
</Avatar>
<Typography sx={{ fontWeight: 700, color: DT.textPrimary, fontSize: 14 }}>No orders found</Typography>
<Typography sx={{ color: DT.textSecondary, fontSize: 12 }}>
{searchword ? 'Try a different keyword or clear the search.' : 'No orders in this status for the selected location.'}
</Typography>
</Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
)} )}
@@ -521,83 +667,101 @@ const ResponsiveLocationDrawer = () => {
{/* DATA ROWS */} {/* DATA ROWS */}
{!loading && {!loading &&
rows?.map((row, index) => ( rows?.map((row, index) => (
<TableRow key={index} sx={{ cursor: 'pointer' }}> <TableRow
<TableCell>{page * rowsPerPage + index + 1}</TableCell> key={index}
sx={{
cursor: 'pointer',
transition: 'background-color 0.12s, box-shadow 0.12s',
'& td': { borderBottom: `1px solid ${DT.divider}`, py: 0.75, px: 1, verticalAlign: 'top' },
'&:hover': { backgroundColor: tint(BRAND), boxShadow: `inset 3px 0 0 ${BRAND}` }
}}
>
<TableCell>
<Typography sx={{ fontWeight: 700, fontSize: 12, color: DT.textMuted }}>{page * rowsPerPage + index + 1}</Typography>
</TableCell>
{/* Order Info */} {/* Order Info */}
<TableCell> <TableCell>
<Typography variant="body2" noWrap> <Typography sx={{ fontSize: 12.5, fontWeight: 700, color: DT.textPrimary, lineHeight: 1.25 }} noWrap>
{row.orderid} {row.orderid}
</Typography> </Typography>
<Typography variant="caption" noWrap> <Stack direction="row" alignItems="center" spacing={0.5} sx={{ mt: 0.125 }}>
{dayjs(row.deliverydate).utc().format('DD/MM/YYYY')} <MdAccessTime size={10} style={{ color: DT.textMuted, flexShrink: 0 }} />
</Typography> <Typography sx={{ fontSize: 10.5, color: DT.textSecondary, fontWeight: 700 }} noWrap>
<Typography variant="caption" noWrap>
{dayjs(row.deliverydate).utc().format('hh:mm A')} {dayjs(row.deliverydate).utc().format('hh:mm A')}
</Typography> </Typography>
<Typography sx={{ fontSize: 10.5, color: DT.textMuted, fontWeight: 600 }} noWrap>
· {dayjs(row.deliverydate).utc().format('DD MMM YY')}
</Typography>
</Stack>
</TableCell> </TableCell>
{/* Pickup */} {/* Pickup */}
<TableCell> <TableCell>
<Stack direction="row" spacing={1}> <Stack spacing={0.125}>
<Avatar sx={{ width: 25, height: 25 }} /> <Typography sx={{ fontSize: 12.5, fontWeight: 700, color: DT.textPrimary, lineHeight: 1.25 }} noWrap>
<Stack> {row.pickupcustomer || '—'}
<Typography variant="caption">{row.pickupcustomer}</Typography> </Typography>
<Typography variant="caption">{row.pickupcontactno}</Typography> <Typography sx={{ fontSize: 11, color: DT.textSecondary, fontWeight: 600, lineHeight: 1.3 }} noWrap>
{row.pickupcontactno}
</Typography>
<Tooltip title={row.pickupaddress || ''}> <Tooltip title={row.pickupaddress || ''}>
<Typography variant="caption">{row.pickupsuburb || row.pickupaddress?.slice(0, 20) || '—'}</Typography> <Typography sx={{ fontSize: 10.5, color: DT.textMuted, fontWeight: 600, lineHeight: 1.3 }} noWrap>
{row.pickupsuburb || (row.pickupaddress ? `${row.pickupaddress.slice(0, 20)}` : '—')}
</Typography>
</Tooltip> </Tooltip>
</Stack> </Stack>
</Stack>
</TableCell> </TableCell>
{/* Drop */} {/* Drop */}
<TableCell> <TableCell>
<Stack direction="row" spacing={1}> <Stack spacing={0.125}>
<Avatar sx={{ width: 25, height: 25 }} /> <Typography sx={{ fontSize: 12.5, fontWeight: 700, color: DT.textPrimary, lineHeight: 1.25 }} noWrap>
<Stack> {row.deliverycustomer || '—'}
<Typography variant="caption">{row.deliverycustomer}</Typography> </Typography>
<Typography variant="caption">{row.deliverycontactno}</Typography> <Typography sx={{ fontSize: 11, color: DT.textSecondary, fontWeight: 600, lineHeight: 1.3 }} noWrap>
{row.deliverycontactno}
</Typography>
<Tooltip title={row.deliveryaddress || ''}> <Tooltip title={row.deliveryaddress || ''}>
<Typography variant="caption">{row.deliverysuburb || row.deliveryaddress?.slice(0, 20) || '—'}</Typography> <Typography sx={{ fontSize: 10.5, color: DT.textMuted, fontWeight: 600, lineHeight: 1.3 }} noWrap>
{row.deliverysuburb || (row.deliveryaddress ? `${row.deliveryaddress.slice(0, 20)}` : '—')}
</Typography>
</Tooltip> </Tooltip>
</Stack> </Stack>
</Stack>
</TableCell> </TableCell>
{/* Notes */} {/* Notes */}
<TableCell>{row.ordernotes}</TableCell> <TableCell>
<Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 600, lineHeight: 1.35 }}>
{row.ordernotes || '—'}
</Typography>
</TableCell>
{/* Status */} {/* Status */}
<TableCell> <TableCell>
<Stack direction="row" spacing={1}> <StatusBadge status={row.orderstatus} />
{row.orderstatus === 'pending' && <Chip label="Pending" color="warning" size="small" />}
{row.orderstatus === 'confirmed' && <Chip label="Confirmed" color="success" size="small" />}
{row.orderstatus === 'cancelled' && <Chip label="Cancelled" color="error" size="small" />}
{row.orderstatus === 'delivered' && <Chip label="Completed" color="primary" size="small" />}
{row.orderstatus === 'processing' && <Chip label="Processing" color="primary" size="small" />}
{row.orderstatus === 'ready' && <Chip label="Accepted" color="info" size="small" />}
{row.orderstatus === 'active' && <Chip label="Picked" color="info" size="small" />}
{row.orderstatus === 'closed' && <Chip label="Closed" color="info" size="small" />}
{row.orderstatus === 'created' && <Chip label="Created" color="secondary" size="small" />}
</Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
))} ))}
{rows?.length != 0 && ( {rows?.length != 0 && (
<TableRow> <TableRow>
<TableCell colSpan={6} rowSpan={3}> <TableCell colSpan={6} sx={{ borderBottom: 'none' }}>
<div ref={loadMoreRef} style={{ height: 40, textAlign: 'center' }}> <Stack ref={loadMoreRef} alignItems="center" justifyContent="center" sx={{ height: 40 }}>
{isFetchingNextPage ? <CircularProgress /> : hasNextPage ? <CircularProgress /> : 'No More Orders'} {isFetchingNextPage || hasNextPage ? (
</div> <CircularProgress size={20} sx={{ color: BRAND }} />
) : (
<Typography sx={{ fontSize: 11.5, fontWeight: 700, color: DT.textMuted }}>No more orders</Typography>
)}
</Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
)} )}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>
</Fragment> </Paper>
</MainCard> </Box>
</Box> </Box>
</Box> </Box>
</React.Fragment> </React.Fragment>

View File

@@ -698,7 +698,7 @@ const MultipleOrders = () => {
'senderphone*': 'locationcontact', 'senderphone*': 'locationcontact',
'senderaddress*': 'locationaddress', 'senderaddress*': 'locationaddress',
'receivername*': 'firstname', 'receivername*': 'firstname',
'receiverphone*': 'contactno', 'receiverphone': 'contactno',
'receiveralternatephone*': 'altcontactno', 'receiveralternatephone*': 'altcontactno',
receiverfulladdress: 'address', receiverfulladdress: 'address',
receiverlatitude: 'latitude', receiverlatitude: 'latitude',

View File

@@ -125,17 +125,21 @@ const pillFieldSx = (color) => ({
} }
}); });
// Semantic per-row status palette. // Semantic per-row status palette — colors per brand standard:
// green=delivered, amber=pending, blue=created/processing, red=cancelled,
// dark-red=failed, purple=on-hold.
const ROW_STATUS_META = { const ROW_STATUS_META = {
created: { label: 'Created', color: '#0ea5e9', icon: MdLocalShipping }, created: { label: 'Created', color: '#3b82f6', icon: MdLocalShipping },
pending: { label: 'Pending', color: '#f59e0b', icon: MdHourglassEmpty }, pending: { label: 'Pending', color: '#f59e0b', icon: MdHourglassEmpty },
processing: { label: 'Processing', color: BRAND, icon: MdAccessTime }, processing: { label: 'Processing', color: '#3b82f6', icon: MdAccessTime },
modified: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle }, modified: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle },
confirmed: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle }, confirmed: { label: 'Confirmed', color: '#10b981', icon: MdCheckCircle },
ready: { label: 'Accepted', color: '#6366f1', icon: MdCheckCircle }, ready: { label: 'Accepted', color: '#6366f1', icon: MdCheckCircle },
active: { label: 'Picked', color: '#8b5cf6', icon: MdLocalShipping }, active: { label: 'Picked', color: '#8b5cf6', icon: MdLocalShipping },
onhold: { label: 'On Hold', color: '#8b5cf6', icon: MdHistoryToggleOff },
closed: { label: 'Closed', color: '#06b6d4', icon: MdCheckCircle }, closed: { label: 'Closed', color: '#06b6d4', icon: MdCheckCircle },
delivered: { label: 'Delivered', color: '#10b981', icon: MdCheckCircle }, delivered: { label: 'Delivered', color: '#10b981', icon: MdCheckCircle },
failed: { label: 'Failed', color: '#991b1b', icon: MdCancel },
cancelled: { label: 'Cancelled', color: '#ef4444', icon: MdCancel } cancelled: { label: 'Cancelled', color: '#ef4444', icon: MdCancel }
}; };
@@ -147,6 +151,7 @@ const ORDERS_STATUS_TABS = [
{ idx: 3, status: 'cancelled', label: 'Cancelled', color: '#ef4444', icon: MdCancel, countKey: 'cancelled' } { idx: 3, status: 'cancelled', label: 'Cancelled', color: '#ef4444', icon: MdCancel, countKey: 'cancelled' }
]; ];
// Filled status badge — high-contrast pill (white text on solid color).
const StatusBadge = ({ status }) => { const StatusBadge = ({ status }) => {
const meta = ROW_STATUS_META[String(status || '').toLowerCase()] || { const meta = ROW_STATUS_META[String(status || '').toLowerCase()] || {
label: status || '—', label: status || '—',
@@ -160,15 +165,18 @@ const StatusBadge = ({ status }) => {
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
gap: 0.5, gap: 0.5,
px: 1, px: 1.125,
py: 0.375, py: 0.375,
borderRadius: 999, borderRadius: 999,
bgcolor: tint(meta.color), bgcolor: meta.color,
border: `1px solid ${edge(meta.color)}`, color: '#fff',
color: meta.color,
fontSize: 11, fontSize: 11,
fontWeight: 800, fontWeight: 700,
whiteSpace: 'nowrap' letterSpacing: 0.2,
whiteSpace: 'nowrap',
minWidth: 86,
justifyContent: 'center',
boxShadow: `0 1px 2px ${ring(meta.color)}`
}} }}
> >
<Icon size={12} /> {meta.label} <Icon size={12} /> {meta.label}
@@ -335,9 +343,11 @@ const Orders = () => {
} }
}, },
{ {
root: document.querySelector('.MuiTableContainer-root'), // The page (viewport) is now the scroll container, not the table.
rootMargin: '0px', // Prefetch the next page ~400px before the sentinel reaches the bottom.
threshold: 1.0 root: null,
rootMargin: '0px 0px 400px 0px',
threshold: 0
} }
); );
if (loadMoreRef.current) observer.observe(loadMoreRef.current); if (loadMoreRef.current) observer.observe(loadMoreRef.current);
@@ -445,13 +455,14 @@ const Orders = () => {
</> </>
)} )}
{/* ============================================= || Header || ============================================= */} {/* ============================================= || Header (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mb: { xs: 1.5, md: 2 }, mb: { xs: 1, md: 1.25 },
p: { xs: 1.5, sm: 2, md: 2.5 }, px: { xs: 1.5, sm: 2 },
borderRadius: DT.radiusCard / 8, py: { xs: 1, sm: 1.25 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`, background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
@@ -462,43 +473,45 @@ const Orders = () => {
direction={{ xs: 'column', sm: 'row' }} direction={{ xs: 'column', sm: 'row' }}
alignItems={{ xs: 'flex-start', sm: 'center' }} alignItems={{ xs: 'flex-start', sm: 'center' }}
justifyContent="space-between" justifyContent="space-between"
spacing={{ xs: 1.5, sm: 2 }} spacing={{ xs: 1, sm: 1.5 }}
> >
<Stack direction="row" alignItems="center" spacing={{ xs: 1.25, sm: 1.75 }}> <Stack direction="row" alignItems="center" spacing={1.25}>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 40, sm: 48 }, width: 36,
height: { xs: 40, sm: 48 }, height: 36,
bgcolor: BRAND, bgcolor: BRAND,
color: '#fff', color: '#fff',
boxShadow: `0 6px 18px ${ring(BRAND)}` borderRadius: 1.5,
boxShadow: `0 4px 12px ${ring(BRAND)}`
}} }}
> >
<MdLocalShipping size={22} /> <MdLocalShipping size={19} />
</Avatar> </Avatar>
<Stack> <Stack spacing={0.125}>
<Typography <Typography
variant="h3" variant="h3"
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.1,
fontSize: { xs: '1.25rem', sm: '1.5rem', md: '1.75rem' } fontSize: { xs: '1.1rem', sm: '1.25rem', md: '1.375rem' }
}} }}
> >
Orders Orders
</Typography> </Typography>
<Stack direction="row" alignItems="center" spacing={0.75} sx={{ mt: 0.5 }}> <Stack direction="row" alignItems="center" spacing={0.75}>
<Box <Box
sx={{ sx={{
width: 8, width: 7,
height: 8, height: 7,
borderRadius: '50%', borderRadius: '50%',
bgcolor: '#10b981', bgcolor: '#10b981',
boxShadow: '0 0 0 4px rgba(16,185,129,0.18)' boxShadow: '0 0 0 3px rgba(16,185,129,0.18)'
}} }}
/> />
<Typography variant="caption" sx={{ color: DT.textSecondary, fontWeight: 600 }}> <Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 600 }}>
Live · {locoName} · {datestatus} Live · {locoName} · {datestatus}
</Typography> </Typography>
</Stack> </Stack>
@@ -563,8 +576,8 @@ const Orders = () => {
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || KPI Cards || ============================================= */} {/* ============================================= || KPI Cards (compact) || ============================================= */}
<Grid container spacing={{ xs: 1.25, sm: 1.5, md: 2 }}> <Grid container spacing={{ xs: 1, sm: 1.25, md: 1.5 }}>
{kpiCards.map((item) => { {kpiCards.map((item) => {
const Icon = item.icon; const Icon = item.icon;
return ( return (
@@ -574,14 +587,15 @@ const Orders = () => {
sx={{ sx={{
position: 'relative', position: 'relative',
overflow: 'hidden', overflow: 'hidden',
p: { xs: 1.25, sm: 1.75, md: 2.25 }, px: { xs: 1.25, sm: 1.5 },
borderRadius: DT.radiusCard / 8, py: { xs: 0.875, sm: 1.125 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: '#fff', background: '#fff',
transition: 'transform 0.2s, box-shadow 0.2s, border-color 0.2s', transition: 'transform 0.15s, box-shadow 0.15s, border-color 0.15s',
'&:hover': { '&:hover': {
transform: 'translateY(-3px)', transform: 'translateY(-1px)',
boxShadow: DT.shadowMd, boxShadow: DT.shadowMd,
borderColor: edge(item.color) borderColor: edge(item.color)
} }
@@ -592,55 +606,59 @@ const Orders = () => {
position: 'absolute', position: 'absolute',
top: 0, top: 0,
left: 0, left: 0,
right: 0, bottom: 0,
height: 3, width: 3,
background: `linear-gradient(90deg, ${item.color} 0%, ${soft(item.color)} 100%)` background: item.color
}} }}
/> />
<Stack direction="row" alignItems="flex-start" justifyContent="space-between" spacing={1}> <Stack direction="row" alignItems="center" justifyContent="space-between" spacing={1} sx={{ pl: 0.5 }}>
<Stack spacing={0.5} sx={{ minWidth: 0, flex: 1 }}> <Stack spacing={0.125} sx={{ minWidth: 0, flex: 1 }}>
<Typography <Typography
variant="caption"
sx={{ sx={{
color: DT.textSecondary, color: DT.textSecondary,
fontWeight: 700, fontWeight: 700,
letterSpacing: 0.4, letterSpacing: 0.4,
textTransform: 'uppercase', textTransform: 'uppercase',
fontSize: { xs: 10, sm: 11 }, fontSize: 10.5,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis' textOverflow: 'ellipsis',
lineHeight: 1.2
}} }}
> >
{item.label} {item.label}
</Typography> </Typography>
<Stack direction="row" alignItems="baseline" spacing={0.75}>
<Typography <Typography
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.15,
fontSize: { xs: '1.25rem', sm: '1.5rem', md: '1.75rem' } fontSize: { xs: '0.95rem', sm: '1.1rem', md: '1.2rem' }
}} }}
noWrap
> >
{item.value === '' ? <Skeleton sx={{ width: 40 }} animation="wave" /> : item.value} {item.value === '' ? <Skeleton sx={{ width: 40 }} animation="wave" /> : item.value}
</Typography> </Typography>
{item.percentage != null && ( {item.percentage != null && item.value !== '' && (
<Typography variant="caption" sx={{ color: DT.textSecondary, fontWeight: 700 }}> <Typography sx={{ fontSize: 10.5, color: DT.textMuted, fontWeight: 700 }}>
{item.percentage}% {item.percentage}%
</Typography> </Typography>
)} )}
</Stack> </Stack>
</Stack>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 36, sm: 42, md: 48 }, width: 30,
height: { xs: 36, sm: 42, md: 48 }, height: 30,
bgcolor: soft(item.color), bgcolor: soft(item.color),
color: item.color, color: item.color,
boxShadow: `inset 0 0 0 1px ${edge(item.color)}`, borderRadius: 1.25,
flexShrink: 0 flexShrink: 0
}} }}
> >
<Icon size={20} /> <Icon size={15} />
</Avatar> </Avatar>
</Stack> </Stack>
</Paper> </Paper>
@@ -649,13 +667,13 @@ const Orders = () => {
})} })}
</Grid> </Grid>
{/* ============================================= || Filter Bar || ============================================= */} {/* ============================================= || Filter Bar (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mt: { xs: 1.5, md: 2 }, mt: { xs: 1, md: 1.25 },
p: { xs: 1.25, md: 1.75 }, p: { xs: 1, md: 1.125 },
borderRadius: DT.radiusCard / 8, borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: '#fff', background: '#fff',
@@ -751,14 +769,14 @@ const Orders = () => {
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || Status Tabs + Search || ============================================= */} {/* ============================================= || Status Tabs + Search (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mt: { xs: 1.5, md: 2 }, mt: { xs: 1, md: 1.25 },
p: { xs: 1, md: 1.5 }, p: { xs: 0.875, md: 1.125 },
borderTopLeftRadius: DT.radiusCard / 8, borderTopLeftRadius: 2,
borderTopRightRadius: DT.radiusCard / 8, borderTopRightRadius: 2,
borderBottomLeftRadius: 0, borderBottomLeftRadius: 0,
borderBottomRightRadius: 0, borderBottomRightRadius: 0,
border: '1px solid', border: '1px solid',
@@ -903,14 +921,14 @@ const Orders = () => {
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || Table || ============================================= */} {/* ============================================= || Table (dense, sticky header) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
borderTopLeftRadius: 0, borderTopLeftRadius: 0,
borderTopRightRadius: 0, borderTopRightRadius: 0,
borderBottomLeftRadius: DT.radiusCard / 8, borderBottomLeftRadius: 2,
borderBottomRightRadius: DT.radiusCard / 8, borderBottomRightRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
overflow: 'hidden', overflow: 'hidden',
@@ -921,8 +939,12 @@ const Orders = () => {
onScroll={handleScroll} onScroll={handleScroll}
ref={containerRef} ref={containerRef}
sx={{ sx={{
maxHeight: { xs: 'calc(100vh - 220px)', md: 'calc(100vh - 190px)' }, // Single page scroll: the table is NOT height-capped, so it renders at its
overflow: 'auto', // full height and the whole page scrolls as one. Scrolling down moves the
// KPI cards + header + filter bar off-screen and reveals the full table.
// Only horizontal overflow scrolls inside the container (for wide column sets).
overflowX: 'auto',
overflowY: 'visible',
'&::-webkit-scrollbar': { width: 10, height: 10 }, '&::-webkit-scrollbar': { width: 10, height: 10 },
'&::-webkit-scrollbar-thumb': { '&::-webkit-scrollbar-thumb': {
backgroundColor: edge(BRAND), backgroundColor: edge(BRAND),
@@ -932,21 +954,21 @@ const Orders = () => {
'&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt } '&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt }
}} }}
> >
<Table stickyHeader sx={{ minWidth: { xs: 960, md: 1180 } }}> <Table stickyHeader size="small" sx={{ minWidth: { xs: 960, md: 1100 } }}>
<TableHead> <TableHead>
<TableRow <TableRow
sx={{ sx={{
'& th': { '& th': {
backgroundColor: DT.surfaceAlt, backgroundColor: DT.surfaceAlt,
color: DT.textSecondary, color: DT.textSecondary,
fontSize: { xs: 10, md: 11 }, fontSize: 10.5,
fontWeight: 800, fontWeight: 800,
letterSpacing: 0.6, letterSpacing: 0.5,
textTransform: 'uppercase', textTransform: 'uppercase',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
borderBottom: `1px solid ${DT.borderSubtle}`, borderBottom: `1px solid ${DT.borderSubtle}`,
py: { xs: 1, md: 1.25 }, py: 0.75,
px: { xs: 1, md: 1.5 } px: 1
} }
}} }}
> >
@@ -967,11 +989,11 @@ const Orders = () => {
<TableBody> <TableBody>
{(isLoadingGetOrders || loading) && {(isLoadingGetOrders || loading) &&
rows.length === 0 && rows.length === 0 &&
[0, 1, 2, 3, 4, 5].map((_, idx) => ( Array.from({ length: 10 }).map((_, idx) => (
<TableRow key={`sk-${idx}`}> <TableRow key={`sk-${idx}`}>
{Array.from({ length: currentStatus === 'created' ? 11 : 10 }).map((__, ci) => ( {Array.from({ length: currentStatus === 'created' ? 11 : 10 }).map((__, ci) => (
<TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}` }}> <TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}`, py: 0.625, px: 1 }}>
<Skeleton animation="wave" /> <Skeleton animation="wave" height={20} />
</TableCell> </TableCell>
))} ))}
</TableRow> </TableRow>
@@ -979,17 +1001,45 @@ const Orders = () => {
{!isLoadingGetOrders && rows.length === 0 && ( {!isLoadingGetOrders && rows.length === 0 && (
<TableRow> <TableRow>
<TableCell colSpan={currentStatus === 'created' ? 11 : 10} sx={{ py: 6, borderBottom: 'none' }}> <TableCell colSpan={currentStatus === 'created' ? 11 : 10} sx={{ py: 7, borderBottom: 'none' }}>
<Stack alignItems="center" spacing={1.5}> <Stack alignItems="center" spacing={1.25}>
<Avatar sx={{ width: 64, height: 64, bgcolor: soft('#94a3b8'), color: DT.textMuted }}> <Avatar
<MdLocalShipping size={28} /> variant="rounded"
sx={{
width: 56,
height: 56,
bgcolor: soft('#94a3b8'),
color: DT.textMuted,
borderRadius: 2
}}
>
<MdLocalShipping size={26} />
</Avatar> </Avatar>
<Typography variant="subtitle1" sx={{ fontWeight: 700, color: DT.textPrimary }}> <Typography sx={{ fontWeight: 700, color: DT.textPrimary, fontSize: 14 }}>
No {currentStatus} orders No {currentStatus} orders
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textSecondary }}> <Typography sx={{ color: DT.textSecondary, fontSize: 12 }}>
{searchword ? 'Try a different keyword.' : 'Adjust the filters above to load orders.'} {searchword ? 'Try a different keyword or clear the search.' : 'Adjust the location, status, or date range above.'}
</Typography> </Typography>
{searchword && (
<Button
size="small"
onClick={() => setSearchword('')}
sx={{
mt: 0.5,
height: 28,
textTransform: 'none',
fontSize: 12,
fontWeight: 700,
color: BRAND,
borderRadius: 1.25,
'&:hover': { bgcolor: tint(BRAND) }
}}
startIcon={<MdClear size={14} />}
>
Clear search
</Button>
)}
</Stack> </Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
@@ -1000,13 +1050,17 @@ const Orders = () => {
key={`${row.orderheaderid}-${index}`} key={`${row.orderheaderid}-${index}`}
sx={{ sx={{
cursor: 'pointer', cursor: 'pointer',
transition: 'background-color 0.15s', transition: 'background-color 0.12s, box-shadow 0.12s',
'& td': { '& td': {
borderBottom: `1px solid ${DT.divider}`, borderBottom: `1px solid ${DT.divider}`,
py: { xs: 1, md: 1.25 }, py: 0.5,
px: { xs: 1, md: 1.5 } px: 1,
verticalAlign: 'top'
}, },
'&:hover': { backgroundColor: DT.surfaceAlt } '&:hover': {
backgroundColor: tint(BRAND),
boxShadow: `inset 3px 0 0 ${BRAND}`
}
}} }}
> >
<TableCell> <TableCell>
@@ -1025,10 +1079,13 @@ const Orders = () => {
{row.orderid} {row.orderid}
</Typography> </Typography>
</Tooltip> </Tooltip>
<Stack direction="row" spacing={0.75} alignItems="center" sx={{ mt: 0.25 }}> <Stack direction="row" spacing={0.5} alignItems="center" sx={{ mt: 0.125 }}>
<MdAccessTime size={11} style={{ color: DT.textMuted }} /> <MdAccessTime size={10} style={{ color: DT.textMuted, flexShrink: 0 }} />
<Typography sx={{ fontSize: 11, color: DT.textSecondary, fontWeight: 600 }} noWrap> <Typography sx={{ fontSize: 10.5, color: DT.textSecondary, fontWeight: 700 }} noWrap>
{dayjs(row.pickupslot).format('DD/MM/YYYY')} · {dayjs(row.pickupslot).format('hh:mm A')} {dayjs(row.pickupslot).format('hh:mm A')}
</Typography>
<Typography sx={{ fontSize: 10.5, color: DT.textMuted, fontWeight: 600 }} noWrap>
· {dayjs(row.pickupslot).format('DD MMM YY')}
</Typography> </Typography>
</Stack> </Stack>
</TableCell> </TableCell>
@@ -1143,19 +1200,29 @@ const Orders = () => {
))} ))}
{rows.length !== 0 && ( {rows.length !== 0 && (
<TableRow> <TableRow sx={{ '&:hover': { backgroundColor: 'transparent !important' } }}>
<TableCell colSpan={15} rowSpan={3} sx={{ borderBottom: 'none' }}> <TableCell colSpan={currentStatus === 'created' ? 11 : 10} sx={{ borderBottom: 'none', py: 1, bgcolor: DT.surfaceAlt }}>
<div ref={loadMoreRef} style={{ height: 40, textAlign: 'center' }}> <Stack
{isFetchingNextPage ? ( ref={loadMoreRef}
<CircularProgress size={20} sx={{ color: BRAND }} /> direction="row"
) : hasNextPage ? ( alignItems="center"
<CircularProgress size={20} sx={{ color: BRAND }} /> justifyContent="center"
spacing={1}
sx={{ minHeight: 32 }}
>
{isFetchingNextPage || hasNextPage ? (
<>
<CircularProgress size={14} sx={{ color: BRAND }} />
<Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 700 }}>
Loading more orders
</Typography>
</>
) : ( ) : (
<Typography variant="caption" sx={{ color: DT.textMuted, fontWeight: 700 }}> <Typography sx={{ fontSize: 11.5, color: DT.textMuted, fontWeight: 700, letterSpacing: 0.3 }}>
No more orders {rows.length} order{rows.length === 1 ? '' : 's'} · End of list
</Typography> </Typography>
)} )}
</div> </Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
)} )}

View File

@@ -34,7 +34,6 @@ import {
MdCheckCircle, MdCheckCircle,
MdCancel, MdCancel,
MdMyLocation, MdMyLocation,
MdPlace,
MdSearch, MdSearch,
MdClear, MdClear,
MdCalendarMonth, MdCalendarMonth,
@@ -333,13 +332,14 @@ export default function OrdersReport() {
{(isLoadingReports || tenantLocationsIsLoading) && <Loader />} {(isLoadingReports || tenantLocationsIsLoading) && <Loader />}
{(isLoadingReports || tenantLocationsIsLoading) && <CircularLoader />} {(isLoadingReports || tenantLocationsIsLoading) && <CircularLoader />}
{/* ============================================= || Header || ============================================= */} {/* ============================================= || Header (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mb: { xs: 1.5, md: 2 }, mb: { xs: 1, md: 1.25 },
p: { xs: 1.5, sm: 2, md: 2.5 }, px: { xs: 1.5, sm: 2 },
borderRadius: DT.radiusCard / 8, py: { xs: 1, sm: 1.25 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`, background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
@@ -350,61 +350,228 @@ export default function OrdersReport() {
direction={{ xs: 'column', sm: 'row' }} direction={{ xs: 'column', sm: 'row' }}
alignItems={{ xs: 'flex-start', sm: 'center' }} alignItems={{ xs: 'flex-start', sm: 'center' }}
justifyContent="space-between" justifyContent="space-between"
spacing={{ xs: 1.5, sm: 2 }} spacing={{ xs: 1, sm: 1.5 }}
> >
<Stack direction="row" alignItems="center" spacing={{ xs: 1.25, sm: 1.75 }}> <Stack direction="row" alignItems="center" spacing={1.25}>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 40, sm: 48 }, width: 36,
height: { xs: 40, sm: 48 }, height: 36,
bgcolor: BRAND, bgcolor: BRAND,
color: '#fff', color: '#fff',
boxShadow: `0 6px 18px ${ring(BRAND)}` borderRadius: 1.5,
boxShadow: `0 4px 12px ${ring(BRAND)}`
}} }}
> >
<MdInsights size={22} /> <MdInsights size={19} />
</Avatar> </Avatar>
<Stack> <Stack spacing={0.125}>
<Typography <Typography
variant="h3" variant="h3"
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.1,
fontSize: { xs: '1.25rem', sm: '1.5rem', md: '1.75rem' } fontSize: { xs: '1.1rem', sm: '1.25rem', md: '1.375rem' }
}} }}
> >
Orders Summary Orders Summary
</Typography> </Typography>
<Stack direction="row" alignItems="center" spacing={0.75} sx={{ mt: 0.5 }}> <Stack direction="row" alignItems="center" spacing={0.75}>
<Box <Box
sx={{ sx={{
width: 8, width: 7,
height: 8, height: 7,
borderRadius: '50%', borderRadius: '50%',
bgcolor: '#10b981', bgcolor: '#10b981',
boxShadow: '0 0 0 4px rgba(16,185,129,0.18)' boxShadow: '0 0 0 3px rgba(16,185,129,0.18)'
}} }}
/> />
<Typography variant="caption" sx={{ color: DT.textSecondary, fontWeight: 600 }}> <Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 600 }}>
Live · {locoName} · {datestatus} Live · {locoName} · {datestatus}
</Typography> </Typography>
</Stack> </Stack>
</Stack> </Stack>
</Stack> </Stack>
<Tooltip title="Date Filter"> {/* Location picker — chip when single, autocomplete when multiple (matches orders page) */}
{tenantLocations?.length === 1 ? (
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
gap: 0.75,
px: 1.5,
py: 0.75,
borderRadius: 999,
bgcolor: tint(BRAND),
border: `1.5px solid ${edge(BRAND)}`,
color: BRAND,
fontWeight: 800,
fontSize: 13
}}
>
<MdMyLocation size={14} /> {tenantLocations[0]?.locationname}
</Box>
) : (
<Autocomplete
options={tenantLocations || []}
value={selectedLocation}
getOptionLabel={(o) => (o ? `${o.locationname} (${o.suburb || ''})` : '')}
PaperComponent={SoftPaper}
onChange={(event, value) => {
setSelectedLocation(value);
setLocationId(value ? value.locationid : 0);
setLocoName(value ? value.locationname : 'All Locations');
}}
renderInput={(params) => (
<TextField
{...params}
placeholder="Select Location"
size="small"
sx={{ ...pillFieldSx(BRAND), width: { xs: '100%', sm: 260 } }}
InputProps={{
...params.InputProps,
startAdornment: (
<Stack direction="row" alignItems="center" spacing={0.75} sx={{ pl: 0.5 }}>
<AccentAvatar color={BRAND} size={22} selected>
<MdMyLocation size={13} />
</AccentAvatar>
</Stack>
)
}}
/>
)}
sx={{ width: { xs: '100%', sm: 280 } }}
/>
)}
</Stack>
</Paper>
{/* ============================================= || KPI Cards (compact) || ============================================= */}
<Grid container spacing={{ xs: 1, sm: 1.25, md: 1.5 }}>
{kpiCards.map((item) => {
const Icon = item.icon;
return (
<Grid item key={item.key} xs={6} sm={6} md={item.key === 'charges' ? 4 : 2}>
<Paper
elevation={0}
sx={{
position: 'relative',
overflow: 'hidden',
px: { xs: 1.25, sm: 1.5 },
py: { xs: 0.875, sm: 1.125 },
borderRadius: 2,
border: '1px solid',
borderColor: DT.borderSubtle,
background: '#fff',
transition: 'transform 0.15s, box-shadow 0.15s, border-color 0.15s',
'&:hover': {
transform: 'translateY(-1px)',
boxShadow: DT.shadowMd,
borderColor: edge(item.color)
}
}}
>
<Box
sx={{
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
width: 3,
background: item.color
}}
/>
<Stack direction="row" alignItems="center" justifyContent="space-between" spacing={1} sx={{ pl: 0.5 }}>
<Stack spacing={0.125} sx={{ minWidth: 0, flex: 1 }}>
<Typography
sx={{
color: DT.textSecondary,
fontWeight: 700,
letterSpacing: 0.4,
textTransform: 'uppercase',
fontSize: 10.5,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
lineHeight: 1.2
}}
>
{item.label}
</Typography>
<Typography
sx={{
fontWeight: 800,
color: DT.textPrimary,
lineHeight: 1.15,
fontSize: { xs: '0.95rem', sm: '1.1rem', md: '1.2rem' }
}}
noWrap
>
{isLoadingReports ? (
<Skeleton sx={{ width: 40 }} animation="wave" />
) : item.isMoney ? (
formatNumberToRupees(item.value)
) : (
item.value
)}
</Typography>
</Stack>
<Avatar
variant="rounded"
sx={{
width: 30,
height: 30,
bgcolor: soft(item.color),
color: item.color,
borderRadius: 1.25,
flexShrink: 0
}}
>
<Icon size={15} />
</Avatar>
</Stack>
</Paper>
</Grid>
);
})}
</Grid>
{/* ============================================= || Filter Bar (compact) || ============================================= */}
<Paper
elevation={0}
sx={{
mt: { xs: 1, md: 1.25 },
p: { xs: 1, md: 1.125 },
borderRadius: 2,
border: '1px solid',
borderColor: DT.borderSubtle,
background: '#fff',
boxShadow: DT.shadowSoft
}}
>
<Stack
direction={{ xs: 'column', md: 'row' }}
spacing={1.25}
alignItems={{ xs: 'stretch', md: 'center' }}
justifyContent={{ xs: 'flex-start', md: 'space-between' }}
>
{/* Date range + active preset pills (matches orders page) */}
<Stack direction="row" spacing={1} alignItems="center" flexWrap="wrap" useFlexGap>
<Tooltip title="Date Filter" placement="top">
<Box <Box
onClick={() => setOpen(true)} onClick={() => setOpen(true)}
sx={{ sx={{
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
gap: 0.75, gap: 0.75,
px: 1.5, px: 1.25,
py: 0.875, py: 0.75,
borderRadius: 999, borderRadius: 999,
cursor: 'pointer', cursor: 'pointer',
bgcolor: '#fff', bgcolor: tint('#f59e0b'),
border: `1.5px solid ${edge('#f59e0b')}`, border: `1.5px solid ${edge('#f59e0b')}`,
color: '#f59e0b', color: '#f59e0b',
fontWeight: 800, fontWeight: 800,
@@ -419,115 +586,25 @@ export default function OrdersReport() {
: 'All time'} : 'All time'}
</Box> </Box>
</Tooltip> </Tooltip>
</Stack>
</Paper>
{/* ============================================= || KPI Cards || ============================================= */}
<Grid container spacing={{ xs: 1.25, sm: 1.5, md: 2 }}>
{kpiCards.map((item) => {
const Icon = item.icon;
return (
<Grid item key={item.key} xs={6} sm={6} md={item.key === 'charges' ? 4 : 2}>
<Paper
elevation={0}
sx={{
position: 'relative',
overflow: 'hidden',
p: { xs: 1.25, sm: 1.75, md: 2.25 },
borderRadius: DT.radiusCard / 8,
border: '1px solid',
borderColor: DT.borderSubtle,
background: '#fff',
transition: 'transform 0.2s, box-shadow 0.2s, border-color 0.2s',
'&:hover': {
transform: 'translateY(-3px)',
boxShadow: DT.shadowMd,
borderColor: edge(item.color)
}
}}
>
<Box <Box
sx={{ sx={{
position: 'absolute', display: 'inline-flex',
top: 0, alignItems: 'center',
left: 0, gap: 0.5,
right: 0, px: 1,
height: 3, py: 0.5,
background: `linear-gradient(90deg, ${item.color} 0%, ${soft(item.color)} 100%)` borderRadius: 999,
}} bgcolor: tint(BRAND),
/> border: `1px solid ${edge(BRAND)}`,
<Stack direction="row" alignItems="flex-start" justifyContent="space-between" spacing={1}> color: BRAND,
<Stack spacing={0.5} sx={{ minWidth: 0, flex: 1 }}> fontSize: 11,
<Typography fontWeight: 800
variant="caption"
sx={{
color: DT.textSecondary,
fontWeight: 700,
letterSpacing: 0.4,
textTransform: 'uppercase',
fontSize: { xs: 10, sm: 11 },
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis'
}} }}
> >
{item.label} <MdReceiptLong size={12} /> {datestatus}
</Typography> </Box>
<Typography
sx={{
fontWeight: 800,
color: DT.textPrimary,
lineHeight: 1.1,
fontSize: { xs: '1.1rem', sm: '1.35rem', md: '1.55rem' }
}}
>
{isLoadingReports ? (
<Skeleton sx={{ width: 40 }} animation="wave" />
) : item.isMoney ? (
formatNumberToRupees(item.value)
) : (
item.value
)}
</Typography>
</Stack> </Stack>
<Avatar
sx={{
width: { xs: 32, sm: 38, md: 44 },
height: { xs: 32, sm: 38, md: 44 },
bgcolor: soft(item.color),
color: item.color,
boxShadow: `inset 0 0 0 1px ${edge(item.color)}`,
flexShrink: 0
}}
>
<Icon size={18} />
</Avatar>
</Stack>
</Paper>
</Grid>
);
})}
</Grid>
{/* ============================================= || Filter Bar || ============================================= */}
<Paper
elevation={0}
sx={{
mt: { xs: 1.5, md: 2 },
p: { xs: 1.25, md: 1.75 },
borderRadius: DT.radiusCard / 8,
border: '1px solid',
borderColor: DT.borderSubtle,
background: '#fff',
boxShadow: DT.shadowSoft
}}
>
<Stack
direction={{ xs: 'column', md: 'row' }}
spacing={1.25}
alignItems={{ xs: 'stretch', md: 'center' }}
justifyContent="space-between"
>
{/* Search */} {/* Search */}
<Box sx={{ width: { xs: '100%', md: 320 } }}> <Box sx={{ width: { xs: '100%', md: 320 } }}>
<Box <Box
@@ -569,58 +646,6 @@ export default function OrdersReport() {
)} )}
</Box> </Box>
</Box> </Box>
{/* Location filter */}
{tenantLocations?.length === 1 ? (
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
gap: 0.75,
px: 1.5,
py: 0.875,
borderRadius: 999,
bgcolor: tint(BRAND),
border: `1.5px solid ${edge(BRAND)}`,
color: BRAND,
fontWeight: 800,
fontSize: 13
}}
>
<MdMyLocation size={14} /> {tenantLocations[0]?.locationname}
</Box>
) : (
<Autocomplete
options={tenantLocations || []}
value={selectedLocation}
getOptionLabel={(o) => (o ? `${o.locationname} (${o.suburb || ''})` : '')}
PaperComponent={SoftPaper}
onChange={(event, value) => {
setSelectedLocation(value);
setLocationId(value ? value.locationid : 0);
setLocoName(value ? value.locationname : 'All Locations');
}}
renderInput={(params) => (
<TextField
{...params}
placeholder="All Locations"
size="small"
sx={pillFieldSx('#10b981')}
InputProps={{
...params.InputProps,
startAdornment: (
<Stack direction="row" alignItems="center" spacing={0.75} sx={{ pl: 0.5 }}>
<AccentAvatar color="#10b981" size={22} selected>
<MdPlace size={13} />
</AccentAvatar>
</Stack>
)
}}
/>
)}
sx={{ width: { xs: '100%', md: 320 } }}
/>
)}
</Stack> </Stack>
</Paper> </Paper>
@@ -628,7 +653,7 @@ export default function OrdersReport() {
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mt: { xs: 1.5, md: 2 }, mt: { xs: 1, md: 1.25 },
borderRadius: DT.radiusCard / 8, borderRadius: DT.radiusCard / 8,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
@@ -669,11 +694,67 @@ export default function OrdersReport() {
<TableCell rowSpan={2}>#</TableCell> <TableCell rowSpan={2}>#</TableCell>
<TableCell rowSpan={2}>Location</TableCell> <TableCell rowSpan={2}>Location</TableCell>
<TableCell rowSpan={2} align="center">All</TableCell> <TableCell rowSpan={2} align="center">All</TableCell>
<TableCell colSpan={3} align="center" sx={{ color: `${C_ORDERS} !important`, bgcolor: `${tint(C_ORDERS)} !important` }}> <TableCell
colSpan={3}
align="center"
sx={{
bgcolor: `${soft(C_ORDERS)} !important`,
borderLeft: `2px solid ${edge(C_ORDERS)} !important`,
borderRight: `2px solid ${edge(C_ORDERS)} !important`,
py: '6px !important'
}}
>
<Stack direction="row" alignItems="center" justifyContent="center" spacing={0.75}>
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
width: 20,
height: 20,
borderRadius: 999,
bgcolor: C_ORDERS,
color: '#fff',
boxShadow: `0 4px 10px ${ring(C_ORDERS)}`
}}
>
<MdInventory2 size={12} />
</Box>
<Typography sx={{ fontWeight: 900, fontSize: 12, letterSpacing: 1, color: C_ORDERS }}>
Orders Orders
</Typography>
</Stack>
</TableCell> </TableCell>
<TableCell colSpan={3} align="center" sx={{ color: `${C_DELIVERIES} !important`, bgcolor: `${tint(C_DELIVERIES)} !important` }}> <TableCell
colSpan={3}
align="center"
sx={{
bgcolor: `${soft(C_DELIVERIES)} !important`,
borderLeft: `2px solid ${edge(C_DELIVERIES)} !important`,
borderRight: `2px solid ${edge(C_DELIVERIES)} !important`,
py: '6px !important'
}}
>
<Stack direction="row" alignItems="center" justifyContent="center" spacing={0.75}>
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
width: 20,
height: 20,
borderRadius: 999,
bgcolor: C_DELIVERIES,
color: '#fff',
boxShadow: `0 4px 10px ${ring(C_DELIVERIES)}`
}}
>
<MdLocalShipping size={12} />
</Box>
<Typography sx={{ fontWeight: 900, fontSize: 12, letterSpacing: 1, color: C_DELIVERIES }}>
Deliveries Deliveries
</Typography>
</Stack>
</TableCell> </TableCell>
<TableCell rowSpan={2} align="center">Kms</TableCell> <TableCell rowSpan={2} align="center">Kms</TableCell>
<TableCell rowSpan={2} align="right">Amount</TableCell> <TableCell rowSpan={2} align="right">Amount</TableCell>
@@ -695,12 +776,52 @@ export default function OrdersReport() {
} }
}} }}
> >
<TableCell align="center" sx={{ color: `${C_PENDING} !important` }}>Pending</TableCell> <TableCell
<TableCell align="center" sx={{ color: `${C_COMPLETED} !important` }}>Completed</TableCell> align="center"
<TableCell align="center" sx={{ color: `${C_CANCELLED} !important` }}>Cancelled</TableCell> sx={{
<TableCell align="center" sx={{ color: `${C_PENDING} !important` }}>Pending</TableCell> color: `${C_PENDING} !important`,
<TableCell align="center" sx={{ color: `${C_COMPLETED} !important` }}>Completed</TableCell> bgcolor: `${tint(C_ORDERS)} !important`,
<TableCell align="center" sx={{ color: `${C_CANCELLED} !important` }}>Cancelled</TableCell> borderLeft: `2px solid ${edge(C_ORDERS)} !important`
}}
>
Pending
</TableCell>
<TableCell align="center" sx={{ color: `${C_COMPLETED} !important`, bgcolor: `${tint(C_ORDERS)} !important` }}>
Completed
</TableCell>
<TableCell
align="center"
sx={{
color: `${C_CANCELLED} !important`,
bgcolor: `${tint(C_ORDERS)} !important`,
borderRight: `2px solid ${edge(C_ORDERS)} !important`
}}
>
Cancelled
</TableCell>
<TableCell
align="center"
sx={{
color: `${C_PENDING} !important`,
bgcolor: `${tint(C_DELIVERIES)} !important`,
borderLeft: `2px solid ${edge(C_DELIVERIES)} !important`
}}
>
Pending
</TableCell>
<TableCell align="center" sx={{ color: `${C_COMPLETED} !important`, bgcolor: `${tint(C_DELIVERIES)} !important` }}>
Completed
</TableCell>
<TableCell
align="center"
sx={{
color: `${C_CANCELLED} !important`,
bgcolor: `${tint(C_DELIVERIES)} !important`,
borderRight: `2px solid ${edge(C_DELIVERIES)} !important`
}}
>
Cancelled
</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
@@ -715,11 +836,20 @@ export default function OrdersReport() {
transition: 'background-color 0.15s', transition: 'background-color 0.15s',
'& td': { '& td': {
borderBottom: `1px solid ${DT.divider}`, borderBottom: `1px solid ${DT.divider}`,
py: { xs: 1, md: 1.25 }, py: 0.5,
px: { xs: 1, md: 1.5 } px: 1,
verticalAlign: 'middle'
}, },
'& td.band-o': { backgroundColor: tint(C_ORDERS) },
'& td.band-d': { backgroundColor: tint(C_DELIVERIES) },
'& td.band-o-first': { borderLeft: `2px solid ${edge(C_ORDERS)}` },
'& td.band-o-last': { borderRight: `2px solid ${edge(C_ORDERS)}` },
'& td.band-d-first': { borderLeft: `2px solid ${edge(C_DELIVERIES)}` },
'& td.band-d-last': { borderRight: `2px solid ${edge(C_DELIVERIES)}` },
backgroundColor: openRow === row.locationid ? tint(BRAND) : 'transparent', backgroundColor: openRow === row.locationid ? tint(BRAND) : 'transparent',
'&:hover': { backgroundColor: openRow === row.locationid ? soft(BRAND) : DT.surfaceAlt } '&:hover': { backgroundColor: openRow === row.locationid ? soft(BRAND) : DT.surfaceAlt },
'&:hover td.band-o': { backgroundColor: soft(C_ORDERS) },
'&:hover td.band-d': { backgroundColor: soft(C_DELIVERIES) }
}} }}
> >
<TableCell> <TableCell>
@@ -727,11 +857,11 @@ export default function OrdersReport() {
</TableCell> </TableCell>
<TableCell> <TableCell>
<Stack> <Stack spacing={0.125}>
<Typography variant="subtitle2" sx={{ fontWeight: 700, color: DT.textPrimary }} noWrap> <Typography sx={{ fontSize: 12.5, fontWeight: 700, color: DT.textPrimary, lineHeight: 1.25 }} noWrap>
{row.locationname} {row.locationname}
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textMuted }}> <Typography sx={{ fontSize: 10.5, fontWeight: 600, color: DT.textMuted, lineHeight: 1.3 }}>
Id : {row.locationid} Id : {row.locationid}
</Typography> </Typography>
</Stack> </Stack>
@@ -741,23 +871,23 @@ export default function OrdersReport() {
<MetricPill value={row.totalorders} color={BRAND} icon={<MdInventory2 size={11} />} /> <MetricPill value={row.totalorders} color={BRAND} icon={<MdInventory2 size={11} />} />
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-o band-o-first">
<MetricPill value={row.Orderspending} color={C_PENDING} icon={<MdHourglassEmpty size={11} />} /> <MetricPill value={row.Orderspending} color={C_PENDING} icon={<MdHourglassEmpty size={11} />} />
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-o">
<MetricPill value={row.orderscompleted} color={C_COMPLETED} icon={<MdCheckCircle size={11} />} /> <MetricPill value={row.orderscompleted} color={C_COMPLETED} icon={<MdCheckCircle size={11} />} />
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-o band-o-last">
<MetricPill value={row.orderscancelled} color={C_CANCELLED} icon={<MdCancel size={11} />} /> <MetricPill value={row.orderscancelled} color={C_CANCELLED} icon={<MdCancel size={11} />} />
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-d band-d-first">
<MetricPill value={row.deliveriespending} color={C_PENDING} icon={<MdHourglassEmpty size={11} />} /> <MetricPill value={row.deliveriespending} color={C_PENDING} icon={<MdHourglassEmpty size={11} />} />
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-d">
<MetricPill value={row.deliveriescompleted} color={C_COMPLETED} icon={<MdCheckCircle size={11} />} /> <MetricPill value={row.deliveriescompleted} color={C_COMPLETED} icon={<MdCheckCircle size={11} />} />
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-d band-d-last">
<MetricPill value={row.deliveriescancelled} color={C_CANCELLED} icon={<MdCancel size={11} />} /> <MetricPill value={row.deliveriescancelled} color={C_CANCELLED} icon={<MdCancel size={11} />} />
</TableCell> </TableCell>
@@ -814,8 +944,8 @@ export default function OrdersReport() {
<TableRow> <TableRow>
<TableCell colSpan={13} sx={{ p: 0, borderBottom: `1px solid ${DT.divider}`, bgcolor: DT.surfaceAlt }}> <TableCell colSpan={13} sx={{ p: 0, borderBottom: `1px solid ${DT.divider}`, bgcolor: DT.surfaceAlt }}>
<Collapse in={openRow === row.locationid} timeout="auto" unmountOnExit> <Collapse in={openRow === row.locationid} timeout="auto" unmountOnExit>
<Box sx={{ p: { xs: 1.5, md: 2 } }}> <Box sx={{ p: { xs: 1, md: 1.5 } }}>
<Stack direction="row" alignItems="center" spacing={1} sx={{ mb: 1.25 }}> <Stack direction="row" alignItems="center" spacing={1} sx={{ mb: 1 }}>
<AccentAvatar color={BRAND} size={22} selected> <AccentAvatar color={BRAND} size={22} selected>
<MdLocalShipping size={12} /> <MdLocalShipping size={12} />
</AccentAvatar> </AccentAvatar>
@@ -871,7 +1001,7 @@ export default function OrdersReport() {
<TableRow <TableRow
key={`${rider?.firstname}-${ri}`} key={`${rider?.firstname}-${ri}`}
sx={{ sx={{
'& td': { borderBottom: `1px solid ${DT.divider}`, py: 0.875, px: 1 }, '& td': { borderBottom: `1px solid ${DT.divider}`, py: 0.5, px: 1, verticalAlign: 'middle' },
'&:hover': { backgroundColor: DT.surfaceAlt } '&:hover': { backgroundColor: DT.surfaceAlt }
}} }}
> >
@@ -986,9 +1116,15 @@ export default function OrdersReport() {
backgroundColor: tint(BRAND), backgroundColor: tint(BRAND),
borderTop: `2px solid ${edge(BRAND)}`, borderTop: `2px solid ${edge(BRAND)}`,
borderBottom: 'none', borderBottom: 'none',
py: 1.25, py: 0.75,
px: 1.5 px: 1
} },
'& td.band-o': { backgroundColor: soft(C_ORDERS) },
'& td.band-d': { backgroundColor: soft(C_DELIVERIES) },
'& td.band-o-first': { borderLeft: `2px solid ${edge(C_ORDERS)}` },
'& td.band-o-last': { borderRight: `2px solid ${edge(C_ORDERS)}` },
'& td.band-d-first': { borderLeft: `2px solid ${edge(C_DELIVERIES)}` },
'& td.band-d-last': { borderRight: `2px solid ${edge(C_DELIVERIES)}` }
}} }}
> >
<TableCell colSpan={2}> <TableCell colSpan={2}>
@@ -1002,22 +1138,22 @@ export default function OrdersReport() {
<TableCell align="center"> <TableCell align="center">
<Typography sx={{ fontWeight: 800, color: DT.textPrimary }}>{totalOrders}</Typography> <Typography sx={{ fontWeight: 800, color: DT.textPrimary }}>{totalOrders}</Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-o band-o-first">
<Typography sx={{ fontWeight: 800, color: C_PENDING }}>{totalOrderPend}</Typography> <Typography sx={{ fontWeight: 800, color: C_PENDING }}>{totalOrderPend}</Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-o">
<Typography sx={{ fontWeight: 800, color: C_COMPLETED }}>{totalOrderComplete}</Typography> <Typography sx={{ fontWeight: 800, color: C_COMPLETED }}>{totalOrderComplete}</Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-o band-o-last">
<Typography sx={{ fontWeight: 800, color: C_CANCELLED }}>{totalOrderCancel}</Typography> <Typography sx={{ fontWeight: 800, color: C_CANCELLED }}>{totalOrderCancel}</Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-d band-d-first">
<Typography sx={{ fontWeight: 800, color: C_PENDING }}>{totalDeliPend}</Typography> <Typography sx={{ fontWeight: 800, color: C_PENDING }}>{totalDeliPend}</Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-d">
<Typography sx={{ fontWeight: 800, color: C_COMPLETED }}>{totalDeliComplete}</Typography> <Typography sx={{ fontWeight: 800, color: C_COMPLETED }}>{totalDeliComplete}</Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className="band-d band-d-last">
<Typography sx={{ fontWeight: 800, color: C_CANCELLED }}>{totalDeliCancel}</Typography> <Typography sx={{ fontWeight: 800, color: C_CANCELLED }}>{totalDeliCancel}</Typography>
</TableCell> </TableCell>
<TableCell /> <TableCell />

File diff suppressed because it is too large Load Diff

View File

@@ -117,9 +117,16 @@ const RidersLogs = () => {
refetchInterval: 5 * 60 * 1000 refetchInterval: 5 * 60 * 1000
}); });
// Only active riders are surfaced on this page — inactive riders are filtered
// out entirely before they reach the list, selection, counts, or map.
const activeRiders = React.useMemo(
() => (riders || []).filter((r) => r.status === 'active'),
[riders]
);
useEffect(() => { useEffect(() => {
setSelectedRiders(riders); setSelectedRiders(activeRiders);
}, [riders]); }, [activeRiders]);
useEffect(() => { useEffect(() => {
setOpen(isDesktop); setOpen(isDesktop);
@@ -140,10 +147,9 @@ const RidersLogs = () => {
return () => document.removeEventListener('keydown', handleKeyPress); return () => document.removeEventListener('keydown', handleKeyPress);
}, []); }, []);
// Counts shown in the drawer header. // Counts shown in the drawer header (active riders only).
const totalRiders = riders?.length || 0; const totalRiders = activeRiders.length;
const activeCount = (riders || []).filter((r) => r.status === 'active').length; const activeCount = totalRiders;
const inactiveCount = totalRiders - activeCount;
const isAllSelected = totalRiders > 0 && selectedRiders?.length === totalRiders; const isAllSelected = totalRiders > 0 && selectedRiders?.length === totalRiders;
return ( return (
@@ -195,8 +201,11 @@ const RidersLogs = () => {
sx={{ sx={{
position: 'sticky', position: 'sticky',
top: 0, top: 0,
zIndex: 2, zIndex: 5,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`, // Solid white base UNDER the translucent brand gradient so the
// scrolling rider list never shows through the sticky header.
backgroundColor: '#fff',
backgroundImage: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
borderBottom: `1px solid ${DT.borderSubtle}`, borderBottom: `1px solid ${DT.borderSubtle}`,
p: 1.75 p: 1.75
}} }}
@@ -250,9 +259,6 @@ const RidersLogs = () => {
<SoftPill color={C_ACTIVE} icon={<MdCheckCircle size={11} />}> <SoftPill color={C_ACTIVE} icon={<MdCheckCircle size={11} />}>
Active · {activeCount} Active · {activeCount}
</SoftPill> </SoftPill>
<SoftPill color={C_INACTIVE} icon={<MdHighlightOff size={11} />}>
Inactive · {inactiveCount}
</SoftPill>
</Stack> </Stack>
{/* Pill search */} {/* Pill search */}
@@ -301,7 +307,7 @@ const RidersLogs = () => {
<Box <Box
onClick={() => { onClick={() => {
if (!isAllSelected) { if (!isAllSelected) {
setSelectedRiders(riders); setSelectedRiders(activeRiders);
} }
}} }}
sx={{ sx={{
@@ -328,7 +334,7 @@ const RidersLogs = () => {
checked={isAllSelected} checked={isAllSelected}
onChange={(e) => { onChange={(e) => {
if (e.target.checked) { if (e.target.checked) {
setSelectedRiders(riders); setSelectedRiders(activeRiders);
} }
}} }}
sx={{ sx={{
@@ -380,7 +386,7 @@ const RidersLogs = () => {
</Stack> </Stack>
</ListItem> </ListItem>
)) ))
: riders?.map((row) => { : activeRiders.map((row) => {
const isSelected = selectedRiders?.length === 1 && selectedRiders[0]?.userid === row?.userid; const isSelected = selectedRiders?.length === 1 && selectedRiders[0]?.userid === row?.userid;
const statusColor = row.status === 'active' ? C_ACTIVE : C_INACTIVE; const statusColor = row.status === 'active' ? C_ACTIVE : C_INACTIVE;
const initial = (row.firstname || row.username || '?').charAt(0).toUpperCase(); const initial = (row.firstname || row.username || '?').charAt(0).toUpperCase();
@@ -422,7 +428,7 @@ const RidersLogs = () => {
if (e.target.checked) { if (e.target.checked) {
setSelectedRiders([row]); setSelectedRiders([row]);
} else { } else {
setSelectedRiders(riders); setSelectedRiders(activeRiders);
} }
}} }}
sx={{ sx={{

View File

@@ -265,13 +265,14 @@ export default function RidersSummary() {
<> <>
{isLoadingReports && <Loader />} {isLoadingReports && <Loader />}
{/* ============================================= || Header || ============================================= */} {/* ============================================= || Header (compact, standardized actions) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mb: { xs: 1.5, md: 2 }, mb: { xs: 1, md: 1.25 },
p: { xs: 1.5, sm: 2, md: 2.5 }, px: { xs: 1.5, sm: 2 },
borderRadius: DT.radiusCard / 8, py: { xs: 1, sm: 1.25 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`, background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
@@ -282,80 +283,87 @@ export default function RidersSummary() {
direction={{ xs: 'column', sm: 'row' }} direction={{ xs: 'column', sm: 'row' }}
alignItems={{ xs: 'flex-start', sm: 'center' }} alignItems={{ xs: 'flex-start', sm: 'center' }}
justifyContent="space-between" justifyContent="space-between"
spacing={{ xs: 1.5, sm: 2 }} spacing={{ xs: 1, sm: 1.5 }}
> >
<Stack direction="row" alignItems="center" spacing={{ xs: 1.25, sm: 1.75 }}> <Stack direction="row" alignItems="center" spacing={1.25}>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 40, sm: 48 }, width: 36,
height: { xs: 40, sm: 48 }, height: 36,
bgcolor: BRAND, bgcolor: BRAND,
color: '#fff', color: '#fff',
boxShadow: `0 6px 18px ${ring(BRAND)}` borderRadius: 1.5,
boxShadow: `0 4px 12px ${ring(BRAND)}`
}} }}
> >
<MdGroups size={22} /> <MdGroups size={19} />
</Avatar> </Avatar>
<Stack> <Stack spacing={0.125}>
<Typography <Typography
variant="h3" variant="h3"
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.1,
fontSize: { xs: '1.25rem', sm: '1.5rem', md: '1.75rem' } fontSize: { xs: '1.1rem', sm: '1.25rem', md: '1.375rem' }
}} }}
> >
Riders Summary Riders Summary
</Typography> </Typography>
<Stack direction="row" alignItems="center" spacing={0.75} sx={{ mt: 0.5 }}> <Stack direction="row" alignItems="center" spacing={0.75}>
<Box <Box
sx={{ sx={{
width: 8, width: 7,
height: 8, height: 7,
borderRadius: '50%', borderRadius: '50%',
bgcolor: '#10b981', bgcolor: '#10b981',
boxShadow: '0 0 0 4px rgba(16,185,129,0.18)' boxShadow: '0 0 0 3px rgba(16,185,129,0.18)'
}} }}
/> />
<Typography variant="caption" sx={{ color: DT.textSecondary, fontWeight: 600 }}> <Typography sx={{ fontSize: 11.5, color: DT.textSecondary, fontWeight: 600 }}>
Live · {filteredRows.length} riders · {datestatus} Live · {filteredRows.length} riders · {datestatus}
</Typography> </Typography>
</Stack> </Stack>
</Stack> </Stack>
</Stack> </Stack>
<Tooltip title="Date Filter"> <Tooltip title="Filter by date range" arrow>
<Box <Button
onClick={() => setOpen(true)} onClick={() => setOpen(true)}
disableElevation
variant="outlined"
size="small"
startIcon={<MdCalendarMonth size={15} />}
sx={{ sx={{
display: 'inline-flex', height: 32,
alignItems: 'center', px: 1.25,
gap: 0.75, borderRadius: 1.5,
px: 1.5, textTransform: 'none',
py: 0.875, fontSize: 12.5,
borderRadius: 999, fontWeight: 700,
cursor: 'pointer', letterSpacing: 0.1,
bgcolor: '#fff', bgcolor: '#fff',
border: `1.5px solid ${edge('#f59e0b')}`, borderColor: DT.borderSubtle,
color: '#f59e0b', color: DT.textPrimary,
fontWeight: 800, '&:hover': {
fontSize: 12, bgcolor: '#fff',
transition: 'all 0.18s', borderColor: BRAND,
'&:hover': { borderColor: '#f59e0b', boxShadow: `0 0 0 3px ${ring('#f59e0b')}` } color: BRAND,
boxShadow: `0 0 0 3px ${ring(BRAND)}`
}
}} }}
> >
<MdCalendarMonth size={14} />
{startdate && enddate {startdate && enddate
? `${dayjs(startdate).format('DD/MM/YY')} ${dayjs(enddate).format('DD/MM/YY')}` ? `${dayjs(startdate).format('DD MMM')} ${dayjs(enddate).format('DD MMM')}`
: 'All time'} : 'All time'}
</Box> </Button>
</Tooltip> </Tooltip>
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || KPI Cards || ============================================= */} {/* ============================================= || KPI Cards (compact) || ============================================= */}
<Grid container spacing={{ xs: 1.25, sm: 1.5, md: 2 }}> <Grid container spacing={{ xs: 1, sm: 1.25, md: 1.5 }}>
{kpiCards.map((item) => { {kpiCards.map((item) => {
const Icon = item.icon; const Icon = item.icon;
return ( return (
@@ -365,14 +373,15 @@ export default function RidersSummary() {
sx={{ sx={{
position: 'relative', position: 'relative',
overflow: 'hidden', overflow: 'hidden',
p: { xs: 1.25, sm: 1.75, md: 2.25 }, px: { xs: 1.25, sm: 1.5 },
borderRadius: DT.radiusCard / 8, py: { xs: 0.875, sm: 1.125 },
borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: '#fff', background: '#fff',
transition: 'transform 0.2s, box-shadow 0.2s, border-color 0.2s', transition: 'transform 0.15s, box-shadow 0.15s, border-color 0.15s',
'&:hover': { '&:hover': {
transform: 'translateY(-3px)', transform: 'translateY(-1px)',
boxShadow: DT.shadowMd, boxShadow: DT.shadowMd,
borderColor: edge(item.color) borderColor: edge(item.color)
} }
@@ -383,24 +392,24 @@ export default function RidersSummary() {
position: 'absolute', position: 'absolute',
top: 0, top: 0,
left: 0, left: 0,
right: 0, bottom: 0,
height: 3, width: 3,
background: `linear-gradient(90deg, ${item.color} 0%, ${soft(item.color)} 100%)` background: item.color
}} }}
/> />
<Stack direction="row" alignItems="flex-start" justifyContent="space-between" spacing={1}> <Stack direction="row" alignItems="center" justifyContent="space-between" spacing={1} sx={{ pl: 0.5 }}>
<Stack spacing={0.5} sx={{ minWidth: 0, flex: 1 }}> <Stack spacing={0.125} sx={{ minWidth: 0, flex: 1 }}>
<Typography <Typography
variant="caption"
sx={{ sx={{
color: DT.textSecondary, color: DT.textSecondary,
fontWeight: 700, fontWeight: 700,
letterSpacing: 0.4, letterSpacing: 0.4,
textTransform: 'uppercase', textTransform: 'uppercase',
fontSize: { xs: 10, sm: 11 }, fontSize: 10.5,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis' textOverflow: 'ellipsis',
lineHeight: 1.2
}} }}
> >
{item.label} {item.label}
@@ -409,9 +418,10 @@ export default function RidersSummary() {
sx={{ sx={{
fontWeight: 800, fontWeight: 800,
color: DT.textPrimary, color: DT.textPrimary,
lineHeight: 1.1, lineHeight: 1.15,
fontSize: { xs: '1.1rem', sm: '1.35rem', md: '1.55rem' } fontSize: { xs: '0.95rem', sm: '1.1rem', md: '1.2rem' }
}} }}
noWrap
> >
{isLoadingReports ? ( {isLoadingReports ? (
<Skeleton sx={{ width: 40 }} animation="wave" /> <Skeleton sx={{ width: 40 }} animation="wave" />
@@ -423,16 +433,17 @@ export default function RidersSummary() {
</Typography> </Typography>
</Stack> </Stack>
<Avatar <Avatar
variant="rounded"
sx={{ sx={{
width: { xs: 32, sm: 38, md: 44 }, width: 30,
height: { xs: 32, sm: 38, md: 44 }, height: 30,
bgcolor: soft(item.color), bgcolor: soft(item.color),
color: item.color, color: item.color,
boxShadow: `inset 0 0 0 1px ${edge(item.color)}`, borderRadius: 1.25,
flexShrink: 0 flexShrink: 0
}} }}
> >
<Icon size={18} /> <Icon size={15} />
</Avatar> </Avatar>
</Stack> </Stack>
</Paper> </Paper>
@@ -441,13 +452,13 @@ export default function RidersSummary() {
})} })}
</Grid> </Grid>
{/* ============================================= || Filter Bar || ============================================= */} {/* ============================================= || Filter Bar (compact) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mt: { xs: 1.5, md: 2 }, mt: { xs: 1, md: 1.25 },
p: { xs: 1.25, md: 1.75 }, p: { xs: 1, md: 1.125 },
borderRadius: DT.radiusCard / 8, borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
background: '#fff', background: '#fff',
@@ -542,12 +553,12 @@ export default function RidersSummary() {
</Stack> </Stack>
</Paper> </Paper>
{/* ============================================= || Table || ============================================= */} {/* ============================================= || Table (dense, sticky header) || ============================================= */}
<Paper <Paper
elevation={0} elevation={0}
sx={{ sx={{
mt: { xs: 1.5, md: 2 }, mt: { xs: 1, md: 1.25 },
borderRadius: DT.radiusCard / 8, borderRadius: 2,
border: '1px solid', border: '1px solid',
borderColor: DT.borderSubtle, borderColor: DT.borderSubtle,
overflow: 'hidden', overflow: 'hidden',
@@ -556,6 +567,8 @@ export default function RidersSummary() {
> >
<TableContainer <TableContainer
sx={{ sx={{
minHeight: 320,
maxHeight: { xs: 'calc(100vh - 320px)', md: 'calc(100vh - 300px)' },
overflow: 'auto', overflow: 'auto',
'&::-webkit-scrollbar': { width: 10, height: 10 }, '&::-webkit-scrollbar': { width: 10, height: 10 },
'&::-webkit-scrollbar-thumb': { '&::-webkit-scrollbar-thumb': {
@@ -566,21 +579,21 @@ export default function RidersSummary() {
'&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt } '&::-webkit-scrollbar-track': { backgroundColor: DT.surfaceAlt }
}} }}
> >
<Table sx={{ minWidth: 1300 }}> <Table stickyHeader size="small" sx={{ minWidth: 1300 }}>
<TableHead> <TableHead>
<TableRow <TableRow
sx={{ sx={{
'& th': { '& th': {
backgroundColor: DT.surfaceAlt, backgroundColor: DT.surfaceAlt,
color: DT.textSecondary, color: DT.textSecondary,
fontSize: { xs: 10, md: 11 }, fontSize: 10.5,
fontWeight: 800, fontWeight: 800,
letterSpacing: 0.6, letterSpacing: 0.5,
textTransform: 'uppercase', textTransform: 'uppercase',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
borderBottom: `1px solid ${DT.borderSubtle}`, borderBottom: `1px solid ${DT.borderSubtle}`,
py: { xs: 1, md: 1.25 }, py: 0.75,
px: { xs: 1, md: 1.5 } px: 1
} }
}} }}
> >
@@ -606,11 +619,11 @@ export default function RidersSummary() {
<TableBody> <TableBody>
{isLoadingReports && {isLoadingReports &&
filteredRows.length === 0 && filteredRows.length === 0 &&
[0, 1, 2, 3, 4].map((_, idx) => ( Array.from({ length: 10 }).map((_, idx) => (
<TableRow key={`sk-${idx}`}> <TableRow key={`sk-${idx}`}>
{Array.from({ length: 16 }).map((__, ci) => ( {Array.from({ length: 16 }).map((__, ci) => (
<TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}` }}> <TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}`, py: 0.625, px: 1 }}>
<Skeleton animation="wave" /> <Skeleton animation="wave" height={20} />
</TableCell> </TableCell>
))} ))}
</TableRow> </TableRow>
@@ -618,17 +631,45 @@ export default function RidersSummary() {
{!isLoadingReports && filteredRows.length === 0 && ( {!isLoadingReports && filteredRows.length === 0 && (
<TableRow> <TableRow>
<TableCell colSpan={16} sx={{ py: 6, borderBottom: 'none' }}> <TableCell colSpan={16} sx={{ py: 7, borderBottom: 'none' }}>
<Stack alignItems="center" spacing={1.5}> <Stack alignItems="center" spacing={1.25}>
<Avatar sx={{ width: 64, height: 64, bgcolor: soft('#94a3b8'), color: DT.textMuted }}> <Avatar
<MdGroups size={28} /> variant="rounded"
sx={{
width: 56,
height: 56,
bgcolor: soft('#94a3b8'),
color: DT.textMuted,
borderRadius: 2
}}
>
<MdGroups size={26} />
</Avatar> </Avatar>
<Typography variant="subtitle1" sx={{ fontWeight: 700, color: DT.textPrimary }}> <Typography sx={{ fontWeight: 700, color: DT.textPrimary, fontSize: 14 }}>
No riders to show No riders to show
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textSecondary }}> <Typography sx={{ color: DT.textSecondary, fontSize: 12 }}>
{searchword ? 'Try a different rider name.' : 'Adjust the date range above.'} {searchword ? 'Try a different rider name or clear the search.' : 'Adjust the date range above.'}
</Typography> </Typography>
{searchword && (
<Button
size="small"
onClick={() => setSearchword('')}
sx={{
mt: 0.5,
height: 28,
textTransform: 'none',
fontSize: 12,
fontWeight: 700,
color: BRAND,
borderRadius: 1.25,
'&:hover': { bgcolor: tint(BRAND) }
}}
startIcon={<MdClear size={14} />}
>
Clear search
</Button>
)}
</Stack> </Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
@@ -640,30 +681,35 @@ export default function RidersSummary() {
<TableRow <TableRow
sx={{ sx={{
cursor: 'pointer', cursor: 'pointer',
transition: 'background-color 0.15s', transition: 'background-color 0.12s, box-shadow 0.12s',
'& td': { '& td': {
borderBottom: `1px solid ${DT.divider}`, borderBottom: `1px solid ${DT.divider}`,
py: { xs: 1, md: 1.25 }, py: 0.625,
px: { xs: 1, md: 1.5 } px: 1,
verticalAlign: 'middle'
}, },
backgroundColor: openRow === row.userid ? tint(BRAND) : 'transparent', backgroundColor: openRow === row.userid ? tint(BRAND) : 'transparent',
'&:hover': { backgroundColor: openRow === row.userid ? soft(BRAND) : DT.surfaceAlt } boxShadow: openRow === row.userid ? `inset 3px 0 0 ${BRAND}` : 'none',
'&:hover': {
backgroundColor: openRow === row.userid ? soft(BRAND) : tint(BRAND),
boxShadow: `inset 3px 0 0 ${BRAND}`
}
}} }}
> >
<TableCell> <TableCell>
<Typography sx={{ fontWeight: 700, color: DT.textSecondary }}>{index + 1}</Typography> <Typography sx={{ fontWeight: 700, fontSize: 12, color: DT.textMuted }}>{index + 1}</Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
<Stack direction="row" alignItems="center" spacing={1}> <Stack direction="row" alignItems="center" spacing={1}>
<AccentAvatar color={BRAND} size={32} selected> <AccentAvatar color={BRAND} size={28} selected>
{String(row.firstname || '?').charAt(0).toUpperCase()} {String(row.firstname || '?').charAt(0).toUpperCase()}
</AccentAvatar> </AccentAvatar>
<Stack> <Stack spacing={0.125}>
<Typography variant="subtitle2" sx={{ fontWeight: 700, color: DT.textPrimary }} noWrap> <Typography sx={{ fontSize: 12.5, fontWeight: 700, color: DT.textPrimary, lineHeight: 1.25 }} noWrap>
{row.firstname} {row.lastname} {row.firstname} {row.lastname}
</Typography> </Typography>
<Typography variant="caption" sx={{ color: DT.textMuted }}> <Typography sx={{ fontSize: 10.5, fontWeight: 600, color: DT.textMuted, lineHeight: 1.3 }}>
Id : {row.userid} Id : {row.userid}
</Typography> </Typography>
</Stack> </Stack>
@@ -823,8 +869,8 @@ export default function RidersSummary() {
<TableRow <TableRow
key={`${subrow.locationid}-${sridx}`} key={`${subrow.locationid}-${sridx}`}
sx={{ sx={{
'& td': { borderBottom: `1px solid ${DT.divider}`, py: 0.875, px: 1 }, '& td': { borderBottom: `1px solid ${DT.divider}`, py: 0.5, px: 1 },
'&:hover': { backgroundColor: DT.surfaceAlt } '&:hover': { backgroundColor: tint(BRAND), boxShadow: `inset 3px 0 0 ${BRAND}` }
}} }}
> >
<TableCell align="center"> <TableCell align="center">

View File

@@ -9,6 +9,7 @@ const initialState = {
openItem: ['dashboard'], openItem: ['dashboard'],
openComponent: 'buttons', openComponent: 'buttons',
selectedID: null, selectedID: null,
selectedMenu: null,
drawerOpen: false, drawerOpen: false,
componentDrawerOpen: true, componentDrawerOpen: true,
menu: {}, menu: {},
@@ -48,6 +49,10 @@ const menu = createSlice({
hasError(state, action) { hasError(state, action) {
state.error = action.payload; state.error = action.payload;
},
setSelectedMenu(state, action) {
state.selectedMenu = action.payload;
} }
}, },
@@ -60,4 +65,4 @@ const menu = createSlice({
export default menu.reducer; export default menu.reducer;
export const { activeItem, activeComponent, openDrawer, openComponentDrawer, activeID } = menu.actions; export const { activeItem, activeComponent, openDrawer, openComponentDrawer, activeID, setSelectedMenu } = menu.actions;