removed the charges column in the report section

This commit is contained in:
2026-06-30 13:00:20 +05:30
parent 0802eea3dc
commit b253ff5388
4 changed files with 17 additions and 95 deletions

View File

@@ -2694,7 +2694,7 @@ const Dispatch = ({
)} )}
</div> </div>
{(o.actualkms != null || (!isDelivered && o.riderkms != null) || estMeters !== null) && ( {(o.actualkms != null || o.riderkms != null || estMeters !== null) && (
<div className="pu-distance-row"> <div className="pu-distance-row">
{o.actualkms != null && o.actualkms !== '' && ( {o.actualkms != null && o.actualkms !== '' && (
<div className="pu-distance-chip"> <div className="pu-distance-chip">
@@ -2703,7 +2703,7 @@ const Dispatch = ({
<span className="pu-distance-value">{o.actualkms} km</span> <span className="pu-distance-value">{o.actualkms} km</span>
</div> </div>
)} )}
{!isDelivered && o.riderkms != null && o.riderkms !== '' && ( {o.riderkms != null && o.riderkms !== '' && (
<div className="pu-distance-chip"> <div className="pu-distance-chip">
<span className="pu-distance-icon"><MdDirectionsBike /></span> <span className="pu-distance-icon"><MdDirectionsBike /></span>
<span className="pu-distance-label">Rider</span> <span className="pu-distance-label">Rider</span>

View File

@@ -757,7 +757,7 @@ export default function OrdersReport() {
</Stack> </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="center">Actual KMs</TableCell>
<TableCell rowSpan={2} align="center">Action</TableCell> <TableCell rowSpan={2} align="center">Action</TableCell>
</TableRow> </TableRow>
<TableRow <TableRow
@@ -903,10 +903,14 @@ export default function OrdersReport() {
</Tooltip> </Tooltip>
</TableCell> </TableCell>
<TableCell align="right"> <TableCell align="center">
<Tooltip title="Total Charges" placement="top"> <Tooltip title="Actual KMs" placement="top">
<Box sx={{ display: 'inline-block' }}> <Box sx={{ display: 'inline-block' }}>
<MetricPill value={row.charges} color={BRAND} icon={<MdCurrencyRupee size={11} />} isMoney /> <MetricPill
value={parseFloat(row.actualkms || 0).toFixed(2)}
color={C_KMS}
icon={<MdStraighten size={11} />}
/>
</Box> </Box>
</Tooltip> </Tooltip>
</TableCell> </TableCell>
@@ -992,7 +996,6 @@ export default function OrdersReport() {
<TableCell align="center">Skipped</TableCell> <TableCell align="center">Skipped</TableCell>
<TableCell align="center">Delivered</TableCell> <TableCell align="center">Delivered</TableCell>
<TableCell align="center">Kms</TableCell> <TableCell align="center">Kms</TableCell>
<TableCell align="center">Charges</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
@@ -1061,14 +1064,11 @@ export default function OrdersReport() {
<TableCell align="center"> <TableCell align="center">
<MetricPill value={rider?.cumulativekms} color={C_KMS} icon={<MdStraighten size={10} />} /> <MetricPill value={rider?.cumulativekms} color={C_KMS} icon={<MdStraighten size={10} />} />
</TableCell> </TableCell>
<TableCell align="center">
<MetricPill value={rider?.deliveryamt} color={BRAND} icon={<MdCurrencyRupee size={10} />} isMoney />
</TableCell>
</TableRow> </TableRow>
)) ))
) : ( ) : (
<TableRow> <TableRow>
<TableCell colSpan={12} sx={{ py: 3, borderBottom: 'none' }}> <TableCell colSpan={11} sx={{ py: 3, borderBottom: 'none' }}>
<Stack alignItems="center" spacing={1}> <Stack alignItems="center" spacing={1}>
<Avatar sx={{ width: 40, height: 40, bgcolor: soft('#94a3b8'), color: DT.textMuted }}> <Avatar sx={{ width: 40, height: 40, bgcolor: soft('#94a3b8'), color: DT.textMuted }}>
<MdLocalShipping size={18} /> <MdLocalShipping size={18} />
@@ -1157,11 +1157,7 @@ export default function OrdersReport() {
<Typography sx={{ fontWeight: 800, color: C_CANCELLED }}>{totalDeliCancel}</Typography> <Typography sx={{ fontWeight: 800, color: C_CANCELLED }}>{totalDeliCancel}</Typography>
</TableCell> </TableCell>
<TableCell /> <TableCell />
<TableCell align="right"> <TableCell />
<Typography sx={{ fontWeight: 800, color: BRAND, fontSize: 14 }}>
{formatNumberToRupees(total)}
</Typography>
</TableCell>
<TableCell /> <TableCell />
</TableRow> </TableRow>
)} )}

View File

@@ -329,8 +329,7 @@ export default function OrdersDetails() {
{ key: 'picked', label: 'Picked', group: 'Lifecycle', defaultVisible: true, minWidth: 90 }, { key: 'picked', label: 'Picked', group: 'Lifecycle', defaultVisible: true, minWidth: 90 },
{ key: 'delivered', label: 'Delivered', group: 'Lifecycle', defaultVisible: true, minWidth: 90 }, { key: 'delivered', label: 'Delivered', group: 'Lifecycle', defaultVisible: true, minWidth: 90 },
{ key: 'cancelled', label: 'Cancelled', group: 'Lifecycle', defaultVisible: false, minWidth: 90 }, { key: 'cancelled', label: 'Cancelled', group: 'Lifecycle', defaultVisible: false, minWidth: 90 },
{ key: 'kms', label: 'Kms', group: 'Metrics', defaultVisible: true, width: 70, align: 'center' }, { key: 'kms', label: 'Kms', group: 'Metrics', defaultVisible: true, width: 70, align: 'center' }
{ key: 'charges', label: 'Charges', group: 'Metrics', defaultVisible: true, width: 100, align: 'right' }
]; ];
const COLUMN_GROUPS = ['Core', 'Lifecycle', 'Metrics']; const COLUMN_GROUPS = ['Core', 'Lifecycle', 'Metrics'];
const COLUMN_DEFAULTS = ALL_COLUMNS.reduce((acc, c) => ({ ...acc, [c.key]: c.defaultVisible }), {}); const COLUMN_DEFAULTS = ALL_COLUMNS.reduce((acc, c) => ({ ...acc, [c.key]: c.defaultVisible }), {});
@@ -1090,7 +1089,6 @@ export default function OrdersDetails() {
{isVisible('delivered') && <TableCell sx={{ minWidth: 90 }}>Delivered</TableCell>} {isVisible('delivered') && <TableCell sx={{ minWidth: 90 }}>Delivered</TableCell>}
{isVisible('cancelled') && <TableCell sx={{ minWidth: 90 }}>Cancelled</TableCell>} {isVisible('cancelled') && <TableCell sx={{ minWidth: 90 }}>Cancelled</TableCell>}
{isVisible('kms') && <TableCell align="center" sx={{ width: 70 }}>Kms</TableCell>} {isVisible('kms') && <TableCell align="center" sx={{ width: 70 }}>Kms</TableCell>}
{isVisible('charges') && <TableCell align="right" sx={{ width: 100 }}>Charges</TableCell>}
</TableRow> </TableRow>
</TableHead> </TableHead>
@@ -1315,21 +1313,6 @@ export default function OrdersDetails() {
</TableCell> </TableCell>
)} )}
{/* Charges */}
{isVisible('charges') && (
<TableCell align="right">
<MetricPill
value={
row.orderstatus === 'cancelled' || row.deliverycharges === ''
? 0
: Number(row.deliverycharges)
}
color={BRAND}
icon={<MdCurrencyRupee size={11} />}
isMoney
/>
</TableCell>
)}
</TableRow> </TableRow>
))} ))}

