@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
|
@@ -2,87 +2,1405 @@ import Controller from '@ember/controller';
|
|
|
2
2
|
import { tracked } from '@glimmer/tracking';
|
|
3
3
|
import { inject as service } from '@ember/service';
|
|
4
4
|
import { action } from '@ember/object';
|
|
5
|
-
import {
|
|
5
|
+
import { getOwner } from '@ember/application';
|
|
6
|
+
import { task, timeout } from 'ember-concurrency';
|
|
7
|
+
import { format } from 'date-fns';
|
|
8
|
+
import { PANEL_DEFAULTS } from '../../utils/context-panel';
|
|
9
|
+
import { RADAR_PILLS, RADAR_DEFAULT_VIEWS, SNOOZE_PRESETS, snoozePayloadFor, patchPayload, recordPanelFor, recordOf } from '../../utils/radar';
|
|
6
10
|
|
|
11
|
+
const VIEWS_CACHE_KEY = 'fleetops:radar:views';
|
|
12
|
+
const VIEW_MODE_CACHE_KEY = 'fleetops:radar:view';
|
|
13
|
+
const BRIEFING_CACHE_KEY = 'fleetops:radar:briefing-collapsed';
|
|
14
|
+
const PAGE_SIZE = 50;
|
|
15
|
+
|
|
16
|
+
/** A record key Radar holds as a uuid rather than a public id. */
|
|
17
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Radar: the triage list that replaced the Resources Hub.
|
|
21
|
+
*
|
|
22
|
+
* The list, its pills, tabs and saved views live in query params so a view
|
|
23
|
+
* is shareable. Items come from `fleet-ops/radar/items`; every action on an
|
|
24
|
+
* item posts to the same prefix and patches the row in place, so the list
|
|
25
|
+
* never reflows under the cursor.
|
|
26
|
+
*/
|
|
7
27
|
export default class ManagementIndexController extends Controller {
|
|
8
28
|
@service fetch;
|
|
9
|
-
@service
|
|
29
|
+
@service notifications;
|
|
30
|
+
@service intl;
|
|
31
|
+
@service appCache;
|
|
32
|
+
@service hostRouter;
|
|
33
|
+
@service store;
|
|
34
|
+
@service modalsManager;
|
|
35
|
+
@service currentUser;
|
|
36
|
+
@service inspectionSubmissionActions;
|
|
37
|
+
@service inspectionFormActions;
|
|
38
|
+
@service issueActions;
|
|
39
|
+
@service resourceContextPanel;
|
|
40
|
+
|
|
41
|
+
queryParams = ['view', 'status', 'filters', 'category', 'fleet', 'q', 'saved', 'assigned', 'window'];
|
|
10
42
|
|
|
11
|
-
@tracked
|
|
43
|
+
@tracked view = 'list';
|
|
44
|
+
@tracked status = 'open';
|
|
45
|
+
@tracked filters = '';
|
|
46
|
+
@tracked category = '';
|
|
47
|
+
@tracked fleet = '';
|
|
48
|
+
@tracked q = '';
|
|
49
|
+
@tracked saved = '';
|
|
50
|
+
@tracked assigned = '';
|
|
51
|
+
@tracked window = '24h';
|
|
52
|
+
@tracked page = 1;
|
|
53
|
+
|
|
54
|
+
@tracked payload = null;
|
|
55
|
+
@tracked summary = null;
|
|
56
|
+
@tracked briefing = null;
|
|
57
|
+
@tracked agenda = null;
|
|
58
|
+
@tracked handover = null;
|
|
59
|
+
@tracked strips = [];
|
|
60
|
+
@tracked briefingCollapsed = false;
|
|
61
|
+
@tracked busyDecisionKey = null;
|
|
62
|
+
@tracked selection = [];
|
|
63
|
+
@tracked selectionAnchor = null;
|
|
64
|
+
@tracked focusedKey = null;
|
|
65
|
+
@tracked drawerItem = null;
|
|
66
|
+
@tracked savedViews = [];
|
|
67
|
+
@tracked lastLoadedAt = null;
|
|
68
|
+
|
|
69
|
+
snoozePresets = SNOOZE_PRESETS;
|
|
12
70
|
|
|
13
71
|
constructor() {
|
|
14
72
|
super(...arguments);
|
|
15
|
-
this.
|
|
73
|
+
this.view = this.appCache.get(VIEW_MODE_CACHE_KEY, 'list') === 'agenda' ? 'agenda' : 'list';
|
|
74
|
+
this.briefingCollapsed = this.appCache.get(BRIEFING_CACHE_KEY, false) === true;
|
|
75
|
+
this.savedViews = this.readSavedViews();
|
|
16
76
|
}
|
|
17
77
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
78
|
+
// ------------------------------------------------------------------
|
|
79
|
+
// Derived state
|
|
80
|
+
// ------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
get items() {
|
|
83
|
+
return this.payload?.items ?? [];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get groups() {
|
|
87
|
+
return this.payload?.groups ?? [];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get counts() {
|
|
91
|
+
return this.payload?.counts ?? this.summary?.counts ?? {};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get stats() {
|
|
95
|
+
return this.summary?.summary ?? this.payload?.summary ?? {};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get meta() {
|
|
99
|
+
return this.payload?.meta ?? { total: 0, page: 1, pages: 1, limit: PAGE_SIZE };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
get snoozeSchedule() {
|
|
103
|
+
return this.payload?.snooze_schedule ?? [];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
get sourceErrors() {
|
|
107
|
+
return Object.keys(this.payload?.sources ?? {});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get sourceErrorsText() {
|
|
111
|
+
return this.sourceErrors.join(', ');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
get previousPage() {
|
|
115
|
+
return Math.max(1, (this.meta.page ?? 1) - 1);
|
|
23
116
|
}
|
|
24
117
|
|
|
25
|
-
get
|
|
26
|
-
return (this.
|
|
118
|
+
get nextPage() {
|
|
119
|
+
return Math.min(this.meta.pages ?? 1, (this.meta.page ?? 1) + 1);
|
|
27
120
|
}
|
|
28
121
|
|
|
29
|
-
get
|
|
30
|
-
return this.
|
|
122
|
+
get activeFilters() {
|
|
123
|
+
return this.filters ? this.filters.split(',').filter(Boolean) : [];
|
|
31
124
|
}
|
|
32
125
|
|
|
33
|
-
get
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
126
|
+
get pills() {
|
|
127
|
+
return RADAR_PILLS.map((key) => ({
|
|
128
|
+
key,
|
|
129
|
+
label: this.intl.t(`radar.pills.${key}`),
|
|
130
|
+
count: this.counts[key] ?? 0,
|
|
131
|
+
active: this.activeFilters.includes(key),
|
|
132
|
+
dot: key === 'overdue',
|
|
37
133
|
}));
|
|
38
134
|
}
|
|
39
135
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
136
|
+
get isFiltered() {
|
|
137
|
+
return this.activeFilters.length > 0 || Boolean(this.q) || Boolean(this.category) || this.assigned === 'me';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get isLoading() {
|
|
141
|
+
return this.loadItems.isRunning && !this.payload;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get isEmpty() {
|
|
145
|
+
return !this.loadItems.isRunning && Boolean(this.payload) && this.items.length === 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
get allViews() {
|
|
149
|
+
return [...RADAR_DEFAULT_VIEWS.map((view) => ({ ...view, label: this.intl.t(view.intl) })), ...this.savedViews];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get activeView() {
|
|
153
|
+
return this.allViews.find((view) => view.id === this.saved) ?? null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
get hasSelection() {
|
|
157
|
+
return this.selection.length > 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get selectedItems() {
|
|
161
|
+
return this.items.filter((item) => this.selection.includes(item.key));
|
|
162
|
+
}
|
|
48
163
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
issues: 'Review Issues',
|
|
53
|
-
fuel_records: 'Review Fuel Records',
|
|
54
|
-
};
|
|
164
|
+
get isAllSelected() {
|
|
165
|
+
return this.items.length > 0 && this.items.every((item) => this.selection.includes(item.key));
|
|
166
|
+
}
|
|
55
167
|
|
|
56
|
-
|
|
57
|
-
|
|
168
|
+
get focusedItem() {
|
|
169
|
+
return this.items.find((item) => item.key === this.focusedKey) ?? null;
|
|
170
|
+
}
|
|
58
171
|
|
|
172
|
+
/**
|
|
173
|
+
* With a selection, the action keys run over the selection; without one
|
|
174
|
+
* they act on the focused row.
|
|
175
|
+
*/
|
|
176
|
+
get keyboardHandlers() {
|
|
59
177
|
return {
|
|
60
|
-
|
|
61
|
-
|
|
178
|
+
next: this.focusNext,
|
|
179
|
+
previous: this.focusPrevious,
|
|
180
|
+
select: this.toggleFocusedSelection,
|
|
181
|
+
acknowledge: () => this.actOnSelectionOrFocused('acknowledge'),
|
|
182
|
+
snooze: () => this.actOnSelectionOrFocused('snooze', snoozePayloadFor('1h')),
|
|
183
|
+
assign: () => this.actOnSelectionOrFocused('assign'),
|
|
184
|
+
open: this.openFocused,
|
|
185
|
+
close: this.closeOpen,
|
|
186
|
+
search: this.focusSearch,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ------------------------------------------------------------------
|
|
191
|
+
// Loading
|
|
192
|
+
// ------------------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
@task *reload() {
|
|
195
|
+
const loads = [this.loadSummary.perform(), this.loadItems.perform(), this.loadBriefing.perform()];
|
|
196
|
+
if (this.view === 'agenda') {
|
|
197
|
+
loads.push(this.loadAgenda.perform());
|
|
198
|
+
}
|
|
199
|
+
yield Promise.all(loads);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@task({ restartable: true }) *loadAgenda() {
|
|
203
|
+
try {
|
|
204
|
+
this.agenda = yield this.fetch.get('fleet-ops/radar/agenda', { window: this.window, fleet: this.fleet });
|
|
205
|
+
} catch (err) {
|
|
206
|
+
this.notifications.serverError(err);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@task({ restartable: true }) *loadBriefing() {
|
|
211
|
+
try {
|
|
212
|
+
this.briefing = yield this.fetch.get('fleet-ops/radar/briefing');
|
|
213
|
+
} catch (err) {
|
|
214
|
+
this.notifications.serverError(err);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@task({ restartable: true }) *loadItems(debounce = false) {
|
|
219
|
+
if (debounce) {
|
|
220
|
+
yield timeout(250);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const params = {
|
|
224
|
+
status: this.status,
|
|
225
|
+
filters: this.filters,
|
|
226
|
+
category: this.category,
|
|
227
|
+
fleet: this.fleet,
|
|
228
|
+
query: this.q,
|
|
229
|
+
assigned: this.assigned,
|
|
230
|
+
page: this.page,
|
|
231
|
+
limit: PAGE_SIZE,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
try {
|
|
235
|
+
this.payload = yield this.fetch.get('fleet-ops/radar/items', params);
|
|
236
|
+
this.lastLoadedAt = new Date();
|
|
237
|
+
this.pruneSelection();
|
|
238
|
+
if (this.focusedKey && !this.items.some((item) => item.key === this.focusedKey)) {
|
|
239
|
+
this.focusedKey = null;
|
|
240
|
+
}
|
|
241
|
+
} catch (err) {
|
|
242
|
+
this.notifications.serverError(err);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@task({ restartable: true }) *loadSummary() {
|
|
247
|
+
try {
|
|
248
|
+
this.summary = yield this.fetch.get('fleet-ops/radar/summary');
|
|
249
|
+
} catch {
|
|
250
|
+
// The header falls back to the list's own summary.
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// ------------------------------------------------------------------
|
|
255
|
+
// Filters, tabs, views
|
|
256
|
+
// ------------------------------------------------------------------
|
|
257
|
+
|
|
258
|
+
@action togglePill(key) {
|
|
259
|
+
const active = new Set(this.activeFilters);
|
|
260
|
+
if (active.has(key)) {
|
|
261
|
+
active.delete(key);
|
|
262
|
+
} else {
|
|
263
|
+
active.add(key);
|
|
264
|
+
}
|
|
265
|
+
this.filters = [...active].join(',');
|
|
266
|
+
this.saved = '';
|
|
267
|
+
this.page = 1;
|
|
268
|
+
this.loadItems.perform();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@action clearFilters() {
|
|
272
|
+
this.filters = '';
|
|
273
|
+
this.category = '';
|
|
274
|
+
this.q = '';
|
|
275
|
+
this.assigned = '';
|
|
276
|
+
this.saved = '';
|
|
277
|
+
this.page = 1;
|
|
278
|
+
this.loadItems.perform();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
@action setStatus(status) {
|
|
282
|
+
if (status === this.status) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.status = status;
|
|
286
|
+
this.page = 1;
|
|
287
|
+
this.selection = [];
|
|
288
|
+
this.loadItems.perform();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@action search(query) {
|
|
292
|
+
this.q = query ?? '';
|
|
293
|
+
this.page = 1;
|
|
294
|
+
this.loadItems.perform(true);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@action setView(view) {
|
|
298
|
+
this.view = view === 'agenda' ? 'agenda' : 'list';
|
|
299
|
+
this.appCache.set(VIEW_MODE_CACHE_KEY, this.view);
|
|
300
|
+
if (this.view === 'agenda') {
|
|
301
|
+
this.loadAgenda.perform();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@action setWindow(window) {
|
|
306
|
+
this.window = window === '7d' ? '7d' : '24h';
|
|
307
|
+
this.loadAgenda.perform();
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** An agenda entry is an item in another coat: open the same drawer. */
|
|
311
|
+
@action openAgendaEntry(entry) {
|
|
312
|
+
if (!entry?.key) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const item = this.items.find((row) => row.key === entry.key) ?? {
|
|
316
|
+
key: entry.key,
|
|
317
|
+
rule: entry.rule,
|
|
318
|
+
category: entry.category,
|
|
319
|
+
severity: entry.severity,
|
|
320
|
+
title: entry.title,
|
|
321
|
+
subject: entry.subject,
|
|
322
|
+
meta_line: entry.meta_line,
|
|
323
|
+
due_at: entry.at,
|
|
324
|
+
due_bucket: 'none',
|
|
325
|
+
due_label: entry.label,
|
|
326
|
+
window: null,
|
|
327
|
+
record: entry.record,
|
|
328
|
+
actions: entry.actions ?? [],
|
|
329
|
+
state: entry.state ?? { status: 'open' },
|
|
330
|
+
details: null,
|
|
62
331
|
};
|
|
332
|
+
this.openDrawer(item);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
@action showAnytimeInList() {
|
|
336
|
+
this.setView('list');
|
|
337
|
+
this.clearFilters();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Dropping a tray item on a lane gives it a time. */
|
|
341
|
+
@task *planItem(key, plannedAt) {
|
|
342
|
+
try {
|
|
343
|
+
yield this.fetch.post(`fleet-ops/radar/items/${encodeURIComponent(key)}/plan`, { planned_at: plannedAt });
|
|
344
|
+
this.notifications.success(this.intl.t('radar.toasts.planned'));
|
|
345
|
+
yield Promise.all([this.loadAgenda.perform(), this.loadItems.perform()]);
|
|
346
|
+
} catch (err) {
|
|
347
|
+
this.notifications.serverError(err);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ------------------------------------------------------------------
|
|
352
|
+
// Handover
|
|
353
|
+
// ------------------------------------------------------------------
|
|
354
|
+
|
|
355
|
+
@task({ restartable: true }) *openHandover(key) {
|
|
356
|
+
this.handover = null;
|
|
357
|
+
try {
|
|
358
|
+
const response = yield this.fetch.get(`fleet-ops/radar/handovers/${encodeURIComponent(key)}`);
|
|
359
|
+
this.handover = response?.handover ?? null;
|
|
360
|
+
} catch (err) {
|
|
361
|
+
this.notifications.serverError(err);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@action closeHandover() {
|
|
366
|
+
this.handover = null;
|
|
63
367
|
}
|
|
64
368
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
369
|
+
@task({ drop: true }) *reassignOrders(handover) {
|
|
370
|
+
const ids = (handover?.orders ?? []).map((order) => order.uuid).filter(Boolean);
|
|
371
|
+
const driver = handover?.suggested?.driver;
|
|
372
|
+
if (!ids.length || !driver?.uuid) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
try {
|
|
377
|
+
yield this.fetch.patch('orders/bulk-assign-driver', { ids, driver: driver.uuid });
|
|
378
|
+
this.notifications.success(this.intl.t('radar.handover.reassigned', { name: driver.label }));
|
|
379
|
+
this.handover = null;
|
|
380
|
+
this.reload.perform();
|
|
381
|
+
} catch (err) {
|
|
382
|
+
this.notifications.serverError(err);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@task({ drop: true }) *extendShift(handover, minutes = 60) {
|
|
387
|
+
const shiftId = handover?.shift?.uuid ?? handover?.shift?.public_id;
|
|
388
|
+
if (!shiftId) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
try {
|
|
393
|
+
yield this.fetch.post(`fleet-ops/radar/shifts/${shiftId}/extend`, { minutes });
|
|
394
|
+
this.notifications.success(this.intl.t('radar.handover.extended'));
|
|
395
|
+
this.handover = null;
|
|
396
|
+
this.reload.perform();
|
|
397
|
+
} catch (err) {
|
|
398
|
+
this.notifications.serverError(err);
|
|
399
|
+
}
|
|
72
400
|
}
|
|
73
401
|
|
|
74
|
-
@
|
|
75
|
-
if (!
|
|
402
|
+
@task({ drop: true }) *snoozeHandover(handover) {
|
|
403
|
+
if (!handover?.key) {
|
|
76
404
|
return;
|
|
77
405
|
}
|
|
406
|
+
yield this.stateAction({ key: handover.key }, 'snooze', { minutes: 60 });
|
|
407
|
+
this.handover = null;
|
|
408
|
+
this.loadAgenda.perform();
|
|
409
|
+
}
|
|
78
410
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
411
|
+
@action setPage(page) {
|
|
412
|
+
this.page = Math.max(1, page);
|
|
413
|
+
this.loadItems.perform();
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@action applyView(view) {
|
|
417
|
+
this.saved = view.id;
|
|
418
|
+
this.status = view.status ?? 'open';
|
|
419
|
+
this.filters = view.filters ?? '';
|
|
420
|
+
this.category = view.category ?? '';
|
|
421
|
+
this.q = view.q ?? '';
|
|
422
|
+
this.assigned = view.assigned ?? '';
|
|
423
|
+
this.page = 1;
|
|
424
|
+
this.loadItems.perform();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
@action saveCurrentView() {
|
|
428
|
+
return this.modalsManager.show('modals/radar-save-view', {
|
|
429
|
+
title: this.intl.t('radar.saved-views.save-current'),
|
|
430
|
+
acceptButtonText: this.intl.t('common.save'),
|
|
431
|
+
acceptButtonIcon: 'save',
|
|
432
|
+
name: '',
|
|
433
|
+
confirm: (modal) => {
|
|
434
|
+
const name = (modal.getOption('name') ?? '').trim();
|
|
435
|
+
if (!name) {
|
|
436
|
+
return this.notifications.warning(this.intl.t('radar.saved-views.name-prompt'));
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const view = {
|
|
440
|
+
id: `view-${Date.now()}`,
|
|
441
|
+
label: name,
|
|
442
|
+
status: this.status,
|
|
443
|
+
filters: this.filters,
|
|
444
|
+
category: this.category,
|
|
445
|
+
q: this.q,
|
|
446
|
+
assigned: this.assigned,
|
|
447
|
+
};
|
|
448
|
+
this.savedViews = [...this.savedViews, view];
|
|
449
|
+
this.writeSavedViews();
|
|
450
|
+
this.saved = view.id;
|
|
451
|
+
this.notifications.success(this.intl.t('radar.saved-views.saved'));
|
|
452
|
+
modal.done();
|
|
453
|
+
},
|
|
82
454
|
});
|
|
83
455
|
}
|
|
84
456
|
|
|
85
|
-
@
|
|
86
|
-
this.
|
|
457
|
+
@action deleteView(view) {
|
|
458
|
+
this.savedViews = this.savedViews.filter((saved) => saved.id !== view.id);
|
|
459
|
+
this.writeSavedViews();
|
|
460
|
+
if (this.saved === view.id) {
|
|
461
|
+
this.saved = '';
|
|
462
|
+
}
|
|
463
|
+
this.notifications.info(this.intl.t('radar.saved-views.deleted'));
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
readSavedViews() {
|
|
467
|
+
const views = this.appCache.get(VIEWS_CACHE_KEY, []);
|
|
468
|
+
|
|
469
|
+
return Array.isArray(views) ? views.filter((view) => view && view.id && view.label) : [];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
writeSavedViews() {
|
|
473
|
+
this.appCache.set(VIEWS_CACHE_KEY, this.savedViews);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// ------------------------------------------------------------------
|
|
477
|
+
// Selection and focus
|
|
478
|
+
// ------------------------------------------------------------------
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Toggle one row, or with Shift held set every row between the last row
|
|
482
|
+
* toggled and this one to this row's new state, the way a mail inbox does.
|
|
483
|
+
*/
|
|
484
|
+
@action toggleSelect(item, { range = false } = {}) {
|
|
485
|
+
const key = item.key;
|
|
486
|
+
const select = !this.selection.includes(key);
|
|
487
|
+
const keys = this.items.map((row) => row.key);
|
|
488
|
+
const from = keys.indexOf(this.selectionAnchor);
|
|
489
|
+
const to = keys.indexOf(key);
|
|
490
|
+
|
|
491
|
+
let affected = [key];
|
|
492
|
+
if (range && from !== -1 && to !== -1) {
|
|
493
|
+
affected = keys.slice(Math.min(from, to), Math.max(from, to) + 1);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const selection = new Set(this.selection);
|
|
497
|
+
for (const affectedKey of affected) {
|
|
498
|
+
if (select) {
|
|
499
|
+
selection.add(affectedKey);
|
|
500
|
+
} else {
|
|
501
|
+
selection.delete(affectedKey);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
this.selection = keys.filter((rowKey) => selection.has(rowKey));
|
|
506
|
+
this.selectionAnchor = key;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
@action selectAll() {
|
|
510
|
+
this.selection = this.isAllSelected ? [] : this.items.map((item) => item.key);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
@action clearSelection() {
|
|
514
|
+
this.selectionAnchor = null;
|
|
515
|
+
this.selection = [];
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
pruneSelection() {
|
|
519
|
+
const keys = new Set(this.items.map((item) => item.key));
|
|
520
|
+
this.selection = this.selection.filter((key) => keys.has(key));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
@action focusItem(item) {
|
|
524
|
+
this.focusedKey = item?.key ?? null;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
@action focusNext() {
|
|
528
|
+
this.moveFocus(1);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
@action focusPrevious() {
|
|
532
|
+
this.moveFocus(-1);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
moveFocus(step) {
|
|
536
|
+
const items = this.items;
|
|
537
|
+
if (!items.length) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const index = items.findIndex((item) => item.key === this.focusedKey);
|
|
542
|
+
const next = index === -1 ? (step > 0 ? 0 : items.length - 1) : Math.min(items.length - 1, Math.max(0, index + step));
|
|
543
|
+
this.focusedKey = items[next].key;
|
|
544
|
+
document.querySelector(`[data-radar-key="${CSS.escape(this.focusedKey)}"]`)?.scrollIntoView({ block: 'nearest' });
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
@action toggleFocusedSelection() {
|
|
548
|
+
if (this.focusedItem) {
|
|
549
|
+
this.toggleSelect(this.focusedItem);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
@action openFocused() {
|
|
554
|
+
if (this.focusedItem) {
|
|
555
|
+
this.openDrawer(this.focusedItem);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
actOnFocused(actionName, payload = {}) {
|
|
560
|
+
if (this.focusedItem) {
|
|
561
|
+
this.act.perform(this.focusedItem, actionName, payload);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
actOnSelectionOrFocused(actionName, payload = {}) {
|
|
566
|
+
if (this.hasSelection) {
|
|
567
|
+
return this.bulkAct.perform(actionName, payload);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return this.actOnFocused(actionName, payload);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
@action closeOpen() {
|
|
574
|
+
if (this.drawerItem) {
|
|
575
|
+
return this.closeDrawer();
|
|
576
|
+
}
|
|
577
|
+
if (this.hasSelection) {
|
|
578
|
+
return this.clearSelection();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
@action focusSearch() {
|
|
583
|
+
document.querySelector('.fleet-ops-radar-search input')?.focus();
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
// ------------------------------------------------------------------
|
|
587
|
+
// Drawer
|
|
588
|
+
// ------------------------------------------------------------------
|
|
589
|
+
|
|
590
|
+
@action openDrawer(item) {
|
|
591
|
+
this.drawerItem = item;
|
|
592
|
+
this.focusedKey = item?.key ?? this.focusedKey;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
@action closeDrawer() {
|
|
596
|
+
this.drawerItem = null;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// ------------------------------------------------------------------
|
|
600
|
+
// Acting on items
|
|
601
|
+
// ------------------------------------------------------------------
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Every action a row, the drawer or a key can fire, by name. State
|
|
605
|
+
* actions post to Radar; record actions use the record's own endpoint.
|
|
606
|
+
*/
|
|
607
|
+
@task *act(item, actionName, payload = {}) {
|
|
608
|
+
switch (actionName) {
|
|
609
|
+
case 'acknowledge':
|
|
610
|
+
return yield this.stateAction(item, 'acknowledge', {}, 'radar.toasts.acknowledged');
|
|
611
|
+
case 'snooze':
|
|
612
|
+
return yield this.snoozeItem(item, payload);
|
|
613
|
+
case 'wake':
|
|
614
|
+
return yield this.stateAction(item, 'wake', {}, 'radar.toasts.woken');
|
|
615
|
+
case 'assign':
|
|
616
|
+
return yield this.assignItem(item);
|
|
617
|
+
case 'unassign':
|
|
618
|
+
return yield this.stateAction(item, 'assign', {}, 'radar.toasts.unassigned');
|
|
619
|
+
case 'plan':
|
|
620
|
+
return yield this.stateAction(item, 'plan', { planned_at: payload.planned_at ?? null }, 'radar.toasts.planned');
|
|
621
|
+
case 'unplan':
|
|
622
|
+
return yield this.stateAction(item, 'plan', { planned_at: null }, 'radar.toasts.planned');
|
|
623
|
+
case 'resolve':
|
|
624
|
+
return yield this.stateAction(item, 'resolve', { resolution: payload.resolution ?? null }, 'radar.toasts.resolved');
|
|
625
|
+
case 'open_record':
|
|
626
|
+
return this.openRecord(item);
|
|
627
|
+
case 'assign_vehicle':
|
|
628
|
+
return yield this.assignVehicle(item);
|
|
629
|
+
case 'assign_driver':
|
|
630
|
+
return yield this.assignDriver(item);
|
|
631
|
+
case 'create_work_order':
|
|
632
|
+
return yield this.createWorkOrderFromSchedule(item);
|
|
633
|
+
case 'create_work_order_from_inspection':
|
|
634
|
+
return yield this.inspectionFollowUp(item, 'createWorkOrder');
|
|
635
|
+
case 'create_issue_from_inspection':
|
|
636
|
+
return yield this.inspectionFollowUp(item, 'createIssue');
|
|
637
|
+
case 'resolve_inspection':
|
|
638
|
+
return yield this.inspectionFollowUp(item, 'resolve');
|
|
639
|
+
case 'resolve_issue':
|
|
640
|
+
return yield this.resolveIssue(item);
|
|
641
|
+
case 'match_vehicle':
|
|
642
|
+
return yield this.matchVehicle(item);
|
|
643
|
+
case 'ignore_transaction':
|
|
644
|
+
return yield this.ignoreTransaction(item);
|
|
645
|
+
case 'attach_device':
|
|
646
|
+
return yield this.attachDevice(item);
|
|
647
|
+
case 'send_pin':
|
|
648
|
+
return yield this.sendPin(item);
|
|
649
|
+
case 'revoke_link':
|
|
650
|
+
return yield this.revokeLink(item);
|
|
651
|
+
case 'call':
|
|
652
|
+
return this.callDriver(item);
|
|
653
|
+
case 'delete_notice':
|
|
654
|
+
return yield this.deleteNotice(item);
|
|
655
|
+
case 'cover_shift':
|
|
656
|
+
case 'handover':
|
|
657
|
+
return yield this.openHandover.perform(item.key);
|
|
658
|
+
case 'extend_shift': {
|
|
659
|
+
const shiftId = item.source?.uuid ?? item.source?.public_id;
|
|
660
|
+
return shiftId ? yield this.extendShift.perform({ shift: { uuid: shiftId } }, 60) : null;
|
|
661
|
+
}
|
|
662
|
+
default:
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* One state action over the selection: acknowledge, snooze, wake or
|
|
669
|
+
* assign. Assign asks who first, then posts once for every key.
|
|
670
|
+
*/
|
|
671
|
+
@task({ drop: true }) *bulkAct(actionName, payload = {}) {
|
|
672
|
+
const keys = [...this.selection];
|
|
673
|
+
if (!keys.length) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (actionName === 'assign') {
|
|
678
|
+
return yield this.bulkAssign(keys);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (actionName === 'revoke_link') {
|
|
682
|
+
return yield this.bulkRevokeLinks(this.selectedItems.filter((item) => item.actions?.includes('revoke_link')));
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const body = { keys, action: actionName };
|
|
686
|
+
if (actionName === 'snooze') {
|
|
687
|
+
Object.assign(body, payload.minutes || payload.until ? { minutes: payload.minutes, until: payload.until } : snoozePayloadFor(payload.preset ?? '1h'));
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
yield this.postBulk(body);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
async bulkAssign(keys) {
|
|
694
|
+
return this.modalsManager.show('modals/radar-select-resource', {
|
|
695
|
+
title: this.intl.t('radar.prompts.assign-user-title'),
|
|
696
|
+
helpText: this.intl.t('radar.prompts.assign-user-help'),
|
|
697
|
+
inputLabel: this.intl.t('radar.prompts.select-user'),
|
|
698
|
+
placeholder: this.intl.t('radar.prompts.select-user'),
|
|
699
|
+
modelName: 'user',
|
|
700
|
+
query: { is_not_customer: true },
|
|
701
|
+
allowClear: true,
|
|
702
|
+
selected: null,
|
|
703
|
+
acceptButtonText: this.intl.t('radar.actions.assign'),
|
|
704
|
+
acceptButtonIcon: 'user-plus',
|
|
705
|
+
confirm: async (modal) => {
|
|
706
|
+
const user = modal.getOption('selected');
|
|
707
|
+
modal.startLoading();
|
|
708
|
+
const ok = await this.postBulk({ keys, action: 'assign', user: user?.id ?? null });
|
|
709
|
+
modal.stopLoading();
|
|
710
|
+
if (ok) {
|
|
711
|
+
modal.done();
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Revoke every selected inspection link at once. Each link is its own
|
|
719
|
+
* delete, so one failure does not stop the rest; the toast counts both.
|
|
720
|
+
*/
|
|
721
|
+
async bulkRevokeLinks(items) {
|
|
722
|
+
if (!items.length) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
return this.modalsManager.confirm({
|
|
727
|
+
title: this.intl.t('radar.prompts.bulk-revoke-link-title', { count: items.length }),
|
|
728
|
+
body: this.intl.t('radar.prompts.bulk-revoke-link-body'),
|
|
729
|
+
acceptButtonText: this.intl.t('radar.actions.revoke-links', { count: items.length }),
|
|
730
|
+
acceptButtonIcon: 'link-slash',
|
|
731
|
+
acceptButtonType: 'danger',
|
|
732
|
+
confirm: async (modal) => {
|
|
733
|
+
modal.startLoading();
|
|
734
|
+
|
|
735
|
+
const results = await Promise.allSettled(
|
|
736
|
+
items.map((item) => {
|
|
737
|
+
const formId = item.source?.form_uuid ?? item.source?.form_public_id;
|
|
738
|
+
const linkId = item.source?.uuid ?? item.source?.public_id;
|
|
739
|
+
|
|
740
|
+
return this.fetch.delete(`inspection-forms/${formId}/links/${linkId}`);
|
|
741
|
+
})
|
|
742
|
+
);
|
|
743
|
+
const revoked = results.filter((result) => result.status === 'fulfilled').length;
|
|
744
|
+
const failed = results.length - revoked;
|
|
745
|
+
|
|
746
|
+
if (revoked) {
|
|
747
|
+
this.notifications.success(this.intl.t('radar.toasts.links-revoked', { count: revoked }));
|
|
748
|
+
}
|
|
749
|
+
if (failed) {
|
|
750
|
+
this.notifications.error(this.intl.t('radar.toasts.links-revoke-failed', { count: failed }));
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
this.selection = [];
|
|
754
|
+
modal.done();
|
|
755
|
+
this.reload.perform();
|
|
756
|
+
},
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
async postBulk(body) {
|
|
761
|
+
try {
|
|
762
|
+
const response = await this.fetch.post('fleet-ops/radar/items/bulk', body);
|
|
763
|
+
const results = response?.results ?? [];
|
|
764
|
+
for (const result of results) {
|
|
765
|
+
if (result.ok && result.state) {
|
|
766
|
+
this.applyState({ key: result.key }, result.state);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
const updated = results.filter((result) => result.ok).length;
|
|
770
|
+
this.selection = [];
|
|
771
|
+
this.notifications.success(this.intl.t('radar.toasts.bulk-done', { count: updated }));
|
|
772
|
+
this.loadSummary.perform();
|
|
773
|
+
|
|
774
|
+
return true;
|
|
775
|
+
} catch (err) {
|
|
776
|
+
this.notifications.serverError(err);
|
|
777
|
+
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
async stateAction(item, endpoint, body = {}, toastKey = null, toastParams = {}) {
|
|
783
|
+
try {
|
|
784
|
+
const response = await this.fetch.post(`fleet-ops/radar/items/${encodeURIComponent(item.key)}/${endpoint}`, body);
|
|
785
|
+
this.applyState(item, response?.state ?? response?.item?.state);
|
|
786
|
+
if (toastKey) {
|
|
787
|
+
this.notifications.success(this.intl.t(toastKey, toastParams));
|
|
788
|
+
}
|
|
789
|
+
this.loadSummary.perform();
|
|
790
|
+
|
|
791
|
+
return response;
|
|
792
|
+
} catch (err) {
|
|
793
|
+
this.notifications.serverError(err);
|
|
794
|
+
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Put a fresh state on the row, or take the row off this tab when the
|
|
801
|
+
* state moved it to another one.
|
|
802
|
+
*/
|
|
803
|
+
applyState(item, state) {
|
|
804
|
+
if (!state) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
const leavesTab = (this.status === 'open' && ['snoozed', 'resolved'].includes(state.status)) || (this.status === 'snoozed' && state.status !== 'snoozed');
|
|
809
|
+
this.payload = patchPayload(this.payload, item.key, (row) => (leavesTab ? null : { ...row, state }));
|
|
810
|
+
|
|
811
|
+
if (this.drawerItem?.key === item.key) {
|
|
812
|
+
this.drawerItem = leavesTab ? null : { ...this.drawerItem, state };
|
|
813
|
+
}
|
|
814
|
+
if (leavesTab) {
|
|
815
|
+
this.selection = this.selection.filter((key) => key !== item.key);
|
|
816
|
+
if (this.focusedKey === item.key) {
|
|
817
|
+
this.focusedKey = null;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
async snoozeItem(item, payload = {}) {
|
|
823
|
+
const body = payload.minutes || payload.until ? payload : snoozePayloadFor(payload.preset ?? '1h');
|
|
824
|
+
const response = await this.stateAction(item, 'snooze', body);
|
|
825
|
+
if (response?.state?.snoozed_until) {
|
|
826
|
+
this.notifications.success(this.intl.t('radar.toasts.snoozed', { time: this.formatTime(response.state.snoozed_until) }));
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return response;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
async assignItem(item) {
|
|
833
|
+
return this.modalsManager.show('modals/radar-select-resource', {
|
|
834
|
+
title: this.intl.t('radar.prompts.assign-user-title'),
|
|
835
|
+
helpText: this.intl.t('radar.prompts.assign-user-help'),
|
|
836
|
+
inputLabel: this.intl.t('radar.prompts.select-user'),
|
|
837
|
+
placeholder: this.intl.t('radar.prompts.select-user'),
|
|
838
|
+
modelName: 'user',
|
|
839
|
+
query: { is_not_customer: true },
|
|
840
|
+
allowClear: true,
|
|
841
|
+
selected: null,
|
|
842
|
+
acceptButtonText: this.intl.t('radar.actions.assign'),
|
|
843
|
+
acceptButtonIcon: 'user-plus',
|
|
844
|
+
confirm: async (modal) => {
|
|
845
|
+
const user = modal.getOption('selected');
|
|
846
|
+
modal.startLoading();
|
|
847
|
+
const response = await this.stateAction(item, 'assign', { user: user?.id ?? null }, user ? 'radar.toasts.assigned' : 'radar.toasts.unassigned', { name: user?.name });
|
|
848
|
+
modal.stopLoading();
|
|
849
|
+
if (response) {
|
|
850
|
+
modal.done();
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
async assignVehicle(item) {
|
|
857
|
+
const driver = await this.findRecord('driver', item.subject?.public_id);
|
|
858
|
+
if (!driver) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
return this.modalsManager.show('modals/driver-assign-vehicle', {
|
|
863
|
+
title: this.intl.t('radar.prompts.assign-vehicle-title', { name: driver.name }),
|
|
864
|
+
acceptButtonText: this.intl.t('radar.actions.assign-vehicle'),
|
|
865
|
+
acceptButtonIcon: 'check',
|
|
866
|
+
hideDeclineButton: true,
|
|
867
|
+
driver,
|
|
868
|
+
confirm: async (modal) => {
|
|
869
|
+
const vehicleId = driver.vehicle_uuid ?? driver.vehicle?.id;
|
|
870
|
+
if (!vehicleId) {
|
|
871
|
+
return this.notifications.warning(this.intl.t('radar.prompts.no-selection'));
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
modal.startLoading();
|
|
875
|
+
try {
|
|
876
|
+
await this.fetch.post(`drivers/${driver.id}/assign-vehicle`, { vehicle: vehicleId });
|
|
877
|
+
this.notifications.success(this.intl.t('radar.toasts.vehicle-assigned'));
|
|
878
|
+
modal.done();
|
|
879
|
+
this.reload.perform();
|
|
880
|
+
} catch (err) {
|
|
881
|
+
this.notifications.serverError(err);
|
|
882
|
+
modal.stopLoading();
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
async assignDriver(item) {
|
|
889
|
+
const vehicleId = item.subject?.uuid ?? item.subject?.public_id;
|
|
890
|
+
|
|
891
|
+
return this.modalsManager.show('modals/radar-select-resource', {
|
|
892
|
+
title: this.intl.t('radar.prompts.assign-driver-title', { name: item.subject?.label }),
|
|
893
|
+
inputLabel: this.intl.t('radar.prompts.select-user'),
|
|
894
|
+
placeholder: this.intl.t('radar.actions.assign-driver'),
|
|
895
|
+
modelName: 'driver',
|
|
896
|
+
selected: null,
|
|
897
|
+
acceptButtonText: this.intl.t('radar.actions.assign-driver'),
|
|
898
|
+
acceptButtonIcon: 'check',
|
|
899
|
+
confirm: async (modal) => {
|
|
900
|
+
const driver = modal.getOption('selected');
|
|
901
|
+
if (!driver) {
|
|
902
|
+
return this.notifications.warning(this.intl.t('radar.prompts.no-selection'));
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
modal.startLoading();
|
|
906
|
+
try {
|
|
907
|
+
await this.fetch.post(`vehicles/${vehicleId}/assign-driver`, { driver: driver.id });
|
|
908
|
+
this.notifications.success(this.intl.t('radar.toasts.driver-assigned'));
|
|
909
|
+
modal.done();
|
|
910
|
+
this.reload.perform();
|
|
911
|
+
} catch (err) {
|
|
912
|
+
this.notifications.serverError(err);
|
|
913
|
+
modal.stopLoading();
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
async createWorkOrderFromSchedule(item) {
|
|
920
|
+
const scheduleId = item.source?.uuid ?? item.source?.public_id;
|
|
921
|
+
|
|
922
|
+
return this.modalsManager.confirm({
|
|
923
|
+
title: this.intl.t('radar.prompts.create-work-order-title'),
|
|
924
|
+
body: this.intl.t('radar.prompts.create-work-order-body'),
|
|
925
|
+
icon: 'clipboard-list',
|
|
926
|
+
iconClass: 'text-blue-500',
|
|
927
|
+
acceptButtonText: this.intl.t('radar.actions.create-work-order'),
|
|
928
|
+
acceptButtonScheme: 'primary',
|
|
929
|
+
confirm: async (modal) => {
|
|
930
|
+
modal.startLoading();
|
|
931
|
+
try {
|
|
932
|
+
await this.fetch.post(`maintenance-schedules/${scheduleId}/trigger`);
|
|
933
|
+
this.notifications.success(this.intl.t('radar.toasts.work-order-created'));
|
|
934
|
+
modal.done();
|
|
935
|
+
this.reload.perform();
|
|
936
|
+
} catch (err) {
|
|
937
|
+
this.notifications.serverError(err);
|
|
938
|
+
modal.stopLoading();
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
async inspectionFollowUp(item, kind) {
|
|
945
|
+
const submission = await this.findRecord('inspection-submission', item.source?.public_id ?? item.source?.uuid);
|
|
946
|
+
if (!submission) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
await this.inspectionSubmissionActions[kind](submission);
|
|
951
|
+
this.reload.perform();
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Close an issue the way its details panel does: the close-issue modal,
|
|
956
|
+
* which asks for the resolution note and records who closed it.
|
|
957
|
+
*/
|
|
958
|
+
async resolveIssue(item) {
|
|
959
|
+
const issue = await this.findRecord('issue', item.source?.public_id ?? item.source?.uuid, recordPanelFor('management.issues')?.include);
|
|
960
|
+
if (!issue) {
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
return this.issueActions.openCloseIssueModal(issue, { onSaved: () => this.reload.perform() });
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
async matchVehicle(item) {
|
|
968
|
+
const transactionId = item.source?.uuid ?? item.source?.public_id;
|
|
969
|
+
const suggested = item.source?.suggested_vehicle;
|
|
970
|
+
|
|
971
|
+
return this.modalsManager.show('modals/radar-select-resource', {
|
|
972
|
+
title: this.intl.t('radar.prompts.match-vehicle-title'),
|
|
973
|
+
body: suggested ? `${this.intl.t('radar.actions.match-vehicle')}: ${suggested.label}` : null,
|
|
974
|
+
inputLabel: this.intl.t('radar.prompts.select-vehicle'),
|
|
975
|
+
placeholder: this.intl.t('radar.prompts.select-vehicle'),
|
|
976
|
+
modelName: 'vehicle',
|
|
977
|
+
selected: null,
|
|
978
|
+
selectedId: suggested?.uuid ?? null,
|
|
979
|
+
acceptButtonText: this.intl.t('radar.actions.match-vehicle'),
|
|
980
|
+
acceptButtonIcon: 'link',
|
|
981
|
+
confirm: async (modal) => {
|
|
982
|
+
const vehicle = modal.getOption('selected');
|
|
983
|
+
const vehicleId = vehicle?.id ?? modal.getOption('selectedId');
|
|
984
|
+
if (!vehicleId) {
|
|
985
|
+
return this.notifications.warning(this.intl.t('radar.prompts.no-selection'));
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
modal.startLoading();
|
|
989
|
+
try {
|
|
990
|
+
await this.fetch.post(`fuel-provider-transactions/${transactionId}/match-vehicle`, { vehicle: vehicleId });
|
|
991
|
+
this.notifications.success(this.intl.t('radar.toasts.matched'));
|
|
992
|
+
modal.done();
|
|
993
|
+
this.reload.perform();
|
|
994
|
+
} catch (err) {
|
|
995
|
+
this.notifications.serverError(err);
|
|
996
|
+
modal.stopLoading();
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
async ignoreTransaction(item) {
|
|
1003
|
+
const transactionId = item.source?.uuid ?? item.source?.public_id;
|
|
1004
|
+
|
|
1005
|
+
return this.modalsManager.confirm({
|
|
1006
|
+
title: this.intl.t('radar.prompts.ignore-title'),
|
|
1007
|
+
body: this.intl.t('radar.prompts.ignore-body'),
|
|
1008
|
+
acceptButtonText: this.intl.t('radar.actions.ignore'),
|
|
1009
|
+
confirm: async (modal) => {
|
|
1010
|
+
modal.startLoading();
|
|
1011
|
+
try {
|
|
1012
|
+
await this.fetch.post(`fuel-provider-transactions/${transactionId}/review`, { status: 'ignored' });
|
|
1013
|
+
this.notifications.success(this.intl.t('radar.toasts.ignored'));
|
|
1014
|
+
modal.done();
|
|
1015
|
+
this.reload.perform();
|
|
1016
|
+
} catch (err) {
|
|
1017
|
+
this.notifications.serverError(err);
|
|
1018
|
+
modal.stopLoading();
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
async attachDevice(item) {
|
|
1025
|
+
const deviceId = item.source?.uuid ?? item.source?.public_id;
|
|
1026
|
+
|
|
1027
|
+
return this.modalsManager.show('modals/radar-select-resource', {
|
|
1028
|
+
title: this.intl.t('radar.prompts.attach-device-title'),
|
|
1029
|
+
inputLabel: this.intl.t('radar.prompts.select-vehicle'),
|
|
1030
|
+
placeholder: this.intl.t('radar.prompts.select-vehicle'),
|
|
1031
|
+
modelName: 'vehicle',
|
|
1032
|
+
selected: null,
|
|
1033
|
+
acceptButtonText: this.intl.t('radar.actions.attach'),
|
|
1034
|
+
acceptButtonIcon: 'link',
|
|
1035
|
+
confirm: async (modal) => {
|
|
1036
|
+
const vehicle = modal.getOption('selected');
|
|
1037
|
+
if (!vehicle) {
|
|
1038
|
+
return this.notifications.warning(this.intl.t('radar.prompts.no-selection'));
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
modal.startLoading();
|
|
1042
|
+
try {
|
|
1043
|
+
await this.fetch.post(`devices/${deviceId}/attach`, { vehicle: vehicle.id });
|
|
1044
|
+
this.notifications.success(this.intl.t('radar.toasts.device-attached'));
|
|
1045
|
+
modal.done();
|
|
1046
|
+
this.reload.perform();
|
|
1047
|
+
} catch (err) {
|
|
1048
|
+
this.notifications.serverError(err);
|
|
1049
|
+
modal.stopLoading();
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Send an inspection link's PIN, asking how first: by email or by text,
|
|
1057
|
+
* offering only the channels the link's recipient can receive, the same
|
|
1058
|
+
* choice the inspection form's link list gives.
|
|
1059
|
+
*/
|
|
1060
|
+
async sendPin(item) {
|
|
1061
|
+
const formId = item.source?.form_uuid ?? item.source?.form_public_id;
|
|
1062
|
+
const linkId = item.source?.uuid ?? item.source?.public_id;
|
|
1063
|
+
|
|
1064
|
+
let link;
|
|
1065
|
+
try {
|
|
1066
|
+
const response = await this.fetch.get(`inspection-forms/${formId}/links`);
|
|
1067
|
+
link = (response?.links ?? []).find((candidate) => [candidate.id, candidate.uuid, candidate.public_id].includes(linkId));
|
|
1068
|
+
} catch (err) {
|
|
1069
|
+
return this.notifications.serverError(err);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
if (!link?.has_pin) {
|
|
1073
|
+
return this.notifications.warning(this.intl.t('inspection.link.no-pin'));
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
const channels = ['email', 'sms'].filter((via) => link.can_send_pin?.[via]);
|
|
1077
|
+
if (!channels.length) {
|
|
1078
|
+
return this.notifications.warning(this.intl.t('radar.prompts.send-pin-unavailable'));
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
return this.modalsManager.show('modals/radar-send-pin', {
|
|
1082
|
+
title: this.intl.t('radar.prompts.send-pin-title'),
|
|
1083
|
+
recipient: link.recipient?.name ?? null,
|
|
1084
|
+
channels,
|
|
1085
|
+
via: channels[0],
|
|
1086
|
+
acceptButtonText: this.intl.t('radar.actions.send-pin'),
|
|
1087
|
+
acceptButtonIcon: 'paper-plane',
|
|
1088
|
+
confirm: async (modal) => {
|
|
1089
|
+
modal.startLoading();
|
|
1090
|
+
try {
|
|
1091
|
+
const response = await this.fetch.post(`inspection-forms/${formId}/links/${link.id ?? linkId}/send-pin`, { via: modal.getOption('via') });
|
|
1092
|
+
this.inspectionFormActions.notifyPinDelivery(response?.pin_delivery);
|
|
1093
|
+
modal.done();
|
|
1094
|
+
} catch (err) {
|
|
1095
|
+
this.notifications.serverError(err);
|
|
1096
|
+
modal.stopLoading();
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
async revokeLink(item) {
|
|
1103
|
+
const formId = item.source?.form_uuid ?? item.source?.form_public_id;
|
|
1104
|
+
const linkId = item.source?.uuid ?? item.source?.public_id;
|
|
1105
|
+
|
|
1106
|
+
return this.modalsManager.confirm({
|
|
1107
|
+
title: this.intl.t('radar.prompts.revoke-link-title'),
|
|
1108
|
+
body: this.intl.t('radar.prompts.revoke-link-body'),
|
|
1109
|
+
acceptButtonText: this.intl.t('radar.actions.revoke-link'),
|
|
1110
|
+
confirm: async (modal) => {
|
|
1111
|
+
modal.startLoading();
|
|
1112
|
+
try {
|
|
1113
|
+
await this.fetch.delete(`inspection-forms/${formId}/links/${linkId}`);
|
|
1114
|
+
this.notifications.success(this.intl.t('radar.toasts.link-revoked'));
|
|
1115
|
+
modal.done();
|
|
1116
|
+
this.reload.perform();
|
|
1117
|
+
} catch (err) {
|
|
1118
|
+
this.notifications.serverError(err);
|
|
1119
|
+
modal.stopLoading();
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
callDriver(item) {
|
|
1126
|
+
const phone = item.subject?.phone;
|
|
1127
|
+
if (!phone) {
|
|
1128
|
+
return this.openRecord(item);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
window.open(`tel:${phone}`, '_self');
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* Open the record behind a row, a decision card, a handover or a brief
|
|
1136
|
+
* link in a context panel, so Radar stays on screen. Resources with an
|
|
1137
|
+
* action service use its `panel.view`; the rest open their details
|
|
1138
|
+
* component in a plain panel. Only a record Radar has no panel for falls
|
|
1139
|
+
* back to navigating to it.
|
|
1140
|
+
*/
|
|
1141
|
+
@action openRecord(target) {
|
|
1142
|
+
const record = recordOf(target);
|
|
1143
|
+
if (!record?.route) {
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
return this.openRecordPanel.perform(record);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
@task *openRecordPanel(record) {
|
|
1151
|
+
const panel = recordPanelFor(record.route);
|
|
1152
|
+
if (!panel) {
|
|
1153
|
+
return this.hostRouter.transitionTo(`console.fleet-ops.${record.route}`, record.model);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
const resource = yield this.findRecord(panel.modelName, record.model, panel.include);
|
|
1157
|
+
if (!resource) {
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
const actions = panel.service ? getOwner(this).lookup(`service:${panel.service}`) : null;
|
|
1162
|
+
if (typeof actions?.panel?.view === 'function') {
|
|
1163
|
+
return yield actions.panel.view(resource);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
return this.resourceContextPanel.open({
|
|
1167
|
+
resource,
|
|
1168
|
+
tabs: [{ key: 'overview', label: this.intl.t('common.overview'), component: panel.component }],
|
|
1169
|
+
...PANEL_DEFAULTS,
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// ------------------------------------------------------------------
|
|
1174
|
+
// Morning brief
|
|
1175
|
+
// ------------------------------------------------------------------
|
|
1176
|
+
|
|
1177
|
+
@action toggleBriefing() {
|
|
1178
|
+
this.briefingCollapsed = !this.briefingCollapsed;
|
|
1179
|
+
this.appCache.set(BRIEFING_CACHE_KEY, this.briefingCollapsed);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/** A category row's "Filter": show exactly the items behind that score. */
|
|
1183
|
+
@action filterCategory(category) {
|
|
1184
|
+
this.category = this.category === category ? '' : category;
|
|
1185
|
+
this.status = 'open';
|
|
1186
|
+
this.saved = '';
|
|
1187
|
+
this.page = 1;
|
|
1188
|
+
this.view = 'list';
|
|
1189
|
+
this.loadItems.perform();
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Confirm a decision card: make the call it describes, keep a strip with
|
|
1194
|
+
* its undo, and refresh the list the change affects.
|
|
1195
|
+
*/
|
|
1196
|
+
@task({ drop: true }) *confirmDecision(decision, call) {
|
|
1197
|
+
if (!call?.endpoint) {
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
this.busyDecisionKey = decision.key;
|
|
1202
|
+
try {
|
|
1203
|
+
yield this.performCall(call);
|
|
1204
|
+
this.addStrip({ kind: 'confirmed', key: decision.key, title: decision.title, at: new Date().toISOString(), undo: call.undo ?? null, keys: decision.keys ?? [] });
|
|
1205
|
+
this.removeDecision(decision.key);
|
|
1206
|
+
this.notifications.success(call.label ?? this.intl.t('radar.briefing.confirm'));
|
|
1207
|
+
this.reload.perform();
|
|
1208
|
+
} catch (err) {
|
|
1209
|
+
this.notifications.serverError(err);
|
|
1210
|
+
} finally {
|
|
1211
|
+
this.busyDecisionKey = null;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/** An alternative is either another call or a prompt (pick another vehicle). */
|
|
1216
|
+
@task({ drop: true }) *decisionAlternative(decision, alternative) {
|
|
1217
|
+
if (alternative?.endpoint) {
|
|
1218
|
+
return yield this.confirmDecision.perform(decision, alternative);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
if (alternative?.action === 'pick_vehicle') {
|
|
1222
|
+
const item = { subject: decision.subject, key: decision.keys?.[0] };
|
|
1223
|
+
yield this.assignVehicle(item);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/** "Not now": snooze the items behind the card for a day. */
|
|
1228
|
+
@task({ drop: true }) *dismissDecision(decision) {
|
|
1229
|
+
const keys = decision.keys ?? [];
|
|
1230
|
+
if (!keys.length) {
|
|
1231
|
+
return this.removeDecision(decision.key);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
this.busyDecisionKey = decision.key;
|
|
1235
|
+
try {
|
|
1236
|
+
const response = yield this.fetch.post('fleet-ops/radar/items/bulk', { keys, action: 'snooze', minutes: 1440 });
|
|
1237
|
+
const until = (response?.results ?? []).find((result) => result.ok)?.state?.snoozed_until ?? null;
|
|
1238
|
+
for (const result of response?.results ?? []) {
|
|
1239
|
+
if (result.ok && result.state) {
|
|
1240
|
+
this.applyState({ key: result.key }, result.state);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
this.addStrip({ kind: 'snoozed', key: decision.key, title: decision.title, until, keys });
|
|
1244
|
+
this.removeDecision(decision.key);
|
|
1245
|
+
this.loadSummary.perform();
|
|
1246
|
+
} catch (err) {
|
|
1247
|
+
this.notifications.serverError(err);
|
|
1248
|
+
} finally {
|
|
1249
|
+
this.busyDecisionKey = null;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
@task({ drop: true }) *undoStrip(strip) {
|
|
1254
|
+
if (!strip.undo?.endpoint) {
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
try {
|
|
1259
|
+
yield this.performCall(strip.undo);
|
|
1260
|
+
this.strips = this.strips.filter((entry) => entry !== strip);
|
|
1261
|
+
this.notifications.info(strip.undo.label ?? this.intl.t('radar.briefing.undo'));
|
|
1262
|
+
this.reload.perform();
|
|
1263
|
+
} catch (err) {
|
|
1264
|
+
this.notifications.serverError(err);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
@task({ drop: true }) *wakeStrip(strip) {
|
|
1269
|
+
try {
|
|
1270
|
+
yield this.fetch.post('fleet-ops/radar/items/bulk', { keys: strip.keys ?? [], action: 'wake' });
|
|
1271
|
+
this.strips = this.strips.filter((entry) => entry !== strip);
|
|
1272
|
+
this.reload.perform();
|
|
1273
|
+
} catch (err) {
|
|
1274
|
+
this.notifications.serverError(err);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
performCall(call) {
|
|
1279
|
+
const method = String(call.method ?? 'POST').toLowerCase();
|
|
1280
|
+
const body = call.body ?? {};
|
|
1281
|
+
|
|
1282
|
+
switch (method) {
|
|
1283
|
+
case 'patch':
|
|
1284
|
+
return this.fetch.patch(call.endpoint, body);
|
|
1285
|
+
case 'put':
|
|
1286
|
+
return this.fetch.put(call.endpoint, body);
|
|
1287
|
+
case 'delete':
|
|
1288
|
+
return this.fetch.delete(call.endpoint, body);
|
|
1289
|
+
default:
|
|
1290
|
+
return this.fetch.post(call.endpoint, body);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
addStrip(strip) {
|
|
1295
|
+
this.strips = [strip, ...this.strips].slice(0, 8);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
removeDecision(key) {
|
|
1299
|
+
if (!this.briefing) {
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
this.briefing = { ...this.briefing, decisions: (this.briefing.decisions ?? []).filter((decision) => decision.key !== key) };
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// ------------------------------------------------------------------
|
|
1307
|
+
// Notices
|
|
1308
|
+
// ------------------------------------------------------------------
|
|
1309
|
+
|
|
1310
|
+
@action newNotice() {
|
|
1311
|
+
return this.modalsManager.show('modals/radar-notice', {
|
|
1312
|
+
title: this.intl.t('radar.notice.title'),
|
|
1313
|
+
acceptButtonText: this.intl.t('radar.notice.create'),
|
|
1314
|
+
acceptButtonIcon: 'bullhorn',
|
|
1315
|
+
notice: { message: '', severity: 'info', due_at: '', scope: '' },
|
|
1316
|
+
confirm: async (modal) => {
|
|
1317
|
+
const notice = modal.getOption('notice');
|
|
1318
|
+
if (!notice.message?.trim()) {
|
|
1319
|
+
return this.notifications.warning(this.intl.t('radar.notice.message'));
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
modal.startLoading();
|
|
1323
|
+
try {
|
|
1324
|
+
await this.fetch.post('fleet-ops/radar/notices', {
|
|
1325
|
+
message: notice.message,
|
|
1326
|
+
severity: notice.severity,
|
|
1327
|
+
due_at: notice.due_at || null,
|
|
1328
|
+
scope: notice.scope || null,
|
|
1329
|
+
});
|
|
1330
|
+
this.notifications.success(this.intl.t('radar.notice.created'));
|
|
1331
|
+
modal.done();
|
|
1332
|
+
this.reload.perform();
|
|
1333
|
+
} catch (err) {
|
|
1334
|
+
this.notifications.serverError(err);
|
|
1335
|
+
modal.stopLoading();
|
|
1336
|
+
}
|
|
1337
|
+
},
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
async deleteNotice(item) {
|
|
1342
|
+
const id = item.source?.public_id ?? item.source?.uuid;
|
|
1343
|
+
|
|
1344
|
+
return this.modalsManager.confirm({
|
|
1345
|
+
title: this.intl.t('radar.notice.delete'),
|
|
1346
|
+
acceptButtonText: this.intl.t('common.delete'),
|
|
1347
|
+
acceptButtonScheme: 'danger',
|
|
1348
|
+
confirm: async (modal) => {
|
|
1349
|
+
modal.startLoading();
|
|
1350
|
+
try {
|
|
1351
|
+
await this.fetch.delete(`fleet-ops/radar/notices/${id}`);
|
|
1352
|
+
this.payload = patchPayload(this.payload, item.key, () => null);
|
|
1353
|
+
if (this.drawerItem?.key === item.key) {
|
|
1354
|
+
this.drawerItem = null;
|
|
1355
|
+
}
|
|
1356
|
+
this.notifications.success(this.intl.t('radar.notice.deleted'));
|
|
1357
|
+
modal.done();
|
|
1358
|
+
this.loadSummary.perform();
|
|
1359
|
+
} catch (err) {
|
|
1360
|
+
this.notifications.serverError(err);
|
|
1361
|
+
modal.stopLoading();
|
|
1362
|
+
}
|
|
1363
|
+
},
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// ------------------------------------------------------------------
|
|
1368
|
+
// Plumbing
|
|
1369
|
+
// ------------------------------------------------------------------
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Load a record Radar points at by its public id (or uuid), the way the
|
|
1373
|
+
* details routes do. `store.findRecord` with a public id registers the
|
|
1374
|
+
* record under an identifier its payload then contradicts, which Ember
|
|
1375
|
+
* Data rejects with "You should not change the <type> of a
|
|
1376
|
+
* RecordIdentifier" once the record is already in the store.
|
|
1377
|
+
*/
|
|
1378
|
+
async findRecord(modelName, id, include = []) {
|
|
1379
|
+
if (!id) {
|
|
1380
|
+
return null;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
const field = UUID_PATTERN.test(id) ? 'uuid' : 'public_id';
|
|
1384
|
+
const query = { [field]: id, single: true };
|
|
1385
|
+
if (include?.length) {
|
|
1386
|
+
query.with = include;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
try {
|
|
1390
|
+
return await this.store.queryRecord(modelName, query);
|
|
1391
|
+
} catch (err) {
|
|
1392
|
+
this.notifications.serverError(err);
|
|
1393
|
+
|
|
1394
|
+
return null;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
formatTime(value) {
|
|
1399
|
+
const date = value ? new Date(value) : null;
|
|
1400
|
+
if (!date || Number.isNaN(date.getTime())) {
|
|
1401
|
+
return '';
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
return format(date, 'EEE d MMM HH:mm');
|
|
87
1405
|
}
|
|
88
1406
|
}
|