updates on the ui changes and frully removed the mui and converted into astryx and color change

This commit is contained in:
2026-08-13 18:24:04 +05:30
parent 498bb7cbc0
commit 8cd8e34b11
122 changed files with 15111 additions and 22411 deletions

View File

@@ -8,7 +8,7 @@ import {
MdInventory2
} from 'react-icons/md';
import { parseDoormileTimestamp } from 'utils/doormileTimestamp';
import { CircularProgress } from '@mui/material';
import LoaderWithImage from 'components/nearle_components/LoaderWithImage';
import { getStatusStyle, getActiveOrder } from './dispatchShared';
import { OpenToast } from 'components/third-party/OpenToast';
@@ -76,7 +76,7 @@ const ActiveSection = ({
if (isLoading) {
return (
<div className="empty-slot" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', minHeight: '200px' }}>
<CircularProgress size={30} style={{ color: '#7b1fa2', marginBottom: '16px' }} />
<div style={{ marginBottom: 16 }}><LoaderWithImage size={44} imgSize={24} /></div>
<div className="empty-slot-title">Loading active deliveries...</div>
</div>
);

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,7 @@ import logger from '../../../utils/logger';
// emerald for the actual GPS trail (signals "live / real" data). Per-step
// distinction in Combined view is carried by the numbered drop pins, which
// keep STEP_PALETTE so the timeline link to a specific delivery survives.
const COMBINED_PLANNED_COLOR = '#C01227';
const COMBINED_PLANNED_COLOR = '#000000';
const COMBINED_ACTUAL_COLOR = '#10b981';
const toNum = (v) => {
@@ -121,6 +121,18 @@ const hasValidDrop = (o) => Number.isFinite(toNum(o.droplat || o.deliverylat)) &
const pickupLat = (o) => o.pickuplat || o.pickuplatitude || o.pickup_lat;
const pickupLon = (o) => o.pickuplong || o.pickuplongitude || o.picklongitude || o.pickup_lon;
const hasValidPickup = (o) => Number.isFinite(toNum(pickupLat(o))) && Number.isFinite(toNum(pickupLon(o)));
// Kitchen/pickup-point display name. `pickupcustomer`/`kitchen_key` are the
// narrowest fields and are frequently blank, which used to fall straight
// through to a literal "Unknown" badge on the map even though the order
// carries a perfectly good name in `locationname`/`pickuplocation` (the same
// fields the order popup at `o.pickupcustomer || o.locationname ||
// o.pickuplocation` already trusts, and what orders.js/deliveries.js render
// as the pickup point elsewhere in the app). Checked by every callsite that
// needs a kitchen grouping key or label so they can't drift out of sync with
// each other (a prior copy at line ~4222 checked kitchen_key before
// pickupcustomer, the opposite order of every other copy, which could group
// the same order under two different keys depending on which code path ran).
const pickupName = (o) => o.pickupcustomer || o.kitchen_key || o.locationname || o.pickuplocation || o.pickupsuburb || null;
// Named delivery batches — operator's mental model of the day's waves.
// Each entry covers a half-open range [startHour, endHour) measured in
@@ -282,6 +294,20 @@ function MapAutoResize({ trigger }) {
return null;
}
// Leaflet divIcons are pixel-fixed by design — they don't shrink as the map
// zooms out, so a kitchen badge sized to look right at street level (zoom
// ~13+) reads as oversized once the operator zooms out to see a whole city.
// Reports current zoom up so the kitchen marker size can scale down with it.
function MapZoomTracker({ onZoomChange }) {
const map = useMap();
useEffect(() => {
onZoomChange(map.getZoom());
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [map]);
useMapEvents({ zoomend: (e) => onZoomChange(e.target.getZoom()) });
return null;
}
// haversineKm/polylineLengthKm/kalmanSmoothGps moved to dispatchShared.js so
// deliveries.js's Update Status dialog can compute the same real, GPS-based
// Actual KMs figure instead of leaving that field permanently blank.
@@ -904,6 +930,9 @@ const Dispatch = ({
const [centerPopupOrder, setCenterPopupOrder] = useState(null);
const isControlled = selectedRiderId !== undefined;
const [clock, setClock] = useState('');
// Current map zoom, mirrored from MapZoomTracker — drives the kitchen
// marker's zoom-responsive size (see kitchenIconZoomScale below).
const [mapZoom, setMapZoom] = useState(12);
// Fetch all hubs/locations the logged-in user has access to. The list is
// rendered as a dropdown next to the Dispatch title so the operator can
@@ -1657,7 +1686,7 @@ const Dispatch = ({
const kitchenMap = {};
orders.forEach(o => {
const name = o.pickupcustomer || o.kitchen_key || 'Unknown';
const name = pickupName(o) || 'Unknown';
const key = name.toLowerCase().trim();
if (!kitchenMap[key]) {
kitchenMap[key] = {
@@ -2501,7 +2530,7 @@ const Dispatch = ({
Object.entries(trips).forEach(([tNum, tOrders]) => {
// Filter orders by focused kitchen if active
const filteredTOrders = focusedKitchen
? tOrders.filter(o => (o.pickupcustomer || o.kitchen_key || 'Unknown').toLowerCase().trim() === focusedKitchen.id)
? tOrders.filter(o => (pickupName(o) || 'Unknown').toLowerCase().trim() === focusedKitchen.id)
: tOrders;
if (filteredTOrders.length === 0) return;
@@ -2645,13 +2674,26 @@ const Dispatch = ({
}
};
const createKitchenIcon = (name, focused = false) => L.divIcon({
className: '',
iconSize: focused ? [56, 56] : [46, 46],
iconAnchor: focused ? [28, 28] : [23, 23],
popupAnchor: [0, focused ? -30 : -24],
html: `<div class="kitchen-mark${focused ? ' is-focused' : ''}">${(name || 'K').charAt(0).toUpperCase()}</div>`
});
// divIcons are pixel-fixed and don't shrink with the map's own zoom-out,
// so scale the badge down as the operator zooms out past street level
// (zoom 12 is this map's initial zoom — see the MapContainer below).
// Clamped to 1 at the top so zooming in past the default never grows the
// badge beyond its original design size, and floored at 0.55 so it never
// shrinks past legibility.
const kitchenIconZoomScale = Math.max(0.55, Math.min(1, 1 + (mapZoom - 12) * 0.12));
const createKitchenIcon = (name, focused = false) => {
const base = focused ? 56 : 46;
const size = Math.round(base * kitchenIconZoomScale);
const anchor = Math.round(size / 2);
return L.divIcon({
className: '',
iconSize: [size, size],
iconAnchor: [anchor, anchor],
popupAnchor: [0, -(anchor + 2)],
html: `<div class="kitchen-mark${focused ? ' is-focused' : ''}" style="width:${size}px;height:${size}px;font-size:${Math.max(11, Math.round(size * 0.38))}px">${(name || 'K').charAt(0).toUpperCase()}</div>`
});
};
const getRiderColor = (rid) => riders.find(r => String(r.id) === String(rid))?.color || '#475569';
@@ -3052,7 +3094,7 @@ const Dispatch = ({
Object.entries(trips).forEach(([tNum, tOrders]) => {
// Filter orders by focused kitchen if active
const filteredTOrders = focusedKitchen
? tOrders.filter(o => (o.pickupcustomer || o.kitchen_key || 'Unknown').toLowerCase().trim() === focusedKitchen.id)
? tOrders.filter(o => (pickupName(o) || 'Unknown').toLowerCase().trim() === focusedKitchen.id)
: tOrders;
if (filteredTOrders.length === 0) return;
@@ -4219,7 +4261,7 @@ const Dispatch = ({
</div>
<div className="zone-order-grid">
{displayOrders.map((o, idx) => {
const kitchenKey = (o.kitchen_key || o.pickupcustomer || 'Unknown').toLowerCase().trim();
const kitchenKey = (pickupName(o) || 'Unknown').toLowerCase().trim();
const showTransition = prevKitchenKey !== null && kitchenKey !== prevKitchenKey;
prevKitchenKey = kitchenKey;
const isStopActive = focusedStop && focusedStop.orderid === o.orderid;
@@ -4860,6 +4902,7 @@ const Dispatch = ({
/>
)}
<MapAutoResize trigger={`${sidebarCollapsed}|${compareOpen}|${compareDataCollapsed}`} />
<MapZoomTracker onZoomChange={setMapZoom} />
<MapController focusedItem={compareFocusItem || ((focusedRider || focusedKitchen) && focusedStop) || focusedRider || focusedKitchen || focusedZone} viewMode={viewMode} orders={allViewOrders} kitchens={kitchens} locationKey={selectedAppLocationId} extraPoints={allViewLivePoints} />
{kitchens
.filter(k => Number.isFinite(k.lat) && Number.isFinite(k.lon))
@@ -5501,7 +5544,7 @@ const Dispatch = ({
style={{
boxShadow: 'var(--shadow-lg)',
background: compareOpen
? 'linear-gradient(135deg, #C01227, #D25463)'
? 'linear-gradient(135deg, #000000, #3A3A3A)'
: '#fff',
marginLeft: 8,
color: compareOpen ? '#fff' : undefined
@@ -6100,7 +6143,7 @@ const Dispatch = ({
<div className="da-section">
<div className="da-hero-row">
<div className="da-hero-card">
<div className="da-hero-icon" style={{ background: '#C012271f', color: '#C01227' }}>
<div className="da-hero-icon" style={{ background: '#0000001f', color: '#000000' }}>
<MdOutlineInventory2 />
</div>
<div className="da-hero-value">{analysisFormatNum(fleet.total_orders)}</div>
@@ -6581,7 +6624,7 @@ const Dispatch = ({
<div className="da-pos-modal-title-wrap">
<div
className="da-pos-modal-avatar"
style={{ background: `${riderPositionModal.color || '#C01227'}22`, color: riderPositionModal.color || '#C01227' }}
style={{ background: `${riderPositionModal.color || '#000000'}22`, color: riderPositionModal.color || '#000000' }}
>
<MdTwoWheeler />
</div>