updates on the changes arelated toe the order creation and delivery fixes as well
This commit is contained in:
@@ -3,6 +3,7 @@ import { MapContainer, TileLayer, Marker, Polyline, Tooltip } from 'react-leafle
|
||||
import L from 'leaflet';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import dayjs from 'dayjs';
|
||||
import { parseDoormileTimestamp } from 'utils/doormileTimestamp';
|
||||
import { Chip, Stack, Typography, Box } from '@mui/material';
|
||||
import { CloseCircleOutlined } from '@ant-design/icons';
|
||||
import CircularLoader from 'components/CircularLoader';
|
||||
@@ -160,12 +161,12 @@ const MapWithRoute = ({ coordinates, additionalProps, order, setMapOpen }) => {
|
||||
|
||||
{/* START MARKER */}
|
||||
<Marker position={start} icon={startIcon}>
|
||||
<Tooltip direction="bottom">{`Pickup: ${dayjs(additionalProps.riderStart).format('DD-MM-YYYY hh:mm A')}`}</Tooltip>
|
||||
<Tooltip direction="bottom">{`Pickup: ${parseDoormileTimestamp(additionalProps.riderStart).format('DD-MM-YYYY hh:mm A')}`}</Tooltip>
|
||||
</Marker>
|
||||
|
||||
{/* END MARKER */}
|
||||
<Marker position={end} icon={endIcon}>
|
||||
<Tooltip direction="bottom">{`Drop: ${dayjs(additionalProps.riderEnd).format('DD-MM-YYYY hh:mm A')}`}</Tooltip>
|
||||
<Tooltip direction="bottom">{`Drop: ${parseDoormileTimestamp(additionalProps.riderEnd).format('DD-MM-YYYY hh:mm A')}`}</Tooltip>
|
||||
</Marker>
|
||||
|
||||
{/* REAL OSRM ROUTE */}
|
||||
|
||||
@@ -80,6 +80,7 @@ import dayjs from 'dayjs';
|
||||
import { OpenToast } from 'components/third-party/OpenToast';
|
||||
import TableLoader from 'components/nearle_components/TableLoader';
|
||||
import { MobileCard, MobileCardList, MobileField, MobileFieldGrid } from 'components/nearle_components/MobileCard';
|
||||
import { parseDoormileTimestamp } from 'utils/doormileTimestamp';
|
||||
var utc = require('dayjs/plugin/utc');
|
||||
dayjs.extend(utc);
|
||||
|
||||
@@ -448,7 +449,10 @@ export default function OrdersDetails() {
|
||||
} = useQuery({
|
||||
queryKey: ['tenantlist', appId],
|
||||
queryFn: () => getTenants(appId),
|
||||
enabled: appId !== 0
|
||||
// appId 0 is a real, deliberate choice — the synthetic "All" zone option
|
||||
// (fetchAppLocations in api.js) — not "nothing picked yet"; only
|
||||
// null/undefined means that now. See LocationAutocomplete.js's onChange.
|
||||
enabled: appId != null
|
||||
});
|
||||
|
||||
const {
|
||||
@@ -459,7 +463,7 @@ export default function OrdersDetails() {
|
||||
} = useQuery({
|
||||
queryKey: ['fetchRidersList', appId],
|
||||
queryFn: fetchRidersList,
|
||||
enabled: appId !== 0
|
||||
enabled: appId != null
|
||||
});
|
||||
|
||||
const {
|
||||
@@ -627,7 +631,7 @@ export default function OrdersDetails() {
|
||||
getOptionLabel={(option) => option?.tenantname || ''}
|
||||
PaperComponent={SoftPaper}
|
||||
onOpen={(event) => {
|
||||
if (!appId) {
|
||||
if (appId == null) {
|
||||
event.preventDefault();
|
||||
OpenToast('Please select a your app location first!', 'warning', 3000);
|
||||
setTimeout(() => {
|
||||
@@ -677,7 +681,7 @@ export default function OrdersDetails() {
|
||||
value={locationValue}
|
||||
PaperComponent={SoftPaper}
|
||||
onOpen={(event) => {
|
||||
if (!appId && !tenantid) {
|
||||
if (appId == null && !tenantid) {
|
||||
event.preventDefault();
|
||||
OpenToast('Please select a your Location and Tenant first!', 'warning', 3000);
|
||||
setTimeout(() => {
|
||||
@@ -731,7 +735,7 @@ export default function OrdersDetails() {
|
||||
}}
|
||||
PaperComponent={SoftPaper}
|
||||
onOpen={() => {
|
||||
if (!appId) {
|
||||
if (appId == null) {
|
||||
OpenToast('Select App Location First', 'warning', 2000);
|
||||
}
|
||||
}}
|
||||
@@ -1105,7 +1109,7 @@ export default function OrdersDetails() {
|
||||
</Box>
|
||||
)}
|
||||
<Typography variant="caption" sx={{ color: DT.textMuted, fontWeight: 600 }}>
|
||||
{dayjs(row.deliverydate).utc().format('DD/MM/YYYY · hh:mm A')}
|
||||
{parseDoormileTimestamp(row.deliverydate).format('DD/MM/YYYY · hh:mm A')}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Stack>
|
||||
@@ -1376,7 +1380,7 @@ export default function OrdersDetails() {
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
<Typography variant="caption" sx={{ color: DT.textMuted }}>
|
||||
{dayjs(row.deliverydate).utc().format('DD/MM/YYYY · hh:mm A')}
|
||||
{parseDoormileTimestamp(row.deliverydate).format('DD/MM/YYYY · hh:mm A')}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Box, Paper, TextField, Typography } from '@mui/material';
|
||||
import { MdCalendarMonth } from 'react-icons/md';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { parseDoormileTimestamp } from 'utils/doormileTimestamp';
|
||||
|
||||
import { fetchDeliveries } from 'pages/api/api';
|
||||
import Loader from 'components/Loader';
|
||||
@@ -111,10 +112,12 @@ const Profitability = () => {
|
||||
rider.orders.forEach((o) => {
|
||||
const status = String(o.orderstatus || '').toLowerCase();
|
||||
if (SKIPPED_STATUSES.has(status)) return;
|
||||
// parseDoormileTimestamp (not bare dayjs()) avoids the false-trailing-Z
|
||||
// parse bug (utils/doormileTimestamp.js) — see ProfitabilitySection.js.
|
||||
const dateStr = o.assigntime
|
||||
? dayjs(o.assigntime).format('YYYY-MM-DD')
|
||||
? parseDoormileTimestamp(o.assigntime).format('YYYY-MM-DD')
|
||||
: o.deliverydate
|
||||
? dayjs(o.deliverydate).format('YYYY-MM-DD')
|
||||
? parseDoormileTimestamp(o.deliverydate).format('YYYY-MM-DD')
|
||||
: null;
|
||||
if (dateStr !== selectedDate) return;
|
||||
const km = parseFloat(o.riderkms || 0);
|
||||
|
||||
Reference in New Issue
Block a user