sgerp-frontend-lib 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/constants/timezones.d.ts +7 -2
  2. package/dist/constants/timezones.d.ts.map +1 -1
  3. package/dist/constants/timezones.js +17 -2
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/locales/locale-server.d.ts +1 -1
  8. package/dist/locales/locale-server.d.ts.map +1 -1
  9. package/dist/locales/locale-server.js +5 -0
  10. package/dist/locales/locale.d.ts +1 -1
  11. package/dist/locales/locale.d.ts.map +1 -1
  12. package/dist/locales/locale.js +6 -2
  13. package/dist/locales/locale_en.d.ts.map +1 -1
  14. package/dist/locales/locale_en.js +236 -1
  15. package/dist/locales/locale_id.d.ts +2 -0
  16. package/dist/locales/locale_id.d.ts.map +1 -0
  17. package/dist/locales/locale_id.js +2473 -0
  18. package/dist/locales/locale_ja.d.ts.map +1 -1
  19. package/dist/locales/locale_ja.js +188 -1
  20. package/dist/locales/locale_ms.d.ts.map +1 -1
  21. package/dist/locales/locale_ms.js +60 -1
  22. package/dist/locales/locale_tl.d.ts +2 -0
  23. package/dist/locales/locale_tl.d.ts.map +1 -0
  24. package/dist/locales/locale_tl.js +1122 -0
  25. package/dist/sgerp/collection.d.ts.map +1 -1
  26. package/dist/sgerp/collection.js +18 -4
  27. package/dist/sgerp/domains.d.ts +16 -2
  28. package/dist/sgerp/domains.d.ts.map +1 -1
  29. package/dist/sgerp/domains.js +47 -1
  30. package/dist/sgerp/hooks/use-selection-state.d.ts +37 -0
  31. package/dist/sgerp/hooks/use-selection-state.d.ts.map +1 -0
  32. package/dist/sgerp/hooks/use-selection-state.js +121 -0
  33. package/dist/sgerp/hooks/use-simulation-data.d.ts +105 -0
  34. package/dist/sgerp/hooks/use-simulation-data.d.ts.map +1 -0
  35. package/dist/sgerp/hooks/use-simulation-data.js +146 -0
  36. package/dist/sgerp/hooks/use-simulation-state.d.ts +80 -0
  37. package/dist/sgerp/hooks/use-simulation-state.d.ts.map +1 -0
  38. package/dist/sgerp/hooks/use-simulation-state.js +161 -0
  39. package/dist/sgerp/index.d.ts +10 -3
  40. package/dist/sgerp/index.d.ts.map +1 -1
  41. package/dist/sgerp/index.js +30 -2
  42. package/dist/sgerp/simulation-logic/fetchUtils.d.ts +18 -0
  43. package/dist/sgerp/simulation-logic/fetchUtils.d.ts.map +1 -1
  44. package/dist/sgerp/simulation-logic/fetchUtils.js +196 -0
  45. package/dist/sgerp/simulation-logic/index.d.ts +7 -2
  46. package/dist/sgerp/simulation-logic/index.d.ts.map +1 -1
  47. package/dist/sgerp/simulation-logic/index.js +18 -1
  48. package/dist/sgerp/simulation-logic/liveUpdates.d.ts +102 -0
  49. package/dist/sgerp/simulation-logic/liveUpdates.d.ts.map +1 -0
  50. package/dist/sgerp/simulation-logic/liveUpdates.js +87 -0
  51. package/dist/sgerp/simulation-logic/prepareSimulationData.d.ts +36 -0
  52. package/dist/sgerp/simulation-logic/prepareSimulationData.d.ts.map +1 -0
  53. package/dist/sgerp/simulation-logic/prepareSimulationData.js +34 -0
  54. package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts +7 -1
  55. package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts.map +1 -1
  56. package/dist/sgerp/simulation-logic/routeCalculationUtils.js +81 -0
  57. package/dist/sgerp/simulation-logic/vrpStatsCalculator.d.ts +52 -0
  58. package/dist/sgerp/simulation-logic/vrpStatsCalculator.d.ts.map +1 -0
  59. package/dist/sgerp/simulation-logic/vrpStatsCalculator.js +247 -0
  60. package/dist/sgerp/simulation-logic/vrpStatsUtils.d.ts +17 -0
  61. package/dist/sgerp/simulation-logic/vrpStatsUtils.d.ts.map +1 -0
  62. package/dist/sgerp/simulation-logic/vrpStatsUtils.js +48 -0
  63. package/dist/sgerp/utils/timezone.d.ts +15 -0
  64. package/dist/sgerp/utils/timezone.d.ts.map +1 -0
  65. package/dist/sgerp/utils/timezone.js +19 -0
  66. package/dist/sgerp/vrptoolbox-analyzer.d.ts +39 -0
  67. package/dist/sgerp/vrptoolbox-analyzer.d.ts.map +1 -0
  68. package/dist/sgerp/vrptoolbox-analyzer.js +210 -0
  69. package/dist/vrptoolbox/collection.d.ts +16 -0
  70. package/dist/vrptoolbox/collection.d.ts.map +1 -0
  71. package/dist/vrptoolbox/collection.js +62 -0
  72. package/dist/vrptoolbox/index.d.ts +7 -0
  73. package/dist/vrptoolbox/index.d.ts.map +1 -0
  74. package/dist/vrptoolbox/index.js +24 -0
  75. package/dist/vrptoolbox/types/job.d.ts +46 -0
  76. package/dist/vrptoolbox/types/job.d.ts.map +1 -0
  77. package/dist/vrptoolbox/types/job.js +5 -0
  78. package/dist/vrptoolbox/vrptoolbox-utils.d.ts +133 -0
  79. package/dist/vrptoolbox/vrptoolbox-utils.d.ts.map +1 -0
  80. package/dist/vrptoolbox/vrptoolbox-utils.js +207 -0
  81. package/package.json +9 -4
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ /**
3
+ * Hook for managing simulation page state and derived calculations
4
+ * Extracts business logic from simulation-detail-page component
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.calculateStateDistribution = calculateStateDistribution;
8
+ exports.calculateVehicleStats = calculateVehicleStats;
9
+ exports.calculateShiftStats = calculateShiftStats;
10
+ exports.filterBookingsByState = filterBookingsByState;
11
+ exports.useSimulationState = useSimulationState;
12
+ const react_1 = require("react");
13
+ const booking_1 = require("../types/simulation/booking");
14
+ /**
15
+ * Calculate booking state distribution
16
+ */
17
+ function calculateStateDistribution(bookings) {
18
+ const distribution = {
19
+ unassigned: 0,
20
+ calculating: 0,
21
+ assigned: 0,
22
+ rejected_by_system: 0,
23
+ sent_offer: 0,
24
+ enroute: 0,
25
+ completed: 0,
26
+ cancelled_by_user: 0,
27
+ cancelled_in_calc: 0,
28
+ fail_to_board: 0,
29
+ fail_to_deliver: 0,
30
+ };
31
+ bookings.forEach((booking) => {
32
+ const state = booking.state;
33
+ // Combine unassigned states (not in calculation)
34
+ if ([booking_1.BookingState.NEW, booking_1.BookingState.PREPARED].includes(state)) {
35
+ distribution.unassigned++;
36
+ }
37
+ else if ([booking_1.BookingState.QUEUED, booking_1.BookingState.CALCULATION].includes(state)) {
38
+ distribution.calculating++;
39
+ }
40
+ else if (state && state in distribution) {
41
+ distribution[state]++;
42
+ }
43
+ });
44
+ return distribution;
45
+ }
46
+ /**
47
+ * Calculate per-vehicle booking statistics
48
+ */
49
+ function calculateVehicleStats(bookings) {
50
+ const stats = {};
51
+ bookings.forEach((booking) => {
52
+ if (!booking.vehicle_id)
53
+ return;
54
+ if (!stats[booking.vehicle_id]) {
55
+ stats[booking.vehicle_id] = {
56
+ total: 0,
57
+ completed: 0,
58
+ assigned: 0,
59
+ enroute: 0,
60
+ };
61
+ }
62
+ stats[booking.vehicle_id].total++;
63
+ if (booking.state === booking_1.BookingState.COMPLETED) {
64
+ stats[booking.vehicle_id].completed++;
65
+ }
66
+ else if (booking.state === booking_1.BookingState.ASSIGNED) {
67
+ stats[booking.vehicle_id].assigned++;
68
+ }
69
+ else if (booking.state === booking_1.BookingState.ENROUTE) {
70
+ stats[booking.vehicle_id].enroute++;
71
+ }
72
+ });
73
+ return stats;
74
+ }
75
+ /**
76
+ * Calculate JIT shift statistics
77
+ */
78
+ function calculateShiftStats(bookings, shifts) {
79
+ const stats = {};
80
+ // Group bookings by shift
81
+ const bookingsByShift = new Map();
82
+ bookings.forEach((booking) => {
83
+ const shiftId = booking.shift_id;
84
+ if (!shiftId)
85
+ return;
86
+ if (!bookingsByShift.has(shiftId)) {
87
+ bookingsByShift.set(shiftId, []);
88
+ }
89
+ bookingsByShift.get(shiftId).push(booking);
90
+ });
91
+ // Calculate stats for each shift
92
+ shifts.forEach((shift) => {
93
+ const shiftId = shift.shift_id || String(shift.id);
94
+ const shiftBookings = bookingsByShift.get(shiftId) || [];
95
+ const vehicleIds = new Set();
96
+ const assignedVehicleIds = new Set();
97
+ shiftBookings.forEach((booking) => {
98
+ if (booking.vehicle_id) {
99
+ vehicleIds.add(booking.vehicle_id);
100
+ if (booking.state === 'assigned' || booking.state === 'enroute' || booking.state === 'completed') {
101
+ assignedVehicleIds.add(booking.vehicle_id);
102
+ }
103
+ }
104
+ });
105
+ const bookingCount = shiftBookings.length;
106
+ stats[shiftId] = {
107
+ bookings: bookingCount,
108
+ vehiclesAllocated: vehicleIds.size,
109
+ vehiclesAssigned: assignedVehicleIds.size,
110
+ };
111
+ });
112
+ return stats;
113
+ }
114
+ /**
115
+ * Filter bookings by state
116
+ */
117
+ function filterBookingsByState(bookings, stateFilters) {
118
+ if (stateFilters.length === 0)
119
+ return bookings;
120
+ return bookings.filter((booking) => {
121
+ // Handle "unassigned" as a combined filter (NEW, PREPARED only - not calculating states)
122
+ if (stateFilters.includes('unassigned')) {
123
+ return [booking_1.BookingState.NEW, booking_1.BookingState.PREPARED].includes(booking.state);
124
+ }
125
+ // Handle "calculating" as a combined filter (QUEUED, CALCULATION)
126
+ if (stateFilters.includes('calculating')) {
127
+ return [booking_1.BookingState.QUEUED, booking_1.BookingState.CALCULATION].includes(booking.state);
128
+ }
129
+ return stateFilters.includes(booking.state);
130
+ });
131
+ }
132
+ /**
133
+ * Hook for simulation state calculations
134
+ * Provides memoized state distribution, vehicle stats, and filtered bookings
135
+ */
136
+ function useSimulationState(bookings, vehicles, stateFilters = [], shifts = []) {
137
+ // Calculate booking state distribution
138
+ const stateDistribution = (0, react_1.useMemo)(() => calculateStateDistribution(bookings), [bookings]);
139
+ // Calculate per-vehicle statistics
140
+ const vehicleStats = (0, react_1.useMemo)(() => calculateVehicleStats(bookings), [bookings]);
141
+ // Calculate JIT shift statistics
142
+ const shiftStats = (0, react_1.useMemo)(() => calculateShiftStats(bookings, shifts), [bookings, shifts]);
143
+ // Filter bookings by selected states
144
+ const filteredBookings = (0, react_1.useMemo)(() => filterBookingsByState(bookings, stateFilters), [bookings, stateFilters]);
145
+ // Calculate autoplan statistics
146
+ const autoplanStats = (0, react_1.useMemo)(() => {
147
+ const unassignedCount = stateDistribution.unassigned || 0;
148
+ const totalVehicleCount = vehicles.length;
149
+ return {
150
+ unassignedCount,
151
+ vehicleCount: totalVehicleCount,
152
+ };
153
+ }, [stateDistribution, vehicles]);
154
+ return {
155
+ stateDistribution,
156
+ vehicleStats,
157
+ shiftStats,
158
+ filteredBookings,
159
+ autoplanStats,
160
+ };
161
+ }
@@ -31,6 +31,12 @@ export { BuildingCollection } from './collections/masstransit/building';
31
31
  export { TransitStopSetCollection } from './collections/masstransit/transitstopset';
