@fleetbase/fleetops-engine 0.6.51 → 0.6.53
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.
- package/README.md +0 -2
- package/addon/components/cell/telematic-provider.hbs +16 -0
- package/addon/components/cell/telematic-provider.js +36 -0
- package/addon/components/cell/telematic-status.hbs +1 -0
- package/addon/components/cell/telematic-status.js +39 -0
- package/addon/components/device/manager.hbs +5 -6
- package/addon/components/device/manager.js +12 -15
- package/addon/components/driver/details.hbs +1 -1
- package/addon/components/fleet/vehicle-listing.js +1 -0
- package/addon/components/fuel-integration/form.hbs +200 -0
- package/addon/components/fuel-integration/form.js +242 -0
- package/addon/components/fuel-integration/hub.hbs +154 -0
- package/addon/components/fuel-integration/hub.js +165 -0
- package/addon/components/fuel-integration/matching-priority.hbs +76 -0
- package/addon/components/fuel-integration/matching-priority.js +145 -0
- package/addon/components/fuel-report/details.hbs +13 -1
- package/addon/components/issue/details.hbs +3 -57
- package/addon/components/issue/details.js +0 -96
- package/addon/components/layout/fleet-ops-sidebar/operations-monitor.hbs +201 -0
- package/addon/components/layout/fleet-ops-sidebar/operations-monitor.js +589 -0
- package/addon/components/layout/fleet-ops-sidebar.hbs +19 -233
- package/addon/components/layout/fleet-ops-sidebar.js +287 -376
- package/addon/components/maintenance-schedule/form.js +1 -0
- package/addon/components/map/drawer/device-event-listing.hbs +12 -2
- package/addon/components/map/drawer/driver-listing.hbs +14 -1
- package/addon/components/map/drawer/place-listing.hbs +14 -1
- package/addon/components/map/drawer/position-listing.hbs +12 -2
- package/addon/components/map/drawer/vehicle-listing.hbs +14 -1
- package/addon/components/modals/assigned-orders.hbs +40 -0
- package/addon/components/modals/attach-device.hbs +4 -3
- package/addon/components/modals/attach-telematic-device.hbs +25 -0
- package/addon/components/modals/attach-telematic-device.js +3 -0
- package/addon/components/modals/driver-assign-order.hbs +7 -58
- package/addon/components/modals/driver-assign-vehicle.hbs +10 -2
- package/addon/components/modals/fleet-assign-driver.hbs +18 -0
- package/addon/components/modals/fleet-assign-driver.js +3 -0
- package/addon/components/modals/fleet-assign-vehicle.hbs +18 -0
- package/addon/components/modals/fleet-assign-vehicle.js +3 -0
- package/addon/components/modals/telematic-connection-diagnostics.hbs +75 -0
- package/addon/components/modals/telematic-connection-diagnostics.js +287 -0
- package/addon/components/modals/vehicle-details.hbs +6 -1
- package/addon/components/modals/vehicle-form.hbs +8 -1
- package/addon/components/order/card.hbs +106 -0
- package/addon/components/order/card.js +257 -0
- package/addon/components/order/form/payload.js +3 -1
- package/addon/components/order/form/service-rate.hbs +2 -0
- package/addon/components/service-rate/form.hbs +3 -2
- package/addon/components/telematic/details.hbs +98 -87
- package/addon/components/telematic/details.js +230 -1
- package/addon/components/telematic/form.hbs +303 -72
- package/addon/components/telematic/form.js +519 -3
- package/addon/components/telematic/hub.hbs +149 -0
- package/addon/components/telematic/hub.js +142 -0
- package/addon/components/telematic/settings.hbs +152 -0
- package/addon/components/telematic/settings.js +45 -0
- package/addon/components/telematic/tab-empty-state.hbs +29 -0
- package/addon/components/telematic/tab-empty-state.js +33 -0
- package/addon/components/vehicle/details.hbs +6 -1
- package/addon/components/vehicle/form.hbs +2 -1
- package/addon/components/widget/fuel-providers.hbs +43 -0
- package/addon/components/widget/fuel-providers.js +27 -0
- package/addon/controllers/connectivity/devices/index/details.js +27 -1
- package/addon/controllers/connectivity/devices/index.js +18 -1
- package/addon/controllers/connectivity/fuel-providers/details/sync.js +18 -0
- package/addon/controllers/connectivity/fuel-providers/details/transactions.js +24 -0
- package/addon/controllers/connectivity/fuel-providers/details.js +69 -0
- package/addon/controllers/connectivity/fuel-providers/edit.js +24 -0
- package/addon/controllers/connectivity/fuel-providers/index.js +177 -0
- package/addon/controllers/connectivity/fuel-providers/new.js +37 -0
- package/addon/controllers/connectivity/telematics/details/attachments.js +247 -0
- package/addon/controllers/connectivity/telematics/details/devices.js +368 -0
- package/addon/controllers/connectivity/telematics/details/events.js +244 -0
- package/addon/controllers/connectivity/telematics/details/index.js +3 -0
- package/addon/controllers/connectivity/telematics/details/logs.js +43 -0
- package/addon/controllers/connectivity/telematics/details/sensors.js +270 -0
- package/addon/controllers/connectivity/telematics/details.js +149 -0
- package/addon/controllers/connectivity/telematics/{index/edit.js → edit.js} +15 -4
- package/addon/controllers/connectivity/telematics/index.js +25 -5
- package/addon/controllers/connectivity/telematics/{index/new.js → new.js} +8 -2
- package/addon/controllers/maintenance/index.js +100 -0
- package/addon/controllers/management/drivers/index/details.js +78 -1
- package/addon/controllers/management/drivers/index.js +39 -0
- package/addon/controllers/management/fleets/index/details.js +23 -1
- package/addon/controllers/management/fleets/index.js +6 -1
- package/addon/controllers/management/fuel-reports/index.js +37 -1
- package/addon/controllers/management/fuel-transactions/index/details.js +70 -0
- package/addon/controllers/management/fuel-transactions/index.js +240 -0
- package/addon/controllers/management/index.js +88 -0
- package/addon/controllers/management/vehicles/index/details.js +32 -0
- package/addon/controllers/management/vehicles/index.js +26 -0
- package/addon/controllers/operations/orders/index.js +4 -0
- package/addon/controllers/settings/index.js +142 -0
- package/addon/controllers/settings/payments/index.js +5 -0
- package/addon/extension.js +31 -0
- package/addon/routes/analytics/index.js +3 -0
- package/addon/routes/connectivity/devices/index.js +3 -0
- package/addon/routes/connectivity/fuel-providers/details/index.js +7 -0
- package/addon/routes/connectivity/fuel-providers/details/matching.js +7 -0
- package/addon/routes/connectivity/fuel-providers/details/settings.js +7 -0
- package/addon/routes/connectivity/fuel-providers/details/sync.js +18 -0
- package/addon/routes/connectivity/fuel-providers/details/transactions.js +14 -0
- package/addon/routes/connectivity/fuel-providers/details.js +18 -0
- package/addon/routes/connectivity/fuel-providers/edit.js +18 -0
- package/addon/routes/connectivity/fuel-providers/index.js +20 -0
- package/addon/routes/connectivity/fuel-providers/new.js +3 -0
- package/addon/routes/connectivity/fuel-providers.js +3 -0
- package/addon/routes/connectivity/telematics/details/attachments.js +28 -0
- package/addon/routes/connectivity/telematics/details/devices.js +30 -0
- package/addon/routes/connectivity/telematics/details/events.js +33 -0
- package/addon/routes/connectivity/telematics/details/index.js +3 -0
- package/addon/routes/connectivity/telematics/details/logs.js +17 -0
- package/addon/routes/connectivity/telematics/details/sensors.js +29 -0
- package/addon/routes/connectivity/telematics/{index/details.js → details.js} +1 -1
- package/addon/routes/connectivity/telematics/{index/edit.js → edit.js} +1 -1
- package/addon/routes/connectivity/telematics/new.js +3 -0
- package/addon/routes/maintenance/index.js +3 -0
- package/addon/routes/maintenance/work-orders/index.js +2 -0
- package/addon/routes/management/drivers/index/details/activity.js +3 -0
- package/addon/routes/management/fuel-reports/index.js +2 -0
- package/addon/routes/management/fuel-transactions/index/details.js +18 -0
- package/addon/routes/management/fuel-transactions/index.js +21 -0
- package/addon/routes/management/fuel-transactions.js +3 -0
- package/addon/routes/settings/index.js +3 -0
- package/addon/routes.js +28 -9
- package/addon/services/device-actions.js +64 -1
- package/addon/services/device-event-actions.js +12 -1
- package/addon/services/driver-actions.js +147 -11
- package/addon/services/fleet-actions.js +66 -1
- package/addon/services/fuel-integration-actions.js +31 -0
- package/addon/services/issue-actions.js +1 -1
- package/addon/services/telematic-actions.js +9 -3
- package/addon/services/vehicle-actions.js +125 -0
- package/addon/styles/fleetops-engine.css +2237 -162
- package/addon/templates/analytics/index.hbs +14 -0
- package/addon/templates/analytics/reports/index.hbs +19 -1
- package/addon/templates/connectivity/devices/index.hbs +19 -1
- package/addon/templates/connectivity/events/index.hbs +16 -1
- package/addon/templates/connectivity/fuel-providers/details/index.hbs +38 -0
- package/addon/templates/connectivity/fuel-providers/details/matching.hbs +13 -0
- package/addon/templates/connectivity/fuel-providers/details/settings.hbs +11 -0
- package/addon/templates/connectivity/fuel-providers/details/sync.hbs +48 -0
- package/addon/templates/connectivity/fuel-providers/details/transactions.hbs +21 -0
- package/addon/templates/connectivity/fuel-providers/details.hbs +51 -0
- package/addon/templates/connectivity/fuel-providers/edit.hbs +24 -0
- package/addon/templates/connectivity/fuel-providers/index.hbs +12 -0
- package/addon/templates/connectivity/fuel-providers/new.hbs +22 -0
- package/addon/templates/connectivity/fuel-providers.hbs +1 -0
- package/addon/templates/connectivity/sensors/index.hbs +19 -1
- package/addon/templates/connectivity/telematics/details/attachments.hbs +163 -0
- package/addon/templates/connectivity/telematics/details/devices.hbs +88 -0
- package/addon/templates/connectivity/telematics/details/events.hbs +101 -0
- package/addon/templates/connectivity/telematics/{index/details → details}/index.hbs +0 -1
- package/addon/templates/connectivity/telematics/details/logs.hbs +69 -0
- package/addon/templates/connectivity/telematics/details/sensors.hbs +88 -0
- package/addon/templates/connectivity/telematics/details.hbs +53 -0
- package/addon/templates/connectivity/telematics/edit.hbs +27 -0
- package/addon/templates/connectivity/telematics/index.hbs +6 -8
- package/addon/templates/connectivity/telematics/new.hbs +24 -0
- package/addon/templates/maintenance/equipment/index.hbs +19 -1
- package/addon/templates/maintenance/index.hbs +113 -0
- package/addon/templates/maintenance/maintenances/index.hbs +15 -1
- package/addon/templates/maintenance/parts/index.hbs +19 -1
- package/addon/templates/maintenance/schedules/index.hbs +19 -1
- package/addon/templates/maintenance/work-orders/index.hbs +19 -1
- package/addon/templates/management/contacts/customers.hbs +15 -1
- package/addon/templates/management/contacts/index.hbs +19 -1
- package/addon/templates/management/drivers/index/details/activity.hbs +1 -0
- package/addon/templates/management/drivers/index.hbs +19 -1
- package/addon/templates/management/fleets/index.hbs +19 -1
- package/addon/templates/management/fuel-reports/index.hbs +19 -1
- package/addon/templates/management/fuel-transactions/index/details.hbs +73 -0
- package/addon/templates/management/fuel-transactions/index.hbs +58 -0
- package/addon/templates/management/fuel-transactions.hbs +1 -0
- package/addon/templates/management/index.hbs +109 -73
- package/addon/templates/management/issues/index.hbs +19 -1
- package/addon/templates/management/places/index.hbs +19 -1
- package/addon/templates/management/vehicles/index.hbs +19 -1
- package/addon/templates/management/vendors/index.hbs +19 -1
- package/addon/templates/management/vendors/integrated.hbs +13 -1
- package/addon/templates/operations/orders/index.hbs +19 -1
- package/addon/templates/operations/service-rates/index.hbs +19 -1
- package/addon/templates/settings/index.hbs +83 -0
- package/addon/templates/settings/payments/index.hbs +15 -1
- package/addon/templates/settings/routing.hbs +2 -2
- package/addon/utils/fleet-ops-options.js +3 -0
- package/app/components/cell/telematic-provider.js +1 -0
- package/app/components/cell/telematic-status.js +1 -0
- package/app/components/fuel-integration/form.js +1 -0
- package/app/components/fuel-integration/hub.js +1 -0
- package/app/components/fuel-integration/matching-priority.js +1 -0
- package/app/components/modals/assigned-orders.js +1 -0
- package/app/components/modals/attach-telematic-device.js +1 -0
- package/app/components/modals/fleet-assign-driver.js +1 -0
- package/app/components/modals/fleet-assign-vehicle.js +1 -0
- package/app/components/modals/telematic-connection-diagnostics.js +1 -0
- package/app/components/order/card.js +1 -0
- package/app/components/telematic/hub.js +1 -0
- package/app/components/telematic/settings.js +1 -0
- package/app/components/telematic/tab-empty-state.js +1 -0
- package/app/components/widget/fuel-providers.js +1 -0
- package/app/controllers/connectivity/fuel-providers/details/sync.js +1 -0
- package/app/controllers/connectivity/{telematics/index/details/devices.js → fuel-providers/details/transactions.js} +1 -1
- package/app/controllers/connectivity/{telematics/index → fuel-providers}/details.js +1 -1
- package/app/controllers/connectivity/{telematics/index → fuel-providers}/edit.js +1 -1
- package/app/controllers/connectivity/{telematics/index/details → fuel-providers}/index.js +1 -1
- package/app/controllers/connectivity/{telematics/index → fuel-providers}/new.js +1 -1
- package/app/controllers/connectivity/telematics/details/attachments.js +1 -0
- package/app/controllers/connectivity/telematics/details/devices.js +1 -0
- package/app/controllers/connectivity/telematics/details/events.js +1 -0
- package/app/controllers/connectivity/telematics/details/index.js +1 -0
- package/app/controllers/connectivity/telematics/details/logs.js +1 -0
- package/app/controllers/connectivity/telematics/details/sensors.js +1 -0
- package/app/controllers/connectivity/telematics/details.js +1 -0
- package/app/controllers/connectivity/telematics/edit.js +1 -0
- package/app/controllers/connectivity/telematics/new.js +1 -0
- package/app/controllers/maintenance/index.js +1 -0
- package/app/controllers/management/fuel-transactions/index/details.js +1 -0
- package/app/controllers/management/fuel-transactions/index.js +1 -0
- package/app/controllers/management/index.js +1 -0
- package/app/controllers/settings/index.js +1 -0
- package/app/routes/analytics/index.js +1 -0
- package/app/routes/connectivity/{telematics/index → fuel-providers}/details/index.js +1 -1
- package/app/routes/connectivity/{telematics/index/details/events.js → fuel-providers/details/matching.js} +1 -1
- package/app/routes/connectivity/fuel-providers/details/settings.js +1 -0
- package/app/routes/connectivity/fuel-providers/details/sync.js +1 -0
- package/app/routes/connectivity/{telematics/index/details/devices.js → fuel-providers/details/transactions.js} +1 -1
- package/app/routes/connectivity/{telematics/index → fuel-providers}/details.js +1 -1
- package/app/routes/connectivity/{telematics/index → fuel-providers}/edit.js +1 -1
- package/app/routes/connectivity/fuel-providers/index.js +1 -0
- package/app/routes/connectivity/{telematics/index → fuel-providers}/new.js +1 -1
- package/app/routes/connectivity/fuel-providers.js +1 -0
- package/app/routes/connectivity/telematics/details/attachments.js +1 -0
- package/app/routes/connectivity/telematics/details/devices.js +1 -0
- package/app/routes/connectivity/telematics/details/events.js +1 -0
- package/app/routes/connectivity/telematics/details/index.js +1 -0
- package/app/routes/connectivity/telematics/details/logs.js +1 -0
- package/app/routes/connectivity/telematics/details/sensors.js +1 -0
- package/app/routes/connectivity/telematics/details.js +1 -0
- package/app/routes/connectivity/telematics/edit.js +1 -0
- package/app/routes/connectivity/telematics/new.js +1 -0
- package/app/routes/maintenance/index.js +1 -0
- package/app/routes/management/drivers/index/details/activity.js +1 -0
- package/app/routes/management/fuel-transactions/index/details.js +1 -0
- package/app/routes/management/fuel-transactions/index.js +1 -0
- package/app/routes/management/fuel-transactions.js +1 -0
- package/app/routes/settings/index.js +1 -0
- package/app/services/fuel-integration-actions.js +1 -0
- package/app/templates/analytics/index.js +1 -0
- package/app/templates/connectivity/{telematics/index → fuel-providers}/details/index.js +1 -1
- package/app/templates/connectivity/{telematics/index/details/events.js → fuel-providers/details/matching.js} +1 -1
- package/app/templates/connectivity/fuel-providers/details/settings.js +1 -0
- package/app/templates/connectivity/fuel-providers/details/sync.js +1 -0
- package/app/templates/connectivity/{telematics/index/details/devices.js → fuel-providers/details/transactions.js} +1 -1
- package/app/templates/connectivity/{telematics/index → fuel-providers}/details.js +1 -1
- package/app/templates/connectivity/{telematics/index → fuel-providers}/edit.js +1 -1
- package/app/templates/connectivity/fuel-providers/index.js +1 -0
- package/app/templates/connectivity/{telematics/index → fuel-providers}/new.js +1 -1
- package/app/templates/connectivity/fuel-providers.js +1 -0
- package/app/templates/connectivity/telematics/details/attachments.js +1 -0
- package/app/templates/connectivity/telematics/details/devices.js +1 -0
- package/app/templates/connectivity/telematics/details/events.js +1 -0
- package/app/templates/connectivity/telematics/details/index.js +1 -0
- package/app/templates/connectivity/telematics/details/logs.js +1 -0
- package/app/templates/connectivity/telematics/details/sensors.js +1 -0
- package/app/templates/connectivity/telematics/details.js +1 -0
- package/app/templates/connectivity/telematics/edit.js +1 -0
- package/app/templates/connectivity/telematics/new.js +1 -0
- package/app/templates/maintenance/index.js +1 -0
- package/app/templates/management/drivers/index/details/activity.js +1 -0
- package/app/templates/management/fuel-transactions/index/details.js +1 -0
- package/app/templates/management/fuel-transactions/index.js +1 -0
- package/app/templates/management/fuel-transactions.js +1 -0
- package/app/templates/management/index.js +1 -0
- package/app/templates/settings/index.js +1 -0
- package/assets/images/telematics/providers/afaqy.webp +0 -0
- package/assets/images/telematics/providers/default.webp +0 -0
- package/assets/images/telematics/providers/flespi.webp +0 -0
- package/assets/images/telematics/providers/geotab.webp +0 -0
- package/assets/images/telematics/providers/safee.webp +0 -0
- package/assets/images/telematics/providers/samsara.webp +0 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/config/fuel-providers.php +42 -0
- package/server/config/telematics.php +139 -130
- package/server/migrations/2026_06_06_000001_harden_device_events_telematics_contract.php +59 -0
- package/server/migrations/2026_06_08_000001_create_fuel_provider_connections_table.php +37 -0
- package/server/migrations/2026_06_08_000002_create_fuel_provider_transactions_table.php +53 -0
- package/server/migrations/2026_06_08_000003_create_fuel_provider_sync_runs_table.php +40 -0
- package/server/migrations/2026_06_10_000001_add_fuel_card_number_to_vehicles_table.php +25 -0
- package/server/migrations/2026_06_10_000002_add_vehicle_identity_columns_to_fuel_provider_transactions_table.php +39 -0
- package/server/migrations/2026_06_15_000001_normalize_device_attachable_vehicle_morph_types.php +30 -0
- package/server/src/Console/Commands/FixInvalidPolymorphicRelationTypeNamespaces.php +1 -0
- package/server/src/Contracts/FuelProvider.php +30 -0
- package/server/src/Contracts/TelematicProviderDescriptor.php +3 -1
- package/server/src/Events/FuelProviderTransactionImported.php +17 -0
- package/server/src/Events/FuelProviderTransactionMatched.php +17 -0
- package/server/src/Events/FuelProviderTransactionUnmatched.php +17 -0
- package/server/src/Events/FuelReportCreatedFromProvider.php +18 -0
- package/server/src/Http/Controllers/Internal/v1/AnalyticsController.php +6 -0
- package/server/src/Http/Controllers/Internal/v1/DeviceController.php +140 -2
- package/server/src/Http/Controllers/Internal/v1/DeviceEventController.php +44 -0
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +158 -7
- package/server/src/Http/Controllers/Internal/v1/FuelProviderConnectionController.php +124 -0
- package/server/src/Http/Controllers/Internal/v1/FuelProviderSyncRunController.php +10 -0
- package/server/src/Http/Controllers/Internal/v1/FuelProviderTransactionController.php +76 -0
- package/server/src/Http/Controllers/Internal/v1/HubController.php +300 -0
- package/server/src/Http/Controllers/Internal/v1/SearchController.php +506 -0
- package/server/src/Http/Controllers/Internal/v1/SensorController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/TelematicController.php +179 -16
- package/server/src/Http/Controllers/Internal/v1/VehicleController.php +249 -0
- package/server/src/Http/Controllers/TelematicWebhookController.php +103 -19
- package/server/src/Http/Filter/DeviceFilter.php +74 -0
- package/server/src/Http/Filter/DriverFilter.php +6 -0
- package/server/src/Http/Filter/FuelProviderConnectionFilter.php +33 -0
- package/server/src/Http/Filter/FuelProviderSyncRunFilter.php +28 -0
- package/server/src/Http/Filter/FuelProviderTransactionFilter.php +59 -0
- package/server/src/Http/Filter/FuelReportFilter.php +10 -0
- package/server/src/Http/Filter/VehicleFilter.php +6 -0
- package/server/src/Http/Resources/v1/Driver.php +15 -0
- package/server/src/Http/Resources/v1/FuelProviderConnection.php +30 -0
- package/server/src/Http/Resources/v1/FuelProviderSyncRun.php +36 -0
- package/server/src/Http/Resources/v1/FuelProviderTransaction.php +54 -0
- package/server/src/Http/Resources/v1/FuelReport.php +28 -22
- package/server/src/Http/Resources/v1/Index/Driver.php +26 -20
- package/server/src/Http/Resources/v1/Index/Vehicle.php +29 -22
- package/server/src/Http/Resources/v1/Vehicle.php +17 -0
- package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +2 -0
- package/server/src/Jobs/SyncFuelProviderTransactionsJob.php +57 -0
- package/server/src/Jobs/SyncTelematicDevicesJob.php +105 -17
- package/server/src/Jobs/TestTelematicConnectionJob.php +9 -22
- package/server/src/Models/Asset.php +2 -1
- package/server/src/Models/Contact.php +2 -1
- package/server/src/Models/Device.php +27 -4
- package/server/src/Models/DeviceEvent.php +40 -3
- package/server/src/Models/Driver.php +3 -2
- package/server/src/Models/Equipment.php +2 -1
- package/server/src/Models/Fleet.php +2 -1
- package/server/src/Models/FuelProviderConnection.php +60 -0
- package/server/src/Models/FuelProviderSyncRun.php +58 -0
- package/server/src/Models/FuelProviderTransaction.php +119 -0
- package/server/src/Models/FuelReport.php +16 -1
- package/server/src/Models/Part.php +2 -1
- package/server/src/Models/Sensor.php +21 -4
- package/server/src/Models/ServiceRate.php +39 -2
- package/server/src/Models/Vehicle.php +14 -2
- package/server/src/Models/Vendor.php +2 -1
- package/server/src/Providers/FleetOpsServiceProvider.php +20 -0
- package/server/src/Support/Analytics/FuelProviderSummary.php +42 -0
- package/server/src/Support/FuelProviders/FuelProviderDescriptor.php +55 -0
- package/server/src/Support/FuelProviders/FuelProviderRegistry.php +75 -0
- package/server/src/Support/FuelProviders/FuelProviderService.php +447 -0
- package/server/src/Support/FuelProviders/Providers/AbstractFuelProvider.php +98 -0
- package/server/src/Support/FuelProviders/Providers/PetroAppFuelProvider.php +167 -0
- package/server/src/Support/Telematics/Providers/AbstractProvider.php +27 -6
- package/server/src/Support/Telematics/Providers/AfaqyProvider.php +105 -38
- package/server/src/Support/Telematics/Providers/FlespiProvider.php +1 -0
- package/server/src/Support/Telematics/Providers/GeotabProvider.php +1 -0
- package/server/src/Support/Telematics/Providers/SafeeProvider.php +32 -22
- package/server/src/Support/Telematics/Providers/SamsaraProvider.php +3 -1
- package/server/src/Support/Telematics/TelematicService.php +340 -21
- package/server/src/routes.php +50 -4
- package/server/tests/FuelProviderRegistryTest.php +416 -0
- package/server/tests/HubRoutesTest.php +62 -0
- package/server/tests/ServiceRateAlgorithmWeightVariablesTest.php +44 -0
- package/server/tests/TelematicsHardeningTest.php +359 -0
- package/server/tests/VehicleDriverAssignmentTest.php +51 -0
- package/translations/ar-ae.yml +23 -1
- package/translations/bg-bg.yaml +72 -0
- package/translations/en-us.yaml +83 -0
- package/translations/es-pa.yaml +72 -0
- package/translations/fr-fr.yaml +72 -0
- package/translations/mn-mn.yaml +72 -0
- package/translations/pt-br.yaml +72 -0
- package/translations/ru-ru.yaml +72 -0
- package/translations/vi-vn.yaml +98 -1
- package/addon/controllers/connectivity/telematics/index/details/devices.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details/events.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details/index.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details/sensors.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details.js +0 -24
- package/addon/routes/connectivity/telematics/index/details/devices.js +0 -3
- package/addon/routes/connectivity/telematics/index/details/events.js +0 -3
- package/addon/routes/connectivity/telematics/index/details/index.js +0 -3
- package/addon/routes/connectivity/telematics/index/details/sensors.js +0 -3
- package/addon/routes/connectivity/telematics/index/new.js +0 -3
- package/addon/templates/connectivity/telematics/index/details/devices.hbs +0 -1
- package/addon/templates/connectivity/telematics/index/details/events.hbs +0 -1
- package/addon/templates/connectivity/telematics/index/details/sensors.hbs +0 -1
- package/addon/templates/connectivity/telematics/index/details.hbs +0 -14
- package/addon/templates/connectivity/telematics/index/edit.hbs +0 -12
- package/addon/templates/connectivity/telematics/index/new.hbs +0 -12
- package/app/controllers/connectivity/telematics/index/details/events.js +0 -1
- package/app/controllers/connectivity/telematics/index/details/sensors.js +0 -1
- package/app/routes/connectivity/telematics/index/details/sensors.js +0 -1
- package/app/templates/connectivity/telematics/index/details/sensors.js +0 -1
|
@@ -41,9 +41,10 @@ class TelematicWebhookController extends Controller
|
|
|
41
41
|
$correlationId = Str::uuid()->toString();
|
|
42
42
|
|
|
43
43
|
Log::info('Webhook received', [
|
|
44
|
-
'correlation_id'
|
|
45
|
-
'provider'
|
|
46
|
-
'
|
|
44
|
+
'correlation_id' => $correlationId,
|
|
45
|
+
'provider' => $providerKey,
|
|
46
|
+
'has_signature' => $request->headers->has('X-Webhook-Signature'),
|
|
47
|
+
'has_idempotency_key' => $request->headers->has('X-Idempotency-Key'),
|
|
47
48
|
]);
|
|
48
49
|
|
|
49
50
|
// Check idempotency
|
|
@@ -60,20 +61,42 @@ class TelematicWebhookController extends Controller
|
|
|
60
61
|
// Get provider
|
|
61
62
|
$provider = $this->registry->resolve($providerKey);
|
|
62
63
|
|
|
63
|
-
// Find telematic for this provider
|
|
64
|
-
|
|
64
|
+
// Find telematic for this provider. Native provider payloads are
|
|
65
|
+
// resolved by provider identifiers first; Fleetbase URL/header ids are
|
|
66
|
+
// optional configuration affordances where provider dashboards allow it.
|
|
67
|
+
$telematicId = $request->query('telematic') ?? $request->query('integration') ?? $request->header('X-Fleetbase-Telematic');
|
|
68
|
+
$signature = $request->header('X-Webhook-Signature');
|
|
69
|
+
$telematic = $this->service->resolveWebhookTelematic($providerKey, $request->all(), $request->headers->all(), $telematicId);
|
|
70
|
+
|
|
71
|
+
if (!$telematic && !$telematicId && $signature) {
|
|
72
|
+
$signatureMatches = Telematic::where('provider', $providerKey)
|
|
73
|
+
->get()
|
|
74
|
+
->filter(fn (Telematic $candidate) => $provider->validateWebhookSignature($request->getContent(), $signature, $this->service->getCredentials($candidate)));
|
|
75
|
+
|
|
76
|
+
if ($signatureMatches->count() === 1) {
|
|
77
|
+
$telematic = $signatureMatches->first();
|
|
78
|
+
} elseif ($signatureMatches->count() > 1) {
|
|
79
|
+
Log::warning('Ambiguous telematic webhook signature match', [
|
|
80
|
+
'correlation_id' => $correlationId,
|
|
81
|
+
'provider' => $providerKey,
|
|
82
|
+
'matches' => $signatureMatches->count(),
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
return response()->json(['error' => 'Ambiguous telematic integration'], 409);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
65
88
|
|
|
66
89
|
if (!$telematic) {
|
|
67
|
-
Log::warning('
|
|
68
|
-
'correlation_id'
|
|
69
|
-
'provider'
|
|
90
|
+
Log::warning('Unable to resolve telematic for provider webhook', [
|
|
91
|
+
'correlation_id' => $correlationId,
|
|
92
|
+
'provider' => $providerKey,
|
|
93
|
+
'has_integration_id' => (bool) $telematicId,
|
|
70
94
|
]);
|
|
71
95
|
|
|
72
|
-
return response()->json(['error' => '
|
|
96
|
+
return response()->json(['error' => 'Unable to resolve telematic integration'], 422);
|
|
73
97
|
}
|
|
74
98
|
|
|
75
99
|
// Validate signature
|
|
76
|
-
$signature = $request->header('X-Webhook-Signature');
|
|
77
100
|
$credentials = $this->service->getCredentials($telematic);
|
|
78
101
|
|
|
79
102
|
if ($signature && !$provider->validateWebhookSignature($request->getContent(), $signature, $credentials)) {
|
|
@@ -87,15 +110,45 @@ class TelematicWebhookController extends Controller
|
|
|
87
110
|
|
|
88
111
|
// Process webhook
|
|
89
112
|
try {
|
|
90
|
-
$result
|
|
113
|
+
$result = $provider->processWebhook($request->all(), $request->headers->all());
|
|
114
|
+
$devices = $result['devices'] ?? [];
|
|
115
|
+
$events = $result['events'] ?? [];
|
|
116
|
+
$sensors = $result['sensors'] ?? [];
|
|
117
|
+
|
|
118
|
+
$devicesByExternalId = [];
|
|
91
119
|
|
|
92
120
|
// Link devices
|
|
93
|
-
foreach ($
|
|
94
|
-
|
|
121
|
+
foreach ($devices as $deviceData) {
|
|
122
|
+
try {
|
|
123
|
+
$device = $this->service->linkDevice($telematic, $deviceData);
|
|
124
|
+
$externalId = $deviceData['external_id'] ?? $deviceData['device_id'] ?? $deviceData['unit_id'] ?? $deviceData['vehicle_id'] ?? $deviceData['imei'] ?? null;
|
|
125
|
+
if ($externalId) {
|
|
126
|
+
$devicesByExternalId[$externalId] = $device;
|
|
127
|
+
}
|
|
128
|
+
} catch (\Illuminate\Validation\ValidationException) {
|
|
129
|
+
Log::warning('Skipping webhook device without provider identity', [
|
|
130
|
+
'correlation_id' => $correlationId,
|
|
131
|
+
'provider' => $providerKey,
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
95
134
|
}
|
|
96
135
|
|
|
97
|
-
|
|
98
|
-
|
|
136
|
+
foreach ($events as $eventData) {
|
|
137
|
+
$externalId = $eventData['device_id'] ?? $eventData['external_id'] ?? $eventData['ident'] ?? $eventData['unit_id'] ?? $eventData['vehicle_id'] ?? $eventData['imei'] ?? null;
|
|
138
|
+
$this->service->storeDeviceEvent($telematic, $eventData, $externalId ? ($devicesByExternalId[$externalId] ?? null) : null);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
foreach ($sensors as $sensorData) {
|
|
142
|
+
try {
|
|
143
|
+
$externalId = $sensorData['device_id'] ?? $sensorData['external_id'] ?? $sensorData['ident'] ?? $sensorData['unit_id'] ?? $sensorData['vehicle_id'] ?? $sensorData['imei'] ?? null;
|
|
144
|
+
$this->service->storeSensor($telematic, $sensorData, $externalId ? ($devicesByExternalId[$externalId] ?? null) : null);
|
|
145
|
+
} catch (\Illuminate\Validation\ValidationException) {
|
|
146
|
+
Log::warning('Skipping webhook sensor without provider or device identity', [
|
|
147
|
+
'correlation_id' => $correlationId,
|
|
148
|
+
'provider' => $providerKey,
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
99
152
|
|
|
100
153
|
// Mark as processed
|
|
101
154
|
if ($idempotencyKey) {
|
|
@@ -104,8 +157,9 @@ class TelematicWebhookController extends Controller
|
|
|
104
157
|
|
|
105
158
|
Log::info('Webhook processed successfully', [
|
|
106
159
|
'correlation_id' => $correlationId,
|
|
107
|
-
'devices_count' => count($
|
|
108
|
-
'events_count' => count($
|
|
160
|
+
'devices_count' => count($devices),
|
|
161
|
+
'events_count' => count($events),
|
|
162
|
+
'sensors_count' => count($sensors),
|
|
109
163
|
]);
|
|
110
164
|
|
|
111
165
|
return response()->json(['status' => 'processed'], 200);
|
|
@@ -124,7 +178,7 @@ class TelematicWebhookController extends Controller
|
|
|
124
178
|
*/
|
|
125
179
|
public function ingest(Request $request, string $id): JsonResponse
|
|
126
180
|
{
|
|
127
|
-
$telematic = Telematic::where('
|
|
181
|
+
$telematic = Telematic::where('public_id', $id)->orWhere('uuid', $id)->firstOrFail();
|
|
128
182
|
$correlationId = Str::uuid()->toString();
|
|
129
183
|
|
|
130
184
|
Log::info('Custom ingest received', [
|
|
@@ -139,10 +193,38 @@ class TelematicWebhookController extends Controller
|
|
|
139
193
|
}
|
|
140
194
|
|
|
141
195
|
try {
|
|
196
|
+
$devicesByExternalId = [];
|
|
197
|
+
|
|
142
198
|
// Process devices
|
|
143
199
|
if ($request->has('devices')) {
|
|
144
200
|
foreach ($request->input('devices') as $deviceData) {
|
|
145
|
-
|
|
201
|
+
try {
|
|
202
|
+
$device = $this->service->linkDevice($telematic, $deviceData);
|
|
203
|
+
$externalId = $deviceData['external_id'] ?? $deviceData['device_id'] ?? $deviceData['unit_id'] ?? $deviceData['vehicle_id'] ?? $deviceData['imei'] ?? null;
|
|
204
|
+
if ($externalId) {
|
|
205
|
+
$devicesByExternalId[$externalId] = $device;
|
|
206
|
+
}
|
|
207
|
+
} catch (\Illuminate\Validation\ValidationException) {
|
|
208
|
+
Log::warning('Skipping custom ingest device without provider identity', [
|
|
209
|
+
'correlation_id' => $correlationId,
|
|
210
|
+
]);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
foreach ($request->input('events', []) as $eventData) {
|
|
216
|
+
$externalId = $eventData['device_id'] ?? $eventData['external_id'] ?? $eventData['ident'] ?? $eventData['unit_id'] ?? $eventData['vehicle_id'] ?? $eventData['imei'] ?? null;
|
|
217
|
+
$this->service->storeDeviceEvent($telematic, $eventData, $externalId ? ($devicesByExternalId[$externalId] ?? null) : null);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
foreach ($request->input('sensors', []) as $sensorData) {
|
|
221
|
+
try {
|
|
222
|
+
$externalId = $sensorData['device_id'] ?? $sensorData['external_id'] ?? $sensorData['ident'] ?? $sensorData['unit_id'] ?? $sensorData['vehicle_id'] ?? $sensorData['imei'] ?? null;
|
|
223
|
+
$this->service->storeSensor($telematic, $sensorData, $externalId ? ($devicesByExternalId[$externalId] ?? null) : null);
|
|
224
|
+
} catch (\Illuminate\Validation\ValidationException) {
|
|
225
|
+
Log::warning('Skipping custom ingest sensor without provider or device identity', [
|
|
226
|
+
'correlation_id' => $correlationId,
|
|
227
|
+
]);
|
|
146
228
|
}
|
|
147
229
|
}
|
|
148
230
|
|
|
@@ -154,6 +236,8 @@ class TelematicWebhookController extends Controller
|
|
|
154
236
|
Log::info('Custom ingest processed', [
|
|
155
237
|
'correlation_id' => $correlationId,
|
|
156
238
|
'devices_count' => count($request->input('devices', [])),
|
|
239
|
+
'events_count' => count($request->input('events', [])),
|
|
240
|
+
'sensors_count' => count($request->input('sensors', [])),
|
|
157
241
|
]);
|
|
158
242
|
|
|
159
243
|
return response()->json(['status' => 'ingested'], 200);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Filter;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Filter\Filter;
|
|
7
|
+
|
|
8
|
+
class DeviceFilter extends Filter
|
|
9
|
+
{
|
|
10
|
+
public function queryForInternal()
|
|
11
|
+
{
|
|
12
|
+
$this->builder->where('company_uuid', $this->session->get('company'));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public function queryForPublic()
|
|
16
|
+
{
|
|
17
|
+
$this->queryForInternal();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public function query(?string $searchQuery)
|
|
21
|
+
{
|
|
22
|
+
$this->builder->search($searchQuery);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public function status(string|array $status)
|
|
26
|
+
{
|
|
27
|
+
$status = Utils::arrayFrom($status);
|
|
28
|
+
|
|
29
|
+
if ($status) {
|
|
30
|
+
$this->builder->whereIn('status', $status);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public function telematic(?string $telematic)
|
|
35
|
+
{
|
|
36
|
+
$this->builder->where('telematic_uuid', $telematic);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public function telematicUuid(?string $telematic)
|
|
40
|
+
{
|
|
41
|
+
$this->telematic($telematic);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public function provider(?string $provider)
|
|
45
|
+
{
|
|
46
|
+
$this->builder->where('provider', $provider);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public function warrantyUuid(?string $warranty)
|
|
50
|
+
{
|
|
51
|
+
$this->builder->where('warranty_uuid', $warranty);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public function attachableType(?string $attachableType)
|
|
55
|
+
{
|
|
56
|
+
$this->builder->where('attachable_type', $attachableType);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public function attachableUuid(?string $attachable)
|
|
60
|
+
{
|
|
61
|
+
$this->builder->where('attachable_uuid', $attachable);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public function attachmentState(?string $attachmentState)
|
|
65
|
+
{
|
|
66
|
+
if ($attachmentState === 'attached') {
|
|
67
|
+
$this->builder->whereNotNull('attachable_uuid');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ($attachmentState === 'unattached') {
|
|
71
|
+
$this->builder->whereNull('attachable_uuid');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -70,6 +70,12 @@ class DriverFilter extends Filter
|
|
|
70
70
|
|
|
71
71
|
public function vehicle(string $vehicle)
|
|
72
72
|
{
|
|
73
|
+
if ($vehicle === 'unassigned') {
|
|
74
|
+
$this->builder->whereNull('vehicle_uuid');
|
|
75
|
+
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
if (Str::isUuid($vehicle)) {
|
|
74
80
|
$this->builder->where('vehicle_uuid', $vehicle);
|
|
75
81
|
} else {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Filter;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Filter\Filter;
|
|
6
|
+
|
|
7
|
+
class FuelProviderConnectionFilter extends Filter
|
|
8
|
+
{
|
|
9
|
+
public function queryForInternal()
|
|
10
|
+
{
|
|
11
|
+
$this->builder->where('company_uuid', $this->session->get('company'));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public function query(?string $searchQuery)
|
|
15
|
+
{
|
|
16
|
+
$this->builder->search($searchQuery);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public function provider(?string $provider)
|
|
20
|
+
{
|
|
21
|
+
$this->builder->where('provider', $provider);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public function status(?string $status)
|
|
25
|
+
{
|
|
26
|
+
$this->builder->where('status', $status);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public function environment(?string $environment)
|
|
30
|
+
{
|
|
31
|
+
$this->builder->where('environment', $environment);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Filter;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Filter\Filter;
|
|
6
|
+
|
|
7
|
+
class FuelProviderSyncRunFilter extends Filter
|
|
8
|
+
{
|
|
9
|
+
public function queryForInternal()
|
|
10
|
+
{
|
|
11
|
+
$this->builder->where('company_uuid', $this->session->get('company'));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public function provider(?string $provider)
|
|
15
|
+
{
|
|
16
|
+
$this->builder->where('provider', $provider);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public function status(?string $status)
|
|
20
|
+
{
|
|
21
|
+
$this->builder->where('status', $status);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public function connection(?string $connection)
|
|
25
|
+
{
|
|
26
|
+
$this->builder->where('fuel_provider_connection_uuid', $connection);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Filter;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
6
|
+
use Fleetbase\Http\Filter\Filter;
|
|
7
|
+
use Illuminate\Support\Str;
|
|
8
|
+
|
|
9
|
+
class FuelProviderTransactionFilter extends Filter
|
|
10
|
+
{
|
|
11
|
+
public function queryForInternal()
|
|
12
|
+
{
|
|
13
|
+
$this->builder->where('company_uuid', $this->session->get('company'));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public function query(?string $searchQuery)
|
|
17
|
+
{
|
|
18
|
+
$this->builder->search($searchQuery);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public function provider(?string $provider)
|
|
22
|
+
{
|
|
23
|
+
$this->builder->where('provider', $provider);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public function syncStatus($status)
|
|
27
|
+
{
|
|
28
|
+
if (Str::contains($status, ',')) {
|
|
29
|
+
$status = explode(',', $status);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (is_array($status)) {
|
|
33
|
+
$this->builder->whereIn('sync_status', $status);
|
|
34
|
+
} else {
|
|
35
|
+
$this->builder->where('sync_status', $status);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public function vehicle(?string $vehicle)
|
|
40
|
+
{
|
|
41
|
+
$this->builder->where('vehicle_uuid', $vehicle);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public function connection(?string $connection)
|
|
45
|
+
{
|
|
46
|
+
$this->builder->where('fuel_provider_connection_uuid', $connection);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public function transactionAt($transactionAt)
|
|
50
|
+
{
|
|
51
|
+
$transactionAt = Utils::dateRange($transactionAt);
|
|
52
|
+
|
|
53
|
+
if (is_array($transactionAt)) {
|
|
54
|
+
$this->builder->whereBetween('transaction_at', $transactionAt);
|
|
55
|
+
} else {
|
|
56
|
+
$this->builder->whereDate('transaction_at', $transactionAt);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -111,4 +111,14 @@ class FuelReportFilter extends Filter
|
|
|
111
111
|
$this->builder->where('status', $status);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
public function source(?string $source)
|
|
116
|
+
{
|
|
117
|
+
$this->builder->where('meta->source', $source);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public function provider(?string $provider)
|
|
121
|
+
{
|
|
122
|
+
$this->builder->where('meta->provider', $provider);
|
|
123
|
+
}
|
|
114
124
|
}
|
|
@@ -59,6 +59,12 @@ class VehicleFilter extends Filter
|
|
|
59
59
|
|
|
60
60
|
public function driver(?string $driverId)
|
|
61
61
|
{
|
|
62
|
+
if ($driverId === 'unassigned') {
|
|
63
|
+
$this->builder->whereDoesntHave('driver');
|
|
64
|
+
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
$this->builder->whereHas(
|
|
63
69
|
'driver',
|
|
64
70
|
function ($query) use ($driverId) {
|
|
@@ -45,6 +45,8 @@ class Driver extends FleetbaseResource
|
|
|
45
45
|
'vehicle_name' => $this->when(Http::isInternalRequest(), $this->vehicle_name),
|
|
46
46
|
'vehicle_avatar' => $this->vehicle_avatar,
|
|
47
47
|
'vendor_name' => $this->when(Http::isInternalRequest(), $this->vendor_name),
|
|
48
|
+
'assigned_orders_count' => $this->when(Http::isInternalRequest(), $this->assignedOrdersCount()),
|
|
49
|
+
'current_order_reference' => $this->when(Http::isInternalRequest(), $this->currentOrderReference()),
|
|
48
50
|
'vehicle' => $this->whenLoaded('vehicle', fn () => new VehicleWithoutDriver($this->vehicle)),
|
|
49
51
|
'current_job' => $this->whenLoaded('currentJob', fn () => new Order($this->currentJob)),
|
|
50
52
|
'current_job_id' => $this->when(Http::isInternalRequest(), data_get($this, 'currentJob.tracking')),
|
|
@@ -68,6 +70,19 @@ class Driver extends FleetbaseResource
|
|
|
68
70
|
]);
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
protected function assignedOrdersCount(): int
|
|
74
|
+
{
|
|
75
|
+
return $this->orders()->count();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
protected function currentOrderReference(): ?string
|
|
79
|
+
{
|
|
80
|
+
$this->loadMissing('currentOrder');
|
|
81
|
+
$order = data_get($this, 'currentOrder');
|
|
82
|
+
|
|
83
|
+
return data_get($order, 'tracking') ?? data_get($order, 'public_id');
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
public function getJobs(): AnonymousResourceCollection|FleetbaseResourceCollection
|
|
72
87
|
{
|
|
73
88
|
return Order::collection(
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class FuelProviderConnection extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
public function toArray($request)
|
|
11
|
+
{
|
|
12
|
+
return [
|
|
13
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
14
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
15
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
16
|
+
'provider' => $this->provider,
|
|
17
|
+
'name' => $this->name,
|
|
18
|
+
'environment' => $this->environment,
|
|
19
|
+
'status' => $this->status,
|
|
20
|
+
'sync_settings' => $this->sync_settings,
|
|
21
|
+
'last_sync_state' => $this->last_sync_state,
|
|
22
|
+
'last_synced_at' => $this->last_synced_at,
|
|
23
|
+
'last_tested_at' => $this->last_tested_at,
|
|
24
|
+
'last_error' => $this->last_error,
|
|
25
|
+
'meta' => $this->meta,
|
|
26
|
+
'updated_at' => $this->updated_at,
|
|
27
|
+
'created_at' => $this->created_at,
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class FuelProviderSyncRun extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
public function toArray($request)
|
|
11
|
+
{
|
|
12
|
+
return [
|
|
13
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
14
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
15
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
16
|
+
'fuel_provider_connection_uuid' => $this->when(Http::isInternalRequest(), $this->fuel_provider_connection_uuid),
|
|
17
|
+
'provider' => $this->provider,
|
|
18
|
+
'status' => $this->status,
|
|
19
|
+
'from' => $this->from,
|
|
20
|
+
'to' => $this->to,
|
|
21
|
+
'imported' => $this->imported,
|
|
22
|
+
'matched' => $this->matched,
|
|
23
|
+
'unmatched' => $this->unmatched,
|
|
24
|
+
'fuel_reports_created' => $this->fuel_reports_created,
|
|
25
|
+
'liters' => $this->liters,
|
|
26
|
+
'amount' => $this->amount,
|
|
27
|
+
'started_at' => $this->started_at,
|
|
28
|
+
'finished_at' => $this->finished_at,
|
|
29
|
+
'error' => $this->error,
|
|
30
|
+
'summary' => $this->summary,
|
|
31
|
+
'meta' => $this->meta,
|
|
32
|
+
'updated_at' => $this->updated_at,
|
|
33
|
+
'created_at' => $this->created_at,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class FuelProviderTransaction extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
public function toArray($request)
|
|
11
|
+
{
|
|
12
|
+
return [
|
|
13
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
14
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
15
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
16
|
+
'fuel_provider_connection_uuid' => $this->when(Http::isInternalRequest(), $this->fuel_provider_connection_uuid),
|
|
17
|
+
'fuel_report_uuid' => $this->when(Http::isInternalRequest(), $this->fuel_report_uuid),
|
|
18
|
+
'fuel_report_id' => $this->when(Http::isInternalRequest(), $this->fuel_report_id),
|
|
19
|
+
'vehicle_uuid' => $this->when(Http::isInternalRequest(), $this->vehicle_uuid),
|
|
20
|
+
'driver_uuid' => $this->when(Http::isInternalRequest(), $this->driver_uuid),
|
|
21
|
+
'order_uuid' => $this->when(Http::isInternalRequest(), $this->order_uuid),
|
|
22
|
+
'provider' => $this->provider,
|
|
23
|
+
'provider_transaction_id' => $this->provider_transaction_id,
|
|
24
|
+
'provider_vehicle_id' => $this->provider_vehicle_id,
|
|
25
|
+
'vehicle_card_id' => $this->vehicle_card_id,
|
|
26
|
+
'internal_number' => $this->internal_number,
|
|
27
|
+
'structure_number' => $this->structure_number,
|
|
28
|
+
'plate_number' => $this->plate_number,
|
|
29
|
+
'vin' => $this->vin,
|
|
30
|
+
'serial_number' => $this->serial_number,
|
|
31
|
+
'call_sign' => $this->call_sign,
|
|
32
|
+
'trip_number' => $this->trip_number,
|
|
33
|
+
'station_name' => $this->station_name,
|
|
34
|
+
'station_latitude' => $this->station_latitude,
|
|
35
|
+
'station_longitude' => $this->station_longitude,
|
|
36
|
+
'station_location' => $this->station_location,
|
|
37
|
+
'transaction_at' => $this->transaction_at,
|
|
38
|
+
'volume' => $this->volume,
|
|
39
|
+
'metric_unit' => $this->metric_unit,
|
|
40
|
+
'amount' => $this->amount,
|
|
41
|
+
'currency' => $this->currency,
|
|
42
|
+
'odometer' => $this->odometer,
|
|
43
|
+
'sync_status' => $this->sync_status,
|
|
44
|
+
'matched_at' => $this->matched_at,
|
|
45
|
+
'vehicle_name' => $this->when(Http::isInternalRequest(), $this->vehicle_name),
|
|
46
|
+
'driver_name' => $this->when(Http::isInternalRequest(), $this->driver_name),
|
|
47
|
+
'normalized_payload' => $this->when(Http::isInternalRequest(), $this->normalized_payload),
|
|
48
|
+
'raw_payload' => $this->when(Http::isInternalRequest(), $this->raw_payload),
|
|
49
|
+
'meta' => $this->when(Http::isInternalRequest(), $this->meta),
|
|
50
|
+
'updated_at' => $this->updated_at,
|
|
51
|
+
'created_at' => $this->created_at,
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -18,28 +18,32 @@ class FuelReport extends FleetbaseResource
|
|
|
18
18
|
public function toArray($request)
|
|
19
19
|
{
|
|
20
20
|
return $this->withCustomFields([
|
|
21
|
-
'id'
|
|
22
|
-
'uuid'
|
|
23
|
-
'public_id'
|
|
24
|
-
'reported_by_uuid'
|
|
25
|
-
'driver_uuid'
|
|
26
|
-
'vehicle_uuid'
|
|
27
|
-
'reporter_name'
|
|
28
|
-
'driver_name'
|
|
29
|
-
'vehicle_name'
|
|
30
|
-
'reporter'
|
|
31
|
-
'vehicle'
|
|
32
|
-
'driver'
|
|
33
|
-
'odometer'
|
|
34
|
-
'amount'
|
|
35
|
-
'currency'
|
|
36
|
-
'volume'
|
|
37
|
-
'metric_unit'
|
|
38
|
-
'type'
|
|
39
|
-
'status'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
21
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
22
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
23
|
+
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
24
|
+
'reported_by_uuid' => $this->when(Http::isInternalRequest(), $this->reported_by_uuid),
|
|
25
|
+
'driver_uuid' => $this->when(Http::isInternalRequest(), $this->driver_uuid),
|
|
26
|
+
'vehicle_uuid' => $this->when(Http::isInternalRequest(), $this->vehicle_uuid),
|
|
27
|
+
'reporter_name' => $this->when(Http::isInternalRequest(), $this->reporter_name),
|
|
28
|
+
'driver_name' => $this->when(Http::isInternalRequest(), $this->driver_name),
|
|
29
|
+
'vehicle_name' => $this->when(Http::isInternalRequest(), $this->vehicle_name),
|
|
30
|
+
'reporter' => $this->whenLoaded('reporter', fn () => $this->reporter),
|
|
31
|
+
'vehicle' => $this->whenLoaded('vehicle', fn () => new Vehicle($this->vehicle)),
|
|
32
|
+
'driver' => $this->whenLoaded('driver', fn () => new Driver($this->driver)),
|
|
33
|
+
'odometer' => $this->odometer,
|
|
34
|
+
'amount' => $this->amount,
|
|
35
|
+
'currency' => $this->currency,
|
|
36
|
+
'volume' => $this->volume,
|
|
37
|
+
'metric_unit' => $this->metric_unit,
|
|
38
|
+
'type' => $this->type,
|
|
39
|
+
'status' => $this->status,
|
|
40
|
+
'source' => $this->when(Http::isInternalRequest(), $this->source),
|
|
41
|
+
'provider' => $this->when(Http::isInternalRequest(), $this->provider),
|
|
42
|
+
'fuel_provider_transaction_uuid' => $this->when(Http::isInternalRequest(), $this->fuel_provider_transaction_uuid),
|
|
43
|
+
'meta' => $this->when(Http::isInternalRequest(), $this->meta),
|
|
44
|
+
'location' => $this->location ?? new Point(0, 0),
|
|
45
|
+
'updated_at' => $this->updated_at,
|
|
46
|
+
'created_at' => $this->created_at,
|
|
43
47
|
]);
|
|
44
48
|
}
|
|
45
49
|
|
|
@@ -63,6 +67,8 @@ class FuelReport extends FleetbaseResource
|
|
|
63
67
|
'metric_unit' => $this->metric_unit,
|
|
64
68
|
'type' => $this->type,
|
|
65
69
|
'status' => $this->status,
|
|
70
|
+
'source' => $this->source,
|
|
71
|
+
'provider' => $this->provider,
|
|
66
72
|
'location' => $this->location ?? new Point(0, 0),
|
|
67
73
|
'updated_at' => $this->updated_at,
|
|
68
74
|
'created_at' => $this->created_at,
|