@fleetbase/fleetops-engine 0.3.8 → 0.3.9
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/addon/components/contact-form-panel.hbs +4 -1
- package/addon/components/contact-panel.hbs +1 -1
- package/addon/components/driver-form-panel.hbs +5 -12
- package/addon/components/driver-panel.hbs +4 -1
- package/addon/components/fleet-form-panel.hbs +4 -1
- package/addon/components/fleet-listing-panel.hbs +2 -2
- package/addon/components/fleet-panel.hbs +1 -1
- package/addon/components/fuel-report-form-panel.hbs +4 -1
- package/addon/components/fuel-report-panel.hbs +4 -1
- package/addon/components/issue-form-panel.hbs +4 -1
- package/addon/components/issue-panel.hbs +4 -1
- package/addon/components/layout/fleet-ops-sidebar/driver-listing.hbs +5 -0
- package/addon/components/layout/fleet-ops-sidebar/driver-listing.js +122 -0
- package/addon/components/layout/fleet-ops-sidebar/fleet-listing.hbs +2 -2
- package/addon/components/layout/fleet-ops-sidebar/fleet-listing.js +69 -49
- package/addon/components/layout/fleet-ops-sidebar.hbs +1 -1
- package/addon/components/layout/fleet-ops-sidebar.js +4 -3
- package/addon/components/live-map.hbs +90 -9
- package/addon/components/live-map.js +28 -11
- package/addon/components/map-container/toolbar/zones-panel.js +16 -13
- package/addon/components/place-form-panel.hbs +4 -1
- package/addon/components/place-panel.hbs +4 -1
- package/addon/components/settings-window.hbs +1 -1
- package/addon/components/vehicle-form-panel.hbs +4 -1
- package/addon/components/vehicle-panel.hbs +4 -1
- package/addon/components/vendor-form-panel.hbs +4 -1
- package/addon/components/vendor-panel.hbs +4 -1
- package/addon/controllers/management/drivers/index.js +10 -90
- package/addon/controllers/management/vehicles/index.js +11 -21
- package/addon/controllers/operations/orders/index/new.js +5 -5
- package/addon/controllers/operations/orders/index/view.js +9 -13
- package/addon/helpers/format-point.js +5 -2
- package/addon/helpers/point-to-coordinates.js +6 -2
- package/addon/services/context-panel.js +23 -18
- package/addon/services/driver-actions.js +107 -0
- package/addon/services/vehicle-actions.js +42 -0
- package/addon/styles/fleetops-engine.css +12 -2
- package/addon/templates/operations/orders/index/new.hbs +3 -3
- package/addon/utils/fly-to-leaflet-layer.js +7 -0
- package/app/components/layout/fleet-ops-sidebar/driver-listing.js +1 -0
- package/app/services/driver-actions.js +1 -0
- package/app/services/vehicle-actions.js +1 -0
- package/composer.json +2 -2
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/src/Exceptions/IntegratedVendorException.php +45 -1
- package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -2
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +25 -4
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +3 -10
- package/server/src/Http/Controllers/Internal/v1/NavigatorController.php +1 -1
- package/addon/helpers/extract-coordinates.js +0 -6
- package/addon/utils/extract-coordinates.js +0 -1
- package/app/helpers/extract-coordinates.js +0 -1
- package/app/utils/extract-coordinates.js +0 -1
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
<div class="live-map-component {{@wrapperClass}}" {{did-insert this.setupComponent}}>
|
|
2
|
-
<LeafletMap
|
|
2
|
+
<LeafletMap
|
|
3
|
+
id={{this.mapId}}
|
|
4
|
+
class={{@mapClass}}
|
|
5
|
+
@lat={{this.latitude}}
|
|
6
|
+
@lng={{this.longitude}}
|
|
7
|
+
@zoom={{this.zoom}}
|
|
8
|
+
@zoomControl={{@zoomControl}}
|
|
9
|
+
@contextmenu={{true}}
|
|
10
|
+
@contextmenuWidth={{140}}
|
|
11
|
+
@contextmenuItems={{this.contextMenuItems}}
|
|
12
|
+
@onLoad={{this.setupMap}}
|
|
13
|
+
{{will-destroy this.closeChannels}}
|
|
14
|
+
...attributes
|
|
15
|
+
as |layers|
|
|
16
|
+
>
|
|
3
17
|
<layers.tile @url={{this.tileSourceUrl}} />
|
|
4
|
-
|
|
5
18
|
{{#if this.visibilityControls.drivers}}
|
|
6
19
|
{{#each this.drivers as |driver|}}
|
|
7
|
-
<layers.drift-marker
|
|
20
|
+
<layers.drift-marker
|
|
21
|
+
@id={{driver.id}}
|
|
22
|
+
@rotationAngle={{driver.heading}}
|
|
23
|
+
@duration={{300}}
|
|
24
|
+
@icon={{icon iconUrl=(or driver.vehicle_avatar (config "defaultValues.vehicleAvatar")) iconSize=(array 24 24)}}
|
|
25
|
+
@location={{point-to-coordinates driver.location}}
|
|
26
|
+
@publicId={{driver.public_id}}
|
|
27
|
+
@onAdd={{fn this.triggerAction "onDriverAdded" driver}}
|
|
28
|
+
@onClick={{fn this.triggerAction "onDriverClicked" driver}}
|
|
29
|
+
as |marker|
|
|
30
|
+
>
|
|
8
31
|
<marker.popup @maxWidth="500" @minWidth="225">
|
|
9
32
|
<DriverCard @driver={{driver}} @showCoordinates={{true}} @textClass="text-gray-900 dark:text-gray-100" />
|
|
10
33
|
</marker.popup>
|
|
@@ -15,7 +38,17 @@
|
|
|
15
38
|
|
|
16
39
|
{{#if this.visibilityControls.vehicles}}
|
|
17
40
|
{{#each this.vehicles as |vehicle|}}
|
|
18
|
-
<layers.drift-marker
|
|
41
|
+
<layers.drift-marker
|
|
42
|
+
@id={{vehicle.id}}
|
|
43
|
+
@rotationAngle={{vehicle.heading}}
|
|
44
|
+
@duration={{300}}
|
|
45
|
+
@icon={{icon iconUrl=(or vehicle.avatar_url (config "defaultValues.vehicleAvatar")) iconSize=(array 24 24)}}
|
|
46
|
+
@location={{point-to-coordinates vehicle.location}}
|
|
47
|
+
@publicId={{vehicle.public_id}}
|
|
48
|
+
@onAdd={{fn this.triggerAction "onVehicleAdded" vehicle}}
|
|
49
|
+
@onClick={{fn this.triggerAction "onVehicleClicked" vehicle}}
|
|
50
|
+
as |marker|
|
|
51
|
+
>
|
|
19
52
|
<marker.tooltip @permanent={{false}} @sticky={{true}}>
|
|
20
53
|
<div>{{vehicle.displayName}}</div>
|
|
21
54
|
<div>{{if vehicle.online "Online" "Offline"}}</div>
|
|
@@ -26,7 +59,17 @@
|
|
|
26
59
|
|
|
27
60
|
{{#if this.visibilityControls.places}}
|
|
28
61
|
{{#each this.places as |place|}}
|
|
29
|
-
<layers.marker
|
|
62
|
+
<layers.marker
|
|
63
|
+
@id={{place.id}}
|
|
64
|
+
@icon={{icon iconUrl="/engines-dist/images/building-marker.png" iconSize=(array 16 16)}}
|
|
65
|
+
@location={{point-to-coordinates place.location}}
|
|
66
|
+
@riseOnHover={{true}}
|
|
67
|
+
@title={{place.address}}
|
|
68
|
+
@alt={{place.address}}
|
|
69
|
+
@onAdd={{fn this.triggerAction "onPlaceAdded" place}}
|
|
70
|
+
@onClick={{fn this.triggerAction "onPlaceClicked" place}}
|
|
71
|
+
as |marker|
|
|
72
|
+
>
|
|
30
73
|
<marker.popup>
|
|
31
74
|
<div>{{place.address}}</div>
|
|
32
75
|
<div>{{format-point place.location}}</div>
|
|
@@ -68,15 +111,41 @@
|
|
|
68
111
|
{{/each}}
|
|
69
112
|
{{/if}} --}}
|
|
70
113
|
|
|
71
|
-
<layers.draw-control
|
|
114
|
+
<layers.draw-control
|
|
115
|
+
@position="topright"
|
|
116
|
+
@draw={{hash marker=false circlemarker=false circle=false polyline=false}}
|
|
117
|
+
@onDrawDrawstop={{fn this.triggerAction "onDrawDrawstop"}}
|
|
118
|
+
@onDrawDeleted={{fn this.triggerAction "onDrawDeleted"}}
|
|
119
|
+
@onDrawEdited={{fn this.triggerAction "onDrawEdited"}}
|
|
120
|
+
@onDrawDeletestart={{fn this.triggerAction "onDrawDeletestart"}}
|
|
121
|
+
@onDrawEditstop={{fn this.triggerAction "onDrawEditstop"}}
|
|
122
|
+
@onDrawControlCreated={{fn this.triggerAction "onDrawControlCreated"}}
|
|
123
|
+
@onDrawFeatureGroupCreated={{fn this.triggerAction "onDrawFeatureGroupCreated"}}
|
|
124
|
+
/>
|
|
72
125
|
|
|
73
126
|
{{#each this.activeServiceAreas as |serviceArea|}}
|
|
74
|
-
<layers.polygon
|
|
127
|
+
<layers.polygon
|
|
128
|
+
@id={{serviceArea.id}}
|
|
129
|
+
@record={{serviceArea}}
|
|
130
|
+
@locations={{serviceArea.bounds}}
|
|
131
|
+
@fillColor={{serviceArea.color}}
|
|
132
|
+
@color={{serviceArea.stroke_color}}
|
|
133
|
+
@onAdd={{fn this.triggerAction "onServiceAreaLayerAdded" serviceArea}}
|
|
134
|
+
as |polygon|
|
|
135
|
+
>
|
|
75
136
|
<polygon.tooltip @permanent={{true}} @sticky={{true}}>{{serviceArea.name}} Service Area</polygon.tooltip>
|
|
76
137
|
</layers.polygon>
|
|
77
138
|
|
|
78
139
|
{{#each serviceArea.zones as |zone|}}
|
|
79
|
-
<layers.polygon
|
|
140
|
+
<layers.polygon
|
|
141
|
+
@id={{zone.id}}
|
|
142
|
+
@record={{zone}}
|
|
143
|
+
@locations={{zone.locations}}
|
|
144
|
+
@fillColor={{zone.color}}
|
|
145
|
+
@color={{zone.stroke_color}}
|
|
146
|
+
@onAdd={{fn this.triggerAction "onZoneLayerAdd" zone}}
|
|
147
|
+
as |polygon|
|
|
148
|
+
>
|
|
80
149
|
<polygon.tooltip @permanent={{true}} @sticky={{true}}>{{zone.name}} Zone</polygon.tooltip>
|
|
81
150
|
</layers.polygon>
|
|
82
151
|
{{/each}}
|
|
@@ -87,5 +156,17 @@
|
|
|
87
156
|
</div>
|
|
88
157
|
|
|
89
158
|
{{#if this.isDataLoaded}}
|
|
90
|
-
<LiveMapDrawer
|
|
159
|
+
<LiveMapDrawer
|
|
160
|
+
@tab={{@drawerTab}}
|
|
161
|
+
@onTabChanged={{@onDrawerTabChanged}}
|
|
162
|
+
@onResizeEnd={{@onDrawerResizeEnd}}
|
|
163
|
+
@onResizeStart={{@onDrawerResizeStart}}
|
|
164
|
+
@isMinimized={{@isDrawerMinimized}}
|
|
165
|
+
@isOpen={{@isDrawerOpen}}
|
|
166
|
+
@vehicles={{this.vehicles}}
|
|
167
|
+
@drivers={{this.drivers}}
|
|
168
|
+
@places={{this.places}}
|
|
169
|
+
@liveMap={{this}}
|
|
170
|
+
@onDrawerReady={{this.setDrawerContext}}
|
|
171
|
+
/>
|
|
91
172
|
{{/if}}
|
|
@@ -297,7 +297,7 @@ export default class LiveMapComponent extends Component {
|
|
|
297
297
|
*/
|
|
298
298
|
@action setupComponent() {
|
|
299
299
|
// trigger that initial coordinates have been set
|
|
300
|
-
this.universe.trigger('
|
|
300
|
+
this.universe.trigger('fleet-ops.live-map.loaded', this);
|
|
301
301
|
|
|
302
302
|
// set initial coordinates
|
|
303
303
|
this.setInitialCoordinates();
|
|
@@ -363,7 +363,7 @@ export default class LiveMapComponent extends Component {
|
|
|
363
363
|
|
|
364
364
|
/**
|
|
365
365
|
* Marks the LiveMapComponent as ready by setting the "isReady" property and triggering
|
|
366
|
-
* the "onReady" action and a "fleetops.
|
|
366
|
+
* the "onReady" action and a "fleetops.live-map.ready" event.
|
|
367
367
|
*
|
|
368
368
|
* @memberof LiveMapComponent
|
|
369
369
|
* @function
|
|
@@ -371,7 +371,7 @@ export default class LiveMapComponent extends Component {
|
|
|
371
371
|
ready() {
|
|
372
372
|
this.isReady = true;
|
|
373
373
|
this.triggerAction('onReady');
|
|
374
|
-
this.universe.trigger('
|
|
374
|
+
this.universe.trigger('fleet-ops.live-map.ready', this);
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
/**
|
|
@@ -396,7 +396,7 @@ export default class LiveMapComponent extends Component {
|
|
|
396
396
|
this.isReady = true;
|
|
397
397
|
|
|
398
398
|
// trigger that initial coordinates is set to livemap component
|
|
399
|
-
this.universe.trigger('
|
|
399
|
+
this.universe.trigger('fleet-ops.live-map.has_coordinates', { latitude: this.latitude, longitude: this.longitude });
|
|
400
400
|
|
|
401
401
|
return [this.latitude, this.longitude];
|
|
402
402
|
}
|
|
@@ -413,7 +413,7 @@ export default class LiveMapComponent extends Component {
|
|
|
413
413
|
this.isReady = true;
|
|
414
414
|
|
|
415
415
|
// trigger that initial coordinates is set to livemap component
|
|
416
|
-
this.universe.trigger('
|
|
416
|
+
this.universe.trigger('fleet-ops.live-map.has_coordinates', { latitude: this.latitude, longitude: this.longitude });
|
|
417
417
|
|
|
418
418
|
return [this.latitude, this.longitude];
|
|
419
419
|
}
|
|
@@ -425,7 +425,7 @@ export default class LiveMapComponent extends Component {
|
|
|
425
425
|
* Sets up the LiveMap component and the Leaflet map instance.
|
|
426
426
|
*
|
|
427
427
|
* This function initializes the LiveMap component, associates it with the Leaflet map instance,
|
|
428
|
-
* triggers the "fleetops.
|
|
428
|
+
* triggers the "fleetops.live-map.leaflet_ready" event, and performs additional setup tasks like
|
|
429
429
|
* configuring context menus, hiding draw controls, and associating the map with the "serviceAreas"
|
|
430
430
|
* service. It also triggers the "onLoad" action with the provided event and target.
|
|
431
431
|
*
|
|
@@ -443,13 +443,13 @@ export default class LiveMapComponent extends Component {
|
|
|
443
443
|
this.leafletMap = target;
|
|
444
444
|
|
|
445
445
|
// trigger liveMap ready through universe
|
|
446
|
-
this.universe.trigger('
|
|
446
|
+
this.universe.trigger('fleet-ops.live-map.leaflet_ready', event, target);
|
|
447
447
|
|
|
448
448
|
// make fleetops map globally available on the window
|
|
449
449
|
window.FleetOpsLeafletMap = target;
|
|
450
450
|
|
|
451
451
|
// store this component to universe
|
|
452
|
-
this.universe.set('
|
|
452
|
+
this.universe.set('component:fleet-ops:live-map', this);
|
|
453
453
|
|
|
454
454
|
// setup context menu
|
|
455
455
|
this.createMapContextMenu(target);
|
|
@@ -1065,7 +1065,16 @@ export default class LiveMapComponent extends Component {
|
|
|
1065
1065
|
*/
|
|
1066
1066
|
@action onDriverClicked(driver) {
|
|
1067
1067
|
this.contextPanel.clear();
|
|
1068
|
-
this.contextPanel.focus(driver
|
|
1068
|
+
this.contextPanel.focus(driver, 'viewing', {
|
|
1069
|
+
args: {
|
|
1070
|
+
width: '450px',
|
|
1071
|
+
onOpen: () => {
|
|
1072
|
+
this.leafletMap.once('moveend', () => {
|
|
1073
|
+
this.leafletMap.panBy([200, 0]);
|
|
1074
|
+
});
|
|
1075
|
+
},
|
|
1076
|
+
},
|
|
1077
|
+
});
|
|
1069
1078
|
}
|
|
1070
1079
|
|
|
1071
1080
|
/**
|
|
@@ -1113,7 +1122,16 @@ export default class LiveMapComponent extends Component {
|
|
|
1113
1122
|
*/
|
|
1114
1123
|
@action onVehicleClicked(vehicle) {
|
|
1115
1124
|
this.contextPanel.clear();
|
|
1116
|
-
this.contextPanel.focus(vehicle
|
|
1125
|
+
this.contextPanel.focus(vehicle, 'viewing', {
|
|
1126
|
+
args: {
|
|
1127
|
+
width: '450px',
|
|
1128
|
+
onOpen: () => {
|
|
1129
|
+
this.leafletMap.once('moveend', () => {
|
|
1130
|
+
this.leafletMap.panBy([200, 0]);
|
|
1131
|
+
});
|
|
1132
|
+
},
|
|
1133
|
+
},
|
|
1134
|
+
});
|
|
1117
1135
|
}
|
|
1118
1136
|
|
|
1119
1137
|
/**
|
|
@@ -1910,7 +1928,6 @@ export default class LiveMapComponent extends Component {
|
|
|
1910
1928
|
}
|
|
1911
1929
|
|
|
1912
1930
|
// from the `get-active-order-coordinates` the responded coordinates will always be [longitude, latitude]
|
|
1913
|
-
// const [latitude, longitude] = extractCoordinates(coordinates.firstObject.coordinates);
|
|
1914
1931
|
const validCoordinates = coordinates.filter((point) => point.cordinates[0] !== 0);
|
|
1915
1932
|
const [longitude, latitude] = getWithDefault(validCoordinates, '0.coordiantes', [0, 0]);
|
|
1916
1933
|
|
|
@@ -2,8 +2,10 @@ 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 { later } from '@ember/runloop';
|
|
5
6
|
import { classify } from '@ember/string';
|
|
6
7
|
import { calculateInPlacePosition } from 'ember-basic-dropdown/utils/calculate-position';
|
|
8
|
+
import { task } from 'ember-concurrency-decorators';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* @class MapContainerToolbarZonesPanelComponent
|
|
@@ -66,10 +68,18 @@ export default class MapContainerToolbarZonesPanelComponent extends Component {
|
|
|
66
68
|
*/
|
|
67
69
|
constructor() {
|
|
68
70
|
super(...arguments);
|
|
71
|
+
|
|
69
72
|
this.map = this.args.map;
|
|
70
73
|
this.liveMap = this.args.liveMap;
|
|
71
|
-
this.fetchServiceAreas();
|
|
72
74
|
this.serviceAreas.setMapInstance(this.args.map);
|
|
75
|
+
|
|
76
|
+
later(
|
|
77
|
+
this,
|
|
78
|
+
() => {
|
|
79
|
+
this.fetchServiceAreas.perform();
|
|
80
|
+
},
|
|
81
|
+
100
|
|
82
|
+
);
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
/**
|
|
@@ -115,21 +125,14 @@ export default class MapContainerToolbarZonesPanelComponent extends Component {
|
|
|
115
125
|
* Fetch service areas and update state.
|
|
116
126
|
* @memberof MapContainerToolbarZonesPanelComponent
|
|
117
127
|
*/
|
|
118
|
-
fetchServiceAreas() {
|
|
119
|
-
this.isLoading = true;
|
|
120
|
-
|
|
128
|
+
@task *fetchServiceAreas() {
|
|
121
129
|
if (this.appCache.has('serviceAreas')) {
|
|
122
130
|
this.serviceAreaRecords = this.appCache.getEmberData('serviceAreas', 'service-area');
|
|
123
131
|
}
|
|
124
132
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.appCache.setEmberData('serviceAreas', serviceAreaRecords);
|
|
130
|
-
})
|
|
131
|
-
.finally(() => {
|
|
132
|
-
this.isLoading = false;
|
|
133
|
-
});
|
|
133
|
+
const serviceAreas = yield this.store.query('service-area', { with: ['zones'] });
|
|
134
|
+
|
|
135
|
+
this.serviceAreaRecords = serviceAreas;
|
|
136
|
+
this.appCache.setEmberData('serviceAreas', serviceAreas);
|
|
134
137
|
}
|
|
135
138
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<Overlay
|
|
2
2
|
@onLoad={{this.setOverlayContext}}
|
|
3
|
+
@onOpen={{this.onOpen}}
|
|
4
|
+
@onClose={{this.onClose}}
|
|
5
|
+
@onToggle={{this.onToggle}}
|
|
3
6
|
@position="right"
|
|
4
7
|
@noBackdrop={{true}}
|
|
5
8
|
@fullHeight={{true}}
|
|
6
9
|
@isResizeble={{or this.isResizable @isResizable}}
|
|
7
|
-
@width={{or this.width @width "
|
|
10
|
+
@width={{or this.width @width "570px"}}
|
|
8
11
|
>
|
|
9
12
|
<Overlay::Header
|
|
10
13
|
@title={{if this.place.public_id this.place.name "New Place"}}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<Overlay
|
|
2
2
|
@onLoad={{this.setOverlayContext}}
|
|
3
|
+
@onOpen={{this.onOpen}}
|
|
4
|
+
@onClose={{this.onClose}}
|
|
5
|
+
@onToggle={{this.onToggle}}
|
|
3
6
|
@position="right"
|
|
4
7
|
@noBackdrop={{true}}
|
|
5
8
|
@fullHeight={{true}}
|
|
6
9
|
@isResizable={{or this.isResizable @isResizable}}
|
|
7
|
-
@width={{or this.width @width "
|
|
10
|
+
@width={{or this.width @width "570px"}}
|
|
8
11
|
>
|
|
9
12
|
<Overlay::Header @title={{this.place.name}} @status={{this.place.public_id}} @hideStatusDot={{true}} @createdAt={{this.place.createdAt}}>
|
|
10
13
|
<Button @type="default" @icon="pen" @helpText="Edit place" @onClick={{this.onEdit}} @wrapperClass="mr-2" />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<Overlay @onLoad={{this.onLoad}} @isOpen={{@isOpen}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @width="
|
|
1
|
+
<Overlay @onLoad={{this.onLoad}} @isOpen={{@isOpen}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @width="570px" as |overlay|>
|
|
2
2
|
<Overlay::Header @overlay={{overlay}} @title="FleetOps Settings" @onPressCancel={{@onPressCancel}}>
|
|
3
3
|
<Button @icon="save" @type="primary" @text={{if (media 'isMobile') "" "Save Changes"}} @onClick={{this.saveSettings}} @isLoading={{this.isSaving}} @disabled={{or this.isLoading this.isSaving}} />
|
|
4
4
|
</Overlay::Header>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<Overlay
|
|
2
2
|
@onLoad={{this.setOverlayContext}}
|
|
3
|
+
@onOpen={{this.onOpen}}
|
|
4
|
+
@onClose={{this.onClose}}
|
|
5
|
+
@onToggle={{this.onToggle}}
|
|
3
6
|
@position="right"
|
|
4
7
|
@noBackdrop={{true}}
|
|
5
8
|
@fullHeight={{true}}
|
|
6
9
|
@isResizeble={{or this.isResizable @isResizable}}
|
|
7
|
-
@width={{or this.width @width "
|
|
10
|
+
@width={{or this.width @width "570px"}}
|
|
8
11
|
>
|
|
9
12
|
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i min-h-[127px]">
|
|
10
13
|
<div class="flex flex-row items-center justify-between w-full mb-4">
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<Overlay
|
|
2
2
|
@onLoad={{this.setOverlayContext}}
|
|
3
|
+
@onOpen={{this.onOpen}}
|
|
4
|
+
@onClose={{this.onClose}}
|
|
5
|
+
@onToggle={{this.onToggle}}
|
|
3
6
|
@position="right"
|
|
4
7
|
@noBackdrop={{true}}
|
|
5
8
|
@fullHeight={{true}}
|
|
6
9
|
@isResizable={{or this.isResizable @isResizable}}
|
|
7
|
-
@width={{or this.width @width "
|
|
10
|
+
@width={{or this.width @width "570px"}}
|
|
8
11
|
>
|
|
9
12
|
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i min-h-[127px]">
|
|
10
13
|
<div class="flex flex-row items-center justify-between w-full mb-4">
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<Overlay
|
|
2
2
|
@onLoad={{this.setOverlayContext}}
|
|
3
|
+
@onOpen={{this.onOpen}}
|
|
4
|
+
@onClose={{this.onClose}}
|
|
5
|
+
@onToggle={{this.onToggle}}
|
|
3
6
|
@position="right"
|
|
4
7
|
@noBackdrop={{true}}
|
|
5
8
|
@fullHeight={{true}}
|
|
6
9
|
@isResizeble={{or this.isResizable @isResizable}}
|
|
7
|
-
@width={{or this.width @width "
|
|
10
|
+
@width={{or this.width @width "570px"}}
|
|
8
11
|
>
|
|
9
12
|
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i">
|
|
10
13
|
<div class="flex flex-row items-center justify-between w-full mb-4">
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<Overlay
|
|
2
2
|
@onLoad={{this.setOverlayContext}}
|
|
3
|
+
@onOpen={{this.onOpen}}
|
|
4
|
+
@onClose={{this.onClose}}
|
|
5
|
+
@onToggle={{this.onToggle}}
|
|
3
6
|
@position="right"
|
|
4
7
|
@noBackdrop={{true}}
|
|
5
8
|
@fullHeight={{true}}
|
|
6
9
|
@isResizable={{or this.isResizable @isResizable}}
|
|
7
|
-
@width={{or this.width @width "
|
|
10
|
+
@width={{or this.width @width "570px"}}
|
|
8
11
|
>
|
|
9
12
|
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i">
|
|
10
13
|
<div class="flex flex-row items-center justify-between w-full mb-4">
|
|
@@ -6,8 +6,6 @@ import { isBlank } from '@ember/utils';
|
|
|
6
6
|
import { equal } from '@ember/object/computed';
|
|
7
7
|
import { timeout } from 'ember-concurrency';
|
|
8
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
9
|
|
|
12
10
|
export default class ManagementDriversIndexController extends BaseController {
|
|
13
11
|
/**
|
|
@@ -18,18 +16,18 @@ export default class ManagementDriversIndexController extends BaseController {
|
|
|
18
16
|
@service notifications;
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
|
-
* Inject the `
|
|
19
|
+
* Inject the `crud` service
|
|
22
20
|
*
|
|
23
21
|
* @var {Service}
|
|
24
22
|
*/
|
|
25
|
-
@service
|
|
23
|
+
@service crud;
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
|
-
* Inject the `
|
|
26
|
+
* Inject the `driverActions` service
|
|
29
27
|
*
|
|
30
28
|
* @var {Service}
|
|
31
29
|
*/
|
|
32
|
-
@service
|
|
30
|
+
@service driverActions;
|
|
33
31
|
|
|
34
32
|
/**
|
|
35
33
|
* Inject the `store` service
|
|
@@ -412,7 +410,7 @@ export default class ManagementDriversIndexController extends BaseController {
|
|
|
412
410
|
},
|
|
413
411
|
{
|
|
414
412
|
label: 'Locate driver on map...',
|
|
415
|
-
fn: this.
|
|
413
|
+
fn: this.locateDriver,
|
|
416
414
|
},
|
|
417
415
|
{
|
|
418
416
|
separator: true,
|
|
@@ -539,7 +537,7 @@ export default class ManagementDriversIndexController extends BaseController {
|
|
|
539
537
|
* @void
|
|
540
538
|
*/
|
|
541
539
|
@action deleteDriver(driver, options = {}) {
|
|
542
|
-
this.
|
|
540
|
+
this.driverActions.delete(driver, {
|
|
543
541
|
onSuccess: () => {
|
|
544
542
|
return this.hostRouter.refresh();
|
|
545
543
|
},
|
|
@@ -555,44 +553,7 @@ export default class ManagementDriversIndexController extends BaseController {
|
|
|
555
553
|
* @void
|
|
556
554
|
*/
|
|
557
555
|
@action assignOrder(driver, options = {}) {
|
|
558
|
-
this.
|
|
559
|
-
title: `Assign Order to this Driver`,
|
|
560
|
-
acceptButtonText: 'Assign Order',
|
|
561
|
-
acceptButtonIcon: 'check',
|
|
562
|
-
acceptButtonIconPrefix: 'fas',
|
|
563
|
-
acceptButtonDisabled: true,
|
|
564
|
-
hideDeclineButton: true,
|
|
565
|
-
selectedOrder: null,
|
|
566
|
-
selectOrder: (order) => {
|
|
567
|
-
this.modalsManager.setOption('selectedOrder', order);
|
|
568
|
-
this.modalsManager.setOption('acceptButtonDisabled', false);
|
|
569
|
-
},
|
|
570
|
-
driver,
|
|
571
|
-
confirm: (modal) => {
|
|
572
|
-
const selectedOrder = modal.getOption('selectedOrder');
|
|
573
|
-
|
|
574
|
-
if (!selectedOrder) {
|
|
575
|
-
this.notifications.warning('No order selected!');
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
modal.startLoading();
|
|
580
|
-
|
|
581
|
-
driver.set('current_job_uuid', selectedOrder.id);
|
|
582
|
-
|
|
583
|
-
return driver
|
|
584
|
-
.save()
|
|
585
|
-
.then(() => {
|
|
586
|
-
this.notifications.success(`${driver.name} assigned to order.`);
|
|
587
|
-
})
|
|
588
|
-
.catch((error) => {
|
|
589
|
-
driver.rollbackAttributes();
|
|
590
|
-
modal.stopLoading();
|
|
591
|
-
this.notifications.serverError(error);
|
|
592
|
-
});
|
|
593
|
-
},
|
|
594
|
-
...options,
|
|
595
|
-
});
|
|
556
|
+
this.driverActions.assignOrder(driver, options);
|
|
596
557
|
}
|
|
597
558
|
|
|
598
559
|
/**
|
|
@@ -603,29 +564,7 @@ export default class ManagementDriversIndexController extends BaseController {
|
|
|
603
564
|
* @void
|
|
604
565
|
*/
|
|
605
566
|
@action assignVehicle(driver, options = {}) {
|
|
606
|
-
this.
|
|
607
|
-
title: `Assign Vehicle to this Driver`,
|
|
608
|
-
acceptButtonText: 'Confirm & Create',
|
|
609
|
-
acceptButtonIcon: 'check',
|
|
610
|
-
acceptButtonIconPrefix: 'fas',
|
|
611
|
-
hideDeclineButton: true,
|
|
612
|
-
driver,
|
|
613
|
-
confirm: (modal) => {
|
|
614
|
-
modal.startLoading();
|
|
615
|
-
|
|
616
|
-
return driver
|
|
617
|
-
.save()
|
|
618
|
-
.then((driver) => {
|
|
619
|
-
this.notifications.success(`${driver.name} assigned to vehicle.`);
|
|
620
|
-
})
|
|
621
|
-
.catch((error) => {
|
|
622
|
-
driver.rollbackAttributes();
|
|
623
|
-
modal.stopLoading();
|
|
624
|
-
this.notifications.serverError(error);
|
|
625
|
-
});
|
|
626
|
-
},
|
|
627
|
-
...options,
|
|
628
|
-
});
|
|
567
|
+
this.driverActions.assignVehicle(driver, options);
|
|
629
568
|
}
|
|
630
569
|
|
|
631
570
|
/**
|
|
@@ -634,26 +573,7 @@ export default class ManagementDriversIndexController extends BaseController {
|
|
|
634
573
|
* @param {DriverModel} driver
|
|
635
574
|
* @void
|
|
636
575
|
*/
|
|
637
|
-
@action
|
|
638
|
-
|
|
639
|
-
const [latitude, longitude] = extractCoordinates(location.coordinates);
|
|
640
|
-
|
|
641
|
-
this.modalsManager.show('modals/point-map', {
|
|
642
|
-
title: `Location of ${driver.name}`,
|
|
643
|
-
acceptButtonText: 'Done',
|
|
644
|
-
acceptButtonIcon: 'check',
|
|
645
|
-
acceptButtonIconPrefix: 'fas',
|
|
646
|
-
modalClass: 'modal-lg',
|
|
647
|
-
hideDeclineButton: true,
|
|
648
|
-
latitude,
|
|
649
|
-
longitude,
|
|
650
|
-
location,
|
|
651
|
-
popupText: `${driver.name} (${driver.public_id})`,
|
|
652
|
-
icon: leafletIcon({
|
|
653
|
-
iconUrl: driver?.vehicle_avatar,
|
|
654
|
-
iconSize: [40, 40],
|
|
655
|
-
}),
|
|
656
|
-
...options,
|
|
657
|
-
});
|
|
576
|
+
@action locateDriver(driver, options = {}) {
|
|
577
|
+
this.driverActions.locate(driver, options);
|
|
658
578
|
}
|
|
659
579
|
}
|
|
@@ -22,11 +22,11 @@ export default class ManagementVehiclesIndexController extends BaseController {
|
|
|
22
22
|
@service notifications;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Inject the `
|
|
25
|
+
* Inject the `vehicleActions` service
|
|
26
26
|
*
|
|
27
27
|
* @var {Service}
|
|
28
28
|
*/
|
|
29
|
-
@service
|
|
29
|
+
@service vehicleActions;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Inject the `store` service
|
|
@@ -386,13 +386,13 @@ export default class ManagementVehiclesIndexController extends BaseController {
|
|
|
386
386
|
label: 'Edit vehicle...',
|
|
387
387
|
fn: this.editVehicle,
|
|
388
388
|
},
|
|
389
|
+
{
|
|
390
|
+
label: 'Locate vehicle...',
|
|
391
|
+
fn: this.locateVehicle,
|
|
392
|
+
},
|
|
389
393
|
{
|
|
390
394
|
separator: true,
|
|
391
395
|
},
|
|
392
|
-
// {
|
|
393
|
-
// label: 'Assign driver to vehicle...',
|
|
394
|
-
// fn: this.assignDriver,
|
|
395
|
-
// },
|
|
396
396
|
{
|
|
397
397
|
label: 'Delete vehicle...',
|
|
398
398
|
fn: this.deleteVehicle,
|
|
@@ -503,7 +503,7 @@ export default class ManagementVehiclesIndexController extends BaseController {
|
|
|
503
503
|
* @void
|
|
504
504
|
*/
|
|
505
505
|
@action deleteVehicle(vehicle, options = {}) {
|
|
506
|
-
this.
|
|
506
|
+
this.vehicleActions.delete(vehicle, {
|
|
507
507
|
onSuccess: () => {
|
|
508
508
|
return this.hostRouter.refresh();
|
|
509
509
|
},
|
|
@@ -522,23 +522,13 @@ export default class ManagementVehiclesIndexController extends BaseController {
|
|
|
522
522
|
@action assignDriver() {}
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
|
-
* View a
|
|
525
|
+
* View a vehicle location on map
|
|
526
526
|
*
|
|
527
|
-
* @param {
|
|
527
|
+
* @param {VehicleModel} vehicle
|
|
528
528
|
* @param {Object} options
|
|
529
529
|
* @void
|
|
530
530
|
*/
|
|
531
|
-
@action
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
this.modalsManager.show('modals/point-map', {
|
|
535
|
-
title: `Location of ${place.name}`,
|
|
536
|
-
acceptButtonText: 'Done',
|
|
537
|
-
hideDeclineButton: true,
|
|
538
|
-
latitude,
|
|
539
|
-
longitude,
|
|
540
|
-
location: [latitude, longitude],
|
|
541
|
-
...options,
|
|
542
|
-
});
|
|
531
|
+
@action locateVehicle(vehicle, options = {}) {
|
|
532
|
+
this.vehicleActions.locate(vehicle, options);
|
|
543
533
|
}
|
|
544
534
|
}
|