32
32
  export { useCollection, useSGERP } from './hooks/use-collection';
33
33
  export { useLiveUpdates } from './hooks/use-live-updates';
34
+ export { useSimulationData } from './hooks/use-simulation-data';
35
+ export type { SimulationDataState, UseSimulationDataOptions } from './hooks/use-simulation-data';
36
+ export { useSimulationState, calculateStateDistribution, calculateVehicleStats, calculateShiftStats, filterBookingsByState } from './hooks/use-simulation-state';
37
+ export type { StateDistribution, VehicleStats, ShiftStats } from './hooks/use-simulation-state';
38
+ export { useSelectionState, useRecentChanges } from './hooks/use-selection-state';
39
+ export type { SelectionState } from './hooks/use-selection-state';
34
40
  export { SGERPProvider, useSGERPContext } from './context/sgerp-context';
35
41
  export type { SGERPProviderProps } from './context/sgerp-context';
36
42
  export * from './constants/scheduling-enums';
@@ -89,8 +95,8 @@ export { generateWaypointRouteFromNodes, createVehicleRoutesFromNodes, validateP
89
95
  export type { RouteNode, Waypoint, Waypoint as RouteWaypoint, VehicleRouteData, VehicleRouteData as RouteVehicleRouteData } from './utils/routeUtils';
90
96
  export { buildBookingPayload } from './utils/bookingPayload';
91
97
  export type { BookingPayloadInput } from './utils/bookingPayload';
92
- export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData, createIndexMaps, attachReferences, calculateBoundingBoxCenter, vehicleComplexRearrange, buildVehicleRouteMap, shiftNodeTimestamps, shiftWaypointTimestamps, calculateVehicleRoute, hasRouteChanged, processUnassignResponse, } from './simulation-logic';
93
- export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap, UnassignResponse, ProcessUnassignResult, } from './simulation-logic';
98
+ export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData, fetchVRPToolboxData, createIndexMaps, attachReferences, calculateBoundingBoxCenter, vehicleComplexRearrange, buildVehicleRouteMap, shiftNodeTimestamps, shiftWaypointTimestamps, calculateVehicleRoute, hasRouteChanged, recalculateVehicleRoute, processUnassignResponse, LIVE_UPDATE_INTERVALS, PROCESSOR_LIVE_UPDATE_PARAMS, getVehicleLiveUpdateConfig, getBookingLiveUpdateConfig, getNodeLiveUpdateConfig, getProcessorLiveUpdateConfig, triggerAllSimulationUpdates, processVRPStatistics, calculateFleetStats, formatSeconds, getDistanceFromLatLonInKm, toDisplayDate, } from './simulation-logic';
99
+ export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap, UnassignResponse, ProcessUnassignResult, SimulationLiveUpdatesConfig, SimulationLiveUpdateTriggers, VRPVehicleStats, FleetStats, ProcessedNode, } from './simulation-logic';
94
100
  export { localize, getLocale, setLocale } from '../locales/locale';
