@fleetbase/fleetops-engine 0.0.9 → 0.1.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/addon/components/live-map.js +2 -13
- package/addon/components/modals/place-form.hbs +1 -1
- package/addon/components/order-config.js +2 -13
- package/addon/controllers/management/drivers/index.js +7 -2
- package/addon/controllers/management/places/index.js +16 -2
- package/addon/controllers/operations/orders/index/new.js +2 -2
- package/addon/templates/operations/orders/index/new.hbs +1 -1
- package/addon/templates/operations/orders/index/view.hbs +1 -1
- package/addon/utils/is-facilitator-supported-place.js +1 -1
- package/package.json +8 -5
|
@@ -9,7 +9,6 @@ import { alias } from '@ember/object/computed';
|
|
|
9
9
|
import { guidFor } from '@ember/object/internals';
|
|
10
10
|
import { later } from '@ember/runloop';
|
|
11
11
|
import { allSettled } from 'rsvp';
|
|
12
|
-
import config from 'ember-get-config';
|
|
13
12
|
|
|
14
13
|
const DEFAULT_LATITUDE = 1.369;
|
|
15
14
|
const DEFAULT_LONGITUDE = 103.8864;
|
|
@@ -17,6 +16,7 @@ const DEFAULT_LONGITUDE = 103.8864;
|
|
|
17
16
|
export default class LiveMapComponent extends Component {
|
|
18
17
|
@service store;
|
|
19
18
|
@service fetch;
|
|
19
|
+
@service socket;
|
|
20
20
|
@service currentUser;
|
|
21
21
|
@service notifications;
|
|
22
22
|
@service serviceAreas;
|
|
@@ -681,20 +681,9 @@ export default class LiveMapComponent extends Component {
|
|
|
681
681
|
* Functions are used to fetch date or handle socket callbacks/initializations.
|
|
682
682
|
*
|
|
683
683
|
*/
|
|
684
|
-
|
|
685
|
-
createSocketClusterClient() {
|
|
686
|
-
const socketConfig = { ...config.socket };
|
|
687
|
-
|
|
688
|
-
if (isBlank(socketConfig.hostname)) {
|
|
689
|
-
socketConfig.hostname = window.location.hostname;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
return socketClusterClient.create(socketConfig);
|
|
693
|
-
}
|
|
694
|
-
|
|
695
684
|
@action watchDrivers(drivers = []) {
|
|
696
685
|
// setup socket
|
|
697
|
-
const socket = this.
|
|
686
|
+
const socket = this.socket.instance();
|
|
698
687
|
|
|
699
688
|
// listen for stivers
|
|
700
689
|
for (let i = 0; i < drivers.length; i++) {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<CountrySelect class="w-full form-input form-select form-datalist" @value={{@options.place.country}} @onChange={{fn (mut @options.place.country)}} placeholder="Country" />
|
|
19
19
|
</InputGroup>
|
|
20
20
|
<InputGroup @name="Coordinates" @wrapperClass="col-span-2">
|
|
21
|
-
<CoordinatesInput @value={{@options.place.location}} @onChange={{@options.updatePlaceCoordinates}} @onGeocode={{@options.autocomplete}} @onInit={{@options.setCoordinatesInput}} />
|
|
21
|
+
<CoordinatesInput @value={{@options.place.location}} @onChange={{@options.updatePlaceCoordinates}} @onGeocode={{@options.autocomplete}} @onUpdatedFromMap={{@options.reverseGeocode}} @onInit={{@options.setCoordinatesInput}} />
|
|
22
22
|
</InputGroup>
|
|
23
23
|
<div class="col-span-1"></div>
|
|
24
24
|
<InputGroup @name="Phone">
|
|
@@ -3,13 +3,12 @@ import { tracked } from '@glimmer/tracking';
|
|
|
3
3
|
import { inject as service } from '@ember/service';
|
|
4
4
|
import { action, computed, set } from '@ember/object';
|
|
5
5
|
import { equal } from '@ember/object/computed';
|
|
6
|
-
import { isBlank } from '@ember/utils';
|
|
7
6
|
import isModel from '@fleetbase/ember-core/utils/is-model';
|
|
8
|
-
import config from 'ember-get-config';
|
|
9
7
|
|
|
10
8
|
export default class OrderConfigComponent extends Component {
|
|
11
9
|
@service modalsManager;
|
|
12
10
|
@service fetch;
|
|
11
|
+
@service socket;
|
|
13
12
|
@service store;
|
|
14
13
|
@service notifications;
|
|
15
14
|
@service crud;
|
|
@@ -255,22 +254,12 @@ export default class OrderConfigComponent extends Component {
|
|
|
255
254
|
});
|
|
256
255
|
}
|
|
257
256
|
|
|
258
|
-
createSocketClusterClient() {
|
|
259
|
-
const socketConfig = { ...config.socket };
|
|
260
|
-
|
|
261
|
-
if (isBlank(socketConfig.hostname)) {
|
|
262
|
-
socketConfig.hostname = window.location.hostname;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return socketClusterClient.create(socketConfig);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
257
|
async listenForUninstallProgress(extension) {
|
|
269
258
|
// get channel identifier
|
|
270
259
|
const channelId = `${extension.id}:${this.currentUser.id}`;
|
|
271
260
|
|
|
272
261
|
// setup socket
|
|
273
|
-
const socket = this.
|
|
262
|
+
const socket = this.socket.instance();
|
|
274
263
|
|
|
275
264
|
// get channel
|
|
276
265
|
const channel = socket.subscribe(channelId);
|
|
@@ -9,6 +9,7 @@ import { task } from 'ember-concurrency-decorators';
|
|
|
9
9
|
import extractCoordinates from '@fleetbase/ember-core/utils/extract-coordinates';
|
|
10
10
|
import leafletIcon from '@fleetbase/ember-core/utils/leaflet-icon';
|
|
11
11
|
import generateSlug from '@fleetbase/ember-core/utils/generate-slug';
|
|
12
|
+
import Point from '@fleetbase/fleetops-data/utils/geojson/point';
|
|
12
13
|
|
|
13
14
|
export default class ManagementDriversIndexController extends Controller {
|
|
14
15
|
/**
|
|
@@ -672,7 +673,6 @@ export default class ManagementDriversIndexController extends Controller {
|
|
|
672
673
|
type: `driver_photo`,
|
|
673
674
|
},
|
|
674
675
|
(uploadedFile) => {
|
|
675
|
-
console.log('uploadedFile', uploadedFile);
|
|
676
676
|
driver.setProperties({
|
|
677
677
|
photo_uuid: uploadedFile.id,
|
|
678
678
|
photo_url: uploadedFile.url,
|
|
@@ -684,6 +684,12 @@ export default class ManagementDriversIndexController extends Controller {
|
|
|
684
684
|
confirm: (modal, done) => {
|
|
685
685
|
modal.startLoading();
|
|
686
686
|
|
|
687
|
+
if (isBlank(driver.location)) {
|
|
688
|
+
// set default location from currentUser service
|
|
689
|
+
const { latitude, longitude } = this.currentUser;
|
|
690
|
+
driver.set('location', new Point(latitude, longitude));
|
|
691
|
+
}
|
|
692
|
+
|
|
687
693
|
driver
|
|
688
694
|
.save()
|
|
689
695
|
.then((driver) => {
|
|
@@ -696,7 +702,6 @@ export default class ManagementDriversIndexController extends Controller {
|
|
|
696
702
|
done();
|
|
697
703
|
})
|
|
698
704
|
.catch((error) => {
|
|
699
|
-
console.log(error);
|
|
700
705
|
// driver.rollbackAttributes();
|
|
701
706
|
modal.stopLoading();
|
|
702
707
|
this.notifications.serverError(error);
|
|
@@ -42,6 +42,13 @@ export default class ManagementPlacesIndexController extends Controller {
|
|
|
42
42
|
*/
|
|
43
43
|
@service store;
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Inject the `fetch` service
|
|
47
|
+
*
|
|
48
|
+
* @var {Service}
|
|
49
|
+
*/
|
|
50
|
+
@service fetch;
|
|
51
|
+
|
|
45
52
|
/**
|
|
46
53
|
* Inject the `filters` service
|
|
47
54
|
*
|
|
@@ -434,14 +441,21 @@ export default class ManagementPlacesIndexController extends Controller {
|
|
|
434
441
|
autocomplete: (selected) => {
|
|
435
442
|
const coordinatesInputComponent = this.modalsManager.getOption('coordinatesInputComponent');
|
|
436
443
|
|
|
437
|
-
console.log('selected', selected);
|
|
438
|
-
|
|
439
444
|
place.setProperties({ ...selected });
|
|
440
445
|
|
|
441
446
|
if (coordinatesInputComponent) {
|
|
442
447
|
coordinatesInputComponent.updateCoordinates(selected.location);
|
|
443
448
|
}
|
|
444
449
|
},
|
|
450
|
+
reverseGeocode: ({ latitude, longitude }) => {
|
|
451
|
+
return this.fetch.get('geocoder/reverse', { coordinates: [latitude, longitude].join(','), single: true }).then((result) => {
|
|
452
|
+
if (isBlank(result)) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
place.setProperties({ ...result });
|
|
457
|
+
});
|
|
458
|
+
},
|
|
445
459
|
setCoordinatesInput: (coordinatesInputComponent) => {
|
|
446
460
|
this.modalsManager.setOption('coordinatesInputComponent', coordinatesInputComponent);
|
|
447
461
|
},
|
|
@@ -674,8 +674,8 @@ export default class OperationsOrdersIndexNewController extends Controller {
|
|
|
674
674
|
profile: 'driving',
|
|
675
675
|
});
|
|
676
676
|
|
|
677
|
-
console.log('[this.routePreviewArray]', this.routePreviewArray);
|
|
678
|
-
console.log('[this.routePreviewCoordinates]', this.routePreviewCoordinates);
|
|
677
|
+
// console.log('[this.routePreviewArray]', this.routePreviewArray);
|
|
678
|
+
// console.log('[this.routePreviewCoordinates]', this.routePreviewCoordinates);
|
|
679
679
|
|
|
680
680
|
this.previewRouteControl = new RoutingControl({
|
|
681
681
|
waypoints: this.routePreviewCoordinates,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<Overlay @position="right" @noBackdrop={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @fullHeight={{true}} @onLoad={{this.setupInterface}} as |overlay|>
|
|
1
|
+
<Overlay @position="right" @noBackdrop={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @width="700px" @fullHeight={{true}} @onLoad={{this.setupInterface}} as |overlay|>
|
|
2
2
|
<Overlay::Header @overlay={{overlay}} @title="New Order" @onPressCancel={{this.transitionBack}}>
|
|
3
3
|
<DropdownButton @icon="ellipsis-h" @size="sm" @iconPrefix="fas" @triggerClass="mr-2 hidden md:flex" as |dd|>
|
|
4
4
|
<div class="next-dd-menu mt-1 mx-0" aria-orientation="vertical" aria-labelledby="user-menu">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<Overlay @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @onLoad={{this.setupInterface}} as |overlay|>
|
|
1
|
+
<Overlay @position="right" @noBackdrop={{true}} @width="700px" @fullHeight={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @onLoad={{this.setupInterface}} as |overlay|>
|
|
2
2
|
<Overlay::Header @overlay={{overlay}} @title={{@model.public_id}} @status={{@model.status}} @dispatched={{@model.dispatched}} @createdAt={{@model.createdAt}} @onPressCancel={{this.transitionBack}}>
|
|
3
3
|
{{#if @model.canBeDispatched}}
|
|
4
4
|
<Button @type="primary" @icon="paper-plane" @text="Dispatch" class="mr-2" @onClick={{fn this.dispatchOrder @model}} />
|
|
@@ -4,7 +4,7 @@ import { isArray } from '@ember/array';
|
|
|
4
4
|
export default function isFacilitatorSupportedPlace(facilitator, place) {
|
|
5
5
|
const supportedCountries = facilitator?.get('supported_countries');
|
|
6
6
|
const country = place?.get('country');
|
|
7
|
-
console.log('isFacilitatorSupportedPlace()', supportedCountries, country, place);
|
|
7
|
+
// console.log('isFacilitatorSupportedPlace()', supportedCountries, country, place);
|
|
8
8
|
|
|
9
9
|
if (isEmpty(supportedCountries) || isEmpty(country)) {
|
|
10
10
|
return true;
|
package/package.json
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
"name": "@fleetbase/fleetops-engine",
|
|
3
3
|
"extension": "Fleet Ops",
|
|
4
4
|
"icon": "route",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.1.1",
|
|
6
6
|
"priority": 0,
|
|
7
|
+
"fleetbase": {
|
|
8
|
+
"dashboard": "int/v1/fleet-ops/dashboard"
|
|
9
|
+
},
|
|
7
10
|
"description": "Fleetbase Fleet-Ops extension provides a fleet management and last mile delivery operations system module.",
|
|
8
11
|
"keywords": [
|
|
9
12
|
"fleetbase-extension",
|
|
@@ -36,9 +39,9 @@
|
|
|
36
39
|
"test:ember-compatibility": "ember try:each"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@fleetbase/ember-core": "^0.0.
|
|
40
|
-
"@fleetbase/ember-ui": "^0.0.
|
|
41
|
-
"@fleetbase/fleetops-data": "^0.0.
|
|
42
|
+
"@fleetbase/ember-core": "^0.0.6",
|
|
43
|
+
"@fleetbase/ember-ui": "^0.0.8",
|
|
44
|
+
"@fleetbase/fleetops-data": "^0.0.3",
|
|
42
45
|
"@fleetbase/leaflet-routing-machine": "^3.2.15",
|
|
43
46
|
"@fortawesome/ember-fontawesome": "^0.4.1",
|
|
44
47
|
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
"ember-cli-es6-transform": "^1.0.0",
|
|
52
55
|
"ember-cli-htmlbars": "^6.1.0",
|
|
53
56
|
"ember-leaflet": "^5.1.1",
|
|
54
|
-
"ember-radio-button": "3.0.0-beta.1",
|
|
57
|
+
"ember-radio-button": "^3.0.0-beta.1",
|
|
55
58
|
"ember-wormhole": "^0.6.0",
|
|
56
59
|
"leaflet": "^1.9.4",
|
|
57
60
|
"leaflet-contextmenu": "^1.4.0",
|