@fleetbase/fleetops-engine 0.0.1
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/LICENSE.md +9 -0
- package/README.md +32 -0
- package/addon/components/cell/driver-name.hbs +13 -0
- package/addon/components/cell/driver-name.js +30 -0
- package/addon/components/custom-field-value.hbs +11 -0
- package/addon/components/custom-field-value.js +41 -0
- package/addon/components/custom-field.hbs +42 -0
- package/addon/components/custom-field.js +46 -0
- package/addon/components/display-place.hbs +52 -0
- package/addon/components/display-place.js +11 -0
- package/addon/components/driver-card-mini.hbs +12 -0
- package/addon/components/driver-card-mini.js +25 -0
- package/addon/components/driver-card.hbs +27 -0
- package/addon/components/driver-card.js +14 -0
- package/addon/components/event-timeline/event.hbs +5 -0
- package/addon/components/event-timeline.hbs +7 -0
- package/addon/components/event-timeline.js +423 -0
- package/addon/components/file-icon.js +1 -0
- package/addon/components/fleet-driver-listing.hbs +73 -0
- package/addon/components/fleet-driver-listing.js +117 -0
- package/addon/components/full-calendar/draggable.js +1 -0
- package/addon/components/full-calendar.js +1 -0
- package/addon/components/full-size.js +1 -0
- package/addon/components/global-search.hbs +84 -0
- package/addon/components/global-search.js +52 -0
- package/addon/components/horizontal-route.hbs +33 -0
- package/addon/components/horizontal-route.js +48 -0
- package/addon/components/integrated-order-details.hbs +117 -0
- package/addon/components/integrated-order-details.js +10 -0
- package/addon/components/leaflet-draw-control.js +147 -0
- package/addon/components/leaflet-rotated-marker.js +24 -0
- package/addon/components/live-map.hbs +63 -0
- package/addon/components/live-map.js +856 -0
- package/addon/components/map-container/toolbar/zones-panel.hbs +41 -0
- package/addon/components/map-container/toolbar/zones-panel.js +106 -0
- package/addon/components/map-container/toolbar-container.hbs +1 -0
- package/addon/components/map-container/toolbar-container.js +3 -0
- package/addon/components/map-container/toolbar.hbs +51 -0
- package/addon/components/map-container/toolbar.js +34 -0
- package/addon/components/map-container/topbar.hbs +1 -0
- package/addon/components/map-container/topbar.js +3 -0
- package/addon/components/map-container/view-switch.hbs +1 -0
- package/addon/components/map-container/view-switch.js +3 -0
- package/addon/components/map-container.hbs +1 -0
- package/addon/components/map-container.js +15 -0
- package/addon/components/modals/assign-driver.hbs +24 -0
- package/addon/components/modals/assign-driver.js +3 -0
- package/addon/components/modals/clone-config-form.hbs +6 -0
- package/addon/components/modals/contact-details.hbs +44 -0
- package/addon/components/modals/contact-form.hbs +56 -0
- package/addon/components/modals/driver-assign-order.hbs +67 -0
- package/addon/components/modals/driver-assign-vehicle.hbs +20 -0
- package/addon/components/modals/driver-assign-vendor.hbs +20 -0
- package/addon/components/modals/driver-details.hbs +85 -0
- package/addon/components/modals/driver-form.hbs +83 -0
- package/addon/components/modals/edit-meta-form.hbs +20 -0
- package/addon/components/modals/entity-form.hbs +57 -0
- package/addon/components/modals/entity-meta-field-prompt.hbs +6 -0
- package/addon/components/modals/fleet-details.hbs +31 -0
- package/addon/components/modals/fleet-form.hbs +26 -0
- package/addon/components/modals/fuel-report-details.hbs +34 -0
- package/addon/components/modals/fuel-report-form.hbs +26 -0
- package/addon/components/modals/group-details.hbs +42 -0
- package/addon/components/modals/group-form.hbs +54 -0
- package/addon/components/modals/install-prompt.hbs +21 -0
- package/addon/components/modals/map-field-form.hbs +9 -0
- package/addon/components/modals/map-field-group-form.hbs +6 -0
- package/addon/components/modals/map-layer-form.hbs +29 -0
- package/addon/components/modals/meta-field-form.hbs +8 -0
- package/addon/components/modals/meta-field-group-form.hbs +5 -0
- package/addon/components/modals/new-order-config.hbs +11 -0
- package/addon/components/modals/option-prompt.hbs +17 -0
- package/addon/components/modals/order-assign-driver.hbs +25 -0
- package/addon/components/modals/order-config-new-status.hbs +5 -0
- package/addon/components/modals/order-event.hbs +18 -0
- package/addon/components/modals/order-form.hbs +63 -0
- package/addon/components/modals/order-import.hbs +84 -0
- package/addon/components/modals/order-label.hbs +7 -0
- package/addon/components/modals/order-meta.hbs +12 -0
- package/addon/components/modals/order-new-activity.hbs +62 -0
- package/addon/components/modals/order-route-form.hbs +111 -0
- package/addon/components/modals/place-assign-vendor.hbs +20 -0
- package/addon/components/modals/place-details.hbs +105 -0
- package/addon/components/modals/place-form.hbs +30 -0
- package/addon/components/modals/point-map.hbs +16 -0
- package/addon/components/modals/policy-form.hbs +22 -0
- package/addon/components/modals/resend-verification-email.hbs +25 -0
- package/addon/components/modals/role-form.hbs +16 -0
- package/addon/components/modals/select-payment-method.hbs +12 -0
- package/addon/components/modals/service-area-form.hbs +31 -0
- package/addon/components/modals/set-password.hbs +15 -0
- package/addon/components/modals/uninstall-prompt.hbs +21 -0
- package/addon/components/modals/user-form.hbs +56 -0
- package/addon/components/modals/vehicle-details.hbs +227 -0
- package/addon/components/modals/vehicle-form.hbs +282 -0
- package/addon/components/modals/vendor-details.hbs +77 -0
- package/addon/components/modals/vendor-form.hbs +168 -0
- package/addon/components/modals/view-service-area.hbs +12 -0
- package/addon/components/modals/view-zone.hbs +12 -0
- package/addon/components/modals/zone-form.hbs +16 -0
- package/addon/components/operations-pane/pane.hbs +1 -0
- package/addon/components/order/header.hbs +48 -0
- package/addon/components/order/header.js +26 -0
- package/addon/components/order/place-card.hbs +51 -0
- package/addon/components/order/place-card.js +33 -0
- package/addon/components/order/schedule-card.hbs +35 -0
- package/addon/components/order/schedule-card.js +17 -0
- package/addon/components/order/sub-header/item.hbs +16 -0
- package/addon/components/order/sub-header.hbs +3 -0
- package/addon/components/order-config/activity-flow-editor.hbs +108 -0
- package/addon/components/order-config/activity-flow-editor.js +374 -0
- package/addon/components/order-config/details-editor.hbs +32 -0
- package/addon/components/order-config/details-editor.js +16 -0
- package/addon/components/order-config/entities-editor.hbs +84 -0
- package/addon/components/order-config/entities-editor.js +123 -0
- package/addon/components/order-config/fields-editor.hbs +122 -0
- package/addon/components/order-config/fields-editor.js +233 -0
- package/addon/components/order-config/selector.hbs +1 -0
- package/addon/components/order-config/selector.js +3 -0
- package/addon/components/order-config.hbs +66 -0
- package/addon/components/order-config.js +296 -0
- package/addon/components/order-list-overlay/driver-panel-title.hbs +6 -0
- package/addon/components/order-list-overlay/order.hbs +22 -0
- package/addon/components/order-list-overlay/order.js +3 -0
- package/addon/components/order-list-overlay.hbs +120 -0
- package/addon/components/order-list-overlay.js +227 -0
- package/addon/components/route-list.hbs +47 -0
- package/addon/components/route-list.js +11 -0
- package/addon/components/settings-window.hbs +15 -0
- package/addon/components/settings-window.js +62 -0
- package/addon/components/split-grid.js +1 -0
- package/addon/components/widget/fleet-ops-quickstart.hbs +40 -0
- package/addon/components/widget/fleet-ops-quickstart.js +58 -0
- package/addon/components/widget/issues.hbs +1 -0
- package/addon/components/widget/key-metrics.hbs +121 -0
- package/addon/components/widget/key-metrics.js +46 -0
- package/addon/components/widget/live-order-map.hbs +59 -0
- package/addon/components/widget/live-order-map.js +11 -0
- package/addon/components/widget/recent-orders.hbs +35 -0
- package/addon/components/widget/recent-orders.js +24 -0
- package/addon/components/widget/transaction-earnings.hbs +1 -0
- package/addon/components/widget/transactions.hbs +36 -0
- package/addon/components/widget/transactions.js +29 -0
- package/addon/components/widget/weekly-orders.hbs +1 -0
- package/addon/components/widget/weekly-orders.js +3 -0
- package/addon/controllers/application.js +40 -0
- package/addon/controllers/management/contacts/index.js +438 -0
- package/addon/controllers/management/drivers/index.js +868 -0
- package/addon/controllers/management/fleets/index.js +507 -0
- package/addon/controllers/management/fuel-reports/index.js +428 -0
- package/addon/controllers/management/issues/index.js +335 -0
- package/addon/controllers/management/places/index.js +571 -0
- package/addon/controllers/management/vehicles/index.js +616 -0
- package/addon/controllers/management/vendors/index.js +626 -0
- package/addon/controllers/management.js +5 -0
- package/addon/controllers/operations/orders/index/config/types.js +17 -0
- package/addon/controllers/operations/orders/index/config.js +13 -0
- package/addon/controllers/operations/orders/index/new.js +1213 -0
- package/addon/controllers/operations/orders/index/view.js +794 -0
- package/addon/controllers/operations/orders/index.js +674 -0
- package/addon/controllers/operations/scheduler/index.js +110 -0
- package/addon/controllers/operations/service-rates/index/edit.js +59 -0
- package/addon/controllers/operations/service-rates/index/new.js +369 -0
- package/addon/controllers/operations/service-rates/index.js +275 -0
- package/addon/controllers/operations/zones/index.js +470 -0
- package/addon/engine.js +19 -0
- package/addon/helpers/avatar-url.js +9 -0
- package/addon/helpers/extract-coordinates.js +6 -0
- package/addon/helpers/feature-group.js +14 -0
- package/addon/helpers/flow-raw-status.js +13 -0
- package/addon/helpers/format-point.js +13 -0
- package/addon/helpers/get-tip-amount.js +19 -0
- package/addon/helpers/is-active-route.js +1 -0
- package/addon/helpers/is-facilitator-supported-place.js +6 -0
- package/addon/helpers/is-not-facilitator-supported-place.js +6 -0
- package/addon/helpers/is-waypoint-record.js +6 -0
- package/addon/helpers/point-coordinates.js +10 -0
- package/addon/helpers/point-to-coordinates.js +28 -0
- package/addon/helpers/service-name.js +6 -0
- package/addon/helpers/waypoint-label.js +1 -0
- package/addon/instance-initializers/register-leaflet-draw-control-layer.js +17 -0
- package/addon/instance-initializers/register-leaflet-rotated-marker.js +17 -0
- package/addon/modifiers/translate-x.js +5 -0
- package/addon/routes/application.js +25 -0
- package/addon/routes/comms/chat.js +3 -0
- package/addon/routes/comms/intercom.js +3 -0
- package/addon/routes/comms.js +3 -0
- package/addon/routes/home.js +20 -0
- package/addon/routes/management/contacts/index.js +24 -0
- package/addon/routes/management/contacts.js +3 -0
- package/addon/routes/management/drivers/index.js +33 -0
- package/addon/routes/management/drivers.js +3 -0
- package/addon/routes/management/fleets/index.js +27 -0
- package/addon/routes/management/fleets.js +3 -0
- package/addon/routes/management/fuel-reports/index.js +23 -0
- package/addon/routes/management/fuel-reports.js +3 -0
- package/addon/routes/management/index.js +3 -0
- package/addon/routes/management/issues/index.js +24 -0
- package/addon/routes/management/issues.js +3 -0
- package/addon/routes/management/places/index.js +18 -0
- package/addon/routes/management/places.js +3 -0
- package/addon/routes/management/vehicles/index.js +35 -0
- package/addon/routes/management/vehicles.js +3 -0
- package/addon/routes/management/vendors/index.js +34 -0
- package/addon/routes/management/vendors.js +3 -0
- package/addon/routes/management.js +3 -0
- package/addon/routes/operations/dispatch.js +3 -0
- package/addon/routes/operations/orders/index/config/types.js +17 -0
- package/addon/routes/operations/orders/index/config.js +3 -0
- package/addon/routes/operations/orders/index/new.js +16 -0
- package/addon/routes/operations/orders/index/view.js +37 -0
- package/addon/routes/operations/orders/index.js +35 -0
- package/addon/routes/operations/orders.js +4 -0
- package/addon/routes/operations/scheduler/index.js +10 -0
- package/addon/routes/operations/scheduler.js +3 -0
- package/addon/routes/operations/service-rates/index/edit.js +35 -0
- package/addon/routes/operations/service-rates/index/new.js +15 -0
- package/addon/routes/operations/service-rates/index.js +49 -0
- package/addon/routes/operations/service-rates.js +10 -0
- package/addon/routes/operations/zones/index.js +25 -0
- package/addon/routes/operations/zones.js +7 -0
- package/addon/routes/operations.js +3 -0
- package/addon/routes.js +55 -0
- package/addon/services/map-manager.js +3 -0
- package/addon/services/service-areas.js +385 -0
- package/addon/templates/application.hbs +27 -0
- package/addon/templates/comms/chat.hbs +1 -0
- package/addon/templates/comms/intercom.hbs +1 -0
- package/addon/templates/comms.hbs +1 -0
- package/addon/templates/home.hbs +1 -0
- package/addon/templates/management/contacts/index.hbs +23 -0
- package/addon/templates/management/contacts.hbs +1 -0
- package/addon/templates/management/drivers/index.hbs +35 -0
- package/addon/templates/management/drivers.hbs +1 -0
- package/addon/templates/management/fleets/index.hbs +22 -0
- package/addon/templates/management/fleets.hbs +1 -0
- package/addon/templates/management/fuel-reports/index.hbs +21 -0
- package/addon/templates/management/fuel-reports.hbs +1 -0
- package/addon/templates/management/index.hbs +53 -0
- package/addon/templates/management/issues/index.hbs +21 -0
- package/addon/templates/management/issues.hbs +1 -0
- package/addon/templates/management/places/index.hbs +34 -0
- package/addon/templates/management/places.hbs +1 -0
- package/addon/templates/management/vehicles/index.hbs +22 -0
- package/addon/templates/management/vehicles.hbs +1 -0
- package/addon/templates/management/vendors/index.hbs +22 -0
- package/addon/templates/management/vendors.hbs +1 -0
- package/addon/templates/management.hbs +1 -0
- package/addon/templates/operations/dispatch.hbs +1 -0
- package/addon/templates/operations/orders/index/config/types.hbs +26 -0
- package/addon/templates/operations/orders/index/config.hbs +24 -0
- package/addon/templates/operations/orders/index/new.hbs +506 -0
- package/addon/templates/operations/orders/index/view.hbs +428 -0
- package/addon/templates/operations/orders/index.hbs +48 -0
- package/addon/templates/operations/orders.hbs +1 -0
- package/addon/templates/operations/scheduler/index.hbs +30 -0
- package/addon/templates/operations/scheduler.hbs +1 -0
- package/addon/templates/operations/service-rates/index/edit.hbs +1 -0
- package/addon/templates/operations/service-rates/index/new.hbs +308 -0
- package/addon/templates/operations/service-rates/index.hbs +23 -0
- package/addon/templates/operations/service-rates.hbs +1 -0
- package/addon/templates/operations/zones/index.hbs +72 -0
- package/addon/templates/operations/zones.hbs +1 -0
- package/addon/templates/operations.hbs +1 -0
- package/addon/utils/calculate-percentage.js +1 -0
- package/addon/utils/extract-coordinates.js +1 -0
- package/addon/utils/format-currency.js +1 -0
- package/addon/utils/geojson/geo-json.js +17 -0
- package/addon/utils/is-facilitator-supported-place.js +14 -0
- package/addon/utils/to-model.js +1 -0
- package/app/components/cell/driver-name.js +1 -0
- package/app/components/custom-field-value.js +1 -0
- package/app/components/custom-field.js +1 -0
- package/app/components/display-place.js +1 -0
- package/app/components/driver-card-mini.js +1 -0
- package/app/components/driver-card.js +1 -0
- package/app/components/event-timeline/event.js +1 -0
- package/app/components/event-timeline.js +1 -0
- package/app/components/file-icon.js +1 -0
- package/app/components/fleet-driver-listing.js +1 -0
- package/app/components/full-calendar/draggable.js +1 -0
- package/app/components/full-calendar.js +1 -0
- package/app/components/full-size.js +1 -0
- package/app/components/global-search.js +1 -0
- package/app/components/horizontal-route.js +1 -0
- package/app/components/integrated-order-details.js +1 -0
- package/app/components/leaflet-draw-control.js +1 -0
- package/app/components/leaflet-rotated-marker.js +1 -0
- package/app/components/live-map.js +1 -0
- package/app/components/map-container/toolbar/zones-panel.js +1 -0
- package/app/components/map-container/toolbar-container.js +1 -0
- package/app/components/map-container/toolbar.js +1 -0
- package/app/components/map-container/topbar.js +1 -0
- package/app/components/map-container/view-switch.js +1 -0
- package/app/components/map-container.js +1 -0
- package/app/components/modals/assign-driver.js +1 -0
- package/app/components/modals/clone-config-form.js +1 -0
- package/app/components/modals/contact-details.js +1 -0
- package/app/components/modals/contact-form.js +1 -0
- package/app/components/modals/driver-assign-order.js +1 -0
- package/app/components/modals/driver-assign-vehicle.js +1 -0
- package/app/components/modals/driver-assign-vendor.js +1 -0
- package/app/components/modals/driver-details.js +1 -0
- package/app/components/modals/driver-form.js +1 -0
- package/app/components/modals/edit-meta-form.js +1 -0
- package/app/components/modals/entity-form.js +1 -0
- package/app/components/modals/entity-meta-field-prompt.js +1 -0
- package/app/components/modals/fleet-details.js +1 -0
- package/app/components/modals/fleet-form.js +1 -0
- package/app/components/modals/fuel-report-details.js +1 -0
- package/app/components/modals/fuel-report-form.js +1 -0
- package/app/components/modals/group-details.js +1 -0
- package/app/components/modals/group-form.js +1 -0
- package/app/components/modals/install-prompt.js +1 -0
- package/app/components/modals/map-field-form.js +1 -0
- package/app/components/modals/map-field-group-form.js +1 -0
- package/app/components/modals/map-layer-form.js +1 -0
- package/app/components/modals/meta-field-form.js +1 -0
- package/app/components/modals/meta-field-group-form.js +1 -0
- package/app/components/modals/new-order-config.js +1 -0
- package/app/components/modals/option-prompt.js +1 -0
- package/app/components/modals/order-assign-driver.js +1 -0
- package/app/components/modals/order-config-new-status.js +1 -0
- package/app/components/modals/order-event.js +1 -0
- package/app/components/modals/order-form.js +1 -0
- package/app/components/modals/order-import.js +1 -0
- package/app/components/modals/order-label.js +1 -0
- package/app/components/modals/order-meta.js +1 -0
- package/app/components/modals/order-new-activity.js +1 -0
- package/app/components/modals/order-route-form.js +1 -0
- package/app/components/modals/place-assign-vendor.js +1 -0
- package/app/components/modals/place-details.js +1 -0
- package/app/components/modals/place-form.js +1 -0
- package/app/components/modals/point-map.js +1 -0
- package/app/components/modals/policy-form.js +1 -0
- package/app/components/modals/resend-verification-email.js +1 -0
- package/app/components/modals/role-form.js +1 -0
- package/app/components/modals/select-payment-method.js +1 -0
- package/app/components/modals/service-area-form.js +1 -0
- package/app/components/modals/set-password.js +1 -0
- package/app/components/modals/uninstall-prompt.js +1 -0
- package/app/components/modals/user-form.js +1 -0
- package/app/components/modals/vehicle-details.js +1 -0
- package/app/components/modals/vehicle-form.js +1 -0
- package/app/components/modals/vendor-details.js +1 -0
- package/app/components/modals/vendor-form.js +1 -0
- package/app/components/modals/view-service-area.js +1 -0
- package/app/components/modals/view-zone.js +1 -0
- package/app/components/modals/zone-form.js +1 -0
- package/app/components/operations-pane/pane.js +1 -0
- package/app/components/order/header.js +1 -0
- package/app/components/order/place-card.js +1 -0
- package/app/components/order/schedule-card.js +1 -0
- package/app/components/order/sub-header/item.js +1 -0
- package/app/components/order/sub-header.js +1 -0
- package/app/components/order-config/activity-flow-editor.js +1 -0
- package/app/components/order-config/details-editor.js +1 -0
- package/app/components/order-config/entities-editor.js +1 -0
- package/app/components/order-config/fields-editor.js +1 -0
- package/app/components/order-config/selector.js +1 -0
- package/app/components/order-config.js +1 -0
- package/app/components/order-list-overlay/driver-panel-title.js +1 -0
- package/app/components/order-list-overlay/order.js +1 -0
- package/app/components/order-list-overlay.js +1 -0
- package/app/components/route-list.js +1 -0
- package/app/components/settings-window.js +1 -0
- package/app/components/split-grid.js +1 -0
- package/app/components/widget/issues.js +1 -0
- package/app/components/widget/key-metrics.js +1 -0
- package/app/components/widget/live-order-map.js +1 -0
- package/app/components/widget/recent-orders.js +1 -0
- package/app/components/widget/recommended-todo.js +1 -0
- package/app/components/widget/transaction-earnings.js +1 -0
- package/app/components/widget/transactions.js +1 -0
- package/app/components/widget/weekly-orders.js +1 -0
- package/app/controllers/application.js +1 -0
- package/app/controllers/management/contacts/index.js +1 -0
- package/app/controllers/management/drivers/index/details.js +1 -0
- package/app/controllers/management/drivers/index.js +1 -0
- package/app/controllers/management/fleets/index/details.js +1 -0
- package/app/controllers/management/fleets/index.js +1 -0
- package/app/controllers/management/fuel-reports/index.js +1 -0
- package/app/controllers/management/issues/index.js +1 -0
- package/app/controllers/management/places/index.js +1 -0
- package/app/controllers/management/vehicles/index.js +1 -0
- package/app/controllers/management/vendors/index/details/remarks.js +1 -0
- package/app/controllers/management/vendors/index/details.js +1 -0
- package/app/controllers/management/vendors/index.js +1 -0
- package/app/controllers/management.js +1 -0
- package/app/controllers/operations/orders/index/config/types.js +1 -0
- package/app/controllers/operations/orders/index/config.js +1 -0
- package/app/controllers/operations/orders/index/new.js +1 -0
- package/app/controllers/operations/orders/index/view.js +1 -0
- package/app/controllers/operations/scheduler/index.js +1 -0
- package/app/controllers/operations/service-rates/index/edit.js +1 -0
- package/app/controllers/operations/service-rates/index/new.js +1 -0
- package/app/controllers/operations/service-rates/index.js +1 -0
- package/app/controllers/operations/zones/index.js +1 -0
- package/app/helpers/avatar-url.js +1 -0
- package/app/helpers/extract-coordinates.js +1 -0
- package/app/helpers/feature-group.js +1 -0
- package/app/helpers/flow-raw-status.js +1 -0
- package/app/helpers/format-point.js +1 -0
- package/app/helpers/get-tip-amount.js +1 -0
- package/app/helpers/is-facilitator-supported-place.js +1 -0
- package/app/helpers/is-not-facilitator-supported-place.js +1 -0
- package/app/helpers/is-waypoint-record.js +1 -0
- package/app/helpers/point-coordinates.js +1 -0
- package/app/helpers/point-to-coordinates.js +1 -0
- package/app/helpers/service-name.js +1 -0
- package/app/helpers/waypoint-label.js +1 -0
- package/app/modifiers/translate-x.js +1 -0
- package/app/routes/home.js +1 -0
- package/app/routes/management/fleets/index/details.js +1 -0
- package/app/routes/operations/orders/index/config/types.js +1 -0
- package/app/routes/operations/orders/index/config.js +1 -0
- package/app/routes/operations/orders/index/new.js +1 -0
- package/app/routes/operations/orders/index/view.js +1 -0
- package/app/routes/operations/scheduler/index.js +1 -0
- package/app/routes/operations/scheduler.js +1 -0
- package/app/routes/operations/service-rates/index/edit.js +1 -0
- package/app/routes/operations/service-rates/index/new.js +1 -0
- package/app/services/map-manager.js +1 -0
- package/app/services/service-areas.js +1 -0
- package/app/templates/home.js +1 -0
- package/app/templates/management/fleets/index/details.js +1 -0
- package/app/templates/operations/orders/index/config/types.js +1 -0
- package/app/templates/operations/orders/index/config.js +1 -0
- package/app/templates/operations/orders/index/new.js +1 -0
- package/app/templates/operations/orders/index/view.js +1 -0
- package/app/templates/operations/scheduler/index.js +1 -0
- package/app/templates/operations/scheduler.js +1 -0
- package/app/templates/operations/service-rates/index/edit.js +1 -0
- package/app/templates/operations/service-rates/index/new.js +1 -0
- package/app/utils/calculate-percentage.js +1 -0
- package/app/utils/extract-coordinates.js +1 -0
- package/app/utils/format-currency.js +1 -0
- package/app/utils/geojson/geo-json.js +1 -0
- package/app/utils/is-facilitator-supported-place.js +1 -0
- package/app/utils/is-latitude.js +1 -0
- package/app/utils/to-model.js +1 -0
- package/assets/images/drawing-controls-spritesheet-inverted.png +0 -0
- package/config/environment.js +25 -0
- package/index.js +73 -0
- package/package.json +132 -0
- package/pnpm-lock.yaml +12613 -0
|
@@ -0,0 +1,868 @@
|
|
|
1
|
+
import Controller, { inject as controller } from '@ember/controller';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { isBlank } from '@ember/utils';
|
|
6
|
+
import { equal } from '@ember/object/computed';
|
|
7
|
+
import { timeout } from 'ember-concurrency';
|
|
8
|
+
import { task } from 'ember-concurrency-decorators';
|
|
9
|
+
import extractCoordinates from '@fleetbase/ember-core/utils/extract-coordinates';
|
|
10
|
+
import leafletIcon from '@fleetbase/ember-core/utils/leaflet-icon';
|
|
11
|
+
import generateSlug from '@fleetbase/ember-core/utils/generate-slug';
|
|
12
|
+
|
|
13
|
+
export default class ManagementDriversIndexController extends Controller {
|
|
14
|
+
/**
|
|
15
|
+
* Inject the `management.vendors.index` controller
|
|
16
|
+
*
|
|
17
|
+
* @var {Controller}
|
|
18
|
+
*/
|
|
19
|
+
@controller('management.vendors.index') vendors;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Inject the `management.vehicles.index` controller
|
|
23
|
+
*
|
|
24
|
+
* @var {Controller}
|
|
25
|
+
*/
|
|
26
|
+
@controller('management.vehicles.index') vehicles;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Inject the `management.fleets.index` controller
|
|
30
|
+
*
|
|
31
|
+
* @var {Controller}
|
|
32
|
+
*/
|
|
33
|
+
@controller('management.fleets.index') fleets;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Inject the `notifications` service
|
|
37
|
+
*
|
|
38
|
+
* @var {Service}
|
|
39
|
+
*/
|
|
40
|
+
@service notifications;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Inject the `modals-manager` service
|
|
44
|
+
*
|
|
45
|
+
* @var {Service}
|
|
46
|
+
*/
|
|
47
|
+
@service modalsManager;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Inject the `crud` service
|
|
51
|
+
*
|
|
52
|
+
* @var {Service}
|
|
53
|
+
*/
|
|
54
|
+
@service crud;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Inject the `store` service
|
|
58
|
+
*
|
|
59
|
+
* @var {Service}
|
|
60
|
+
*/
|
|
61
|
+
@service store;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Inject the `fetch` service
|
|
65
|
+
*
|
|
66
|
+
* @var {Service}
|
|
67
|
+
*/
|
|
68
|
+
@service fetch;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Inject the `hostRouter` service
|
|
72
|
+
*
|
|
73
|
+
* @var {Service}
|
|
74
|
+
*/
|
|
75
|
+
@service hostRouter;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Inject the `filters` service
|
|
79
|
+
*
|
|
80
|
+
* @var {Service}
|
|
81
|
+
*/
|
|
82
|
+
@service filters;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Inject the `currentUser` service
|
|
86
|
+
*
|
|
87
|
+
* @var {Service}
|
|
88
|
+
*/
|
|
89
|
+
@service currentUser;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Queryable parameters for this controller's model
|
|
93
|
+
*
|
|
94
|
+
* @var {Array}
|
|
95
|
+
*/
|
|
96
|
+
queryParams = [
|
|
97
|
+
'page',
|
|
98
|
+
'limit',
|
|
99
|
+
'sort',
|
|
100
|
+
'query',
|
|
101
|
+
'name',
|
|
102
|
+
'drivers_license_number',
|
|
103
|
+
'vehicle',
|
|
104
|
+
'fleet',
|
|
105
|
+
'vendor',
|
|
106
|
+
'phone',
|
|
107
|
+
'country',
|
|
108
|
+
'public_id',
|
|
109
|
+
'internal_id',
|
|
110
|
+
'created_at',
|
|
111
|
+
'updated_at',
|
|
112
|
+
'status',
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The current page of data being viewed
|
|
117
|
+
*
|
|
118
|
+
* @var {Integer}
|
|
119
|
+
*/
|
|
120
|
+
@tracked page = 1;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The maximum number of items to show per page
|
|
124
|
+
*
|
|
125
|
+
* @var {Integer}
|
|
126
|
+
*/
|
|
127
|
+
@tracked limit;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The param to sort the data on, the param with prepended `-` is descending
|
|
131
|
+
*
|
|
132
|
+
* @var {String}
|
|
133
|
+
*/
|
|
134
|
+
@tracked sort = '-created_at';
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The filterable param `public_id`
|
|
138
|
+
*
|
|
139
|
+
* @var {String}
|
|
140
|
+
*/
|
|
141
|
+
@tracked public_id;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The filterable param `internal_id`
|
|
145
|
+
*
|
|
146
|
+
* @var {String}
|
|
147
|
+
*/
|
|
148
|
+
@tracked internal_id;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The filterable param `drivers_license_number`
|
|
152
|
+
*
|
|
153
|
+
* @var {String}
|
|
154
|
+
*/
|
|
155
|
+
@tracked drivers_license_number;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The filterable param `name`
|
|
159
|
+
*
|
|
160
|
+
* @var {String}
|
|
161
|
+
*/
|
|
162
|
+
@tracked name;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The filterable param `vehicle`
|
|
166
|
+
*
|
|
167
|
+
* @var {String}
|
|
168
|
+
*/
|
|
169
|
+
@tracked vehicle;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The filterable param `fleet`
|
|
173
|
+
*
|
|
174
|
+
* @var {String}
|
|
175
|
+
*/
|
|
176
|
+
@tracked fleet;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The filterable param `drivers_license_number`
|
|
180
|
+
*
|
|
181
|
+
* @var {String}
|
|
182
|
+
*/
|
|
183
|
+
@tracked drivers_license_number;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The filterable param `phone`
|
|
187
|
+
*
|
|
188
|
+
* @var {String}
|
|
189
|
+
*/
|
|
190
|
+
@tracked phone;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The filterable param `status`
|
|
194
|
+
*
|
|
195
|
+
* @var {Array|String}
|
|
196
|
+
*/
|
|
197
|
+
@tracked status;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The filterable param `created_at`
|
|
201
|
+
*
|
|
202
|
+
* @var {String}
|
|
203
|
+
*/
|
|
204
|
+
@tracked created_at;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The filterable param `updated_at`
|
|
208
|
+
*
|
|
209
|
+
* @var {String}
|
|
210
|
+
*/
|
|
211
|
+
@tracked updated_at;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The current layout.
|
|
215
|
+
*
|
|
216
|
+
* @memberof ManagementDriversIndexController
|
|
217
|
+
*/
|
|
218
|
+
@tracked layout = 'table';
|
|
219
|
+
|
|
220
|
+
@equal('layout', 'grid') isGridLayout;
|
|
221
|
+
@equal('layout', 'table') isTableLayout;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* All columns applicable for orders
|
|
225
|
+
*
|
|
226
|
+
* @var {Array}
|
|
227
|
+
*/
|
|
228
|
+
@tracked columns = [
|
|
229
|
+
{
|
|
230
|
+
label: 'Name',
|
|
231
|
+
valuePath: 'name',
|
|
232
|
+
width: '200px',
|
|
233
|
+
cellComponent: 'table/cell/driver-name',
|
|
234
|
+
action: this.viewDriver,
|
|
235
|
+
resizable: true,
|
|
236
|
+
sortable: true,
|
|
237
|
+
filterable: true,
|
|
238
|
+
filterComponent: 'filter/string',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
label: 'ID',
|
|
242
|
+
valuePath: 'public_id',
|
|
243
|
+
width: '130px',
|
|
244
|
+
cellComponent: 'click-to-copy',
|
|
245
|
+
resizable: true,
|
|
246
|
+
sortable: true,
|
|
247
|
+
filterable: true,
|
|
248
|
+
hidden: false,
|
|
249
|
+
filterComponent: 'filter/string',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
label: 'Internal ID',
|
|
253
|
+
valuePath: 'internal_id',
|
|
254
|
+
cellComponent: 'click-to-copy',
|
|
255
|
+
width: '130px',
|
|
256
|
+
resizable: true,
|
|
257
|
+
sortable: true,
|
|
258
|
+
filterable: true,
|
|
259
|
+
filterComponent: 'filter/string',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
label: 'Vendor',
|
|
263
|
+
cellComponent: 'table/cell/anchor',
|
|
264
|
+
action: this.viewDriverVendor,
|
|
265
|
+
valuePath: 'vendor.name',
|
|
266
|
+
modelNamePath: 'name',
|
|
267
|
+
width: '180px',
|
|
268
|
+
resizable: true,
|
|
269
|
+
filterable: true,
|
|
270
|
+
filterComponent: 'filter/model',
|
|
271
|
+
filterComponentPlaceholder: 'Select vendor to filter by',
|
|
272
|
+
filterParam: 'vendor',
|
|
273
|
+
model: 'vendor',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
label: 'Vehicle',
|
|
277
|
+
cellComponent: 'table/cell/anchor',
|
|
278
|
+
action: this.viewDriverVehicle,
|
|
279
|
+
valuePath: 'vehicle.display_name',
|
|
280
|
+
modelNamePath: 'display_name',
|
|
281
|
+
resizable: true,
|
|
282
|
+
width: '180px',
|
|
283
|
+
filterable: true,
|
|
284
|
+
filterComponent: 'filter/model',
|
|
285
|
+
filterComponentPlaceholder: 'Select vehicle to filter by',
|
|
286
|
+
filterParam: 'vehicle',
|
|
287
|
+
model: 'vehicle',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
label: 'Fleets',
|
|
291
|
+
cellComponent: 'table/cell/link-list',
|
|
292
|
+
cellComponentLabelPath: 'name',
|
|
293
|
+
action: (fleet) => {
|
|
294
|
+
this.fleets.viewFleet(fleet);
|
|
295
|
+
},
|
|
296
|
+
valuePath: 'fleets',
|
|
297
|
+
width: '180px',
|
|
298
|
+
resizable: true,
|
|
299
|
+
hidden: true,
|
|
300
|
+
filterable: true,
|
|
301
|
+
filterComponent: 'filter/model',
|
|
302
|
+
filterComponentPlaceholder: 'Select fleet to filter by',
|
|
303
|
+
filterParam: 'fleet',
|
|
304
|
+
model: 'fleet',
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
label: 'License',
|
|
308
|
+
valuePath: 'drivers_license_number',
|
|
309
|
+
cellComponent: 'table/cell/base',
|
|
310
|
+
width: '150px',
|
|
311
|
+
resizable: true,
|
|
312
|
+
sortable: true,
|
|
313
|
+
filterable: true,
|
|
314
|
+
filterComponent: 'filter/string',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
label: 'Phone',
|
|
318
|
+
valuePath: 'phone',
|
|
319
|
+
cellComponent: 'table/cell/base',
|
|
320
|
+
width: '150px',
|
|
321
|
+
resizable: true,
|
|
322
|
+
sortable: true,
|
|
323
|
+
filterable: true,
|
|
324
|
+
filterParam: 'phone',
|
|
325
|
+
filterComponent: 'filter/string',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
label: 'Country',
|
|
329
|
+
valuePath: 'country',
|
|
330
|
+
cellComponent: 'table/cell/country',
|
|
331
|
+
cellClassNames: 'uppercase',
|
|
332
|
+
width: '120px',
|
|
333
|
+
resizable: true,
|
|
334
|
+
hidden: true,
|
|
335
|
+
sortable: true,
|
|
336
|
+
filterable: true,
|
|
337
|
+
filterParam: 'country',
|
|
338
|
+
filterComponent: 'filter/multi-option',
|
|
339
|
+
filterFetchOptions: 'lookup/countries',
|
|
340
|
+
filterOptionLabel: 'name',
|
|
341
|
+
filterOptionValue: 'cca2',
|
|
342
|
+
multiOptionSearchEnabled: true,
|
|
343
|
+
multiOptionSearchPlaceholder: 'Search countries...',
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
label: 'Status',
|
|
347
|
+
valuePath: 'status',
|
|
348
|
+
cellComponent: 'table/cell/status',
|
|
349
|
+
width: '10%',
|
|
350
|
+
resizable: true,
|
|
351
|
+
sortable: true,
|
|
352
|
+
filterable: true,
|
|
353
|
+
filterComponent: 'filter/multi-option',
|
|
354
|
+
filterFetchOptions: 'drivers/statuses',
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
label: 'Created At',
|
|
358
|
+
valuePath: 'createdAt',
|
|
359
|
+
sortParam: 'created_at',
|
|
360
|
+
filterParam: 'created_at',
|
|
361
|
+
width: '130px',
|
|
362
|
+
resizable: true,
|
|
363
|
+
sortable: true,
|
|
364
|
+
filterable: true,
|
|
365
|
+
filterComponent: 'filter/date',
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
label: 'Updated At',
|
|
369
|
+
valuePath: 'updatedAt',
|
|
370
|
+
sortParam: 'updated_at',
|
|
371
|
+
filterParam: 'updated_at',
|
|
372
|
+
width: '130px',
|
|
373
|
+
resizable: true,
|
|
374
|
+
sortable: true,
|
|
375
|
+
hidden: true,
|
|
376
|
+
filterable: true,
|
|
377
|
+
filterComponent: 'filter/date',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
label: '',
|
|
381
|
+
cellComponent: 'table/cell/dropdown',
|
|
382
|
+
ddButtonText: false,
|
|
383
|
+
ddButtonIcon: 'ellipsis-h',
|
|
384
|
+
ddButtonIconPrefix: 'fas',
|
|
385
|
+
ddMenuLabel: 'Driver Actions',
|
|
386
|
+
cellClassNames: 'overflow-visible',
|
|
387
|
+
wrapperClass: 'flex items-center justify-end mx-2',
|
|
388
|
+
width: '10%',
|
|
389
|
+
actions: [
|
|
390
|
+
{
|
|
391
|
+
label: 'View driver details...',
|
|
392
|
+
fn: this.viewDriver,
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
label: 'Edit driver details...',
|
|
396
|
+
fn: this.editDriver,
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
separator: true,
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
label: 'Assign order to driver...',
|
|
403
|
+
fn: this.assignOrder,
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
label: 'Assign vehicle to driver...',
|
|
407
|
+
fn: this.assignVehicle,
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
label: 'Locate driver on map...',
|
|
411
|
+
fn: this.viewOnMap,
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
separator: true,
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
label: 'Delete driver...',
|
|
418
|
+
fn: this.deleteDriver,
|
|
419
|
+
},
|
|
420
|
+
],
|
|
421
|
+
sortable: false,
|
|
422
|
+
filterable: false,
|
|
423
|
+
resizable: false,
|
|
424
|
+
searchable: false,
|
|
425
|
+
},
|
|
426
|
+
];
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The search task.
|
|
430
|
+
*
|
|
431
|
+
* @void
|
|
432
|
+
*/
|
|
433
|
+
@task({ restartable: true }) *search({ target: { value } }) {
|
|
434
|
+
// if no query don't search
|
|
435
|
+
if (isBlank(value)) {
|
|
436
|
+
this.query = null;
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// timeout for typing
|
|
441
|
+
yield timeout(250);
|
|
442
|
+
|
|
443
|
+
// reset page for results
|
|
444
|
+
if (this.page > 1) {
|
|
445
|
+
this.page = 1;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// update the query param
|
|
449
|
+
this.query = value;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Switch layout view.
|
|
454
|
+
*
|
|
455
|
+
* @param {String} layout
|
|
456
|
+
* @memberof ManagementDriversIndexController
|
|
457
|
+
*/
|
|
458
|
+
@action changeLayout(layout) {
|
|
459
|
+
this.layout = layout;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Bulk deletes selected `driver` via confirm prompt
|
|
464
|
+
*
|
|
465
|
+
* @param {Array} selected an array of selected models
|
|
466
|
+
* @void
|
|
467
|
+
*/
|
|
468
|
+
@action bulkDeleteDrivers() {
|
|
469
|
+
const selected = this.table.selectedRows;
|
|
470
|
+
|
|
471
|
+
this.crud.bulkDelete(selected, {
|
|
472
|
+
modelNamePath: `name`,
|
|
473
|
+
acceptButtonText: 'Delete Drivers',
|
|
474
|
+
onSuccess: () => {
|
|
475
|
+
return this.hostRouter.refresh();
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Toggles dialog to export `drivers`
|
|
484
|
+
*
|
|
485
|
+
* @void
|
|
486
|
+
*/
|
|
487
|
+
@action exportDrivers() {
|
|
488
|
+
this.crud.export('driver');
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* View a `driver` details in modal
|
|
493
|
+
*
|
|
494
|
+
* @param {DriverModel} driver
|
|
495
|
+
* @param {Object} options
|
|
496
|
+
* @void
|
|
497
|
+
*/
|
|
498
|
+
@action viewDriver(driver, options = {}) {
|
|
499
|
+
const viewDriverOnMap = () => {
|
|
500
|
+
this.modalsManager.done().then(() => {
|
|
501
|
+
return this.viewOnMap(driver, {
|
|
502
|
+
onFinish: () => {
|
|
503
|
+
this.viewDriver(driver);
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
this.modalsManager.show('modals/driver-details', {
|
|
510
|
+
title: driver.name,
|
|
511
|
+
titleComponent: 'modal/title-with-buttons',
|
|
512
|
+
acceptButtonText: 'Done',
|
|
513
|
+
acceptButtonIcon: 'check',
|
|
514
|
+
acceptButtonIconPrefix: 'fas',
|
|
515
|
+
hideDeclineButton: true,
|
|
516
|
+
declineButtonIcon: 'times',
|
|
517
|
+
declineButtonIconPrefix: 'fas',
|
|
518
|
+
headerStatus: driver.status,
|
|
519
|
+
headerButtons: [
|
|
520
|
+
{
|
|
521
|
+
icon: 'cog',
|
|
522
|
+
iconPrefix: 'fas',
|
|
523
|
+
type: 'link',
|
|
524
|
+
size: 'xs',
|
|
525
|
+
ddMenuLabel: 'Driver Actions',
|
|
526
|
+
options: [
|
|
527
|
+
{
|
|
528
|
+
title: 'Edit Driver',
|
|
529
|
+
icon: 'edit',
|
|
530
|
+
action: () => {
|
|
531
|
+
this.modalsManager.done().then(() => {
|
|
532
|
+
return this.editDriver(driver, {
|
|
533
|
+
onFinish: () => {
|
|
534
|
+
this.viewDriver(driver);
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
});
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
separator: true,
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
title: 'Assign Order to Driver',
|
|
545
|
+
icon: 'user-check',
|
|
546
|
+
action: () => {
|
|
547
|
+
this.modalsManager.done().then(() => {
|
|
548
|
+
return this.assignOrder(driver, {
|
|
549
|
+
onFinish: () => {
|
|
550
|
+
this.viewDriver(driver);
|
|
551
|
+
},
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
title: 'Assign Vehicle to Driver',
|
|
558
|
+
icon: 'car',
|
|
559
|
+
action: () => {
|
|
560
|
+
this.modalsManager.done().then(() => {
|
|
561
|
+
return this.assignVehicle(driver, {
|
|
562
|
+
onFinish: () => {
|
|
563
|
+
this.viewDriver(driver);
|
|
564
|
+
},
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
title: 'Locate Driver',
|
|
571
|
+
icon: 'map-pin',
|
|
572
|
+
action: viewDriverOnMap,
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
separator: true,
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
title: 'Listen to socket channel',
|
|
579
|
+
icon: 'headphones',
|
|
580
|
+
action: () => {
|
|
581
|
+
this.modalsManager.done().then(() => {
|
|
582
|
+
this.hostRouter.transitionTo('console.developers-console.sockets.watch', `driver.${driver.public_id}`);
|
|
583
|
+
});
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
separator: true,
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
title: 'Delete Driver',
|
|
591
|
+
icon: 'trash',
|
|
592
|
+
action: () => {
|
|
593
|
+
this.modalsManager.done().then(() => {
|
|
594
|
+
return this.deleteDriver(driver, {
|
|
595
|
+
onDecline: () => {
|
|
596
|
+
this.viewDriver(driver);
|
|
597
|
+
},
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
},
|
|
604
|
+
],
|
|
605
|
+
viewVendor: () =>
|
|
606
|
+
this.viewDriverVendor(driver, {
|
|
607
|
+
onFinish: () => {
|
|
608
|
+
this.viewDriver(driver);
|
|
609
|
+
},
|
|
610
|
+
}),
|
|
611
|
+
viewVehicle: () =>
|
|
612
|
+
this.viewDriverVehicle(driver, {
|
|
613
|
+
onFinish: () => {
|
|
614
|
+
this.viewDriver(driver);
|
|
615
|
+
},
|
|
616
|
+
}),
|
|
617
|
+
viewDriverOnMap,
|
|
618
|
+
driver,
|
|
619
|
+
...options,
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Create a new `driver` in modal
|
|
625
|
+
*
|
|
626
|
+
* @param {Object} options
|
|
627
|
+
* @void
|
|
628
|
+
*/
|
|
629
|
+
@action createDriver() {
|
|
630
|
+
const driver = this.store.createRecord('driver', {
|
|
631
|
+
status: `active`,
|
|
632
|
+
slug: generateSlug(),
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
return this.editDriver(driver, {
|
|
636
|
+
title: 'New Driver',
|
|
637
|
+
acceptButtonText: 'Create',
|
|
638
|
+
acceptButtonIcon: 'check',
|
|
639
|
+
acceptButtonIconPrefix: 'fas',
|
|
640
|
+
successNotification: (driver) => `New driver (${driver.name}) created.`,
|
|
641
|
+
onConfirm: () => {
|
|
642
|
+
return this.hostRouter.refresh();
|
|
643
|
+
},
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Edit a `driver` details
|
|
649
|
+
*
|
|
650
|
+
* @param {DriverModel} driver
|
|
651
|
+
* @param {Object} options
|
|
652
|
+
* @void
|
|
653
|
+
*/
|
|
654
|
+
@action editDriver(driver, options = {}) {
|
|
655
|
+
// make sure vehicle is loaded
|
|
656
|
+
driver.loadVehicle();
|
|
657
|
+
|
|
658
|
+
this.modalsManager.show('modals/driver-form', {
|
|
659
|
+
title: 'Edit Driver',
|
|
660
|
+
acceptButtonText: 'Save Changes',
|
|
661
|
+
acceptButtonIcon: 'save',
|
|
662
|
+
declineButtonIcon: 'times',
|
|
663
|
+
declineButtonIconPrefix: 'fas',
|
|
664
|
+
driver,
|
|
665
|
+
uploadNewPhoto: (file) => {
|
|
666
|
+
this.fetch.uploadFile.perform(
|
|
667
|
+
file,
|
|
668
|
+
{
|
|
669
|
+
path: `uploads/${this.currentUser.companyId}/drivers/${driver.slug}`,
|
|
670
|
+
subject_uuid: driver.id,
|
|
671
|
+
subject_type: `driver`,
|
|
672
|
+
type: `driver_photo`,
|
|
673
|
+
},
|
|
674
|
+
(uploadedFile) => {
|
|
675
|
+
console.log('uploadedFile', uploadedFile);
|
|
676
|
+
driver.setProperties({
|
|
677
|
+
photo_uuid: uploadedFile.id,
|
|
678
|
+
photo_url: uploadedFile.url,
|
|
679
|
+
photo: uploadedFile,
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
},
|
|
684
|
+
confirm: (modal, done) => {
|
|
685
|
+
modal.startLoading();
|
|
686
|
+
|
|
687
|
+
driver
|
|
688
|
+
.save()
|
|
689
|
+
.then((driver) => {
|
|
690
|
+
if (typeof options.successNotification === 'function') {
|
|
691
|
+
this.notifications.success(options.successNotification(driver));
|
|
692
|
+
} else {
|
|
693
|
+
this.notifications.success(options.successNotification || `${driver.name} details updated.`);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
done();
|
|
697
|
+
})
|
|
698
|
+
.catch((error) => {
|
|
699
|
+
console.log(error);
|
|
700
|
+
// driver.rollbackAttributes();
|
|
701
|
+
modal.stopLoading();
|
|
702
|
+
this.notifications.serverError(error);
|
|
703
|
+
});
|
|
704
|
+
},
|
|
705
|
+
...options,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Delete a `driver` via confirm prompt
|
|
711
|
+
*
|
|
712
|
+
* @param {DriverModel} driver
|
|
713
|
+
* @param {Object} options
|
|
714
|
+
* @void
|
|
715
|
+
*/
|
|
716
|
+
@action deleteDriver(driver, options = {}) {
|
|
717
|
+
this.crud.delete(driver, {
|
|
718
|
+
onSuccess: () => {
|
|
719
|
+
return this.hostRouter.refresh();
|
|
720
|
+
},
|
|
721
|
+
...options,
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Prompt user to assign a `order` to a `driver`
|
|
727
|
+
*
|
|
728
|
+
* @param {DriverModel} driver
|
|
729
|
+
* @param {Object} options
|
|
730
|
+
* @void
|
|
731
|
+
*/
|
|
732
|
+
@action assignOrder(driver, options = {}) {
|
|
733
|
+
this.modalsManager.show('modals/driver-assign-order', {
|
|
734
|
+
title: `Assign Order to this Driver`,
|
|
735
|
+
acceptButtonText: 'Assign Order',
|
|
736
|
+
acceptButtonIcon: 'check',
|
|
737
|
+
acceptButtonIconPrefix: 'fas',
|
|
738
|
+
acceptButtonDisabled: true,
|
|
739
|
+
hideDeclineButton: true,
|
|
740
|
+
selectedOrder: null,
|
|
741
|
+
selectOrder: (order) => {
|
|
742
|
+
this.modalsManager.setOption('selectedOrder', order);
|
|
743
|
+
this.modalsManager.setOption('acceptButtonDisabled', false);
|
|
744
|
+
},
|
|
745
|
+
driver,
|
|
746
|
+
confirm: (modal) => {
|
|
747
|
+
const selectedOrder = modal.getOption('selectedOrder');
|
|
748
|
+
|
|
749
|
+
if (!selectedOrder) {
|
|
750
|
+
this.notifications.warning('No order selected!');
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
modal.startLoading();
|
|
755
|
+
|
|
756
|
+
driver.set('current_job_uuid', selectedOrder.id);
|
|
757
|
+
|
|
758
|
+
return driver
|
|
759
|
+
.save()
|
|
760
|
+
.then(() => {
|
|
761
|
+
this.notifications.success(`${driver.name} assigned to order.`);
|
|
762
|
+
})
|
|
763
|
+
.catch((error) => {
|
|
764
|
+
driver.rollbackAttributes();
|
|
765
|
+
modal.stopLoading();
|
|
766
|
+
this.notifications.serverError(error);
|
|
767
|
+
});
|
|
768
|
+
},
|
|
769
|
+
...options,
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Prompt user to assign a `vehicle` to a `driver`
|
|
775
|
+
*
|
|
776
|
+
* @param {DriverModel} driver
|
|
777
|
+
* @param {Object} options
|
|
778
|
+
* @void
|
|
779
|
+
*/
|
|
780
|
+
@action assignVehicle(driver, options = {}) {
|
|
781
|
+
this.modalsManager.show('modals/driver-assign-vehicle', {
|
|
782
|
+
title: `Assign Vehicle to this Driver`,
|
|
783
|
+
acceptButtonText: 'Confirm & Create',
|
|
784
|
+
acceptButtonIcon: 'check',
|
|
785
|
+
acceptButtonIconPrefix: 'fas',
|
|
786
|
+
hideDeclineButton: true,
|
|
787
|
+
driver,
|
|
788
|
+
confirm: (modal) => {
|
|
789
|
+
modal.startLoading();
|
|
790
|
+
|
|
791
|
+
return driver
|
|
792
|
+
.save()
|
|
793
|
+
.then((driver) => {
|
|
794
|
+
this.notifications.success(`${driver.name} assigned to vehicle.`);
|
|
795
|
+
})
|
|
796
|
+
.catch((error) => {
|
|
797
|
+
driver.rollbackAttributes();
|
|
798
|
+
modal.stopLoading();
|
|
799
|
+
this.notifications.serverError(error);
|
|
800
|
+
});
|
|
801
|
+
},
|
|
802
|
+
...options,
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Display a dialog with a map view of the `driver` location
|
|
808
|
+
*
|
|
809
|
+
* @param {DriverModel} driver
|
|
810
|
+
* @void
|
|
811
|
+
*/
|
|
812
|
+
@action viewOnMap(driver, options = {}) {
|
|
813
|
+
const { location } = driver;
|
|
814
|
+
const [latitude, longitude] = extractCoordinates(location.coordinates);
|
|
815
|
+
|
|
816
|
+
this.modalsManager.show('modals/point-map', {
|
|
817
|
+
title: `Location of ${driver.name}`,
|
|
818
|
+
acceptButtonText: 'Done',
|
|
819
|
+
acceptButtonIcon: 'check',
|
|
820
|
+
acceptButtonIconPrefix: 'fas',
|
|
821
|
+
modalClass: 'modal-lg',
|
|
822
|
+
hideDeclineButton: true,
|
|
823
|
+
latitude,
|
|
824
|
+
longitude,
|
|
825
|
+
location,
|
|
826
|
+
popupText: `${driver.name} (${driver.public_id})`,
|
|
827
|
+
icon: leafletIcon({
|
|
828
|
+
iconUrl: driver?.vehicle_avatar,
|
|
829
|
+
iconSize: [40, 40],
|
|
830
|
+
}),
|
|
831
|
+
...options,
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* View information about the drivers assigned vehicle
|
|
837
|
+
*
|
|
838
|
+
* @param {DriverModel} driver
|
|
839
|
+
* @param {Object} options
|
|
840
|
+
* @void
|
|
841
|
+
*/
|
|
842
|
+
@action async viewDriverVehicle(driver, options = {}) {
|
|
843
|
+
this.modalsManager.displayLoader();
|
|
844
|
+
|
|
845
|
+
const vehicle = await this.store.findRecord('vehicle', driver.vehicle_uuid);
|
|
846
|
+
|
|
847
|
+
this.modalsManager.done().then(() => {
|
|
848
|
+
return this.vehicles.viewVehicle(vehicle, options);
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* View information about the driver vendor
|
|
854
|
+
*
|
|
855
|
+
* @param {DriverModel} driver
|
|
856
|
+
* @param {Object} options
|
|
857
|
+
* @void
|
|
858
|
+
*/
|
|
859
|
+
@action async viewDriverVendor(driver, options = {}) {
|
|
860
|
+
this.modalsManager.displayLoader();
|
|
861
|
+
|
|
862
|
+
const vendor = await this.store.findRecord('vendor', driver.vendor_uuid);
|
|
863
|
+
|
|
864
|
+
this.modalsManager.done().then(() => {
|
|
865
|
+
return this.vendors.viewVendor(vendor, options);
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|