95
101
  export type { Language } from '../locales/locale';
96
102
  export { useLocalization } from '../locales/useLocalization';
@@ -99,7 +105,8 @@ export type { StoredConnection } from '../connection-manager';
99
105
  export { getTimezoneOptions } from '../constants/timezones';
100
106
  export { COUNTRIES, POPULAR_COUNTRIES, getLocalizedCountryName } from '../utils/countries';
101
107
  export { cn } from '../utils';
102
- export { SGERP_DOMAINS, DEFAULT_SERVERS } from './domains';
108
+ export { SGERP_DOMAINS, DEFAULT_SERVERS, BACKEND_DETECTION_RULES, detectBackendFromUrl } from './domains';
109
+ export type { BackendEnvironment, OSRMBackend } from './domains';
103
110
  export { FIRST_SOLUTION_STRATEGIES } from './constants/solver-strategies';
104
111
  export type { FirstSolutionStrategy } from './constants/solver-strategies';
105
112
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sgerplib/sgerp/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM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e,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1G,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.routingProfileToEngineSettings = exports.getRoutingEngineLabel = exports.RoutingEngineName = exports.NodeType = exports.BookingState = exports.TransactionCurrency = exports.TransactionProvider = exports.TransactionType = exports.TransactionStatus = exports.PassengerGender = exports.isValidEnumValue = exports.getEnumValues = exports.getEnumLabel = exports.getEnumOptions = exports.useSGERPContext = exports.SGERPProvider = exports.useLiveUpdates = exports.useSGERP = exports.useCollection = exports.TransitStopSetCollection = exports.BuildingCollection = exports.TransitStopCollection = exports.SMSScheduledCollection = exports.MapboxTokenCollection = exports.GeofenceCollection = exports.RoutingProfileCollection = exports.OperationsLocationGroupCollection = exports.OperationsLocationCollection = exports.SimulationProcessorCollection = exports.DatasetCollection = exports.NodeCollection = exports.BookingCollection = exports.VehicleTypeCollection = exports.VehicleCollection = exports.DriverCollection = exports.SimulationCollection = exports.UserCollection = exports.TransactionCollection = exports.TicketCollection = exports.PassengerCollection = exports.PricingCollection = exports.OrganizationProjectCollection = exports.OrganizationCollection = exports.ProjectMemberCollection = exports.ProjectCollection = exports.Collection = exports.APIError = exports.APIClient = exports.SGERPClient = exports.initializeSGERP = void 0;
18
- exports.FIRST_SOLUTION_STRATEGIES = exports.DEFAULT_SERVERS = exports.SGERP_DOMAINS = exports.cn = exports.getLocalizedCountryName = exports.POPULAR_COUNTRIES = exports.COUNTRIES = exports.getTimezoneOptions = exports.ConnectionManager = exports.useLocalization = exports.setLocale = exports.getLocale = exports.localize = exports.processUnassignResponse = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = exports.buildBookingPayload = exports.validatePickupDropoffConstraint = exports.createVehicleRoutesFromNodes = exports.generateWaypointRouteFromNodes = exports.getContrastTextColor = exports.normalizeVehicleColor = exports.getColorFromAgentId = exports.getHSLToRGB = exports.airLeg = exports.Route = exports.Leg = exports.Step = exports.RoutingEngine = exports.OperationsLocationByProjectMapState = exports.OperationsLocationMapState = exports.createVehicleUploadTask = exports.VehicleExportAttemptStatus = exports.VehicleUseOption = exports.VehicleStatus = exports.getDefaultLogisticsApiSettings = void 0;
17
+ exports.TransactionStatus = exports.PassengerGender = exports.isValidEnumValue = exports.getEnumValues = exports.getEnumLabel = exports.getEnumOptions = exports.useSGERPContext = exports.SGERPProvider = exports.useRecentChanges = exports.useSelectionState = exports.filterBookingsByState = exports.calculateShiftStats = exports.calculateVehicleStats = exports.calculateStateDistribution = exports.useSimulationState = exports.useSimulationData = exports.useLiveUpdates = exports.useSGERP = exports.useCollection = exports.TransitStopSetCollection = exports.BuildingCollection = exports.TransitStopCollection = exports.SMSScheduledCollection = exports.MapboxTokenCollection = exports.GeofenceCollection = exports.RoutingProfileCollection = exports.OperationsLocationGroupCollection = exports.OperationsLocationCollection = exports.SimulationProcessorCollection = exports.DatasetCollection = exports.NodeCollection = exports.BookingCollection = exports.VehicleTypeCollection = exports.VehicleCollection = exports.DriverCollection = exports.SimulationCollection = exports.UserCollection = exports.TransactionCollection = exports.TicketCollection = exports.PassengerCollection = exports.PricingCollection = exports.OrganizationProjectCollection = exports.OrganizationCollection = exports.ProjectMemberCollection = exports.ProjectCollection = exports.Collection = exports.APIError = exports.APIClient = exports.SGERPClient = exports.initializeSGERP = void 0;
18
+ exports.getVehicleLiveUpdateConfig = exports.PROCESSOR_LIVE_UPDATE_PARAMS = exports.LIVE_UPDATE_INTERVALS = exports.processUnassignResponse = exports.recalculateVehicleRoute = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchVRPToolboxData = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = exports.buildBookingPayload = exports.validatePickupDropoffConstraint = exports.createVehicleRoutesFromNodes = exports.generateWaypointRouteFromNodes = exports.getContrastTextColor = exports.normalizeVehicleColor = exports.getColorFromAgentId = exports.getHSLToRGB = exports.airLeg = exports.Route = exports.Leg = exports.Step = exports.RoutingEngine = exports.OperationsLocationByProjectMapState = exports.OperationsLocationMapState = exports.createVehicleUploadTask = exports.VehicleExportAttemptStatus = exports.VehicleUseOption = exports.VehicleStatus = exports.getDefaultLogisticsApiSettings = exports.routingProfileToEngineSettings = exports.getRoutingEngineLabel = exports.RoutingEngineName = exports.NodeType = exports.BookingState = exports.TransactionCurrency = exports.TransactionProvider = exports.TransactionType = void 0;
19
+ exports.FIRST_SOLUTION_STRATEGIES = exports.detectBackendFromUrl = exports.BACKEND_DETECTION_RULES = exports.DEFAULT_SERVERS = exports.SGERP_DOMAINS = exports.cn = exports.getLocalizedCountryName = exports.POPULAR_COUNTRIES = exports.COUNTRIES = exports.getTimezoneOptions = exports.ConnectionManager = exports.useLocalization = exports.setLocale = exports.getLocale = exports.localize = exports.toDisplayDate = exports.getDistanceFromLatLonInKm = exports.formatSeconds = exports.calculateFleetStats = exports.processVRPStatistics = exports.triggerAllSimulationUpdates = exports.getProcessorLiveUpdateConfig = exports.getNodeLiveUpdateConfig = exports.getBookingLiveUpdateConfig = void 0;
19
20
  // Main Client