View File

@@ -167,7 +167,6 @@ export default function RidersSummary() {
const [enddate, setEnddate] = useState(dayjs().format('YYYY-MM-DD')); const [enddate, setEnddate] = useState(dayjs().format('YYYY-MM-DD'));
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [datestatus, setDatestatus] = useState('Today'); const [datestatus, setDatestatus] = useState('Today');
const [total, settotal] = useState(0);
const [tenantData, setTenantData] = useState([]); const [tenantData, setTenantData] = useState([]);
const [openRow, setOpenRow] = useState(null); const [openRow, setOpenRow] = useState(null);
const [searchword, setSearchword] = useState(''); const [searchword, setSearchword] = useState('');
@@ -206,15 +205,6 @@ export default function RidersSummary() {
queryFn: fetchRidersSummary queryFn: fetchRidersSummary
}); });
// ============================================= || calculate totals || =============================================
useEffect(() => {
if (!rows) return;
let calculatedTotal = 0;
rows.forEach((row) => {
calculatedTotal += Number(row.Deliveryamt || row.deliveryamt || 0);
});
settotal(calculatedTotal);
}, [rows]);
// ============================================= || fetchTenantSummary (per rider) || ============================================= // ============================================= || fetchTenantSummary (per rider) || =============================================
const fetchTenantSummary = async (riderUserid) => { const fetchTenantSummary = async (riderUserid) => {
@@ -611,7 +601,6 @@ export default function RidersSummary() {
<TableCell align="center" sx={{ color: `${C_DELIVERED} !important` }}>Delivered</TableCell> <TableCell align="center" sx={{ color: `${C_DELIVERED} !important` }}>Delivered</TableCell>
<TableCell align="center">Kms</TableCell> <TableCell align="center">Kms</TableCell>
<TableCell align="center">COD / PLA</TableCell> <TableCell align="center">COD / PLA</TableCell>
<TableCell align="right">Charges</TableCell>
<TableCell align="center">Action</TableCell> <TableCell align="center">Action</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
@@ -621,7 +610,7 @@ export default function RidersSummary() {
filteredRows.length === 0 && filteredRows.length === 0 &&
Array.from({ length: 10 }).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: 15 }).map((__, ci) => (
<TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}`, py: 0.625, px: 1 }}> <TableCell key={ci} sx={{ borderBottom: `1px solid ${DT.divider}`, py: 0.625, px: 1 }}>
<Skeleton animation="wave" height={20} /> <Skeleton animation="wave" height={20} />
</TableCell> </TableCell>
@@ -631,7 +620,7 @@ export default function RidersSummary() {
{!isLoadingReports && filteredRows.length === 0 && ( {!isLoadingReports && filteredRows.length === 0 && (
<TableRow> <TableRow>
<TableCell colSpan={16} sx={{ py: 7, borderBottom: 'none' }}> <TableCell colSpan={15} sx={{ py: 7, borderBottom: 'none' }}>
<Stack alignItems="center" spacing={1.25}> <Stack alignItems="center" spacing={1.25}>
<Avatar <Avatar
variant="rounded" variant="rounded"
@@ -774,14 +763,6 @@ export default function RidersSummary() {
</Stack> </Stack>
</TableCell> </TableCell>
<TableCell align="right">
<Tooltip title="Total Charges" placement="top">
<Box sx={{ display: 'inline-block' }}>
<MetricPill value={row.deliveryamt} color={BRAND} icon={<MdCurrencyRupee size={11} />} isMoney />
</Box>
</Tooltip>
</TableCell>
<TableCell align="center"> <TableCell align="center">
<Tooltip title={openRow === row.userid ? 'Collapse locations' : 'View locations'}> <Tooltip title={openRow === row.userid ? 'Collapse locations' : 'View locations'}>
<IconButton <IconButton
@@ -813,7 +794,7 @@ export default function RidersSummary() {
{/* ===================== || Collapsible per-location summary || ===================== */} {/* ===================== || Collapsible per-location summary || ===================== */}
{openRow === row.userid && ( {openRow === row.userid && (
<TableRow> <TableRow>
<TableCell colSpan={16} sx={{ p: 0, borderBottom: `1px solid ${DT.divider}`, bgcolor: DT.surfaceAlt }}> <TableCell colSpan={15} sx={{ p: 0, borderBottom: `1px solid ${DT.divider}`, bgcolor: DT.surfaceAlt }}>
<Collapse in={openRow === row.userid} timeout="auto" unmountOnExit> <Collapse in={openRow === row.userid} timeout="auto" unmountOnExit>
<Box sx={{ p: { xs: 1.5, md: 2 } }}> <Box sx={{ p: { xs: 1.5, md: 2 } }}>
<Stack direction="row" alignItems="center" spacing={1} sx={{ mb: 1.25 }}> <Stack direction="row" alignItems="center" spacing={1} sx={{ mb: 1.25 }}>
@@ -860,7 +841,6 @@ export default function RidersSummary() {
<TableCell align="center">Cancelled</TableCell> <TableCell align="center">Cancelled</TableCell>
<TableCell align="center">Kms</TableCell> <TableCell align="center">Kms</TableCell>
<TableCell align="center">COD / PLA</TableCell> <TableCell align="center">COD / PLA</TableCell>
<TableCell align="right">Amount</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
@@ -921,14 +901,11 @@ export default function RidersSummary() {
</Tooltip> </Tooltip>
</Stack> </Stack>
</TableCell> </TableCell>
<TableCell align="right">
<MetricPill value={subrow.charges} color={BRAND} icon={<MdCurrencyRupee size={10} />} isMoney />
</TableCell>
</TableRow> </TableRow>
)) ))
) : ( ) : (
<TableRow> <TableRow>
<TableCell colSpan={9} sx={{ py: 3, borderBottom: 'none' }}> <TableCell colSpan={8} sx={{ py: 3, borderBottom: 'none' }}>
<Stack alignItems="center" spacing={1}> <Stack alignItems="center" spacing={1}>
<Avatar sx={{ width: 40, height: 40, bgcolor: soft('#94a3b8'), color: DT.textMuted }}> <Avatar sx={{ width: 40, height: 40, bgcolor: soft('#94a3b8'), color: DT.textMuted }}>
<MdPlace size={18} /> <MdPlace size={18} />
@@ -954,40 +931,6 @@ export default function RidersSummary() {
</Table> </Table>
</TableContainer> </TableContainer>
<Divider />
{/* ===================== || Footer total strip || ===================== */}
{filteredRows.length > 0 && (
<Stack
direction={{ xs: 'column', sm: 'row' }}
spacing={1.25}
alignItems="center"
justifyContent="flex-end"
sx={{
p: { xs: 1.25, md: 1.75 },
background: `linear-gradient(135deg, ${tint(BRAND)} 0%, ${tint(BRAND_LIGHT)} 100%)`,
borderTop: `1px solid ${edge(BRAND)}`
}}
>
<Box
sx={{
display: 'inline-flex',
alignItems: 'center',
gap: 0.75,
px: 1.25,
py: 0.5,
borderRadius: 999,
bgcolor: '#fff',
border: `1.5px solid ${edge(BRAND)}`,
color: BRAND,
fontWeight: 800,
fontSize: 13
}}
>
<MdLocalOffer size={13} /> Total Amount · {formatNumberToRupees(total)}
</Box>
</Stack>
)}
</Paper> </Paper>
{/* ============================================= || Date Filter Dialog || ============================================= */} {/* ============================================= || Date Filter Dialog || ============================================= */}