@fleetbase/fleetops-engine 0.1.0 → 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.
@@ -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">
@@ -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,7 +2,7 @@
2
2
  "name": "@fleetbase/fleetops-engine",
3
3
  "extension": "Fleet Ops",
4
4
  "icon": "route",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "priority": 0,
7
7
  "fleetbase": {
8
8
  "dashboard": "int/v1/fleet-ops/dashboard"
@@ -39,9 +39,9 @@
39
39
  "test:ember-compatibility": "ember try:each"
40
40
  },
41
41
  "dependencies": {
42
- "@fleetbase/ember-core": "^0.0.4",
43
- "@fleetbase/ember-ui": "^0.0.7",
44
- "@fleetbase/fleetops-data": "^0.0.2",
42
+ "@fleetbase/ember-core": "^0.0.6",
43
+ "@fleetbase/ember-ui": "^0.0.8",
44
+ "@fleetbase/fleetops-data": "^0.0.3",
45
45
  "@fleetbase/leaflet-routing-machine": "^3.2.15",
46
46
  "@fortawesome/ember-fontawesome": "^0.4.1",
47
47
  "@fortawesome/fontawesome-svg-core": "^6.4.0",