20
21
  var client_1 = require("./client");
21
22
  Object.defineProperty(exports, "initializeSGERP", { enumerable: true, get: function () { return client_1.initializeSGERP; } });
@@ -85,6 +86,17 @@ Object.defineProperty(exports, "useCollection", { enumerable: true, get: functio
85
86
  Object.defineProperty(exports, "useSGERP", { enumerable: true, get: function () { return use_collection_1.useSGERP; } });
86
87
  var use_live_updates_1 = require("./hooks/use-live-updates");
87
88
  Object.defineProperty(exports, "useLiveUpdates", { enumerable: true, get: function () { return use_live_updates_1.useLiveUpdates; } });
89
+ var use_simulation_data_1 = require("./hooks/use-simulation-data");
90
+ Object.defineProperty(exports, "useSimulationData", { enumerable: true, get: function () { return use_simulation_data_1.useSimulationData; } });
91
+ var use_simulation_state_1 = require("./hooks/use-simulation-state");
92
+ Object.defineProperty(exports, "useSimulationState", { enumerable: true, get: function () { return use_simulation_state_1.useSimulationState; } });
93
+ Object.defineProperty(exports, "calculateStateDistribution", { enumerable: true, get: function () { return use_simulation_state_1.calculateStateDistribution; } });
94
+ Object.defineProperty(exports, "calculateVehicleStats", { enumerable: true, get: function () { return use_simulation_state_1.calculateVehicleStats; } });
95
+ Object.defineProperty(exports, "calculateShiftStats", { enumerable: true, get: function () { return use_simulation_state_1.calculateShiftStats; } });
96
+ Object.defineProperty(exports, "filterBookingsByState", { enumerable: true, get: function () { return use_simulation_state_1.filterBookingsByState; } });
97
+ var use_selection_state_1 = require("./hooks/use-selection-state");
98
+ Object.defineProperty(exports, "useSelectionState", { enumerable: true, get: function () { return use_selection_state_1.useSelectionState; } });
99
+ Object.defineProperty(exports, "useRecentChanges", { enumerable: true, get: function () { return use_selection_state_1.useRecentChanges; } });
88
100
  // React Context
89
101
  var sgerp_context_1 = require("./context/sgerp-context");
90
102
  Object.defineProperty(exports, "SGERPProvider", { enumerable: true, get: function () { return sgerp_context_1.SGERPProvider; } });
@@ -155,6 +167,7 @@ Object.defineProperty(exports, "fetchDrivers", { enumerable: true, get: function
155
167
  Object.defineProperty(exports, "fetchDriversByProject", { enumerable: true, get: function () { return simulation_logic_1.fetchDriversByProject; } });
156
168
  Object.defineProperty(exports, "fetchOperationsLocationsByProject", { enumerable: true, get: function () { return simulation_logic_1.fetchOperationsLocationsByProject; } });
157
169
  Object.defineProperty(exports, "fetchSimulationData", { enumerable: true, get: function () { return simulation_logic_1.fetchSimulationData; } });
170
+ Object.defineProperty(exports, "fetchVRPToolboxData", { enumerable: true, get: function () { return simulation_logic_1.fetchVRPToolboxData; } });
158
171
  Object.defineProperty(exports, "createIndexMaps", { enumerable: true, get: function () { return simulation_logic_1.createIndexMaps; } });
159
172
  Object.defineProperty(exports, "attachReferences", { enumerable: true, get: function () { return simulation_logic_1.attachReferences; } });
160
173
  Object.defineProperty(exports, "calculateBoundingBoxCenter", { enumerable: true, get: function () { return simulation_logic_1.calculateBoundingBoxCenter; } });
@@ -164,7 +177,20 @@ Object.defineProperty(exports, "shiftNodeTimestamps", { enumerable: true, get: f
164
177
  Object.defineProperty(exports, "shiftWaypointTimestamps", { enumerable: true, get: function () { return simulation_logic_1.shiftWaypointTimestamps; } });
165
178
  Object.defineProperty(exports, "calculateVehicleRoute", { enumerable: true, get: function () { return simulation_logic_1.calculateVehicleRoute; } });
166
179
  Object.defineProperty(exports, "hasRouteChanged", { enumerable: true, get: function () { return simulation_logic_1.hasRouteChanged; } });
180
+ Object.defineProperty(exports, "recalculateVehicleRoute", { enumerable: true, get: function () { return simulation_logic_1.recalculateVehicleRoute; } });
167
181
  Object.defineProperty(exports, "processUnassignResponse", { enumerable: true, get: function () { return simulation_logic_1.processUnassignResponse; } });
182
+ Object.defineProperty(exports, "LIVE_UPDATE_INTERVALS", { enumerable: true, get: function () { return simulation_logic_1.LIVE_UPDATE_INTERVALS; } });
183
+ Object.defineProperty(exports, "PROCESSOR_LIVE_UPDATE_PARAMS", { enumerable: true, get: function () { return simulation_logic_1.PROCESSOR_LIVE_UPDATE_PARAMS; } });
184
+ Object.defineProperty(exports, "getVehicleLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getVehicleLiveUpdateConfig; } });
185
+ Object.defineProperty(exports, "getBookingLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getBookingLiveUpdateConfig; } });
186
+ Object.defineProperty(exports, "getNodeLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getNodeLiveUpdateConfig; } });
187
+ Object.defineProperty(exports, "getProcessorLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getProcessorLiveUpdateConfig; } });
188
+ Object.defineProperty(exports, "triggerAllSimulationUpdates", { enumerable: true, get: function () { return simulation_logic_1.triggerAllSimulationUpdates; } });
189
+ Object.defineProperty(exports, "processVRPStatistics", { enumerable: true, get: function () { return simulation_logic_1.processVRPStatistics; } });
190
+ Object.defineProperty(exports, "calculateFleetStats", { enumerable: true, get: function () { return simulation_logic_1.calculateFleetStats; } });
191
+ Object.defineProperty(exports, "formatSeconds", { enumerable: true, get: function () { return simulation_logic_1.formatSeconds; } });
192
+ Object.defineProperty(exports, "getDistanceFromLatLonInKm", { enumerable: true, get: function () { return simulation_logic_1.getDistanceFromLatLonInKm; } });
193
+ Object.defineProperty(exports, "toDisplayDate", { enumerable: true, get: function () { return simulation_logic_1.toDisplayDate; } });
168
194
  // Localization
169
195
  var locale_1 = require("../locales/locale");
170
196
  Object.defineProperty(exports, "localize", { enumerable: true, get: function () { return locale_1.localize; } });
@@ -187,5 +213,7 @@ Object.defineProperty(exports, "cn", { enumerable: true, get: function () { retu
187
213
  var domains_1 = require("./domains");
188
214
  Object.defineProperty(exports, "SGERP_DOMAINS", { enumerable: true, get: function () { return domains_1.SGERP_DOMAINS; } });
189
215
  Object.defineProperty(exports, "DEFAULT_SERVERS", { enumerable: true, get: function () { return domains_1.DEFAULT_SERVERS; } });
216
+ Object.defineProperty(exports, "BACKEND_DETECTION_RULES", { enumerable: true, get: function () { return domains_1.BACKEND_DETECTION_RULES; } });
217
+ Object.defineProperty(exports, "detectBackendFromUrl", { enumerable: true, get: function () { return domains_1.detectBackendFromUrl; } });
190
218
  var solver_strategies_1 = require("./constants/solver-strategies");
191
219
  Object.defineProperty(exports, "FIRST_SOLUTION_STRATEGIES", { enumerable: true, get: function () { return solver_strategies_1.FIRST_SOLUTION_STRATEGIES; } });
@@ -66,4 +66,22 @@ export declare function fetchSimulationData(api: SGERPClient, simulationId: numb
66
66
  geofences: Geofence[];
67
67
  mainGeofence: Geofence | null;
68
68
  }>;
69
+ /**
70
+ * Fetch and convert VRPToolbox job data to SGERP simulation format
71
+ * Based on dashviewer's INITIALIZE_VRPTOOLBOX and createStateFromCommuteOffers logic
72
+ *
73
+ * @param vrpServer - VRPToolbox server URL
74
+ * @param taskId - VRPToolbox job/task ID
75
+ * @returns Simulation data in same format as fetchSimulationData
76
+ */
77
+ export declare function fetchVRPToolboxData(vrpServer: string, taskId: string): Promise<{
78
+ vehicles: Vehicle[];
79
+ bookings: Booking[];
80
+ nodes: Node[];
81
+ drivers: Driver[];
82
+ geofences: Geofence[];
83
+ mainGeofence: Geofence | null;
84
+ rawPayload?: unknown;
85
+ rawResult?: unknown;
86
+ }>;
69
87
  //# sourceMappingURL=fetchUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/fetchUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAIjF;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,CASpB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,CAUpB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,OAAO,CAAC,IAAI,EAAE,CAAC,CAQjB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CACh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uB,CAC3C,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,UAAU,GAAG,IAAI,GAC5B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA0B1B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,EAC7B,UAAU,GAAE,UAAU,GAAG,IAAW;;;;;;;GA8BrC;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IACT,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAmOD"}
@@ -9,7 +9,9 @@ exports.fetchOperationsLocationsByProject = fetchOperationsLocationsByProject;
9
9
  exports.fetchGeofences = fetchGeofences;
10
10
  exports.fetchSimulationGeofence = fetchSimulationGeofence;
11
11
  exports.fetchSimulationData = fetchSimulationData;
12
+ exports.fetchVRPToolboxData = fetchVRPToolboxData;
12
13
  const client_1 = require("../api/client");
14
+ const referenceUtils_1 = require("./referenceUtils");
13
15
  /**
14
16
  * Fetch vehicles for a simulation
15
17
  * Uses fetchAll() to get all vehicles regardless of count
@@ -215,6 +217,7 @@ async function fetchSimulationData(api, simulationId, simulation = null) {
215
217
  fetchGeofences(api, vehicles, simulationId),
216
218
  fetchSimulationGeofence(api, simulation)
217
219
  ]);
220
+ (0, referenceUtils_1.attachReferences)(bookings, vehicles, nodes);
218
221
  return {
219
222
  vehicles,
220
223
  bookings,
@@ -224,3 +227,196 @@ async function fetchSimulationData(api, simulationId, simulation = null) {
224
227
  mainGeofence
225
228
  };
226
229
  }
230
+ /**
231
+ * Fetch and convert VRPToolbox job data to SGERP simulation format
232
+ * Based on dashviewer's INITIALIZE_VRPTOOLBOX and createStateFromCommuteOffers logic
233
+ *
234
+ * @param vrpServer - VRPToolbox server URL
235
+ * @param taskId - VRPToolbox job/task ID
236
+ * @returns Simulation data in same format as fetchSimulationData
237
+ */
238
+ async function fetchVRPToolboxData(vrpServer, taskId) {
239
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
240
+ // Fetch VRPToolbox job result with payload
241
+ const url = `${vrpServer}/jobs/${taskId}/result_with_payload`;
242
+ const response = await fetch(url);
243
+ if (!response.ok) {
244
+ throw new Error(`Failed to fetch VRPToolbox data: ${response.statusText}`);
245
+ }
246
+ const data = await response.json();
247
+ const { payload, result } = data;
248
+ console.log('[fetchVRPToolboxData] Raw VRPToolbox data:', {
249
+ payloadNodesCount: (_a = payload.nodes) === null || _a === void 0 ? void 0 : _a.length,
250
+ payloadVehiclesCount: (_b = payload.vehicles) === null || _b === void 0 ? void 0 : _b.length,
251
+ resultVehiclesKeys: Object.keys(result.vehicles || {}),
252
+ resultAssignedBookings: ((_c = result.assigned_bookings) === null || _c === void 0 ? void 0 : _c.length) || 0,
253
+ resultRejectedBookings: ((_d = result.rejected_bookings) === null || _d === void 0 ? void 0 : _d.length) || 0,
254
+ samplePayloadNode: (_e = payload.nodes) === null || _e === void 0 ? void 0 : _e[0],
255
+ sampleResultVehicleNodes: result.vehicles ? Object.values(result.vehicles)[0] : null,
256
+ allPayloadNodeTypes: (_f = payload.nodes) === null || _f === void 0 ? void 0 : _f.map((n) => ({ uid: n.uid, type: n.node_type, booking_uid: n.booking_uid })),
257
+ payloadKeys: Object.keys(payload),
258
+ payloadCalculationParameters: payload.calculation_parameters,
259
+ dataKeys: Object.keys(data)
260
+ });
261
+ // Set default routing engine on vehicles if missing
262
+ const defaultRoutingEngine = (_g = payload.engine_settings) === null || _g === void 0 ? void 0 : _g.routing_engine;
263
+ const vrpVehicles = payload.vehicles.map((vehicle) => (Object.assign(Object.assign({}, vehicle), { routing_engine: vehicle.routing_engine || defaultRoutingEngine })));
264
+ // Build assignedNodesCache from result.vehicles
265
+ const assignedNodesCache = {};
266
+ Object.entries(result.vehicles || {}).forEach(([vehicleAgentId, vehicleNodes]) => {
267
+ vehicleNodes.forEach((node) => {
268
+ assignedNodesCache[node.uid] = Object.assign(Object.assign({}, node), { assigned_vehicle_id: vehicleAgentId, status: 'assigned' });
269
+ });
270
+ });
271
+ // Collect partial route nodes from vehicle.assigned_nodes
272
+ const partialRoutesNodes = [];
273
+ vrpVehicles.forEach((vehicle) => {
274
+ const assignedNodes = vehicle.assigned_nodes || [];
275
+ const completedNodes = vehicle.completed_nodes || [];
276
+ assignedNodes.forEach((vehicleNode) => {
277
+ vehicleNode.id = vehicleNode.uid;
278
+ partialRoutesNodes.push(vehicleNode);
279
+ });
280
+ });
281
+ // Process vehicles to SGERP format
282
+ const vehicles = vrpVehicles.map((vehicle) => (Object.assign(Object.assign({}, vehicle), { id: vehicle.agent_id, simulation_id: taskId, routing_engine_settings: vehicle.routing_engine })));
283
+ // Process nodes to SGERP format
284
+ const nodes = [];
285
+ const included = {};
286
+ payload.nodes.forEach((node) => {
287
+ const processedNode = Object.assign(Object.assign({}, node), { simulation_id: taskId, booking_id: node.booking_uid, id: node.uid });
288
+ if (node.uid in assignedNodesCache) {
289
+ processedNode.scheduled_ts = assignedNodesCache[node.uid].scheduled_ts;
290
+ processedNode.assigned_vehicle_id = assignedNodesCache[node.uid].assigned_vehicle_id;
291
+ processedNode.status = assignedNodesCache[node.uid].status;
292
+ }
293
+ else {
294
+ processedNode.status = 'rejected_by_system';
295
+ processedNode.scheduled_ts = null;
296
+ processedNode.assigned_vehicle_id = null;
297
+ }
298
+ nodes.push(processedNode);
299
+ included[node.uid] = processedNode;
300
+ });
301
+ // Add partial route nodes that weren't in payload.nodes
302
+ partialRoutesNodes.forEach((partialRouteNode) => {
303
+ if (!(partialRouteNode.id in included)) {
304
+ const processedNode = Object.assign(Object.assign({}, partialRouteNode), { simulation_id: taskId });
305
+ if (partialRouteNode.id in assignedNodesCache) {
306
+ processedNode.scheduled_ts = assignedNodesCache[partialRouteNode.id].scheduled_ts;
307
+ processedNode.assigned_vehicle_id = assignedNodesCache[partialRouteNode.id].assigned_vehicle_id;
308
+ processedNode.status = assignedNodesCache[partialRouteNode.id].status;
309
+ }
310
+ else {
311
+ processedNode.scheduled_ts = null;
312
+ processedNode.assigned_vehicle_id = null;
313
+ processedNode.status = 'rejected_by_system';
314
+ }
315
+ nodes.push(processedNode);
316
+ included[partialRouteNode.id] = processedNode;
317
+ }
318
+ });
319
+ // Check if this is CVRP mode (prebook_cvrptw) and find depot/point node
320
+ // CVRP mode detection: check scheduling_mode OR presence of point nodes without pickup nodes
321
+ const schedulingMode = (_h = payload.calculation_parameters) === null || _h === void 0 ? void 0 : _h.scheduling_mode;
322
+ const hasPointNodes = nodes.some((n) => n.node_type === 'point');
323
+ const hasPickupNodes = nodes.some((n) => n.node_type === 'pickup');
324
+ const isCVRP = schedulingMode === 'prebook_cvrptw' || (hasPointNodes && !hasPickupNodes);
325
+ const depotNode = isCVRP ? nodes.find((n) => n.node_type === 'point') : null;
326
+ console.log('[fetchVRPToolboxData] CVRP mode detection:', {
327
+ schedulingMode,
328
+ hasPointNodes,
329
+ hasPickupNodes,
330
+ isCVRP,
331
+ hasDepotNode: !!depotNode,
332
+ depotNodeLocation: depotNode ? { lat: depotNode.lat, lon: depotNode.lon, name: depotNode.location_name } : null
333
+ });
334
+ // Build bookings from nodes (must be done AFTER all nodes are processed)
335
+ const bookingsMap = {};
336
+ const nodeTypeCount = { pickup: 0, dropoff: 0, point: 0, other: 0 };
337
+ nodes.forEach((node) => {
338
+ const nodeType = node.node_type;
339
+ if (nodeType === 'pickup')
340
+ nodeTypeCount.pickup++;
341
+ else if (nodeType === 'dropoff')
342
+ nodeTypeCount.dropoff++;
343
+ else if (nodeType === 'point')
344
+ nodeTypeCount.point++;
345
+ else
346
+ nodeTypeCount.other++;
347
+ if (node.booking_id !== null && node.booking_id !== undefined) {
348
+ if (!(node.booking_id in bookingsMap)) {
349
+ bookingsMap[node.booking_id] = {
350
+ simulation_id: node.simulation_id,
351
+ id: node.booking_id,
352
+ uid: node.booking_id,
353
+ };
354
+ }
355
+ const booking = bookingsMap[node.booking_id];
356
+ // Update booking state from node status
357
+ booking.state = node.status;
358
+ // Set location data based on node type
359
+ booking[`${nodeType}_location_name`] = node.location_name;
360
+ booking[`${nodeType}_location_lat`] = node.lat;
361
+ booking[`${nodeType}_location_lon`] = node.lon;
362
+ booking[`${nodeType}_service_time`] = node.service_time;
363
+ // Set time windows and demand based on node type
364
+ if (nodeType === 'pickup') {
365
+ booking.min_pickup_time = node.open_time_ts;
366
+ booking.demand = node.demand;
367
+ }
368
+ else if (nodeType === 'dropoff') {
369
+ booking.max_dropoff_time = node.close_time_ts;
370
+ // In CVRP mode, set demand from dropoff node (take absolute values since dropoff has negative demand)
371
+ if (isCVRP && node.demand) {
372
+ booking.demand = Object.fromEntries(Object.entries(node.demand).map(([key, value]) => [key, Math.abs(value)]));
373
+ }
374
+ }
375
+ }
376
+ });
377
+ // For CVRP mode: Set all bookings to use depot as pickup location
378
+ if (isCVRP && depotNode) {
379
+ Object.values(bookingsMap).forEach((booking) => {
380
+ booking.pickup_location_lat = depotNode.lat;
381
+ booking.pickup_location_lon = depotNode.lon;
382
+ booking.pickup_location_name = depotNode.location_name || 'Depot';
383
+ booking.pickup_service_time = depotNode.service_time || 0;
384
+ booking.min_pickup_time = depotNode.open_time_ts;
385
+ });
386
+ }
387
+ // Now attach booking_object to each node
388
+ nodes.forEach((node) => {
389
+ if (node.booking_id !== null && node.booking_id !== undefined) {
390
+ node.booking_object = bookingsMap[node.booking_id];
391
+ }
392
+ });
393
+ const bookings = Object.values(bookingsMap);
394
+ console.log('[fetchVRPToolboxData] Result:', {
395
+ vehiclesCount: vehicles.length,
396
+ bookingsCount: bookings.length,
397
+ nodesCount: nodes.length,
398
+ nodeTypeCount,
399
+ sampleBooking: bookings[0],
400
+ sampleBookingKeys: bookings[0] ? Object.keys(bookings[0]) : [],
401
+ sampleBookingId: (_j = bookings[0]) === null || _j === void 0 ? void 0 : _j.id,
402
+ sampleBookingUid: (_k = bookings[0]) === null || _k === void 0 ? void 0 : _k.uid,
403
+ sampleBookingState: (_l = bookings[0]) === null || _l === void 0 ? void 0 : _l.state,
404
+ sampleNode: nodes.find(n => n.booking_id),
405
+ bookingsWithCoordinates: bookings.filter(b => b.pickup_location_lat && b.pickup_location_lon &&
406
+ b.dropoff_location_lat && b.dropoff_location_lon).length,
407
+ bookingsWithPickup: bookings.filter(b => b.pickup_location_lat).length,
408
+ bookingsWithDropoff: bookings.filter(b => b.dropoff_location_lat).length,
409
+ bookingStates: bookings.map(b => b.state).filter((v, i, a) => a.indexOf(v) === i)
410
+ });
411
+ return {
412
+ vehicles,
413
+ bookings,
414
+ nodes,
415
+ drivers: [], // No drivers in VRPToolbox data
416
+ geofences: [], // No geofences in VRPToolbox data
417
+ mainGeofence: null,
418
+ // Also return raw payload and result for analyzer
419
+ rawPayload: payload,
420
+ rawResult: result
421
+ };
422
+ }
@@ -2,13 +2,18 @@
2
2
  * Simulation page logic utilities
3
3
  * Inspired by dashviewer's SimulationPage/logic structure
4
4
  */
5
- export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData } from './fetchUtils';
5
+ export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData, fetchVRPToolboxData } from './fetchUtils';
6
6
  export { createIndexMaps, attachReferences } from './referenceUtils';
7
7
  export { calculateBoundingBoxCenter } from './mapUtils';
8
8
  export { vehicleComplexRearrange, buildVehicleRouteMap } from './manualEditUtils';
9
9
  export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap } from './manualEditUtils';
10
10
  export { shiftNodeTimestamps, shiftWaypointTimestamps } from './timeShiftUtils';
11
- export { calculateVehicleRoute, hasRouteChanged } from './routeCalculationUtils';
11
+ export { calculateVehicleRoute, hasRouteChanged, recalculateVehicleRoute } from './routeCalculationUtils';
12
12
  export { processUnassignResponse } from './optimisticUpdateUtils';
13
13
  export type { UnassignResponse, ProcessUnassignResult } from './optimisticUpdateUtils';
14
+ export { LIVE_UPDATE_INTERVALS, PROCESSOR_LIVE_UPDATE_PARAMS, getVehicleLiveUpdateConfig, getBookingLiveUpdateConfig, getNodeLiveUpdateConfig, getProcessorLiveUpdateConfig, triggerAllSimulationUpdates } from './liveUpdates';
15
+ export type { SimulationLiveUpdatesConfig, SimulationLiveUpdateTriggers } from './liveUpdates';
16
+ export { processVRPStatistics, calculateFleetStats } from './vrpStatsCalculator';
17
+ export type { VRPVehicleStats, FleetStats, ProcessedNode } from './vrpStatsCalculator';
18
+ export { formatSeconds, getDistanceFromLatLonInKm, toDisplayDate } from './vrpStatsUtils';
14
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,iCAAiC,EACjC,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,8BAA8B,EAC9B,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,iCAAiC,EACjC,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,8BAA8B,EAC9B,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,aAAa,EACd,MAAM,iBAAiB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Inspired by dashviewer's SimulationPage/logic structure
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.processUnassignResponse = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = void 0;
7
+ exports.toDisplayDate = exports.getDistanceFromLatLonInKm = exports.formatSeconds = exports.calculateFleetStats = exports.processVRPStatistics = exports.triggerAllSimulationUpdates = exports.getProcessorLiveUpdateConfig = exports.getNodeLiveUpdateConfig = exports.getBookingLiveUpdateConfig = exports.getVehicleLiveUpdateConfig = exports.PROCESSOR_LIVE_UPDATE_PARAMS = exports.LIVE_UPDATE_INTERVALS = exports.processUnassignResponse = exports.recalculateVehicleRoute = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchVRPToolboxData = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = void 0;
8
8
  var fetchUtils_1 = require("./fetchUtils");
9
9
  Object.defineProperty(exports, "fetchVehicles", { enumerable: true, get: function () { return fetchUtils_1.fetchVehicles; } });
10
10
  Object.defineProperty(exports, "fetchBookings", { enumerable: true, get: function () { return fetchUtils_1.fetchBookings; } });
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "fetchDrivers", { enumerable: true, get: function
13
13
  Object.defineProperty(exports, "fetchDriversByProject", { enumerable: true, get: function () { return fetchUtils_1.fetchDriversByProject; } });
14
14
  Object.defineProperty(exports, "fetchOperationsLocationsByProject", { enumerable: true, get: function () { return fetchUtils_1.fetchOperationsLocationsByProject; } });
15
15
  Object.defineProperty(exports, "fetchSimulationData", { enumerable: true, get: function () { return fetchUtils_1.fetchSimulationData; } });
16
+ Object.defineProperty(exports, "fetchVRPToolboxData", { enumerable: true, get: function () { return fetchUtils_1.fetchVRPToolboxData; } });
16
17
  var referenceUtils_1 = require("./referenceUtils");
17
18
  Object.defineProperty(exports, "createIndexMaps", { enumerable: true, get: function () { return referenceUtils_1.createIndexMaps; } });
18
19
  Object.defineProperty(exports, "attachReferences", { enumerable: true, get: function () { return referenceUtils_1.attachReferences; } });
@@ -27,5 +28,21 @@ Object.defineProperty(exports, "shiftWaypointTimestamps", { enumerable: true, ge
27
28
  var routeCalculationUtils_1 = require("./routeCalculationUtils");
28
29
  Object.defineProperty(exports, "calculateVehicleRoute", { enumerable: true, get: function () { return routeCalculationUtils_1.calculateVehicleRoute; } });
29
30
  Object.defineProperty(exports, "hasRouteChanged", { enumerable: true, get: function () { return routeCalculationUtils_1.hasRouteChanged; } });
31
+ Object.defineProperty(exports, "recalculateVehicleRoute", { enumerable: true, get: function () { return routeCalculationUtils_1.recalculateVehicleRoute; } });
30
32
  var optimisticUpdateUtils_1 = require("./optimisticUpdateUtils");
31
33
  Object.defineProperty(exports, "processUnassignResponse", { enumerable: true, get: function () { return optimisticUpdateUtils_1.processUnassignResponse; } });
34
+ var liveUpdates_1 = require("./liveUpdates");
35
+ Object.defineProperty(exports, "LIVE_UPDATE_INTERVALS", { enumerable: true, get: function () { return liveUpdates_1.LIVE_UPDATE_INTERVALS; } });
36
+ Object.defineProperty(exports, "PROCESSOR_LIVE_UPDATE_PARAMS", { enumerable: true, get: function () { return liveUpdates_1.PROCESSOR_LIVE_UPDATE_PARAMS; } });
37
+ Object.defineProperty(exports, "getVehicleLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getVehicleLiveUpdateConfig; } });
38
+ Object.defineProperty(exports, "getBookingLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getBookingLiveUpdateConfig; } });
39
+ Object.defineProperty(exports, "getNodeLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getNodeLiveUpdateConfig; } });
40
+ Object.defineProperty(exports, "getProcessorLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getProcessorLiveUpdateConfig; } });
41
+ Object.defineProperty(exports, "triggerAllSimulationUpdates", { enumerable: true, get: function () { return liveUpdates_1.triggerAllSimulationUpdates; } });
42
+ var vrpStatsCalculator_1 = require("./vrpStatsCalculator");
43
+ Object.defineProperty(exports, "processVRPStatistics", { enumerable: true, get: function () { return vrpStatsCalculator_1.processVRPStatistics; } });
44
+ Object.defineProperty(exports, "calculateFleetStats", { enumerable: true, get: function () { return vrpStatsCalculator_1.calculateFleetStats; } });
45
+ var vrpStatsUtils_1 = require("./vrpStatsUtils");
46
+ Object.defineProperty(exports, "formatSeconds", { enumerable: true, get: function () { return vrpStatsUtils_1.formatSeconds; } });
47
+ Object.defineProperty(exports, "getDistanceFromLatLonInKm", { enumerable: true, get: function () { return vrpStatsUtils_1.getDistanceFromLatLonInKm; } });
48
+ Object.defineProperty(exports, "toDisplayDate", { enumerable: true, get: function () { return vrpStatsUtils_1.toDisplayDate; } });