@fleetbase/fleetops-engine 0.6.44 → 0.6.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/addon/components/admin/map-settings.hbs +26 -0
  2. package/addon/components/admin/map-settings.js +46 -0
  3. package/addon/components/admin/routing-settings.hbs +11 -0
  4. package/addon/components/cell/order-route-type.hbs +46 -0
  5. package/addon/components/cell/order-route-type.js +90 -0
  6. package/addon/components/cell/place-address.hbs +1 -0
  7. package/addon/components/display-place.hbs +45 -56
  8. package/addon/components/display-place.js +21 -0
  9. package/addon/components/entity/form.hbs +24 -0
  10. package/addon/components/entity/form.js +30 -0
  11. package/addon/components/layout/fleet-ops-sidebar/driver-listing.js +5 -5
  12. package/addon/components/layout/fleet-ops-sidebar/fleet-listing.js +5 -5
  13. package/addon/components/layout/fleet-ops-sidebar.js +8 -0
  14. package/addon/components/leaflet-draw-control.js +1 -1
  15. package/addon/components/maintenance-schedule/form.js +2 -1
  16. package/addon/components/map/drawer/driver-listing.js +5 -5
  17. package/addon/components/map/drawer/geofence-event-listing.js +5 -2
  18. package/addon/components/map/drawer/place-listing.js +5 -5
  19. package/addon/components/map/drawer/position-listing.js +102 -21
  20. package/addon/components/map/drawer/vehicle-listing.js +5 -5
  21. package/addon/components/map/google-live-map.hbs +9 -0
  22. package/addon/components/map/google-live-map.js +445 -0
  23. package/addon/components/map/leaflet-live-map.hbs +186 -142
  24. package/addon/components/map/leaflet-live-map.js +121 -41
  25. package/addon/components/map/toolbar/visibility-control-panel.js +2 -2
  26. package/addon/components/map/toolbar/zones-panel.hbs +9 -9
  27. package/addon/components/map/toolbar.hbs +3 -3
  28. package/addon/components/map/toolbar.js +9 -1
  29. package/addon/components/modals/map-layer-form.hbs +132 -63
  30. package/addon/components/modals/orchestrator-import.hbs +4 -11
  31. package/addon/components/modals/orchestrator-import.js +17 -1
  32. package/addon/components/modals/update-order-activity.hbs +1 -1
  33. package/addon/components/orchestrator/order-pool.js +3 -2
  34. package/addon/components/orchestrator-workbench.js +29 -41
  35. package/addon/components/order/details/detail.js +2 -2
  36. package/addon/components/order/details/payload.hbs +5 -5
  37. package/addon/components/order/details/payload.js +18 -1
  38. package/addon/components/order/details/route.hbs +2 -2
  39. package/addon/components/order/details/route.js +76 -3
  40. package/addon/components/order/form/payload.hbs +33 -0
  41. package/addon/components/order/form/payload.js +1 -0
  42. package/addon/components/order/form/route.hbs +8 -8
  43. package/addon/components/order/form/route.js +78 -18
  44. package/addon/components/order/form/service-rate.hbs +1 -1
  45. package/addon/components/order/form.js +2 -2
  46. package/addon/components/order/route-editor.hbs +209 -147
  47. package/addon/components/order/route-editor.js +143 -102
  48. package/addon/components/place/address.hbs +1 -0
  49. package/addon/components/place/address.js +12 -0
  50. package/addon/components/route-list.hbs +43 -55
  51. package/addon/components/route-list.js +47 -0
  52. package/addon/components/route-optimization-wizard-panel.js +3 -4
  53. package/addon/components/service-rate/details.hbs +6 -6
  54. package/addon/components/service-rate/form.hbs +28 -15
  55. package/addon/components/vehicle/card.hbs +4 -4
  56. package/addon/controllers/maintenance/schedules/index.js +2 -1
  57. package/addon/controllers/operations/orders/index/details/virtual.js +5 -0
  58. package/addon/controllers/operations/orders/index/details.js +113 -15
  59. package/addon/controllers/operations/orders/index/new.js +1 -1
  60. package/addon/controllers/operations/orders/index.js +8 -1
  61. package/addon/controllers/operations/service-rates/index/edit.js +1 -0
  62. package/addon/controllers/operations/service-rates/index/new.js +1 -0
  63. package/addon/controllers/settings/map.js +97 -0
  64. package/addon/controllers/settings/routing.js +47 -12
  65. package/addon/extension.js +11 -0
  66. package/addon/helpers/f-to-int.js +6 -0
  67. package/addon/helpers/place-address-html.js +6 -0
  68. package/addon/instance-initializers/register-google-routes.js +17 -0
  69. package/addon/instance-initializers/register-osrm.js +5 -0
  70. package/addon/routes/application.js +9 -3
  71. package/addon/routes/operations/orchestrator.js +13 -0
  72. package/addon/routes/operations/orders/index/details/virtual.js +1 -0
  73. package/addon/routes/operations/orders/index/details.js +47 -24
  74. package/addon/routes/operations/orders/index/new.js +9 -0
  75. package/addon/routes/operations/orders/index.js +0 -1
  76. package/addon/routes/settings/map.js +3 -0
  77. package/addon/routes.js +1 -0
  78. package/addon/services/entity-actions.js +1 -1
  79. package/addon/services/equipment-actions.js +4 -6
  80. package/addon/services/geofence-event-bus.js +2 -1
  81. package/addon/services/geofence.js +204 -168
  82. package/addon/services/google-routes.js +300 -0
  83. package/addon/services/leaflet-draw-restriction.js +2 -1
  84. package/addon/services/leaflet-map-manager.js +21 -0
  85. package/addon/services/maintenance-actions.js +4 -6
  86. package/addon/services/map-adapter/google.js +2205 -0
  87. package/addon/services/map-adapter/leaflet.js +1042 -0
  88. package/addon/services/map-adapter-interface.js +551 -0
  89. package/addon/services/map-manager.js +768 -0
  90. package/addon/services/map-settings.js +75 -0
  91. package/addon/services/movement-tracker.js +83 -32
  92. package/addon/services/order-actions.js +11 -1
  93. package/addon/services/osrm.js +79 -6
  94. package/addon/services/part-actions.js +4 -6
  95. package/addon/services/position-playback.js +135 -62
  96. package/addon/services/route-engine.js +83 -0
  97. package/addon/services/service-areas.js +8 -1
  98. package/addon/services/service-rate-actions.js +8 -3
  99. package/addon/styles/fleetops-engine.css +555 -0
  100. package/addon/templates/management/vehicles/index.hbs +0 -1
  101. package/addon/templates/operations/orders/index/details/virtual.hbs +7 -1
  102. package/addon/templates/operations/orders/index/details.hbs +0 -1
  103. package/addon/templates/settings/map.hbs +53 -0
  104. package/addon/templates/settings/routing.hbs +15 -4
  105. package/addon/utils/fleet-ops-options.js +34 -0
  106. package/addon/utils/has-valid-coordinates.js +6 -0
  107. package/addon/utils/map-provider-options.js +6 -0
  108. package/addon/utils/order-route-editing.js +86 -0
  109. package/addon/utils/order-route-summary.js +20 -0
  110. package/addon/utils/place-address-html.js +41 -0
  111. package/addon/utils/route-colors.js +43 -12
  112. package/addon/utils/route-visualization.js +93 -0
  113. package/addon/utils/serialize-payload.js +1 -1
  114. package/addon/utils/vendor-integration.js +2 -1
  115. package/app/components/admin/map-settings.js +1 -0
  116. package/app/components/admin/routing-settings.js +1 -0
  117. package/app/components/cell/order-route-type.js +1 -0
  118. package/app/components/cell/place-address.js +1 -0
  119. package/app/components/map/google-live-map.js +1 -0
  120. package/app/components/place/address.js +1 -0
  121. package/app/controllers/operations/orders/index/details/virtual.js +1 -0
  122. package/app/controllers/settings/map.js +1 -0
  123. package/app/helpers/f-to-int.js +1 -0
  124. package/app/helpers/place-address-html.js +1 -0
  125. package/app/routes/settings/map.js +1 -0
  126. package/app/services/map-adapter/google.js +1 -0
  127. package/app/services/map-adapter/leaflet.js +1 -0
  128. package/app/services/map-adapter-interface.js +1 -0
  129. package/app/services/map-manager.js +1 -0
  130. package/app/services/map-settings.js +1 -0
  131. package/app/templates/settings/map.js +1 -0
  132. package/app/utils/has-valid-coordinates.js +1 -0
  133. package/app/utils/order-route-editing.js +2 -0
  134. package/app/utils/order-route-summary.js +1 -0
  135. package/app/utils/place-address-html.js +1 -0
  136. package/app/utils/route-colors.js +1 -1
  137. package/app/utils/route-visualization.js +1 -0
  138. package/assets/images/drawing-controls-spritesheet.svg +156 -0
  139. package/composer.json +1 -1
  140. package/extension.json +1 -1
  141. package/package.json +3 -3
  142. package/server/src/Auth/Schemas/FleetOps.php +5 -0
  143. package/server/src/Http/Controllers/Api/v1/OrderController.php +36 -8
  144. package/server/src/Http/Controllers/Api/v1/PayloadController.php +14 -1
  145. package/server/src/Http/Controllers/Api/v1/PurchaseRateController.php +11 -3
  146. package/server/src/Http/Controllers/Api/v1/ServiceAreaController.php +2 -0
  147. package/server/src/Http/Controllers/Api/v1/ServiceQuoteController.php +7 -2
  148. package/server/src/Http/Controllers/Api/v1/ServiceRateController.php +6 -1
  149. package/server/src/Http/Controllers/Api/v1/ZoneController.php +2 -0
  150. package/server/src/Http/Controllers/Internal/v1/LiveController.php +2 -1
  151. package/server/src/Http/Controllers/Internal/v1/OrchestrationController.php +7 -4
  152. package/server/src/Http/Controllers/Internal/v1/OrderController.php +61 -34
  153. package/server/src/Http/Controllers/Internal/v1/ServiceQuoteController.php +3 -2
  154. package/server/src/Http/Controllers/Internal/v1/SettingController.php +106 -3
  155. package/server/src/Http/Filter/OrderFilter.php +2 -1
  156. package/server/src/Http/Requests/CreateServiceRateRequest.php +2 -2
  157. package/server/src/Http/Resources/v1/Index/Payload.php +9 -7
  158. package/server/src/Http/Resources/v1/Order.php +20 -2
  159. package/server/src/Http/Resources/v1/ServiceQuote.php +2 -2
  160. package/server/src/Models/Entity.php +7 -0
  161. package/server/src/Models/Order.php +81 -8
  162. package/server/src/Models/OrderConfig.php +15 -0
  163. package/server/src/Models/Payload.php +131 -27
  164. package/server/src/Models/Place.php +182 -48
  165. package/server/src/Models/ServiceRate.php +125 -32
  166. package/server/src/Observers/PurchaseRateObserver.php +3 -5
  167. package/server/src/Orchestration/Engines/VroomOrchestrationEngine.php +59 -23
  168. package/server/src/Rules/ComputableAlgo.php +1 -3
  169. package/server/src/Support/Algo.php +87 -1
  170. package/server/src/Support/Utils.php +69 -0
  171. package/server/src/routes.php +4 -0
  172. package/translations/en-us.yaml +1937 -1916
