@fleetbase/fleetops-engine 0.6.65 → 0.6.66
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/RELEASE.md +11 -6
- package/addon/components/ai/create-order-preview.hbs +10 -5
- package/addon/components/asset/pill.hbs +24 -0
- package/addon/components/asset/summary.hbs +1 -0
- package/addon/components/asset-connection/pill.hbs +24 -0
- package/addon/components/asset-connection/summary.hbs +1 -0
- package/addon/components/attachable/pill.hbs +24 -0
- package/addon/components/attachable/summary.hbs +1 -0
- package/addon/components/cell/asset-connection-identity.hbs +1 -0
- package/addon/components/cell/asset-identity.hbs +1 -0
- package/addon/components/cell/attachable-identity.hbs +1 -0
- package/addon/components/cell/contact-identity.hbs +1 -0
- package/addon/components/cell/customer-identity.hbs +1 -0
- package/addon/components/cell/device-event-identity.hbs +1 -0
- package/addon/components/cell/device-identity.hbs +1 -24
- package/addon/components/cell/driver-identity.hbs +1 -33
- package/addon/components/cell/entity-identity.hbs +1 -0
- package/addon/components/cell/equipment-identity.hbs +1 -5
- package/addon/components/cell/facilitator-identity.hbs +1 -0
- package/addon/components/cell/fleet-driver-identity.hbs +1 -0
- package/addon/components/cell/fleet-identity.hbs +1 -0
- package/addon/components/cell/fuel-provider-connection-identity.hbs +1 -0
- package/addon/components/cell/fuel-provider-transaction-identity.hbs +1 -0
- package/addon/components/cell/fuel-report-identity.hbs +1 -0
- package/addon/components/cell/inspection-form-identity.hbs +1 -0
- package/addon/components/cell/inspection-item-result-identity.hbs +1 -0
- package/addon/components/cell/inspection-submission-identity.hbs +1 -0
- package/addon/components/cell/integrated-vendor-identity.hbs +1 -0
- package/addon/components/cell/issue-identity.hbs +1 -0
- package/addon/components/cell/maintenance-identity.hbs +1 -0
- package/addon/components/cell/maintenance-schedule-identity.hbs +1 -0
- package/addon/components/cell/maintenance-subject-identity.hbs +1 -0
- package/addon/components/cell/manifest-identity.hbs +1 -0
- package/addon/components/cell/manifest-stop-identity.hbs +1 -0
- package/addon/components/cell/order-config-identity.hbs +1 -0
- package/addon/components/cell/order-identity.hbs +1 -0
- package/addon/components/cell/part-identity.hbs +1 -5
- package/addon/components/cell/payload-identity.hbs +1 -0
- package/addon/components/cell/place-identity.hbs +1 -0
- package/addon/components/cell/position-identity.hbs +1 -0
- package/addon/components/cell/purchase-rate-identity.hbs +1 -0
- package/addon/components/cell/recurring-order-schedule-identity.hbs +1 -0
- package/addon/components/cell/resource-list.hbs +10 -0
- package/addon/components/cell/resource-list.js +28 -0
- package/addon/components/cell/route-identity.hbs +1 -0
- package/addon/components/cell/sensor-identity.hbs +1 -0
- package/addon/components/cell/service-area-identity.hbs +1 -0
- package/addon/components/cell/service-quote-identity.hbs +1 -0
- package/addon/components/cell/service-quote-item-identity.hbs +1 -0
- package/addon/components/cell/service-rate-fee-identity.hbs +1 -0
- package/addon/components/cell/service-rate-identity.hbs +1 -0
- package/addon/components/cell/service-rate-parcel-fee-identity.hbs +1 -0
- package/addon/components/cell/telematic-identity.hbs +1 -0
- package/addon/components/cell/tracking-number-identity.hbs +1 -0
- package/addon/components/cell/tracking-status-identity.hbs +1 -0
- package/addon/components/cell/trailer-identity.hbs +1 -0
- package/addon/components/cell/vehicle-device-identity.hbs +1 -0
- package/addon/components/cell/vehicle-identity.hbs +1 -33
- package/addon/components/cell/vendor-identity.hbs +1 -0
- package/addon/components/cell/warranty-identity.hbs +1 -0
- package/addon/components/cell/waypoint-identity.hbs +1 -0
- package/addon/components/cell/work-order-identity.hbs +1 -0
- package/addon/components/cell/zone-identity.hbs +1 -0
- package/addon/components/contact/form.hbs +2 -4
- package/addon/components/contact/pill.hbs +24 -0
- package/addon/components/contact/summary.hbs +1 -0
- package/addon/components/customer/create-order-form.hbs +8 -4
- package/addon/components/customer/form.hbs +2 -4
- package/addon/components/customer/order-form.hbs +10 -8
- package/addon/components/customer/pill.hbs +24 -0
- package/addon/components/customer/summary.hbs +1 -0
- package/addon/components/device/details.hbs +3 -1
- package/addon/components/device/form.hbs +4 -13
- package/addon/components/device/panel-header.hbs +3 -2
- package/addon/components/device/panel-header.js +1 -5
- package/addon/components/device/panel-tabs/vehicle.hbs +2 -2
- package/addon/components/device/pill.hbs +24 -16
- package/addon/components/device/summary.hbs +1 -0
- package/addon/components/device/telemetry.hbs +17 -0
- package/addon/components/device/telemetry.js +117 -0
- package/addon/components/device-event/details.hbs +6 -24
- package/addon/components/device-event/pill.hbs +24 -0
- package/addon/components/device-event/summary.hbs +1 -0
- package/addon/components/driver/details.hbs +9 -1
- package/addon/components/driver/form.hbs +6 -18
- package/addon/components/driver/panel-header.hbs +3 -4
- package/addon/components/driver/panel-header.js +8 -1
- package/addon/components/driver/pill.hbs +16 -8
- package/addon/components/driver/summary.hbs +1 -0
- package/addon/components/entity/pill.hbs +24 -0
- package/addon/components/entity/summary.hbs +1 -0
- package/addon/components/equipment/details.hbs +6 -2
- package/addon/components/equipment/form.hbs +10 -4
- package/addon/components/equipment/pill.hbs +24 -20
- package/addon/components/equipment/summary.hbs +1 -0
- package/addon/components/facilitator/pill.hbs +24 -0
- package/addon/components/facilitator/summary.hbs +1 -0
- package/addon/components/fleet/details.hbs +6 -2
- package/addon/components/fleet/driver-listing.hbs +3 -12
- package/addon/components/fleet/form.hbs +8 -4
- package/addon/components/fleet/pill.hbs +24 -0
- package/addon/components/fleet/summary.hbs +1 -0
- package/addon/components/fleet/vehicle-listing.hbs +3 -12
- package/addon/components/fleet-driver/pill.hbs +24 -0
- package/addon/components/fleet-driver/summary.hbs +1 -0
- package/addon/components/fleet-driver-listing.hbs +2 -1
- package/addon/components/fleet-panel/details.hbs +6 -2
- package/addon/components/fleet-panel/driver-listing.hbs +2 -1
- package/addon/components/fleet-panel/vehicle-listing.hbs +2 -1
- package/addon/components/fleet-vehicle-listing.hbs +2 -1
- package/addon/components/fuel-integration/form.hbs +125 -25
- package/addon/components/fuel-integration/form.js +74 -19
- package/addon/components/fuel-integration/hub.hbs +68 -65
- package/addon/components/fuel-integration/hub.js +15 -19
- package/addon/components/fuel-provider-connection/pill.hbs +24 -0
- package/addon/components/fuel-provider-connection/summary.hbs +1 -0
- package/addon/components/fuel-provider-transaction/pill.hbs +24 -0
- package/addon/components/fuel-provider-transaction/summary.hbs +1 -0
- package/addon/components/fuel-report/details.hbs +9 -3
- package/addon/components/fuel-report/form.hbs +6 -3
- package/addon/components/fuel-report/pill.hbs +24 -0
- package/addon/components/fuel-report/summary.hbs +1 -0
- package/addon/components/fuel-transaction-status.hbs +1 -0
- package/addon/components/fuel-transaction-status.js +8 -0
- package/addon/components/geofence-map.hbs +19 -0
- package/addon/components/geofence-map.js +83 -0
- package/addon/components/inspection-field/form.hbs +103 -0
- package/addon/components/inspection-field/form.js +211 -0
- package/addon/components/inspection-field/input.hbs +270 -0
- package/addon/components/inspection-field/input.js +472 -0
- package/addon/components/inspection-field/value.hbs +90 -0
- package/addon/components/inspection-field/value.js +158 -0
- package/addon/components/inspection-flyout.hbs +34 -0
- package/addon/components/inspection-flyout.js +66 -0
- package/addon/components/inspection-form/builder.hbs +88 -0
- package/addon/components/inspection-form/builder.js +211 -0
- package/addon/components/inspection-form/details/submissions.hbs +48 -0
- package/addon/components/inspection-form/details/submissions.js +42 -0
- package/addon/components/inspection-form/details.hbs +97 -0
- package/addon/components/inspection-form/details.js +57 -0
- package/addon/components/inspection-form/form.hbs +93 -0
- package/addon/components/inspection-form/form.js +79 -0
- package/addon/components/inspection-form/pill.hbs +24 -0
- package/addon/components/inspection-form/summary.hbs +1 -0
- package/addon/components/inspection-item-result/pill.hbs +24 -0
- package/addon/components/inspection-item-result/summary.hbs +1 -0
- package/addon/components/inspection-link/list.hbs +94 -0
- package/addon/components/inspection-link/list.js +129 -0
- package/addon/components/inspection-sheet/group.hbs +45 -0
- package/addon/components/inspection-sheet/group.js +75 -0
- package/addon/components/inspection-sheet.hbs +77 -0
- package/addon/components/inspection-sheet.js +152 -0
- package/addon/components/inspection-submission/details.hbs +149 -0
- package/addon/components/inspection-submission/details.js +130 -0
- package/addon/components/inspection-submission/form.hbs +114 -0
- package/addon/components/inspection-submission/form.js +129 -0
- package/addon/components/inspection-submission/photos.hbs +20 -0
- package/addon/components/inspection-submission/photos.js +57 -0
- package/addon/components/inspection-submission/pill.hbs +24 -0
- package/addon/components/inspection-submission/summary.hbs +1 -0
- package/addon/components/integrated-vendor/pill.hbs +24 -0
- package/addon/components/integrated-vendor/summary.hbs +1 -0
- package/addon/components/issue/details.hbs +12 -0
- package/addon/components/issue/details.js +36 -0
- package/addon/components/issue/form.hbs +10 -5
- package/addon/components/issue/pill.hbs +24 -0
- package/addon/components/issue/summary.hbs +1 -0
- package/addon/components/layout/fleet-ops-sidebar.js +14 -3
- package/addon/components/maintenance/details.hbs +9 -3
- package/addon/components/maintenance/form.hbs +22 -3
- package/addon/components/maintenance/form.js +4 -4
- package/addon/components/maintenance/panel-header.hbs +14 -12
- package/addon/components/maintenance/pill.hbs +24 -0
- package/addon/components/maintenance/summary.hbs +1 -0
- package/addon/components/maintenance-schedule/details.hbs +7 -3
- package/addon/components/maintenance-schedule/form.hbs +20 -2
- package/addon/components/maintenance-schedule/form.js +6 -6
- package/addon/components/maintenance-schedule/pill.hbs +24 -0
- package/addon/components/maintenance-schedule/summary.hbs +1 -0
- package/addon/components/maintenance-schedule/work-orders.hbs +39 -0
- package/addon/components/maintenance-schedule/work-orders.js +37 -0
- package/addon/components/maintenance-subject/pill.hbs +24 -0
- package/addon/components/maintenance-subject/summary.hbs +1 -0
- package/addon/components/manifest/pill.hbs +24 -0
- package/addon/components/manifest/summary.hbs +1 -0
- package/addon/components/manifest-stop/pill.hbs +24 -0
- package/addon/components/manifest-stop/summary.hbs +1 -0
- package/addon/components/map/drawer/device-event-listing.hbs +4 -14
- package/addon/components/map/drawer/device-event-listing.js +3 -1
- package/addon/components/map/drawer/driver-listing.js +6 -2
- package/addon/components/map/drawer/position-listing.hbs +2 -16
- package/addon/components/map/drawer/vehicle-listing.js +1 -2
- package/addon/components/modals/add-driver-shift.hbs +2 -1
- package/addon/components/modals/assign-driver.hbs +2 -16
- package/addon/components/modals/attach-device.hbs +2 -1
- package/addon/components/modals/attach-equipment.hbs +2 -4
- package/addon/components/modals/attach-telematic-device.hbs +8 -1
- package/addon/components/modals/attach-trailer.hbs +2 -1
- package/addon/components/modals/bulk-assign-driver.hbs +2 -9
- package/addon/components/modals/bulk-assign-orders.hbs +2 -9
- package/addon/components/modals/driver-assign-order.hbs +2 -6
- package/addon/components/modals/driver-assign-vehicle.hbs +4 -12
- package/addon/components/modals/driver-assign-vehicle.js +30 -0
- package/addon/components/modals/driver-assign-vendor.hbs +2 -1
- package/addon/components/modals/driver-form.hbs +4 -2
- package/addon/components/modals/fleet-assign-driver.hbs +2 -1
- package/addon/components/modals/fleet-assign-vehicle.hbs +2 -1
- package/addon/components/modals/fleet-form.hbs +4 -2
- package/addon/components/modals/fuel-connection-diagnostics.hbs +35 -0
- package/addon/components/modals/fuel-connection-diagnostics.js +87 -0
- package/addon/components/modals/fuel-report-form.hbs +4 -2
- package/addon/components/modals/fuel-transaction-action.hbs +48 -0
- package/addon/components/modals/fuel-transaction-action.js +98 -0
- package/addon/components/modals/group-form.hbs +2 -1
- package/addon/components/modals/inspection-follow-up.hbs +31 -0
- package/addon/components/modals/inspection-follow-up.js +39 -0
- package/addon/components/modals/inspection-link.hbs +100 -0
- package/addon/components/modals/inspection-link.js +83 -0
- package/addon/components/modals/issue-assign.hbs +2 -1
- package/addon/components/modals/issue-from.hbs +8 -4
- package/addon/components/modals/map-layer-form.hbs +2 -1
- package/addon/components/modals/order-assign-driver.hbs +2 -16
- package/addon/components/modals/order-form.hbs +8 -46
- package/addon/components/modals/order-route-form.hbs +8 -4
- package/addon/components/modals/place-assign-vendor.hbs +3 -2
- package/addon/components/modals/place-details.hbs +1 -1
- package/addon/components/modals/point-map.hbs +1 -1
- package/addon/components/modals/radar-notice.hbs +24 -0
- package/addon/components/modals/radar-notice.js +8 -0
- package/addon/components/modals/radar-save-view.hbs +7 -0
- package/addon/components/modals/radar-select-resource.hbs +35 -0
- package/addon/components/modals/radar-send-pin.hbs +20 -0
- package/addon/components/modals/radar-send-pin.js +8 -0
- package/addon/components/modals/select-trailer.hbs +2 -4
- package/addon/components/modals/vehicle-form.hbs +2 -1
- package/addon/components/modals/vendor-form.hbs +2 -3
- package/addon/components/order/details/activity.js +9 -0
- package/addon/components/order/details/detail.hbs +2 -32
- package/addon/components/order/form/details.hbs +10 -48
- package/addon/components/order/form/route.hbs +10 -12
- package/addon/components/order/form/service-rate.hbs +2 -3
- package/addon/components/order/pill.hbs +24 -34
- package/addon/components/order/route-editor.hbs +8 -4
- package/addon/components/order/schedule-card.hbs +2 -1
- package/addon/components/order/summary.hbs +1 -0
- package/addon/components/order-config/pill.hbs +24 -0
- package/addon/components/order-config/summary.hbs +1 -0
- package/addon/components/part/details.hbs +15 -3
- package/addon/components/part/details.js +37 -1
- package/addon/components/part/form.hbs +12 -5
- package/addon/components/part/pill.hbs +24 -0
- package/addon/components/part/summary.hbs +1 -0
- package/addon/components/payload/pill.hbs +24 -0
- package/addon/components/payload/summary.hbs +1 -0
- package/addon/components/place/details.hbs +1 -1
- package/addon/components/place/pill.hbs +24 -0
- package/addon/components/place/summary.hbs +1 -0
- package/addon/components/position/pill.hbs +24 -0
- package/addon/components/position/summary.hbs +1 -0
- package/addon/components/positions-replay.hbs +2 -4
- package/addon/components/public-inspection.hbs +174 -0
- package/addon/components/public-inspection.js +279 -0
- package/addon/components/purchase-rate/pill.hbs +24 -0
- package/addon/components/purchase-rate/summary.hbs +1 -0
- package/addon/components/radar/agenda/entry.hbs +17 -0
- package/addon/components/radar/agenda/entry.js +26 -0
- package/addon/components/radar/agenda/lane.hbs +33 -0
- package/addon/components/radar/agenda/lane.js +80 -0
- package/addon/components/radar/agenda.hbs +69 -0
- package/addon/components/radar/agenda.js +29 -0
- package/addon/components/radar/briefing.hbs +108 -0
- package/addon/components/radar/briefing.js +43 -0
- package/addon/components/radar/bulk-bar.hbs +41 -0
- package/addon/components/radar/bulk-bar.js +32 -0
- package/addon/components/radar/decision-card.hbs +28 -0
- package/addon/components/radar/decision-card.js +7 -0
- package/addon/components/radar/empty-state.hbs +30 -0
- package/addon/components/radar/empty-state.js +27 -0
- package/addon/components/radar/filter-pills.hbs +22 -0
- package/addon/components/radar/filter-pills.js +3 -0
- package/addon/components/radar/handover-card.hbs +62 -0
- package/addon/components/radar/handover-card.js +14 -0
- package/addon/components/radar/header.hbs +28 -0
- package/addon/components/radar/header.js +12 -0
- package/addon/components/radar/item-drawer.hbs +92 -0
- package/addon/components/radar/item-drawer.js +37 -0
- package/addon/components/radar/item-list.hbs +20 -0
- package/addon/components/radar/item-list.js +3 -0
- package/addon/components/radar/item-row.hbs +90 -0
- package/addon/components/radar/item-row.js +43 -0
- package/addon/components/radar/keyboard-hints.hbs +8 -0
- package/addon/components/radar/keyboard-hints.js +3 -0
- package/addon/components/radar/subject.hbs +14 -0
- package/addon/components/radar/subject.js +26 -0
- package/addon/components/radar/view-bar.hbs +27 -0
- package/addon/components/radar/view-bar.js +16 -0
- package/addon/components/recurring-order-schedule/pill.hbs +24 -0
- package/addon/components/recurring-order-schedule/summary.hbs +1 -0
- package/addon/components/resource-activity.hbs +1 -0
- package/addon/components/resource-activity.js +4 -0
- package/addon/components/route/pill.hbs +24 -0
- package/addon/components/route/summary.hbs +1 -0
- package/addon/components/select-option/asset-connection.hbs +12 -0
- package/addon/components/select-option/asset.hbs +12 -0
- package/addon/components/select-option/attachable.hbs +12 -0
- package/addon/components/select-option/contact.hbs +12 -0
- package/addon/components/select-option/customer.hbs +12 -0
- package/addon/components/select-option/device-event.hbs +12 -0
- package/addon/components/select-option/device.hbs +12 -0
- package/addon/components/select-option/driver.hbs +12 -0
- package/addon/components/select-option/entity.hbs +12 -0
- package/addon/components/select-option/equipment.hbs +12 -0
- package/addon/components/select-option/facilitator.hbs +12 -0
- package/addon/components/select-option/fleet-driver.hbs +12 -0
- package/addon/components/select-option/fleet.hbs +12 -0
- package/addon/components/select-option/fuel-provider-connection.hbs +12 -0
- package/addon/components/select-option/fuel-provider-transaction.hbs +12 -0
- package/addon/components/select-option/fuel-report.hbs +12 -0
- package/addon/components/select-option/inspection-form.hbs +12 -0
- package/addon/components/select-option/inspection-item-result.hbs +12 -0
- package/addon/components/select-option/inspection-submission.hbs +12 -0
- package/addon/components/select-option/integrated-vendor.hbs +12 -0
- package/addon/components/select-option/issue.hbs +12 -0
- package/addon/components/select-option/maintenance-schedule.hbs +12 -0
- package/addon/components/select-option/maintenance-subject.hbs +12 -0
- package/addon/components/select-option/maintenance.hbs +12 -0
- package/addon/components/select-option/manifest-stop.hbs +12 -0
- package/addon/components/select-option/manifest.hbs +12 -0
- package/addon/components/select-option/order-config.hbs +12 -0
- package/addon/components/select-option/order.hbs +12 -0
- package/addon/components/select-option/part.hbs +12 -0
- package/addon/components/select-option/payload.hbs +12 -0
- package/addon/components/select-option/place.hbs +12 -0
- package/addon/components/select-option/position.hbs +12 -0
- package/addon/components/select-option/purchase-rate.hbs +12 -0
- package/addon/components/select-option/recurring-order-schedule.hbs +12 -0
- package/addon/components/select-option/route.hbs +12 -0
- package/addon/components/select-option/sensor.hbs +12 -0
- package/addon/components/select-option/service-area.hbs +12 -0
- package/addon/components/select-option/service-quote-item.hbs +12 -0
- package/addon/components/select-option/service-quote.hbs +12 -0
- package/addon/components/select-option/service-rate-fee.hbs +12 -0
- package/addon/components/select-option/service-rate-parcel-fee.hbs +12 -0
- package/addon/components/select-option/service-rate.hbs +12 -0
- package/addon/components/select-option/telematic.hbs +12 -0
- package/addon/components/select-option/trackable.hbs +8 -0
- package/addon/components/select-option/tracking-number.hbs +12 -0
- package/addon/components/select-option/tracking-status.hbs +12 -0
- package/addon/components/select-option/trailer.hbs +12 -0
- package/addon/components/select-option/vehicle-device.hbs +12 -0
- package/addon/components/select-option/vehicle.hbs +12 -0
- package/addon/components/select-option/vendor.hbs +12 -0
- package/addon/components/select-option/warranty.hbs +12 -0
- package/addon/components/select-option/waypoint.hbs +12 -0
- package/addon/components/select-option/work-order.hbs +12 -0
- package/addon/components/select-option/zone.hbs +12 -0
- package/addon/components/sensor/details.hbs +6 -2
- package/addon/components/sensor/form.hbs +6 -17
- package/addon/components/sensor/panel-header.hbs +1 -1
- package/addon/components/sensor/pill.hbs +24 -0
- package/addon/components/sensor/summary.hbs +1 -0
- package/addon/components/service-area/details.hbs +1 -20
- package/addon/components/service-area/pill.hbs +24 -0
- package/addon/components/service-area/summary.hbs +1 -0
- package/addon/components/service-quote/pill.hbs +24 -0
- package/addon/components/service-quote/summary.hbs +1 -0
- package/addon/components/service-quote-item/pill.hbs +24 -0
- package/addon/components/service-quote-item/summary.hbs +1 -0
- package/addon/components/service-rate/details.hbs +12 -6
- package/addon/components/service-rate/form.hbs +10 -8
- package/addon/components/service-rate/pill.hbs +24 -0
- package/addon/components/service-rate/summary.hbs +1 -0
- package/addon/components/service-rate-fee/pill.hbs +24 -0
- package/addon/components/service-rate-fee/summary.hbs +1 -0
- package/addon/components/service-rate-parcel-fee/pill.hbs +24 -0
- package/addon/components/service-rate-parcel-fee/summary.hbs +1 -0
- package/addon/components/table/cell/fleet-ops-option.hbs +20 -0
- package/addon/components/telematic/details.hbs +4 -1
- package/addon/components/telematic/details.js +1 -0
- package/addon/components/telematic/form.hbs +6 -1
- package/addon/components/telematic/form.js +1 -0
- package/addon/components/telematic/pill.hbs +24 -0
- package/addon/components/telematic/settings.hbs +6 -1
- package/addon/components/telematic/settings.js +1 -0
- package/addon/components/telematic/summary.hbs +1 -0
- package/addon/components/telematic/telemetry-status.hbs +43 -0
- package/addon/components/telematic/telemetry-status.js +95 -0
- package/addon/components/tracking-number/pill.hbs +24 -0
- package/addon/components/tracking-number/summary.hbs +1 -0
- package/addon/components/tracking-status/pill.hbs +24 -0
- package/addon/components/tracking-status/summary.hbs +1 -0
- package/addon/components/trailer/card.hbs +2 -5
- package/addon/components/trailer/details.hbs +11 -5
- package/addon/components/trailer/details.js +4 -0
- package/addon/components/trailer/form.hbs +6 -3
- package/addon/components/trailer/pill.hbs +24 -21
- package/addon/components/trailer/summary.hbs +1 -0
- package/addon/components/vehicle/card.hbs +4 -8
- package/addon/components/vehicle/details/inspections.hbs +49 -0
- package/addon/components/vehicle/details/inspections.js +44 -0
- package/addon/components/vehicle/details/maintenance-history.hbs +1 -1
- package/addon/components/vehicle/details/schedules.hbs +2 -2
- package/addon/components/vehicle/details/work-orders.hbs +1 -1
- package/addon/components/vehicle/details.hbs +18 -1
- package/addon/components/vehicle/form.hbs +2 -1
- package/addon/components/vehicle/panel-header.hbs +3 -4
- package/addon/components/vehicle/panel-header.js +8 -1
- package/addon/components/vehicle/pill.hbs +15 -24
- package/addon/components/vehicle/summary.hbs +1 -0
- package/addon/components/vehicle-device/pill.hbs +24 -0
- package/addon/components/vehicle-device/summary.hbs +1 -0
- package/addon/components/vendor/form.hbs +2 -4
- package/addon/components/vendor/personnel-manager.hbs +2 -9
- package/addon/components/vendor/personnel-tab.hbs +1 -0
- package/addon/components/vendor/personnel-tab.js +4 -0
- package/addon/components/vendor/pill.hbs +24 -0
- package/addon/components/vendor/summary.hbs +1 -0
- package/addon/components/warranty/details.hbs +3 -1
- package/addon/components/warranty/form.hbs +2 -1
- package/addon/components/warranty/pill.hbs +24 -0
- package/addon/components/warranty/summary.hbs +1 -0
- package/addon/components/waypoint/pill.hbs +24 -0
- package/addon/components/waypoint/summary.hbs +1 -0
- package/addon/components/widget/radar.hbs +28 -0
- package/addon/components/widget/radar.js +44 -0
- package/addon/components/work-order/details.hbs +20 -4
- package/addon/components/work-order/details.js +64 -1
- package/addon/components/work-order/form.hbs +20 -2
- package/addon/components/work-order/form.js +10 -10
- package/addon/components/work-order/panel-header.hbs +15 -13
- package/addon/components/work-order/pill.hbs +24 -0
- package/addon/components/work-order/summary.hbs +1 -0
- package/addon/components/zone/details.hbs +2 -21
- package/addon/components/zone/pill.hbs +24 -0
- package/addon/components/zone/summary.hbs +1 -0
- package/addon/controllers/connectivity/devices/index/details/sensors.js +4 -0
- package/addon/controllers/connectivity/devices/index/details.js +1 -18
- package/addon/controllers/connectivity/events/index.js +1 -4
- package/addon/controllers/connectivity/fuel-providers/details/index.js +6 -0
- package/addon/controllers/connectivity/fuel-providers/details/matching.js +13 -0
- package/addon/controllers/connectivity/fuel-providers/details/sync.js +21 -10
- package/addon/controllers/connectivity/fuel-providers/details/transactions.js +5 -16
- package/addon/controllers/connectivity/fuel-providers/details.js +76 -13
- package/addon/controllers/connectivity/fuel-providers/index.js +22 -17
- package/addon/controllers/connectivity/sensors/index.js +1 -3
- package/addon/controllers/connectivity/telematics/details/events.js +8 -0
- package/addon/controllers/connectivity/telematics/details/sensors.js +3 -2
- package/addon/controllers/connectivity/telematics/index.js +3 -1
- package/addon/controllers/maintenance/inspection-forms/index/details.js +29 -0
- package/addon/controllers/maintenance/inspection-forms/index/edit.js +39 -0
- package/addon/controllers/maintenance/inspection-forms/index/new.js +48 -0
- package/addon/controllers/maintenance/inspection-forms/index.js +90 -0
- package/addon/controllers/maintenance/inspection-submissions/index/details.js +53 -0
- package/addon/controllers/maintenance/inspection-submissions/index/edit.js +39 -0
- package/addon/controllers/maintenance/inspection-submissions/index/new.js +48 -0
- package/addon/controllers/maintenance/inspection-submissions/index.js +142 -0
- package/addon/controllers/maintenance/maintenances/index.js +6 -2
- package/addon/controllers/maintenance/schedules/index/details.js +4 -86
- package/addon/controllers/maintenance/schedules/index.js +15 -0
- package/addon/controllers/maintenance/work-orders/index.js +19 -1
- package/addon/controllers/management/contacts/customers.js +6 -4
- package/addon/controllers/management/contacts/index.js +6 -3
- package/addon/controllers/management/drivers/index/details.js +1 -66
- package/addon/controllers/management/drivers/index.js +9 -34
- package/addon/controllers/management/fleets/index/details.js +2 -15
- package/addon/controllers/management/fleets/index.js +12 -20
- package/addon/controllers/management/fuel-reports/index.js +9 -59
- package/addon/controllers/management/fuel-transactions/index/details.js +51 -48
- package/addon/controllers/management/fuel-transactions/index.js +32 -32
- package/addon/controllers/management/index.js +1367 -49
- package/addon/controllers/management/issues/index/details.js +1 -33
- package/addon/controllers/management/issues/index.js +10 -59
- package/addon/controllers/management/trailers/index/details.js +4 -78
- package/addon/controllers/management/trailers/index.js +20 -22
- package/addon/controllers/management/vehicles/index/details.js +9 -77
- package/addon/controllers/management/vehicles/index.js +50 -72
- package/addon/controllers/management/vendors/index.js +6 -3
- package/addon/controllers/operations/orders/index.js +38 -11
- package/addon/controllers/operations/service-rates/index.js +10 -2
- package/addon/controllers/settings/payments/index.js +11 -2
- package/addon/extension.js +36 -0
- package/addon/helpers/initials.js +6 -0
- package/addon/helpers/leaflet-tile-url.js +6 -1
- package/addon/instance-initializers/register-fleetops-resource-descriptors.js +29 -0
- package/addon/modifiers/inspection-flyout.js +237 -0
- package/addon/modifiers/radar-keyboard.js +78 -0
- package/addon/modifiers/sync-value.js +26 -0
- package/addon/modifiers/when-changed.js +25 -0
- package/addon/routes/connectivity/fuel-providers/details/settings.js +5 -2
- package/addon/routes/connectivity/fuel-providers/details/sync.js +6 -13
- package/addon/routes/connectivity/fuel-providers/details/transactions.js +8 -7
- package/addon/routes/connectivity/fuel-providers/details.js +15 -2
- package/addon/routes/connectivity/fuel-providers/edit.js +2 -1
- package/addon/routes/connectivity/fuel-providers/index.js +5 -0
- package/addon/routes/maintenance/inspection-forms/index/details/index.js +3 -0
- package/addon/routes/maintenance/inspection-forms/index/details/submissions.js +3 -0
- package/addon/routes/maintenance/inspection-forms/index/details.js +18 -0
- package/addon/routes/maintenance/inspection-forms/index/edit.js +18 -0
- package/addon/routes/maintenance/inspection-forms/index/new.js +3 -0
- package/addon/routes/maintenance/inspection-forms/index.js +22 -0
- package/addon/routes/maintenance/inspection-forms.js +3 -0
- package/addon/routes/maintenance/inspection-submissions/index/details/audit.js +8 -0
- package/addon/routes/maintenance/inspection-submissions/index/details/index.js +3 -0
- package/addon/routes/maintenance/inspection-submissions/index/details/photos.js +8 -0
- package/addon/routes/maintenance/inspection-submissions/index/details.js +18 -0
- package/addon/routes/maintenance/inspection-submissions/index/edit.js +18 -0
- package/addon/routes/maintenance/inspection-submissions/index/new.js +3 -0
- package/addon/routes/maintenance/inspection-submissions/index.js +25 -0
- package/addon/routes/maintenance/inspection-submissions.js +3 -0
- package/addon/routes/management/fuel-transactions/index/details.js +12 -2
- package/addon/routes/management/fuel-transactions/index.js +6 -0
- package/addon/routes/management/index.js +17 -1
- package/addon/routes/management/vehicles/index/details/inspections.js +3 -0
- package/addon/routes/management/vehicles/index.js +2 -2
- package/addon/routes.js +24 -0
- package/addon/services/contact-actions.js +22 -4
- package/addon/services/customer-actions.js +7 -4
- package/addon/services/device-actions.js +28 -0
- package/addon/services/driver-actions.js +79 -16
- package/addon/services/equipment-actions.js +15 -6
- package/addon/services/fleet-actions.js +20 -4
- package/addon/services/fuel-report-actions.js +7 -7
- package/addon/services/inspection-form-actions.js +236 -0
- package/addon/services/inspection-submission-actions.js +273 -0
- package/addon/services/issue-actions.js +58 -7
- package/addon/services/maintenance-actions.js +22 -3
- package/addon/services/maintenance-schedule-actions.js +70 -5
- package/addon/services/movement-tracker.js +52 -1
- package/addon/services/part-actions.js +13 -7
- package/addon/services/place-actions.js +8 -7
- package/addon/services/service-area-actions.js +27 -4
- package/addon/services/trailer-actions.js +60 -7
- package/addon/services/vehicle-actions.js +58 -3
- package/addon/services/vendor-actions.js +8 -7
- package/addon/services/work-order-actions.js +14 -5
- package/addon/services/zone-actions.js +27 -4
- package/addon/styles/fleetops-engine.css +3621 -75
- package/addon/templates/connectivity/devices/index/details/vehicle.hbs +2 -2
- package/addon/templates/connectivity/events/details.hbs +2 -2
- package/addon/templates/connectivity/fuel-providers/details/index.hbs +65 -35
- package/addon/templates/connectivity/fuel-providers/details/matching.hbs +2 -2
- package/addon/templates/connectivity/fuel-providers/details/sync.hbs +54 -43
- package/addon/templates/connectivity/fuel-providers/details/transactions.hbs +10 -5
- package/addon/templates/connectivity/fuel-providers/details.hbs +38 -13
- package/addon/templates/connectivity/fuel-providers/edit.hbs +1 -0
- package/addon/templates/connectivity/fuel-providers/index.hbs +2 -1
- package/addon/templates/connectivity/fuel-providers/new.hbs +1 -1
- package/addon/templates/connectivity/telematics/details/attachments.hbs +2 -1
- package/addon/templates/maintenance/inspection-forms/index/details/index.hbs +1 -0
- package/addon/templates/maintenance/inspection-forms/index/details/submissions.hbs +2 -0
- package/addon/templates/maintenance/inspection-forms/index/details.hbs +14 -0
- package/addon/templates/maintenance/inspection-forms/index/edit.hbs +11 -0
- package/addon/templates/maintenance/inspection-forms/index/new.hbs +11 -0
- package/addon/templates/maintenance/inspection-forms/index.hbs +28 -0
- package/addon/templates/maintenance/inspection-forms.hbs +1 -0
- package/addon/templates/maintenance/inspection-submissions/index/details/audit.hbs +1 -0
- package/addon/templates/maintenance/inspection-submissions/index/details/index.hbs +1 -0
- package/addon/templates/maintenance/inspection-submissions/index/details/photos.hbs +1 -0
- package/addon/templates/maintenance/inspection-submissions/index/details.hbs +14 -0
- package/addon/templates/maintenance/inspection-submissions/index/edit.hbs +11 -0
- package/addon/templates/maintenance/inspection-submissions/index/new.hbs +11 -0
- package/addon/templates/maintenance/inspection-submissions/index.hbs +28 -0
- package/addon/templates/maintenance/inspection-submissions.hbs +1 -0
- package/addon/templates/management/fuel-transactions/index/details.hbs +64 -62
- package/addon/templates/management/fuel-transactions/index.hbs +9 -31
- package/addon/templates/management/index.hbs +110 -102
- package/addon/templates/management/vehicles/index/details/inspections.hbs +2 -0
- package/addon/templates/operations/orders/index.hbs +2 -4
- package/addon/utils/context-panel.js +34 -0
- package/addon/utils/device-table-columns.js +18 -27
- package/addon/utils/fleet-ops-options.js +40 -0
- package/addon/utils/fuel-integration-format.js +43 -0
- package/addon/utils/fuel-transaction.js +115 -0
- package/addon/utils/identity-cell-resource.js +56 -0
- package/addon/utils/inspection-answers.js +283 -0
- package/addon/utils/inspection-field-types.js +74 -0
- package/addon/utils/inspection-form-structure.js +161 -0
- package/addon/utils/radar.js +212 -0
- package/addon/utils/relation-value.js +37 -0
- package/addon/utils/resource-descriptors/assets.js +246 -0
- package/addon/utils/resource-descriptors/connectivity.js +146 -0
- package/addon/utils/resource-descriptors/fuel.js +75 -0
- package/addon/utils/resource-descriptors/helpers.js +191 -0
- package/addon/utils/resource-descriptors/index.js +35 -0
- package/addon/utils/resource-descriptors/maintenance.js +175 -0
- package/addon/utils/resource-descriptors/operations.js +215 -0
- package/addon/utils/resource-descriptors/people.js +173 -0
- package/addon/utils/resource-descriptors/polymorphic.js +123 -0
- package/addon/utils/resource-descriptors/sub-records.js +297 -0
- package/addon/utils/telemetry-timestamp.js +6 -0
- package/app/components/asset/pill.js +1 -0
- package/app/components/asset/summary.js +1 -0
- package/app/components/asset-connection/pill.js +1 -0
- package/app/components/asset-connection/summary.js +1 -0
- package/app/components/attachable/pill.js +1 -0
- package/app/components/attachable/summary.js +1 -0
- package/app/components/cell/asset-connection-identity.js +1 -0
- package/app/components/cell/{attached-vehicle.js → asset-identity.js} +1 -1
- package/app/components/cell/attachable-identity.js +1 -0
- package/app/components/cell/{telematic-device.js → contact-identity.js} +1 -1
- package/app/components/cell/customer-identity.js +1 -0
- package/app/components/cell/device-event-identity.js +1 -0
- package/app/components/cell/entity-identity.js +1 -0
- package/app/components/cell/facilitator-identity.js +1 -0
- package/app/components/cell/fleet-driver-identity.js +1 -0
- package/app/components/cell/fleet-identity.js +1 -0
- package/app/components/cell/fuel-provider-connection-identity.js +1 -0
- package/app/components/cell/fuel-provider-transaction-identity.js +1 -0
- package/app/components/cell/fuel-report-identity.js +1 -0
- package/app/components/cell/inspection-form-identity.js +1 -0
- package/app/components/cell/inspection-item-result-identity.js +1 -0
- package/app/components/cell/inspection-submission-identity.js +1 -0
- package/app/components/cell/integrated-vendor-identity.js +1 -0
- package/app/components/cell/issue-identity.js +1 -0
- package/app/components/cell/maintenance-identity.js +1 -0
- package/app/components/cell/maintenance-schedule-identity.js +1 -0
- package/app/components/cell/maintenance-subject-identity.js +1 -0
- package/app/components/cell/manifest-identity.js +1 -0
- package/app/components/cell/manifest-stop-identity.js +1 -0
- package/app/components/cell/order-config-identity.js +1 -0
- package/app/components/cell/order-identity.js +1 -0
- package/app/components/cell/payload-identity.js +1 -0
- package/app/components/cell/place-identity.js +1 -0
- package/app/components/cell/position-identity.js +1 -0
- package/app/components/cell/purchase-rate-identity.js +1 -0
- package/app/components/cell/recurring-order-schedule-identity.js +1 -0
- package/app/components/cell/resource-list.js +1 -0
- package/app/components/cell/route-identity.js +1 -0
- package/app/components/cell/sensor-identity.js +1 -0
- package/app/components/cell/service-area-identity.js +1 -0
- package/app/components/cell/service-quote-identity.js +1 -0
- package/app/components/cell/service-quote-item-identity.js +1 -0
- package/app/components/cell/service-rate-fee-identity.js +1 -0
- package/app/components/cell/service-rate-identity.js +1 -0
- package/app/components/cell/service-rate-parcel-fee-identity.js +1 -0
- package/app/components/cell/{telematic-provider.js → telematic-identity.js} +1 -1
- package/app/components/cell/tracking-number-identity.js +1 -0
- package/app/components/cell/tracking-status-identity.js +1 -0
- package/app/components/cell/trailer-identity.js +1 -0
- package/app/components/cell/vehicle-device-identity.js +1 -0
- package/app/components/cell/vendor-identity.js +1 -0
- package/app/components/cell/warranty-identity.js +1 -0
- package/app/components/cell/waypoint-identity.js +1 -0
- package/app/components/cell/work-order-identity.js +1 -0
- package/app/components/cell/zone-identity.js +1 -0
- package/app/components/{cell/driver-name.js → contact/pill.js} +1 -1
- package/app/components/{cell/vehicle-name.js → contact/summary.js} +1 -1
- package/app/components/customer/pill.js +1 -0
- package/app/components/customer/summary.js +1 -0
- package/app/components/device/summary.js +1 -0
- package/app/components/device/telemetry.js +1 -0
- package/app/components/device-event/pill.js +1 -0
- package/app/components/device-event/summary.js +1 -0
- package/app/components/driver/summary.js +1 -0
- package/app/components/entity/pill.js +1 -0
- package/app/components/entity/summary.js +1 -0
- package/app/components/equipment/card.js +1 -0
- package/app/components/equipment/panel-header.js +1 -0
- package/app/components/equipment/summary.js +1 -0
- package/app/components/{filter/multi-model.js → facilitator/pill.js} +1 -1
- package/app/components/facilitator/summary.js +1 -0
- package/app/components/fleet/pill.js +1 -0
- package/app/components/fleet/summary.js +1 -0
- package/app/components/fleet-driver/pill.js +1 -0
- package/app/components/fleet-driver/summary.js +1 -0
- package/app/components/fuel-provider-connection/pill.js +1 -0
- package/app/components/fuel-provider-connection/summary.js +1 -0
- package/app/components/fuel-provider-transaction/pill.js +1 -0
- package/app/components/fuel-provider-transaction/summary.js +1 -0
- package/app/components/fuel-report/pill.js +1 -0
- package/app/components/fuel-report/summary.js +1 -0
- package/app/components/fuel-transaction-status.js +1 -0
- package/app/components/geofence-map.js +1 -0
- package/app/components/inspection-field/form.js +1 -0
- package/app/components/inspection-field/input.js +1 -0
- package/app/components/inspection-field/value.js +1 -0
- package/app/components/inspection-flyout.js +1 -0
- package/app/components/inspection-form/builder.js +1 -0
- package/app/components/inspection-form/details/submissions.js +1 -0
- package/app/components/inspection-form/details.js +1 -0
- package/app/components/inspection-form/form.js +1 -0
- package/app/components/inspection-form/pill.js +1 -0
- package/app/components/inspection-form/summary.js +1 -0
- package/app/components/inspection-item-result/pill.js +1 -0
- package/app/components/inspection-item-result/summary.js +1 -0
- package/app/components/inspection-link/list.js +1 -0
- package/app/components/inspection-sheet/group.js +1 -0
- package/app/components/inspection-sheet.js +1 -0
- package/app/components/inspection-submission/details.js +1 -0
- package/app/components/inspection-submission/form.js +1 -0
- package/app/components/inspection-submission/photos.js +1 -0
- package/app/components/inspection-submission/pill.js +1 -0
- package/app/components/inspection-submission/summary.js +1 -0
- package/app/components/integrated-vendor/pill.js +1 -0
- package/app/components/integrated-vendor/summary.js +1 -0
- package/app/components/issue/pill.js +1 -0
- package/app/components/issue/summary.js +1 -0
- package/app/components/issue/timeline.js +1 -0
- package/app/components/layout/fleet-ops-sidebar/operations-monitor.js +1 -0
- package/app/components/maintenance/pill.js +1 -0
- package/app/components/maintenance/summary.js +1 -0
- package/app/components/maintenance-schedule/pill.js +1 -0
- package/app/components/maintenance-schedule/summary.js +1 -0
- package/app/components/maintenance-schedule/work-orders.js +1 -0
- package/app/components/maintenance-subject/pill.js +1 -0
- package/app/components/maintenance-subject/summary.js +1 -0
- package/app/components/manifest/pill.js +1 -0
- package/app/components/manifest/summary.js +1 -0
- package/app/components/manifest-stop/pill.js +1 -0
- package/app/components/manifest-stop/summary.js +1 -0
- package/app/components/modals/fuel-connection-diagnostics.js +1 -0
- package/app/components/modals/fuel-transaction-action.js +1 -0
- package/app/components/modals/inspection-follow-up.js +1 -0
- package/app/components/modals/inspection-link.js +1 -0
- package/app/components/modals/radar-notice.js +1 -0
- package/app/components/modals/radar-save-view.js +1 -0
- package/app/components/modals/radar-select-resource.js +1 -0
- package/app/components/modals/radar-send-pin.js +1 -0
- package/app/components/order/summary.js +1 -0
- package/app/components/order-config/pill.js +1 -0
- package/app/components/order-config/summary.js +1 -0
- package/app/components/part/card.js +1 -0
- package/app/components/part/panel-header.js +1 -0
- package/app/components/part/pill.js +1 -0
- package/app/components/part/summary.js +1 -0
- package/app/components/payload/pill.js +1 -0
- package/app/components/payload/summary.js +1 -0
- package/app/components/place/pill.js +1 -0
- package/app/components/place/summary.js +1 -0
- package/app/components/position/pill.js +1 -0
- package/app/components/position/summary.js +1 -0
- package/app/components/public-inspection.js +1 -0
- package/app/components/purchase-rate/pill.js +1 -0
- package/app/components/purchase-rate/summary.js +1 -0
- package/app/components/radar/agenda/entry.js +1 -0
- package/app/components/radar/agenda/lane.js +1 -0
- package/app/components/radar/agenda.js +1 -0
- package/app/components/radar/briefing.js +1 -0
- package/app/components/radar/bulk-bar.js +1 -0
- package/app/components/radar/decision-card.js +1 -0
- package/app/components/radar/empty-state.js +1 -0
- package/app/components/radar/filter-pills.js +1 -0
- package/app/components/radar/handover-card.js +1 -0
- package/app/components/radar/header.js +1 -0
- package/app/components/radar/item-drawer.js +1 -0
- package/app/components/radar/item-list.js +1 -0
- package/app/components/radar/item-row.js +1 -0
- package/app/components/radar/keyboard-hints.js +1 -0
- package/app/components/radar/subject.js +1 -0
- package/app/components/radar/view-bar.js +1 -0
- package/app/components/recurring-order-schedule/pill.js +1 -0
- package/app/components/recurring-order-schedule/summary.js +1 -0
- package/app/components/resource-activity.js +1 -0
- package/app/components/route/pill.js +1 -0
- package/app/components/route/summary.js +1 -0
- package/app/components/select-option/asset-connection.js +1 -0
- package/app/components/select-option/asset.js +1 -0
- package/app/components/select-option/attachable.js +1 -0
- package/app/components/select-option/contact.js +1 -0
- package/app/components/select-option/customer.js +1 -0
- package/app/components/select-option/device-event.js +1 -0
- package/app/components/select-option/device.js +1 -0
- package/app/components/select-option/driver.js +1 -0
- package/app/components/select-option/entity.js +1 -0
- package/app/components/select-option/equipment.js +1 -0
- package/app/components/select-option/facilitator.js +1 -0
- package/app/components/select-option/fleet-driver.js +1 -0
- package/app/components/select-option/fleet.js +1 -0
- package/app/components/select-option/fuel-provider-connection.js +1 -0
- package/app/components/select-option/fuel-provider-transaction.js +1 -0
- package/app/components/select-option/fuel-report.js +1 -0
- package/app/components/select-option/inspection-form.js +1 -0
- package/app/components/select-option/inspection-item-result.js +1 -0
- package/app/components/select-option/inspection-submission.js +1 -0
- package/app/components/select-option/integrated-vendor.js +1 -0
- package/app/components/select-option/issue.js +1 -0
- package/app/components/select-option/maintenance-schedule.js +1 -0
- package/app/components/select-option/maintenance-subject.js +1 -0
- package/app/components/select-option/maintenance.js +1 -0
- package/app/components/select-option/manifest-stop.js +1 -0
- package/app/components/select-option/manifest.js +1 -0
- package/app/components/select-option/order-config.js +1 -0
- package/app/components/select-option/order.js +1 -0
- package/app/components/select-option/part.js +1 -0
- package/app/components/select-option/payload.js +1 -0
- package/app/components/select-option/place.js +1 -0
- package/app/components/select-option/position.js +1 -0
- package/app/components/select-option/purchase-rate.js +1 -0
- package/app/components/select-option/recurring-order-schedule.js +1 -0
- package/app/components/select-option/route.js +1 -0
- package/app/components/select-option/sensor.js +1 -0
- package/app/components/select-option/service-area.js +1 -0
- package/app/components/select-option/service-quote-item.js +1 -0
- package/app/components/select-option/service-quote.js +1 -0
- package/app/components/select-option/service-rate-fee.js +1 -0
- package/app/components/select-option/service-rate-parcel-fee.js +1 -0
- package/app/components/select-option/service-rate.js +1 -0
- package/app/components/select-option/telematic.js +1 -0
- package/app/components/select-option/trackable.js +1 -0
- package/app/components/select-option/tracking-number.js +1 -0
- package/app/components/select-option/tracking-status.js +1 -0
- package/app/components/select-option/trailer.js +1 -0
- package/app/components/select-option/vehicle-device.js +1 -0
- package/app/components/select-option/vehicle.js +1 -0
- package/app/components/select-option/vendor.js +1 -0
- package/app/components/select-option/warranty.js +1 -0
- package/app/components/select-option/waypoint.js +1 -0
- package/app/components/select-option/work-order.js +1 -0
- package/app/components/select-option/zone.js +1 -0
- package/app/components/sensor/pill.js +1 -0
- package/app/components/sensor/summary.js +1 -0
- package/app/components/service-area/pill.js +1 -0
- package/app/components/service-area/summary.js +1 -0
- package/app/components/service-quote/pill.js +1 -0
- package/app/components/service-quote/summary.js +1 -0
- package/app/components/service-quote-item/pill.js +1 -0
- package/app/components/service-quote-item/summary.js +1 -0
- package/app/components/service-rate/pill.js +1 -0
- package/app/components/service-rate/summary.js +1 -0
- package/app/components/service-rate-fee/pill.js +1 -0
- package/app/components/service-rate-fee/summary.js +1 -0
- package/app/components/service-rate-parcel-fee/pill.js +1 -0
- package/app/components/service-rate-parcel-fee/summary.js +1 -0
- package/app/components/table/cell/fleet-ops-option.js +1 -0
- package/app/components/telematic/pill.js +1 -0
- package/app/components/telematic/summary.js +1 -0
- package/app/components/telematic/telemetry-status.js +1 -0
- package/app/components/tracking-number/pill.js +1 -0
- package/app/components/tracking-number/summary.js +1 -0
- package/app/components/tracking-status/pill.js +1 -0
- package/app/components/tracking-status/summary.js +1 -0
- package/app/components/trailer/summary.js +1 -0
- package/app/components/vehicle/details/inspections.js +1 -0
- package/app/components/vehicle/summary.js +1 -0
- package/app/components/vehicle-device/pill.js +1 -0
- package/app/components/vehicle-device/summary.js +1 -0
- package/app/components/vendor/personnel-tab.js +1 -0
- package/app/components/vendor/pill.js +1 -0
- package/app/components/vendor/summary.js +1 -0
- package/app/components/warranty/pill.js +1 -0
- package/app/components/warranty/summary.js +1 -0
- package/app/components/waypoint/pill.js +1 -0
- package/app/components/waypoint/summary.js +1 -0
- package/app/components/widget/radar.js +1 -0
- package/app/components/work-order/panel-header.js +1 -0
- package/app/components/work-order/pill.js +1 -0
- package/app/components/work-order/summary.js +1 -0
- package/app/components/zone/pill.js +1 -0
- package/app/components/zone/summary.js +1 -0
- package/app/controllers/maintenance/inspection-forms/index/details.js +1 -0
- package/app/controllers/maintenance/inspection-forms/index/edit.js +1 -0
- package/app/controllers/maintenance/inspection-forms/index/new.js +1 -0
- package/app/controllers/maintenance/inspection-forms/index.js +1 -0
- package/app/controllers/maintenance/inspection-submissions/index/details.js +1 -0
- package/app/controllers/maintenance/inspection-submissions/index/edit.js +1 -0
- package/app/controllers/maintenance/inspection-submissions/index/new.js +1 -0
- package/app/controllers/maintenance/inspection-submissions/index.js +1 -0
- package/app/helpers/initials.js +1 -0
- package/app/modifiers/inspection-flyout.js +1 -0
- package/app/modifiers/radar-keyboard.js +1 -0
- package/app/modifiers/sync-value.js +1 -0
- package/app/modifiers/when-changed.js +1 -0
- package/app/routes/maintenance/inspection-forms/index/details/index.js +1 -0
- package/app/routes/maintenance/inspection-forms/index/details/submissions.js +1 -0
- package/app/routes/maintenance/inspection-forms/index/details.js +1 -0
- package/app/routes/maintenance/inspection-forms/index/edit.js +1 -0
- package/app/routes/maintenance/inspection-forms/index/new.js +1 -0
- package/app/routes/maintenance/inspection-forms/index.js +1 -0
- package/app/routes/maintenance/inspection-forms.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index/details/audit.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index/details/index.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index/details/photos.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index/details.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index/edit.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index/new.js +1 -0
- package/app/routes/maintenance/inspection-submissions/index.js +1 -0
- package/app/routes/maintenance/inspection-submissions.js +1 -0
- package/app/routes/management/vehicles/index/details/inspections.js +1 -0
- package/app/services/inspection-form-actions.js +1 -0
- package/app/services/inspection-submission-actions.js +1 -0
- package/app/templates/maintenance/inspection-forms/index/details/index.js +1 -0
- package/app/templates/maintenance/inspection-forms/index/details/submissions.js +1 -0
- package/app/templates/maintenance/inspection-forms/index/details.js +1 -0
- package/app/templates/maintenance/inspection-forms/index/edit.js +1 -0
- package/app/templates/maintenance/inspection-forms/index/new.js +1 -0
- package/app/templates/maintenance/inspection-forms/index.js +1 -0
- package/app/templates/maintenance/inspection-forms.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index/details/audit.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index/details/index.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index/details/photos.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index/details.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index/edit.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index/new.js +1 -0
- package/app/templates/maintenance/inspection-submissions/index.js +1 -0
- package/app/templates/maintenance/inspection-submissions.js +1 -0
- package/app/templates/management/vehicles/index/details/inspections.js +1 -0
- package/app/utils/inspection-field-types.js +2 -0
- package/app/utils/inspection-form-structure.js +1 -0
- package/app/utils/radar.js +1 -0
- package/composer.json +1 -1
- package/docs/AFAQY.md +91 -0
- package/docs/TELEMETRY_ARCHITECTURE.md +115 -0
- package/extension.json +1 -1
- package/package.json +3 -3
- package/scripts/coverage-summary.php +11 -0
- package/scripts/pest-bootstrap.php +1 -1
- package/server/config/afaqy.php +8 -0
- package/server/config/fuel-providers.php +28 -7
- package/server/config/telematics.php +8 -1
- package/server/config/telemetry.php +17 -0
- package/server/migrations/2026_09_09_000001_create_inspection_tables.php +152 -0
- package/server/migrations/2026_09_10_000001_convert_inspection_form_items_to_field_groups.php +44 -0
- package/server/migrations/2026_09_10_000002_add_token_to_inspection_links.php +39 -0
- package/server/migrations/2026_09_11_000001_add_assignee_and_pin_to_inspection_links.php +39 -0
- package/server/migrations/2026_09_15_000001_create_telematic_telemetry_tables.php +62 -0
- package/server/migrations/2026_09_15_000002_scope_fuel_transactions_to_connection.php +25 -0
- package/server/migrations/2026_09_16_000001_add_public_id_to_alerts_table.php +45 -0
- package/server/resources/views/mail/inspection-link-pin.blade.php +34 -0
- package/server/src/Auth/Schemas/FleetOps.php +12 -0
- package/server/src/Console/Commands/DrainTelematicInbox.php +82 -0
- package/server/src/Console/Commands/ProcessMaintenanceTriggers.php +4 -1
- package/server/src/Console/Commands/SyncTelematics.php +32 -2
- package/server/src/Contracts/TelemetryProviderInterface.php +27 -0
- package/server/src/Events/DeviceTelemetryUpdated.php +37 -0
- package/server/src/Events/VehicleLocationChanged.php +8 -4
- package/server/src/Exports/InspectionExport.php +125 -0
- package/server/src/Http/Controllers/Api/v1/GeofenceController.php +1 -1
- package/server/src/Http/Controllers/Api/v1/InspectionController.php +300 -0
- package/server/src/Http/Controllers/Internal/v1/FuelProviderConnectionController.php +40 -8
- package/server/src/Http/Controllers/Internal/v1/HubController.php +36 -11
- package/server/src/Http/Controllers/Internal/v1/InspectionFormController.php +326 -0
- package/server/src/Http/Controllers/Internal/v1/InspectionSubmissionController.php +229 -0
- package/server/src/Http/Controllers/Internal/v1/RadarController.php +1117 -0
- package/server/src/Http/Controllers/Internal/v1/TelematicController.php +67 -0
- package/server/src/Http/Controllers/Public/PublicInspectionController.php +243 -0
- package/server/src/Http/Controllers/TelematicPositionWebhookController.php +60 -0
- package/server/src/Http/Controllers/TelematicWebhookController.php +3 -0
- package/server/src/Http/Filter/FuelProviderConnectionFilter.php +1 -1
- package/server/src/Http/Middleware/ForceJsonResponse.php +25 -0
- package/server/src/Http/Resources/v1/InspectionForm.php +153 -0
- package/server/src/Http/Resources/v1/InspectionItemResult.php +77 -0
- package/server/src/Http/Resources/v1/InspectionLink.php +84 -0
- package/server/src/Http/Resources/v1/InspectionSubmission.php +173 -0
- package/server/src/Jobs/PollTelematicTelemetry.php +118 -0
- package/server/src/Jobs/ProcessTelematicDelivery.php +122 -0
- package/server/src/Jobs/SyncFuelProviderTransactionsJob.php +21 -4
- package/server/src/Mail/InspectionLinkPinMail.php +57 -0
- package/server/src/Models/Driver.php +8 -2
- package/server/src/Models/FuelProviderTransaction.php +1 -0
- package/server/src/Models/InspectionForm.php +240 -0
- package/server/src/Models/InspectionItemResult.php +90 -0
- package/server/src/Models/InspectionLink.php +284 -0
- package/server/src/Models/InspectionSubmission.php +440 -0
- package/server/src/Models/Part.php +9 -2
- package/server/src/Models/WorkOrder.php +3 -0
- package/server/src/Observers/WorkOrderObserver.php +1 -1
- package/server/src/Providers/FleetOpsServiceProvider.php +9 -0
- package/server/src/Rules/Base64OrUrl.php +54 -0
- package/server/src/Support/FuelProviders/FuelProviderService.php +64 -27
- package/server/src/Support/FuelProviders/Providers/PetroAppFuelProvider.php +81 -15
- package/server/src/Support/InspectionFileStore.php +268 -0
- package/server/src/Support/InspectionFormSync.php +231 -0
- package/server/src/Support/InspectionLinkPin.php +150 -0
- package/server/src/Support/InspectionSubmitter.php +297 -0
- package/server/src/Support/Radar/RadarAgenda.php +375 -0
- package/server/src/Support/Radar/RadarBriefing.php +504 -0
- package/server/src/Support/Radar/RadarItemState.php +435 -0
- package/server/src/Support/Radar/RadarRules.php +1424 -0
- package/server/src/Support/Reporting/FleetOpsReportSchema.php +178 -0
- package/server/src/Support/Telematics/Afaqy/Payload.php +49 -0
- package/server/src/Support/Telematics/Providers/AfaqyProvider.php +179 -61
- package/server/src/Support/Telematics/TelematicService.php +37 -6
- package/server/src/Support/Telematics/Telemetry/Configuration.php +30 -0
- package/server/src/Support/Telematics/Telemetry/Inbox.php +61 -0
- package/server/src/Support/Telematics/Telemetry/Ingestor.php +112 -0
- package/server/src/Support/Telematics/Telemetry/Queue.php +28 -0
- package/server/src/Support/Telematics/Telemetry/Sample.php +54 -0
- package/server/src/routes.php +76 -0
- package/server/tests/ApiManifestControllerContractsTest.php +9 -9
- package/server/tests/ControllerFilterContractsTest.php +1 -1
- package/server/tests/EventContractsTest.php +2 -1
- package/server/tests/Feature/Http/AfaqyRealtimeIngestionTest.php +792 -0
- package/server/tests/Feature/Http/Api/GeofenceControllerContractsTest.php +4 -4
- package/server/tests/Feature/Http/Api/TrailerControllerLifecycleTest.php +1 -1
- package/server/tests/Feature/Http/Internal/DriverControllerCreateRecordTest.php +1 -1
- package/server/tests/Feature/Http/Internal/DriverControllerExistingUserAdoptionTest.php +1 -1
- package/server/tests/Feature/Http/Internal/HubControllerTest.php +28 -2
- package/server/tests/Feature/Http/Internal/OrderControllerCreateRecordTest.php +1 -1
- package/server/tests/Feature/Http/Internal/RadarControllerDatabaseTest.php +415 -0
- package/server/tests/Feature/Http/Internal/RadarControllerTest.php +594 -0
- package/server/tests/FuelProviderConnectionControllerContractsTest.php +83 -3
- package/server/tests/FuelProviderImplementationTest.php +10 -2
- package/server/tests/HubAndGettingStartedContractsTest.php +26 -3
- package/server/tests/InspectionControllerContractsTest.php +1329 -0
- package/server/tests/InspectionFieldContractsTest.php +1019 -0
- package/server/tests/InspectionModelContractsTest.php +728 -0
- package/server/tests/InspectionSubmitterRulesTest.php +47 -0
- package/server/tests/ObserverContractsTest.php +1 -1
- package/server/tests/QueueJobContractsTest.php +3 -4
- package/server/tests/RadarRoutesTest.php +35 -0
- package/server/tests/ReportSchemaContractsTest.php +15 -1
- package/server/tests/RouteRegistrationExecutionTest.php +109 -18
- package/server/tests/Support/AfaqyTestCrypto.php +27 -0
- package/server/tests/Support/ExampleTelemetryProvider.php +82 -0
- package/server/tests/Support/TelemetryTestEnvironment.php +53 -0
- package/server/tests/TelematicsHardeningTest.php +17 -17
- package/server/tests/TrailerSupportCoverageTest.php +1 -1
- package/server/tests/Unit/Http/Resources/ManifestResourceTest.php +3 -3
- package/server/tests/Unit/Support/FuelProviderServiceMatchingTest.php +127 -0
- package/server/tests/Unit/Support/PetroAppFuelProviderTest.php +126 -1
- package/server/tests/Unit/Support/RadarAgendaTest.php +200 -0
- package/server/tests/Unit/Support/RadarBriefingTest.php +214 -0
- package/server/tests/Unit/Support/RadarItemStateTest.php +260 -0
- package/server/tests/Unit/Support/RadarRulesTest.php +523 -0
- package/server/tests/Unit/Support/Telematics/Providers/AfaqyProviderTest.php +9 -1
- package/server/tests/Unit/Support/Telematics/Providers/AfaqyProviderTransportTest.php +8 -0
- package/server/tests/Unit/Support/Telematics/Providers/AfaqyRealtimeContractTest.php +188 -0
- package/server/tests/Unit/Support/Telematics/TelematicServiceTelemetryTest.php +1 -0
- package/translations/ar-ae.yml +3 -1
- package/translations/bg-bg.yaml +3 -1
- package/translations/en-us.yaml +738 -15
- package/translations/es-pa.yaml +3 -1
- package/translations/fr-fr.yaml +3 -1
- package/translations/mn-mn.yaml +3 -1
- package/translations/pt-br.yaml +3 -1
- package/translations/ru-ru.yaml +3 -1
- package/translations/vi-vn.yaml +3 -1
- package/addon/components/cell/attached-vehicle.hbs +0 -10
- package/addon/components/cell/attached-vehicle.js +0 -58
- package/addon/components/cell/device-identity.js +0 -129
- package/addon/components/cell/driver-identity.js +0 -143
- package/addon/components/cell/driver-name.hbs +0 -26
- package/addon/components/cell/driver-name.js +0 -30
- package/addon/components/cell/equipment-identity.js +0 -48
- package/addon/components/cell/part-identity.js +0 -63
- package/addon/components/cell/telematic-device.hbs +0 -38
- package/addon/components/cell/telematic-device.js +0 -44
- package/addon/components/cell/telematic-provider.hbs +0 -33
- package/addon/components/cell/telematic-provider.js +0 -78
- package/addon/components/cell/vehicle-identity.js +0 -138
- package/addon/components/cell/vehicle-name.hbs +0 -23
- package/addon/components/cell/vehicle-name.js +0 -3
- package/addon/components/device/pill.js +0 -3
- package/addon/components/driver/pill.js +0 -7
- package/addon/components/equipment/pill.js +0 -3
- package/addon/components/filter/multi-model.hbs +0 -19
- package/addon/components/filter/multi-model.js +0 -90
- package/addon/components/order/pill.js +0 -3
- package/addon/components/trailer/pill.js +0 -3
- package/addon/components/vehicle/pill.js +0 -7
- package/addon/templates/connectivity/fuel-providers/details/settings.hbs +0 -11
|
@@ -199,6 +199,73 @@ class TelematicController extends FleetOpsController
|
|
|
199
199
|
], 201);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
public function telemetryWebhook(Request $request, string $id): JsonResponse
|
|
203
|
+
{
|
|
204
|
+
$telematic = $this->findTelematic($id);
|
|
205
|
+
$provider = $this->registry->resolve($telematic->provider);
|
|
206
|
+
abort_unless($provider instanceof \Fleetbase\FleetOps\Contracts\TelemetryProviderInterface, 422);
|
|
207
|
+
abort_unless($provider->supportsWebhooks(), 422);
|
|
208
|
+
$url = \Fleetbase\Support\Utils::apiUrl('webhooks/telematics/' . $telematic->provider);
|
|
209
|
+
abort_unless(str_starts_with($url, 'https://'), 422, 'Configure the public API URL with HTTPS before registering the webhook.');
|
|
210
|
+
$token = \Illuminate\Support\Facades\DB::transaction(function () use ($telematic, $request) {
|
|
211
|
+
// Serialize first-time provisioning as well as rotation.
|
|
212
|
+
Telematic::where('uuid', $telematic->uuid)->lockForUpdate()->firstOrFail();
|
|
213
|
+
$stored = \Illuminate\Support\Facades\DB::table('telematic_webhook_credentials')->where('telematic_uuid', $telematic->uuid)->first();
|
|
214
|
+
if ($stored && !$request->boolean('rotate')) {
|
|
215
|
+
return \Illuminate\Support\Facades\Crypt::decryptString($stored->token);
|
|
216
|
+
}
|
|
217
|
+
$token = bin2hex(random_bytes(32));
|
|
218
|
+
\Illuminate\Support\Facades\DB::table('telematic_webhook_credentials')->updateOrInsert(['telematic_uuid' => $telematic->uuid], [
|
|
219
|
+
'token' => \Illuminate\Support\Facades\Crypt::encryptString($token), 'created_at' => now(), 'updated_at' => now(),
|
|
220
|
+
]);
|
|
221
|
+
|
|
222
|
+
return $token;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return response()->json(['url' => $url . '?' . http_build_query(['telematic' => $telematic->public_id, 'key' => $token])]);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
public function telemetryDiagnostics(string $id): JsonResponse
|
|
229
|
+
{
|
|
230
|
+
$telematic = $this->findTelematic($id);
|
|
231
|
+
$provider = $this->registry->resolve($telematic->provider);
|
|
232
|
+
abort_unless($provider instanceof \Fleetbase\FleetOps\Contracts\TelemetryProviderInterface, 422);
|
|
233
|
+
$options = \Fleetbase\FleetOps\Support\Telematics\Telemetry\Configuration::options($provider);
|
|
234
|
+
$query = \Illuminate\Support\Facades\DB::table('telematic_deliveries')->where('telematic_uuid', $telematic->uuid);
|
|
235
|
+
$last = (clone $query)->where('source', 'webhook')->orderByDesc('received_at')->first(['uuid', 'status', 'received_at', 'processed_at', 'error']);
|
|
236
|
+
$provisioned = \Illuminate\Support\Facades\DB::table('telematic_webhook_credentials')->where('telematic_uuid', $telematic->uuid)->exists();
|
|
237
|
+
$state = !$provisioned ? 'not_configured' : (!$last ? 'awaiting_first_delivery' : ($last->status === 'quarantined' || \Illuminate\Support\Carbon::parse($last->received_at)->lt(now()->subMinutes(10)) ? 'degraded' : 'receiving'));
|
|
238
|
+
|
|
239
|
+
return response()->json([
|
|
240
|
+
'polling_enabled' => $options['polling_enabled'] ?? false,
|
|
241
|
+
'webhooks_enabled' => $options['webhooks_enabled'] ?? false,
|
|
242
|
+
'webhook_state' => $state, 'last_webhook' => $last,
|
|
243
|
+
'last_poll' => \Illuminate\Support\Facades\DB::table('telematic_sync_runs')->where('telematic_uuid', $telematic->uuid)->orderByDesc('created_at')->first(),
|
|
244
|
+
'last_ingestion' => (clone $query)->whereNotNull('processed_at')->orderByDesc('received_at')->first(['queue_delay_seconds', 'source_delay_seconds', 'processed_at']),
|
|
245
|
+
'delivery_counts' => (clone $query)->whereIn('status', ['pending', 'retry', 'processing'])->selectRaw('status, count(*) as total')->groupBy('status')->pluck('total', 'status'),
|
|
246
|
+
'oldest_pending_at' => (clone $query)->whereIn('status', ['pending', 'retry', 'processing'])->min('received_at'),
|
|
247
|
+
'recent_failures' => (clone $query)->whereIn('status', ['quarantined', 'retry'])->orderByDesc('received_at')->limit(10)->get(['uuid', 'status', 'source', 'received_at', 'applied', 'failed', 'error']),
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
public function replayTelemetryDelivery(string $id, string $delivery): JsonResponse
|
|
252
|
+
{
|
|
253
|
+
$telematic = $this->findTelematic($id);
|
|
254
|
+
$provider = $this->registry->resolve($telematic->provider);
|
|
255
|
+
abort_unless($provider instanceof \Fleetbase\FleetOps\Contracts\TelemetryProviderInterface, 422);
|
|
256
|
+
$options = \Fleetbase\FleetOps\Support\Telematics\Telemetry\Configuration::options($provider);
|
|
257
|
+
$updated = \Illuminate\Support\Facades\DB::table('telematic_deliveries')->where('telematic_uuid', $telematic->uuid)->where('uuid', $delivery)->where('status', 'quarantined')
|
|
258
|
+
->update(['status' => 'pending', 'attempts' => 0, 'retry_payload' => null, 'invalid_count' => 0, 'failed' => 0, 'applied' => 0, 'error' => null, 'available_at' => now(), 'processed_at' => null, 'updated_at' => now()]);
|
|
259
|
+
abort_unless($updated, 404);
|
|
260
|
+
try {
|
|
261
|
+
\Fleetbase\FleetOps\Support\Telematics\Telemetry\Queue::dispatch((new \Fleetbase\FleetOps\Jobs\ProcessTelematicDelivery($delivery))->onQueue($options['ingestion_queue'] ?? 'default'));
|
|
262
|
+
} catch (\Throwable) {
|
|
263
|
+
// The durable replay is recovered by the scheduled inbox drain.
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return response()->json(['status' => 'queued'], 202);
|
|
267
|
+
}
|
|
268
|
+
|
|
202
269
|
protected function findTelematic(string $id): Telematic
|
|
203
270
|
{
|
|
204
271
|
return Telematic::where(function ($query) use ($id) {
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Controllers\Public;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Http\Resources\v1\InspectionForm as InspectionFormResource;
|
|
6
|
+
use Fleetbase\FleetOps\Http\Resources\v1\InspectionSubmission as InspectionSubmissionResource;
|
|
7
|
+
use Fleetbase\FleetOps\Models\InspectionForm;
|
|
8
|
+
use Fleetbase\FleetOps\Models\InspectionLink;
|
|
9
|
+
use Fleetbase\FleetOps\Support\InspectionFileStore;
|
|
10
|
+
use Fleetbase\FleetOps\Support\InspectionLinkPin;
|
|
11
|
+
use Fleetbase\FleetOps\Support\InspectionSubmitter;
|
|
12
|
+
use Fleetbase\Models\File;
|
|
13
|
+
use Illuminate\Http\JsonResponse;
|
|
14
|
+
use Illuminate\Http\Request;
|
|
15
|
+
use Illuminate\Routing\Controller;
|
|
16
|
+
use Illuminate\Support\Facades\DB;
|
|
17
|
+
|
|
18
|
+
class PublicInspectionController extends Controller
|
|
19
|
+
{
|
|
20
|
+
/** The largest photo a link will take, in kilobytes: a phone camera's JPEG, with room. */
|
|
21
|
+
public const MAX_UPLOAD_KB = 10240;
|
|
22
|
+
|
|
23
|
+
/** How many files one link may upload, so a leaked link cannot fill the bucket. */
|
|
24
|
+
public const MAX_UPLOADS_PER_LINK = 40;
|
|
25
|
+
|
|
26
|
+
/** What a locked link says, wherever the lock is found. */
|
|
27
|
+
protected const LOCKED_MESSAGE = 'This link is locked after too many incorrect PINs. Ask whoever sent it for a new one.';
|
|
28
|
+
|
|
29
|
+
/** The extension each accepted image type is stored under. */
|
|
30
|
+
protected const EXTENSIONS = [
|
|
31
|
+
'image/jpeg' => 'jpg',
|
|
32
|
+
'image/png' => 'png',
|
|
33
|
+
'image/webp' => 'webp',
|
|
34
|
+
'image/gif' => 'gif',
|
|
35
|
+
'image/heic' => 'heic',
|
|
36
|
+
'image/heif' => 'heif',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
public function show(Request $request, string $id): JsonResponse
|
|
40
|
+
{
|
|
41
|
+
[$form, $link] = $this->resolvePublishedFormAndLink($request, $id);
|
|
42
|
+
|
|
43
|
+
$link->markViewed();
|
|
44
|
+
|
|
45
|
+
return response()->json([
|
|
46
|
+
'form' => (new InspectionFormResource($form))->resolve(),
|
|
47
|
+
'identity' => $this->identityPayload($link),
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public function submit(Request $request, string $id): JsonResponse
|
|
52
|
+
{
|
|
53
|
+
[$form, $link] = $this->resolvePublishedFormAndLink($request, $id);
|
|
54
|
+
|
|
55
|
+
$validated = $request->validate(InspectionSubmitter::rules());
|
|
56
|
+
|
|
57
|
+
// A link submits through its form's fields. The older flat checklist
|
|
58
|
+
// stores photo URLs exactly as given, which on a public link would let
|
|
59
|
+
// anyone put an arbitrary outside image on the record.
|
|
60
|
+
if (!empty($validated['item_results']) && empty($validated['custom_field_values'])) {
|
|
61
|
+
abort(response()->json(['error' => 'Submit this inspection through its form fields.'], 422));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// A single-use link is claimed before anything is written, inside the
|
|
65
|
+
// same transaction as the submission: a second submit at the same
|
|
66
|
+
// moment finds it already taken and writes nothing, and a submission
|
|
67
|
+
// that fails to save gives the link back.
|
|
68
|
+
$submission = DB::connection($link->getConnectionName())->transaction(function () use ($form, $link, $validated, $request) {
|
|
69
|
+
if ($link->single_use && !$link->claim($request->ip(), (string) $request->userAgent())) {
|
|
70
|
+
abort(response()->json(['error' => 'This inspection link has already been used.'], 409));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
$submission = InspectionSubmitter::submit($form, $validated, [
|
|
74
|
+
'vehicle_uuid' => $link->vehicle_uuid,
|
|
75
|
+
'driver_uuid' => $link->driver_uuid,
|
|
76
|
+
// The person the link is for: its assignee, or the driver's
|
|
77
|
+
// account. What they typed as their name is kept beside it,
|
|
78
|
+
// with whether a PIN stood between the link and the form.
|
|
79
|
+
'submitted_by_uuid' => InspectionLinkPin::recipientFor($link)?->uuid,
|
|
80
|
+
'source' => 'public_link',
|
|
81
|
+
'meta' => [
|
|
82
|
+
'inspection_link_uuid' => $link->uuid,
|
|
83
|
+
'inspection_link_id' => $link->public_id,
|
|
84
|
+
'completed_by_name' => data_get($validated, 'signature.name'),
|
|
85
|
+
'pin_verified' => $link->hasPin(),
|
|
86
|
+
],
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
if (!$link->single_use) {
|
|
90
|
+
$link->markUsed($request->ip(), (string) $request->userAgent());
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return $submission;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return response()->json([
|
|
97
|
+
'message' => 'Inspection submitted.',
|
|
98
|
+
'submission' => (new InspectionSubmissionResource($submission->fresh(['form', 'vehicle', 'driver', 'itemResults', 'issue', 'workOrder'])))->resolve(),
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Upload a photo or a signature through the link, before submitting.
|
|
104
|
+
*
|
|
105
|
+
* The console uploads through the platform's file endpoint, which needs a
|
|
106
|
+
* session; a link has none, so this is the link's own. It checks the link
|
|
107
|
+
* exactly as submitting does, takes images only, caps how many one link
|
|
108
|
+
* may send, and tags each file with the link it came through — a
|
|
109
|
+
* submission through a link may only reference files uploaded through
|
|
110
|
+
* that same link.
|
|
111
|
+
*/
|
|
112
|
+
public function upload(Request $request, string $id): JsonResponse
|
|
113
|
+
{
|
|
114
|
+
[, $link] = $this->resolvePublishedFormAndLink($request, $id);
|
|
115
|
+
|
|
116
|
+
$request->validate([
|
|
117
|
+
'file' => 'required|file|mimetypes:image/jpeg,image/png,image/webp,image/gif,image/heic,image/heif|max:' . static::MAX_UPLOAD_KB,
|
|
118
|
+
'type' => 'nullable|in:' . InspectionFileStore::TYPE_PHOTO . ',' . InspectionFileStore::TYPE_SIGNATURE,
|
|
119
|
+
]);
|
|
120
|
+
|
|
121
|
+
$already = File::query()
|
|
122
|
+
->where('company_uuid', $link->company_uuid)
|
|
123
|
+
->where('meta->inspection_link_uuid', $link->uuid)
|
|
124
|
+
->count();
|
|
125
|
+
|
|
126
|
+
if ($already >= static::MAX_UPLOADS_PER_LINK) {
|
|
127
|
+
abort(response()->json(['error' => 'This inspection link has reached its upload limit.'], 422));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
$upload = $request->file('file');
|
|
131
|
+
$disk = config('filesystems.default');
|
|
132
|
+
$bucket = config('filesystems.disks.' . $disk . '.bucket', config('filesystems.disks.s3.bucket'));
|
|
133
|
+
// The stored name's extension comes from the type the server found in
|
|
134
|
+
// the bytes, never from the name the device sent. Validation checks the
|
|
135
|
+
// content, so an image that is also valid PHP, uploaded as `photo.php`,
|
|
136
|
+
// would pass it — and stored under that extension on a web-served local
|
|
137
|
+
// disk, it would be an invitation to run it.
|
|
138
|
+
$extension = static::EXTENSIONS[$upload->getMimeType()] ?? 'jpg';
|
|
139
|
+
$stored = $upload->storeAs('inspections/links/' . $link->uuid, File::randomFileNameFromRequest($request, 'file', $extension), ['disk' => $disk]);
|
|
140
|
+
|
|
141
|
+
if ($stored === false) {
|
|
142
|
+
abort(response()->json(['error' => 'This photo could not be stored.'], 500));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Built here rather than through File::createFromUpload(), which takes
|
|
146
|
+
// the company and uploader from the session — and a link has none.
|
|
147
|
+
// The type comes from the bytes the server received, not from the
|
|
148
|
+
// name the device gave the file.
|
|
149
|
+
$file = File::create([
|
|
150
|
+
'company_uuid' => $link->company_uuid,
|
|
151
|
+
'uploader_uuid' => InspectionLinkPin::recipientFor($link)?->uuid,
|
|
152
|
+
'original_filename' => $upload->getClientOriginalName(),
|
|
153
|
+
'content_type' => $upload->getMimeType(),
|
|
154
|
+
'disk' => $disk,
|
|
155
|
+
'path' => $stored,
|
|
156
|
+
'bucket' => $bucket,
|
|
157
|
+
'type' => $request->input('type', InspectionFileStore::TYPE_PHOTO),
|
|
158
|
+
'file_size' => $upload->getSize(),
|
|
159
|
+
'meta' => ['inspection_link_uuid' => $link->uuid],
|
|
160
|
+
]);
|
|
161
|
+
|
|
162
|
+
return response()->json([
|
|
163
|
+
'file' => [
|
|
164
|
+
'id' => $file->public_id,
|
|
165
|
+
'url' => $file->url,
|
|
166
|
+
'filename' => $file->original_filename,
|
|
167
|
+
'content_type' => $file->content_type,
|
|
168
|
+
],
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
protected function resolvePublishedFormAndLink(Request $request, string $id): array
|
|
173
|
+
{
|
|
174
|
+
$token = (string) $request->query('token', $request->input('token'));
|
|
175
|
+
if (empty($token)) {
|
|
176
|
+
abort(response()->json(['error' => 'Inspection token is required.'], 403));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
$form = InspectionForm::where('uuid', $id)
|
|
180
|
+
->orWhere('public_id', $id)
|
|
181
|
+
->firstOrFail();
|
|
182
|
+
|
|
183
|
+
if (!$form->is_published) {
|
|
184
|
+
abort(response()->json(['error' => 'This inspection form is not available.'], 403));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
$link = InspectionLink::where('inspection_form_uuid', $form->uuid)
|
|
188
|
+
->where('token_hash', InspectionLink::hashToken($token))
|
|
189
|
+
->first();
|
|
190
|
+
|
|
191
|
+
if (!$link) {
|
|
192
|
+
abort(response()->json(['error' => 'Inspection link is invalid.'], 403));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if ($link->status === 'locked') {
|
|
196
|
+
abort(response()->json(['error' => static::LOCKED_MESSAGE, 'locked' => true], 403));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!$link->isUsable()) {
|
|
200
|
+
abort(response()->json(['error' => 'Inspection link is expired, revoked, or already used.'], 403));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// A link with a PIN answers nothing, not even the form's name, until
|
|
204
|
+
// the PIN is given. Wrong guesses count against the link and lock it.
|
|
205
|
+
// Every refusal here is a 403, so the page handles them all one way.
|
|
206
|
+
// The page sends it as a header, so it stays out of URLs and the
|
|
207
|
+
// access logs that record them; a `pin` field is accepted as well.
|
|
208
|
+
switch ($link->verifyPin($request->header('X-Inspection-Pin') ?: $request->input('pin'))) {
|
|
209
|
+
case 'missing':
|
|
210
|
+
abort(response()->json(['error' => 'Enter the PIN you were given with this link.', 'pin_required' => true], 403));
|
|
211
|
+
// no break
|
|
212
|
+
case 'wrong':
|
|
213
|
+
abort(response()->json(['error' => 'That PIN is not right.', 'pin_required' => true, 'attempts_left' => $link->pinAttemptsLeft()], 403));
|
|
214
|
+
// no break
|
|
215
|
+
case 'locked':
|
|
216
|
+
abort(response()->json(['error' => static::LOCKED_MESSAGE, 'locked' => true], 403));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return [$form, $link];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
protected function identityPayload(InspectionLink $link): array
|
|
223
|
+
{
|
|
224
|
+
return [
|
|
225
|
+
'assignee' => $link->assignee ? [
|
|
226
|
+
'id' => $link->assignee->public_id,
|
|
227
|
+
'name' => $link->assignee->name,
|
|
228
|
+
] : null,
|
|
229
|
+
// Name, not phone number: whoever holds the link needs to know who
|
|
230
|
+
// it is for, not how to reach them.
|
|
231
|
+
'driver' => $link->driver ? [
|
|
232
|
+
'id' => $link->driver->public_id,
|
|
233
|
+
'name' => $link->driver->name,
|
|
234
|
+
] : null,
|
|
235
|
+
'vehicle' => $link->vehicle ? [
|
|
236
|
+
'id' => $link->vehicle->public_id,
|
|
237
|
+
'name' => $link->vehicle->display_name ?? $link->vehicle->name,
|
|
238
|
+
'plate_number' => $link->vehicle->plate_number,
|
|
239
|
+
] : null,
|
|
240
|
+
'expires_at' => $link->expires_at,
|
|
241
|
+
];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Controllers;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\Telematic;
|
|
6
|
+
use Fleetbase\FleetOps\Support\Telematics\Telemetry\Configuration;
|
|
7
|
+
use Fleetbase\FleetOps\Support\Telematics\Telemetry\Inbox;
|
|
8
|
+
use Illuminate\Http\JsonResponse;
|
|
9
|
+
use Illuminate\Http\Request;
|
|
10
|
+
use Illuminate\Routing\Controller;
|
|
11
|
+
use Illuminate\Support\Facades\Crypt;
|
|
12
|
+
use Illuminate\Support\Facades\DB;
|
|
13
|
+
|
|
14
|
+
class TelematicPositionWebhookController extends Controller
|
|
15
|
+
{
|
|
16
|
+
public function handle(Request $request, Inbox $inbox, string $providerKey): JsonResponse
|
|
17
|
+
{
|
|
18
|
+
if (!$request->isMethod('post')) {
|
|
19
|
+
return response()->json(['error' => 'POST required.'], 405);
|
|
20
|
+
}
|
|
21
|
+
$id = $request->query('telematic');
|
|
22
|
+
$token = $request->query('key');
|
|
23
|
+
if (!is_string($id) || !is_string($token)) {
|
|
24
|
+
return response()->json(['error' => 'Invalid webhook credentials.'], 403);
|
|
25
|
+
}
|
|
26
|
+
$telematic = Telematic::withoutGlobalScopes()->where('provider', $providerKey)->where('public_id', $id)->first();
|
|
27
|
+
$stored = $telematic ? DB::table('telematic_webhook_credentials')->where('telematic_uuid', $telematic->uuid)->value('token') : null;
|
|
28
|
+
if (!$stored || !hash_equals(Crypt::decryptString($stored), $token) || !Inbox::enabled($telematic)) {
|
|
29
|
+
return response()->json(['error' => 'Invalid webhook credentials.'], 403);
|
|
30
|
+
}
|
|
31
|
+
$options = Configuration::forConnection($telematic);
|
|
32
|
+
if (!($options['webhooks_enabled'] ?? false)) {
|
|
33
|
+
return response()->json(['error' => 'Webhook processing is disabled.'], 503);
|
|
34
|
+
}
|
|
35
|
+
$body = $request->getContent();
|
|
36
|
+
if (strlen($body) > ($options['max_payload_bytes'] ?? 2097152)) {
|
|
37
|
+
return response()->json(['error' => 'Payload too large.'], 413);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
$payload = json_decode($body, true, 64, JSON_THROW_ON_ERROR);
|
|
41
|
+
if (!is_array($payload)) {
|
|
42
|
+
throw new \InvalidArgumentException();
|
|
43
|
+
}
|
|
44
|
+
} catch (\Throwable) {
|
|
45
|
+
return response()->json(['error' => 'JSON object or array required.'], 422);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
// Per-connection pressure protection; The provider can retry after capacity recovers.
|
|
49
|
+
$pending = DB::table('telematic_deliveries')->where('telematic_uuid', $telematic->uuid)->whereIn('status', ['pending', 'processing', 'retry'])->count();
|
|
50
|
+
if ($pending >= ($options['max_pending_deliveries'] ?? 10000)) {
|
|
51
|
+
return response()->json(['error' => 'Ingestion capacity exceeded.'], 503);
|
|
52
|
+
}
|
|
53
|
+
$delivery = $inbox->accept($telematic, $payload, 'webhook');
|
|
54
|
+
|
|
55
|
+
return response()->json(['status' => 'accepted', 'delivery_id' => $delivery], 200);
|
|
56
|
+
} catch (\Throwable) {
|
|
57
|
+
return response()->json(['error' => 'Unable to persist delivery; retry required.'], 503);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -38,6 +38,9 @@ class TelematicWebhookController extends Controller
|
|
|
38
38
|
*/
|
|
39
39
|
public function handle(Request $request, string $providerKey): JsonResponse
|
|
40
40
|
{
|
|
41
|
+
if ($this->registry->resolve($providerKey) instanceof \Fleetbase\FleetOps\Contracts\TelemetryProviderInterface) {
|
|
42
|
+
return app(TelematicPositionWebhookController::class)->handle($request, app(\Fleetbase\FleetOps\Support\Telematics\Telemetry\Inbox::class), $providerKey);
|
|
43
|
+
}
|
|
41
44
|
$correlationId = Str::uuid()->toString();
|
|
42
45
|
|
|
43
46
|
Log::info('Webhook received', [
|
|
@@ -23,7 +23,7 @@ class FuelProviderConnectionFilter extends Filter
|
|
|
23
23
|
|
|
24
24
|
public function status(?string $status)
|
|
25
25
|
{
|
|
26
|
-
$this->builder->
|
|
26
|
+
$this->builder->whereIn('status', explode(',', $status ?? ''));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
public function environment(?string $environment)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Middleware;
|
|
4
|
+
|
|
5
|
+
use Illuminate\Http\Request;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Makes a route answer in JSON whatever the client's Accept header says.
|
|
9
|
+
*
|
|
10
|
+
* Laravel decides how to answer a failed validation from `expectsJson()`: a
|
|
11
|
+
* request that does not ask for JSON is redirected back to the page it came
|
|
12
|
+
* from with its errors flashed to a session. The public inspection page has
|
|
13
|
+
* no session and cannot follow that redirect, and the platform's fetch
|
|
14
|
+
* service sends `Accept: *\/*`, so a refused submission reached the page as a
|
|
15
|
+
* bare 302 with its reasons lost.
|
|
16
|
+
*/
|
|
17
|
+
class ForceJsonResponse
|
|
18
|
+
{
|
|
19
|
+
public function handle(Request $request, \Closure $next)
|
|
20
|
+
{
|
|
21
|
+
$request->headers->set('Accept', 'application/json');
|
|
22
|
+
|
|
23
|
+
return $next($request);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\InspectionFormSync;
|
|
6
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
7
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
8
|
+
use Fleetbase\Models\Category;
|
|
9
|
+
use Fleetbase\Models\CustomField;
|
|
10
|
+
use Fleetbase\Support\Http;
|
|
11
|
+
use Illuminate\Support\Str;
|
|
12
|
+
|
|
13
|
+
class InspectionForm extends FleetbaseResource
|
|
14
|
+
{
|
|
15
|
+
/**
|
|
16
|
+
* Transform the resource into an array.
|
|
17
|
+
*
|
|
18
|
+
* @param \Illuminate\Http\Request $request
|
|
19
|
+
*
|
|
20
|
+
* @return array
|
|
21
|
+
*/
|
|
22
|
+
public function toArray($request)
|
|
23
|
+
{
|
|
24
|
+
$internal = Http::isInternalRequest();
|
|
25
|
+
|
|
26
|
+
return $this->withCustomFields([
|
|
27
|
+
'id' => $this->when($internal, $this->id, $this->public_id),
|
|
28
|
+
'uuid' => $this->when($internal, $this->uuid),
|
|
29
|
+
'public_id' => $this->when($internal, $this->public_id),
|
|
30
|
+
'company_uuid' => $this->when($internal, $this->company_uuid),
|
|
31
|
+
'created_by_uuid'=> $this->when($internal, $this->created_by_uuid),
|
|
32
|
+
'updated_by_uuid'=> $this->when($internal, $this->updated_by_uuid),
|
|
33
|
+
'subject_uuid' => $this->when($internal, $this->subject_uuid),
|
|
34
|
+
'subject_type' => $this->when($internal, $this->subject_type ? Utils::toEmberResourceType($this->subject_type) : null),
|
|
35
|
+
'subject' => $this->whenLoaded('subject', fn () => $this->setSubjectType($this->transformMorphResource($this->subject))),
|
|
36
|
+
'name' => $this->name,
|
|
37
|
+
'description' => $this->description,
|
|
38
|
+
'type' => $this->type,
|
|
39
|
+
'status' => $this->status,
|
|
40
|
+
'items' => data_get($this, 'items', []),
|
|
41
|
+
'grouped_fields' => array_map(fn (Category $group) => static::groupToArray($group, $internal), $this->grouped_fields),
|
|
42
|
+
'field_groups' => $this->whenLoaded('fieldGroups', fn () => $this->fieldGroups->map(fn (Category $group) => static::groupToArray($group, $internal, false))->values()->all()),
|
|
43
|
+
'fields' => $this->whenLoaded('fields', fn () => $this->fields->map(fn (CustomField $field) => static::fieldToArray($field, $internal))->values()->all()),
|
|
44
|
+
'settings' => data_get($this, 'settings', (object) []),
|
|
45
|
+
'meta' => data_get($this, 'meta', (object) []),
|
|
46
|
+
'subject_name' => $this->subject_name,
|
|
47
|
+
'item_count' => $this->item_count,
|
|
48
|
+
'is_published' => $this->is_published,
|
|
49
|
+
'published_at' => $this->published_at,
|
|
50
|
+
'updated_at' => $this->updated_at,
|
|
51
|
+
'created_at' => $this->created_at,
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A field group as the API answers it. The console gets the identifiers it
|
|
57
|
+
* addresses the category by; the driver gets what it renders.
|
|
58
|
+
*/
|
|
59
|
+
public static function groupToArray(Category $group, bool $internal, bool $withFields = true): array
|
|
60
|
+
{
|
|
61
|
+
$data = [
|
|
62
|
+
'id' => $internal ? $group->uuid : ($group->public_id ?? $group->uuid),
|
|
63
|
+
'uuid' => $group->uuid,
|
|
64
|
+
'name' => $group->name,
|
|
65
|
+
'description' => $group->description,
|
|
66
|
+
'order' => $group->order === null ? null : (int) $group->order,
|
|
67
|
+
'meta' => is_array($group->meta) && !empty($group->meta) ? $group->meta : (object) [],
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
if ($internal) {
|
|
71
|
+
$data['public_id'] = $group->public_id;
|
|
72
|
+
$data['company_uuid'] = $group->company_uuid;
|
|
73
|
+
$data['owner_uuid'] = $group->owner_uuid;
|
|
74
|
+
$data['owner_type'] = $group->owner_type;
|
|
75
|
+
$data['for'] = $group->for;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if ($withFields) {
|
|
79
|
+
$fields = $group->relationLoaded('fields') ? $group->getRelation('fields') : collect();
|
|
80
|
+
$data['fields'] = collect($fields)->map(fn (CustomField $field) => static::fieldToArray($field, $internal))->values()->all();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return $data;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A field as the API answers it.
|
|
88
|
+
*
|
|
89
|
+
* The id a consumer sees here is the id a submit names the field by, and
|
|
90
|
+
* the id that comes back on the submission's answers — the three have to
|
|
91
|
+
* agree, so this follows the groups above: the public id outside, the uuid
|
|
92
|
+
* on the console's own namespace.
|
|
93
|
+
*/
|
|
94
|
+
public static function fieldToArray(CustomField $field, bool $internal): array
|
|
95
|
+
{
|
|
96
|
+
$data = [
|
|
97
|
+
'id' => $internal ? $field->uuid : ($field->public_id ?? $field->uuid),
|
|
98
|
+
'name' => $field->name,
|
|
99
|
+
'label' => $field->label,
|
|
100
|
+
'description' => $field->description,
|
|
101
|
+
'help_text' => $field->help_text,
|
|
102
|
+
'type' => $field->type,
|
|
103
|
+
// A field written straight into the table — by a seed, or by an
|
|
104
|
+
// older builder — may carry no component. The type names its own.
|
|
105
|
+
'component' => $field->component ?: InspectionFormSync::componentFor((string) $field->type),
|
|
106
|
+
'required' => (bool) $field->required,
|
|
107
|
+
'editable' => $field->editable === null ? true : (bool) $field->editable,
|
|
108
|
+
'options' => is_array($field->options) ? array_values($field->options) : [],
|
|
109
|
+
'order' => $field->order === null ? null : (int) $field->order,
|
|
110
|
+
'meta' => is_array($field->meta) && !empty($field->meta) ? $field->meta : (object) [],
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
if ($internal) {
|
|
114
|
+
$data['uuid'] = $field->uuid;
|
|
115
|
+
$data['company_uuid'] = $field->company_uuid;
|
|
116
|
+
$data['category_uuid'] = $field->category_uuid;
|
|
117
|
+
$data['subject_uuid'] = $field->subject_uuid;
|
|
118
|
+
$data['subject_type'] = $field->subject_type;
|
|
119
|
+
$data['for'] = $field->for;
|
|
120
|
+
$data['default_value'] = $field->default_value;
|
|
121
|
+
$data['validation_rules'] = $field->validation_rules;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return $data;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
protected function setSubjectType(?array $resolved): ?array
|
|
128
|
+
{
|
|
129
|
+
if (empty($resolved)) {
|
|
130
|
+
return $resolved;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
$bareSlug = Str::kebab(class_basename($this->subject_type ?? ''));
|
|
134
|
+
|
|
135
|
+
data_set($resolved, 'type', 'maintenance-subject-' . $bareSlug);
|
|
136
|
+
data_set($resolved, 'subject_type', 'maintenance-subject-' . $bareSlug);
|
|
137
|
+
|
|
138
|
+
return $resolved;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
protected function transformMorphResource($model): ?array
|
|
142
|
+
{
|
|
143
|
+
if (!$model) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Always answers: a model with no resource of its own is served by the
|
|
148
|
+
// base FleetbaseResource, so there is no second fallback to keep here.
|
|
149
|
+
$resourceClass = \Fleetbase\Support\Find::httpResourceForModel($model);
|
|
150
|
+
|
|
151
|
+
return (new $resourceClass($model))->resolve();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Support\InspectionFileStore;
|
|
6
|
+
use Fleetbase\FleetOps\Support\Utils;
|
|
7
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
8
|
+
use Fleetbase\Support\Http;
|
|
9
|
+
|
|
10
|
+
class InspectionItemResult extends FleetbaseResource
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* Transform the resource into an array.
|
|
14
|
+
*
|
|
15
|
+
* @param \Illuminate\Http\Request $request
|
|
16
|
+
*
|
|
17
|
+
* @return array
|
|
18
|
+
*/
|
|
19
|
+
public function toArray($request)
|
|
20
|
+
{
|
|
21
|
+
return [
|
|
22
|
+
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->uuid),
|
|
23
|
+
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
24
|
+
'company_uuid' => $this->when(Http::isInternalRequest(), $this->company_uuid),
|
|
25
|
+
'inspection_submission_uuid' => $this->when(Http::isInternalRequest(), $this->inspection_submission_uuid),
|
|
26
|
+
'issue_uuid' => $this->when(Http::isInternalRequest(), $this->issue_uuid),
|
|
27
|
+
'work_order_uuid' => $this->when(Http::isInternalRequest(), $this->work_order_uuid),
|
|
28
|
+
'item_key' => $this->item_key,
|
|
29
|
+
'label' => $this->label,
|
|
30
|
+
'category' => $this->category,
|
|
31
|
+
'status' => $this->status,
|
|
32
|
+
'severity' => $this->severity,
|
|
33
|
+
'passed' => $this->passed,
|
|
34
|
+
'comments' => $this->comments,
|
|
35
|
+
'photos' => $this->projectPhotos(),
|
|
36
|
+
'meta' => $this->projectMeta(),
|
|
37
|
+
'submission_id' => $this->submission_id,
|
|
38
|
+
'updated_at' => $this->updated_at,
|
|
39
|
+
'created_at' => $this->created_at,
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `custom_field_uuid` links a result back to the field it mirrors, which is
|
|
45
|
+
* the console's business. Outside, `item_key` already names the field, so
|
|
46
|
+
* the uuid is not something a consumer should have to see.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* A result's photos are stored as `file:<uuid>` references, the same as the
|
|
50
|
+
* answer they mirror — and the answer hands back something fetchable, so
|
|
51
|
+
* this does too rather than leaking the uuid. A flat `item_results` submit
|
|
52
|
+
* stores no file, and `project()` hands those values straight back.
|
|
53
|
+
*/
|
|
54
|
+
protected function projectPhotos(): array
|
|
55
|
+
{
|
|
56
|
+
$photos = data_get($this, 'photos', []);
|
|
57
|
+
if (!is_array($photos) || empty($photos)) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return array_values(array_map(fn ($photo) => InspectionFileStore::project($photo), $photos));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected function projectMeta(): mixed
|
|
65
|
+
{
|
|
66
|
+
$meta = data_get($this, 'meta');
|
|
67
|
+
if (!is_array($meta) || empty($meta)) {
|
|
68
|
+
return Utils::createObject();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!Http::isInternalRequest()) {
|
|
72
|
+
unset($meta['custom_field_uuid']);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return empty($meta) ? Utils::createObject() : $meta;
|
|
76
|
+
}
|
|
77
|
+
}
|