@@ -0,0 +1,26 @@
1
+ <ContentPanel @title="Configure Map" @open={{true}} @wrapperClass="bordered-classic">
2
+ <InputGroup @name="Default Map Provider" @helpText="Sets the default map provider for all organizations unless they override it in their own FleetOps map settings.">
3
+ <Select
4
+ class="w-full flex-1"
5
+ @value={{this.mapProvider}}
6
+ @options={{this.mapProviderOptions}}
7
+ @optionLabel="label"
8
+ @optionValue="value"
9
+ @placeholder="Select default map provider"
10
+ @onSelect={{this.selectMapProvider}}
11
+ />
12
+ </InputGroup>
13
+ <InputGroup @name="Google Map ID" @value={{this.googleMapsMapId}} @helpText="Required for Google Advanced Markers and cloud-based map styling." />
14
+ </ContentPanel>
15
+
16
+ <EmberWormhole @to="next-view-section-subheader-actions">
17
+ <Button
18
+ @type="primary"
19
+ @size="sm"
20
+ @icon="save"
21
+ @text="Save Changes"
22
+ @onClick={{perform this.saveSettings}}
23
+ @isLoading={{or this.saveSettings.isRunning this.loadSettings.isRunning}}
24
+ @disabled={{this.saveSettings.isRunning}}
25
+ />
26
+ </EmberWormhole>
@@ -0,0 +1,46 @@
1
+ import Component from '@glimmer/component';
2
+ import { inject as service } from '@ember/service';
3
+ import { tracked } from '@glimmer/tracking';
4
+ import { task } from 'ember-concurrency';
5
+ import { action } from '@ember/object';
6
+ import MAP_PROVIDER_OPTIONS from '../../utils/map-provider-options';
7
+
8
+ export default class AdminMapSettingsComponent extends Component {
9
+ @service fetch;
10
+ @service notifications;
11
+ @tracked mapProviderOptions = MAP_PROVIDER_OPTIONS;
12
+ @tracked mapProvider = 'leaflet';
13
+ @tracked googleMapsMapId = '';
14
+
15
+ constructor() {
16
+ super(...arguments);
17
+ this.loadSettings.perform();
18
+ }
19
+
20
+ @task *loadSettings() {
21
+ try {
22
+ const settings = yield this.fetch.get('fleet-ops/settings/admin-map');
23
+ this.mapProvider = settings?.mapProvider ?? 'leaflet';
24
+ this.googleMapsMapId = settings?.googleMapsMapId ?? '';
25
+ } catch (error) {
26
+ this.notifications.serverError(error);
27
+ }
28
+ }
29
+
30
+ @action selectMapProvider(option) {
31
+ this.mapProvider = option?.value ?? option ?? 'leaflet';
32
+ }
33
+
34
+ @task *saveSettings() {
35
+ try {
36
+ yield this.fetch.post('fleet-ops/settings/admin-map', {
37
+ mapProvider: this.mapProvider,
38
+ googleMapsMapId: this.googleMapsMapId,
39
+ });
40
+
41
+ this.notifications.success('Map settings saved.');
42
+ } catch (error) {
43
+ this.notifications.serverError(error);
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,11 @@
1
+ <div class="space-y-6">
2
+ <InfoBlock @type="info" @icon="circle-info" class="mb-4">
3
+ Configure system-wide routing engine defaults here. Organizations can optionally override these values from their own routing settings.
4
+ </InfoBlock>
5
+
6
+ <RegistryYield @registry="fleet-ops:component:admin:routing-settings" as |RegistryComponent|>
7
+ <div>
8
+ <RegistryComponent />
9
+ </div>
10
+ </RegistryYield>
11
+ </div>
@@ -0,0 +1,46 @@
1
+ <div class="orders-route-type-cell" ...attributes>
2
+ {{#if this.hasRoutePreview}}
3
+ <div class="orders-route-type-trigger" {{on "mouseenter" this.ensurePayloadLoaded}} {{on "focusin" this.ensurePayloadLoaded}}>
4
+ <span class="{{this.summary.badgeClass}} orders-route-type-badge">
5
+ <FaIcon @icon={{this.summary.icon}} class="mr-0.5" />
6
+ {{this.summary.label}}
7
+ </span>
8
+ <Attach::Tooltip @class="clean orders-route-type-tooltip" @animation="scale" @placement="right">
9
+ <InputInfo @hideIcon={{true}}>
10
+ <div class="orders-route-type-preview">
11
+ <div class="orders-route-type-preview__header">
12
+ <FaIcon @icon="route" class="mr-2" />
13
+ <span>{{t "resource.route"}}</span>
14
+ </div>
15
+ {{#if this.isLoadingPayload}}
16
+ <div class="orders-route-type-preview__state">
17
+ <Spinner class="mr-2" />
18
+ <span>{{t "common.loading-route"}}</span>
19
+ </div>
20
+ {{else if this.loadPayloadError}}
21
+ <div class="orders-route-type-preview__state orders-route-type-preview__state--error">
22
+ {{this.loadPayloadError}}
23
+ </div>
24
+ {{else if this.hasLoadedWaypointPayload}}
25
+ <RouteList
26
+ @order={{this.order}}
27
+ @isCollapsible={{false}}
28
+ @routeStopClass="orders-route-type-preview__stop"
29
+ @routeLocationClass="orders-route-type-preview__location"
30
+ />
31
+ {{else}}
32
+ <div class="orders-route-type-preview__state">
33
+ {{t "common.hover-to-load-route"}}
34
+ </div>
35
+ {{/if}}
36
+ </div>
37
+ </InputInfo>
38
+ </Attach::Tooltip>
39
+ </div>
40
+ {{else}}
41
+ <span class="{{this.summary.badgeClass}} orders-route-type-badge">
42
+ <FaIcon @icon={{this.summary.icon}} class="mr-0.5" />
43
+ {{this.summary.label}}
44
+ </span>
45
+ {{/if}}
46
+ </div>
@@ -0,0 +1,90 @@
1
+ import Component from '@glimmer/component';
2
+ import { inject as service } from '@ember/service';
3
+ import { tracked } from '@glimmer/tracking';
4
+ import { action } from '@ember/object';
5
+ import { isArray } from '@ember/array';
6
+ import { buildRouteTypeSummary } from '../../utils/order-route-summary';
7
+
8
+ export default class CellOrderRouteTypeComponent extends Component {
9
+ @service intl;
10
+ @tracked isLoadingPayload = false;
11
+ @tracked loadPayloadError = null;
12
+ _payloadLoadPromise = null;
13
+
14
+ get order() {
15
+ return this.args.row;
16
+ }
17
+
18
+ get payload() {
19
+ return this.order?.payload;
20
+ }
21
+
22
+ get intermediateStopCount() {
23
+ const loadedWaypointCount = this.payload?.waypoints?.length;
24
+ const indexedWaypointCount = Number(this.payload?.waypoints_count ?? 0);
25
+
26
+ if (typeof loadedWaypointCount === 'number') {
27
+ return Math.max(loadedWaypointCount, indexedWaypointCount);
28
+ }
29
+
30
+ return indexedWaypointCount;
31
+ }
32
+
33
+ get baseSummary() {
34
+ return buildRouteTypeSummary({
35
+ hasIntermediateWaypoints: this.order?.hasIntermediateWaypoints ?? this.payload?.hasIntermediateWaypoints,
36
+ intermediateStopCount: this.intermediateStopCount,
37
+ hasPickup: Boolean(this.payload?.pickup_uuid),
38
+ hasDropoff: Boolean(this.payload?.dropoff_uuid),
39
+ });
40
+ }
41
+
42
+ get summary() {
43
+ return {
44
+ ...this.baseSummary,
45
+ label: this.intl.t(this.baseSummary.translationKey, this.baseSummary.translationOptions),
46
+ };
47
+ }
48
+
49
+ get hasRoutePreview() {
50
+ return this.baseSummary.kind === 'multi_stop' || this.baseSummary.kind === 'pickup_dropoff_stops';
51
+ }
52
+
53
+ get hasLoadedWaypointPayload() {
54
+ const waypoints = this.payload?.waypoints;
55
+ const loadedWaypointCount = waypoints?.length;
56
+
57
+ if (typeof loadedWaypointCount === 'number') {
58
+ if (loadedWaypointCount > 0) {
59
+ return true;
60
+ }
61
+
62
+ return this.intermediateStopCount === 0;
63
+ }
64
+
65
+ return (typeof waypoints?.toArray === 'function' || isArray(waypoints)) && this.intermediateStopCount === 0;
66
+ }
67
+
68
+ @action async ensurePayloadLoaded() {
69
+ if (!this.hasRoutePreview || this.hasLoadedWaypointPayload || this.isLoadingPayload) {
70
+ return;
71
+ }
72
+
73
+ if (typeof this.order?.loadPayload !== 'function') {
74
+ return;
75
+ }
76
+
77
+ this.isLoadingPayload = true;
78
+ this.loadPayloadError = null;
79
+
80
+ try {
81
+ this._payloadLoadPromise ??= this.order.loadPayload();
82
+ await this._payloadLoadPromise;
83
+ } catch (error) {
84
+ this.loadPayloadError = error?.message ?? this.intl.t('common.unable-to-load-route');
85
+ } finally {
86
+ this.isLoadingPayload = false;
87
+ this._payloadLoadPromise = null;
88
+ }
89
+ }
90
+ }
@@ -0,0 +1 @@
1
+ <Place::Address @place={{@row}} />
@@ -1,23 +1,25 @@
1
1
  <div {{did-insert this.setupComponent}} ...attributes>
2
- {{#let (or @place.place @place) as |place|}}
3
- {{#if (is-empty place)}}
4
- <div class={{@noAddressClass}}>
5
- <span class="text-red-500">
6
- {{#if @type}}
7
- {{t "display-panel.no-address" htmlSafe=true type=@type}}
8
- {{else}}
9
- {{t "display-panel.no-address-message"}}
10
- {{/if}}
11
- </span>
12
- </div>
13
- {{else}}
14
- <div class="flex flex-row item-center space-x-2 {{if (or place.status_code @eta) 'mb-2'}}">
15
- {{#if place.status_code}}
16
- <Badge @status={{place.status_code}} />
17
- {{/if}}
18
- {{#if @eta}}
19
- <Badge @status="warning" @hideStatusDot={{true}}><span class="font-bold">{{t "common.eta"}}:</span> {{format-duration @eta}}</Badge>
2
+ {{#if (is-empty this.place)}}
3
+ <div class={{@noAddressClass}}>
4
+ <span class="text-red-500">
5
+ {{#if @type}}
6
+ {{t "display-panel.no-address" htmlSafe=true type=@type}}
7
+ {{else}}
8
+ {{t "display-panel.no-address-message"}}
20
9
  {{/if}}
10
+ </span>
11
+ </div>
12
+ {{else}}
13
+ {{#if (and @waypointActions (not @hideBadges))}}
14
+ <div class="flex flex-row item-center space-x-2 {{if (or this.place.status_code @eta) 'mb-2'}}">
15
+ {{#unless @hideBadges}}
16
+ {{#if this.place.status_code}}
17
+ <Badge @status={{this.place.status_code}} />
18
+ {{/if}}
19
+ {{#if @eta}}
20
+ <Badge @status="warning" @hideStatusDot={{true}}><span class="font-bold">{{t "common.eta"}}:</span> {{format-duration @eta}}</Badge>
21
+ {{/if}}
22
+ {{/unless}}
21
23
  {{#if @waypointActions}}
22
24
  <DropdownButton @iconClass="icon-text-height" @size="xs" @buttonClass="fleetops-btn-xxs" @icon="ellipsis-h" @iconPrefix="fas" @contentClass="dropdown-menu" as |dd|>
23
25
  <div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
@@ -29,7 +31,7 @@
29
31
  <div class="next-dd-menu-seperator"></div>
30
32
  {{#each-in @waypointActions as |actionId action|}}
31
33
  <div class="px-1">
32
- <a href="javascript:;" class="next-dd-item" disabled={{cannot "fleet-ops view order"}} {{on "click" (dropdown-fn dd action.fn place)}}>
34
+ <a href="javascript:;" class="next-dd-item" disabled={{cannot "fleet-ops view order"}} {{on "click" (dropdown-fn dd action.fn this.place)}}>
33
35
  {{action.label}}
34
36
  </a>
35
37
  </div>
@@ -38,42 +40,29 @@
38
40
  </DropdownButton>
39
41
  {{/if}}
40
42
  </div>
41
- <address class={{@addressClass}}>
42
- {{#if place.name}}
43
- {{place.name}}<br />
44
- {{/if}}
45
- {{#if place.street1}}
46
- {{place.street1}}<br />
47
- {{/if}}
48
- {{#if place.street2}}
49
- {{place.street2}}<br />
50
- {{/if}}
51
- <div class="comma-spans">
52
- {{#if place.city}}
53
- <span>{{place.city}}</span>
54
- {{/if}}
55
- {{#if place.province}}
56
- <span>{{place.province}}</span>
57
- {{/if}}
58
- {{#if place.postal_code}}
59
- <span>{{place.postal_code}}</span>
60
- {{/if}}
61
- </div>
62
- <div class="comma-spans">
63
- {{#if place.neighborhood}}
64
- <span>{{place.neighborhood}}</span>
65
- {{/if}}
66
- {{#if place.district}}
67
- <span>{{place.district}}</span>
68
- {{/if}}
69
- {{#if (and place.building (not place.street1))}}
70
- <span>{{place.building}}</span>
71
- {{/if}}
72
- </div>
73
- {{#if place.phone}}
74
- <a href="tel:{{place.phone}}" class="text-blue-500 hover:text-blue-400">{{place.phone}}</a><br />
75
- {{/if}}
76
- </address>
77
43
  {{/if}}
78
- {{/let}}
44
+ <address class={{@addressClass}}>
45
+ {{#if this.name}}
46
+ <div class="font-semibold">{{this.name}}</div>
47
+ <div>{{this.place.street1}}</div>
48
+ {{else}}
49
+ <div class="font-semibold">{{this.place.street1}}</div>
50
+ {{/if}}
51
+ {{#if this.place.street2}}
52
+ <div>{{this.place.street2}}</div>
53
+ {{/if}}
54
+ {{#if this.cityStatePostalCode}}
55
+ <div>{{this.cityStatePostalCode}}</div>
56
+ {{/if}}
57
+ {{#if this.neighborhoodDistrictBuilding}}
58
+ <div>{{this.neighborhoodDistrictBuilding}}</div>
59
+ {{/if}}
60
+ {{#if this.place.country}}
61
+ <div>{{this.place.country_name}}</div>
62
+ {{/if}}
63
+ {{#if this.place.phone}}
64
+ <a href="tel:{{this.place.phone}}" class="text-blue-500 hover:text-blue-400">{{this.place.phone}}</a><br />
65
+ {{/if}}
66
+ </address>
67
+ {{/if}}
79
68
  </div>
@@ -1,10 +1,31 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
+ import { isBlank } from '@ember/utils';
4
5
 
5
6
  export default class DisplayPlaceComponent extends Component {
6
7
  @tracked ref;
7
8
 
9
+ get place() {
10
+ return this.args.place?.place ?? this.args.place ?? this.args.resource;
11
+ }
12
+
13
+ get name() {
14
+ if (this.place.name === this.place.street1) {
15
+ return null;
16
+ }
17
+
18
+ return this.place.name;
19
+ }
20
+
21
+ get cityStatePostalCode() {
22
+ return [this.place.city, this.place.province, this.place.postal_code].filter((value) => !isBlank(value)).join(', ');
23
+ }
24
+
25
+ get neighborhoodDistrictBuilding() {
26
+ return [this.place.neighborhood, this.place.district, this.place.building].filter((value) => !isBlank(value)).join(', ');
27
+ }
28
+
8
29
  @action setupComponent(element) {
9
30
  this.ref = element;
10
31
  }
@@ -23,6 +23,30 @@
23
23
  <div class="grid grid-cols-1 lg:grid-cols-2 gap-2">
24
24
  <InputGroup @name={{t "common.name"}} @value={{@resource.name}} @helpText={{t "modals.entity-form.name-text"}} />
25
25
  <InputGroup @name={{t "common.internal-id"}} @value={{@resource.internal_id}} @helpText={{t "modals.entity-form.id-text"}} />
26
+ <div class="space-y-2">
27
+ <InputGroup @name={{t "common.type"}} @helpText="Choose a common entity type or switch to a custom value.">
28
+ {{#if this.useCustomType}}
29
+ <Input @value={{@resource.type}} @type="text" class="w-full form-input" placeholder="Enter custom entity type" />
30
+ {{else}}
31
+ <div class="fleetbase-model-select fleetbase-power-select ember-model-select">
32
+ <PowerSelect
33
+ @options={{this.entityTypes}}
34
+ @selected={{this.selectedEntityType}}
35
+ @onChange={{this.selectEntityType}}
36
+ @placeholder="Select entity type"
37
+ @triggerClass="form-select"
38
+ as |type|
39
+ >
40
+ <div class="text-sm">
41
+ <div class="font-semibold normalize-in-trigger">{{type.label}}</div>
42
+ <div class="hide-from-trigger">{{type.description}}</div>
43
+ </div>
44
+ </PowerSelect>
45
+ </div>
46
+ {{/if}}
47
+ </InputGroup>
48
+ <Checkbox @value={{this.useCustomType}} @label="Use custom type" @onToggle={{this.toggleCustomType}} @alignItems="center" @labelClass="mb-0i" />
49
+ </div>
26
50
  <InputGroup @name={{t "modals.entity-form.sku"}} @value={{@resource.sku}} @helpText={{t "modals.entity-form.sku-text"}} />
27
51
  <div></div>
28
52
  <InputGroup @name={{t "modals.entity-form.description"}} @helpText={{t "modals.entity-form.description-text"}} @wrapperClass="col-span-2">
@@ -1,11 +1,41 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { inject as service } from '@ember/service';
3
+ import { action } from '@ember/object';
4
+ import { tracked } from '@glimmer/tracking';
3
5
  import { task } from 'ember-concurrency';
6
+ import fleetOpsOptions from '../../utils/fleet-ops-options';
4
7
 
5
8
  export default class EntityFormComponent extends Component {
6
9
  @service fetch;
7
10
  @service currentUser;
8
11
  @service notifications;
12
+ @tracked useCustomType = false;
13
+
14
+ constructor() {
15
+ super(...arguments);
16
+ this.useCustomType = this.selectedEntityType === undefined && Boolean(this.args.resource?.type);
17
+ }
18
+
19
+ get entityTypes() {
20
+ return fleetOpsOptions('entityTypes');
21
+ }
22
+
23
+ get selectedEntityType() {
24
+ return this.entityTypes.find((option) => option.value === this.args.resource?.type);
25
+ }
26
+
27
+ @action selectEntityType(option) {
28
+ this.useCustomType = false;
29
+ this.args.resource.type = option?.value ?? null;
30
+ }
31
+
32
+ @action toggleCustomType(value) {
33
+ this.useCustomType = value;
34
+
35
+ if (!value && !this.selectedEntityType) {
36
+ this.args.resource.type = null;
37
+ }
38
+ }
9
39
 
10
40
  @task *handlePhotoUpload(file) {
11
41
  try {
@@ -6,7 +6,7 @@ import { task } from 'ember-concurrency';
6
6
 
7
7
  export default class LayoutFleetOpsSidebarDriverListingComponent extends Component {
8
8
  @service driverActions;
9
- @service leafletMapManager;
9
+ @service mapManager;
10
10
  @service store;
11
11
  @service universe;
12
12
  @service hostRouter;
@@ -133,10 +133,10 @@ export default class LayoutFleetOpsSidebarDriverListingComponent extends Compone
133
133
  await this.hostRouter.transitionTo('console.fleet-ops.operations.orders.index', { queryParams: { layout: 'map' } });
134
134
  } catch {}
135
135
 
136
- if (this.leafletMapManager._livemap?.isReady()) {
136
+ if (this.mapManager.livemap?.isReady?.()) {
137
137
  this.focusDriverOnMap(driver);
138
138
  } else {
139
- this.universe.one('fleet-ops.live-map.on-loaded', () => {
139
+ this.universe.one('fleet-ops.live-map.loaded', () => {
140
140
  this.focusDriverOnMap(driver);
141
141
  });
142
142
  }
@@ -147,8 +147,8 @@ export default class LayoutFleetOpsSidebarDriverListingComponent extends Compone
147
147
  }
148
148
 
149
149
  @action async focusDriverOnMap(driver) {
150
- await this.leafletMapManager.ensureInteractive({ timeoutMs: 8000 });
151
- this.leafletMapManager.flyToRecordLayer(driver, 16, {
150
+ await this.mapManager.waitForMap({ timeoutMs: 8000 });
151
+ this.mapManager.focusResource(driver, 16, {
152
152
  paddingBottomRight: [300, 200],
153
153
  moveend: () => {
154
154
  this.driverActions.panel.view(driver, { closeOnTransition: true });
@@ -8,7 +8,7 @@ export default class LayoutFleetOpsSidebarFleetListingComponent extends Componen
8
8
  @service store;
9
9
  @service universe;
10
10
  @service vehicleActions;
11
- @service leafletMapManager;
11
+ @service mapManager;
12
12
  @service hostRouter;
13
13
  @service abilities;
14
14
  @service notifications;
@@ -86,10 +86,10 @@ export default class LayoutFleetOpsSidebarFleetListingComponent extends Componen
86
86
  await this.hostRouter.transitionTo('console.fleet-ops.operations.orders.index', { queryParams: { layout: 'map' } });
87
87
  } catch {}
88
88
 
89
- if (this.leafletMapManager._livemap?.isReady()) {
89
+ if (this.mapManager.livemap?.isReady?.()) {
90
90
  this.focusVehicleOnMap(vehicle);
91
91
  } else {
92
- this.universe.one('fleet-ops.live-map.on-loaded', () => {
92
+ this.universe.one('fleet-ops.live-map.loaded', () => {
93
93
  this.focusVehicleOnMap(vehicle);
94
94
  });
95
95
  }
@@ -100,8 +100,8 @@ export default class LayoutFleetOpsSidebarFleetListingComponent extends Componen
100
100
  }
101
101
 
102
102
  @action async focusVehicleOnMap(vehicle) {
103
- await this.leafletMapManager.ensureInteractive({ timeoutMs: 8000 });
104
- this.leafletMapManager.flyToRecordLayer(vehicle, 16, {
103
+ await this.mapManager.waitForMap({ timeoutMs: 8000 });
104
+ this.mapManager.focusResource(vehicle, 16, {
105
105
  paddingBottomRight: [300, 200],
106
106
  moveend: () => {
107
107
  this.vehicleActions.panel.view(vehicle, { closeOnTransition: true });
@@ -311,6 +311,14 @@ export default class LayoutFleetOpsSidebarComponent extends Component {
311
311
  permission: 'fleet-ops view routing-settings',
312
312
  visible: this.abilities.can('fleet-ops see routing-settings'),
313
313
  },
314
+ {
315
+ intl: 'menu.map',
316
+ title: this.intl.t('menu.map'),
317
+ icon: 'map',
318
+ route: 'settings.map',
319
+ permission: 'fleet-ops view map-settings',
320
+ visible: this.abilities.can('fleet-ops see map-settings'),
321
+ },
314
322
  {
315
323
  priority: 4,
316
324
  intl: 'menu.orchestrator',
@@ -27,7 +27,7 @@ export default class LeafletDrawControl extends BaseLayer {
27
27
  leafletOptions = ['draw', 'edit', 'remove', 'poly', 'position'];
28
28
 
29
29
  @computed('leafletEvents.[]', 'args') get usedLeafletEvents() {
30
- const leafletEvents = [...this.leafletEvents, ...Object.values(L.Draw.Event)];
30
+ const leafletEvents = [...this.leafletEvents, ...Object.values(L.Draw?.Event ?? {})];
31
31
  return leafletEvents.filter((eventName) => {
32
32
  eventName = camelize(eventName.replace(':', ' '));
33
33
  let methodName = `_${eventName}`;
@@ -1,5 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { tracked } from '@glimmer/tracking';
3
+ import { isArray } from '@ember/array';
3
4
  import { action } from '@ember/object';
4
5
 
5
6
  /**
@@ -116,7 +117,7 @@ export default class MaintenanceScheduleFormComponent extends Component {
116
117
  }
117
118
  }
118
119
  // Restore reminder_offsets from the resource
119
- if (Array.isArray(resource.reminder_offsets)) {
120
+ if (isArray(resource.reminder_offsets)) {
120
121
  this.reminderOffsets = [...resource.reminder_offsets];
121
122
  }
122
123
  // Restore interval method from stored interval_method field, or infer from populated fields
@@ -5,13 +5,13 @@ import { action } from '@ember/object';
5
5
 
6
6
  export default class MapDrawerDriverListingComponent extends Component {
7
7
  @service driverActions;
8
- @service leafletMapManager;
8
+ @service mapManager;
9
9
  @service hostRouter;
10
10
  @service intl;
11
11
  @tracked query = '';
12
12
 
13
13
  get filteredDrivers() {
14
- const drivers = this.leafletMapManager._livemap?.drivers ?? [];
14
+ const drivers = this.mapManager.livemap?.drivers ?? [];
15
15
  const query = this.query?.toLowerCase();
16
16
  if (!query) {
17
17
  return drivers;
@@ -119,7 +119,7 @@ export default class MapDrawerDriverListingComponent extends Component {
119
119
  }
120
120
 
121
121
  @action view(driver) {
122
- this.leafletMapManager.flyToRecordLayer(driver, 16, {
122
+ this.mapManager.focusResource(driver, 16, {
123
123
  paddingBottomRight: [300, 200],
124
124
  moveend: () => {
125
125
  this.driverActions.panel.view(driver);
@@ -128,7 +128,7 @@ export default class MapDrawerDriverListingComponent extends Component {
128
128
  }
129
129
 
130
130
  @action edit(driver) {
131
- this.leafletMapManager.flyToRecordLayer(driver, 16, {
131
+ this.mapManager.focusResource(driver, 16, {
132
132
  paddingBottomRight: [300, 200],
133
133
  moveend: () => {
134
134
  this.driverActions.panel.edit(driver);
@@ -137,7 +137,7 @@ export default class MapDrawerDriverListingComponent extends Component {
137
137
  }
138
138
 
139
139
  @action locate(driver) {
140
- this.leafletMapManager.flyToRecordLayer(driver, 18, {
140
+ this.mapManager.focusResource(driver, 18, {
141
141
  paddingBottomRight: [300, 200],
142
142
  });
143
143
  }
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
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 { next } from '@ember/runloop';
5
6
 
6
7
  export default class MapDrawerGeofenceEventListingComponent extends Component {
7
8
  @service fetch;
@@ -12,8 +13,10 @@ export default class MapDrawerGeofenceEventListingComponent extends Component {
12
13
 
13
14
  constructor() {
14
15
  super(...arguments);
15
- this.geofenceEventBus.subscribe(this.currentUser.companyId);
16
- this.loadRecentEvents();
16
+ next(() => {
17
+ this.geofenceEventBus.subscribe(this.currentUser.companyId);
18
+ this.loadRecentEvents();
19
+ });
17
20
  }
18
21
 
19
22
  get events() {