@fleetbase/fleetops-engine 0.2.1 → 0.2.2

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.
@@ -1,4 +1,4 @@
1
- <div class="driver-card flex flex-1" {{did-insert this.setupComponent}} ...attributes>
1
+ <div class="driver-card flex flex-1" ...attributes>
2
2
  <a href="javascript:;" class="driver-card-details flex flex-1 bg-black bg-opacity-25 rounded-md px-4 py-3 shadow-sm" {{on "click" this.onClick}}>
3
3
  <div class="flex flex-row">
4
4
  <div class="mr-3">
@@ -4,14 +4,27 @@
4
4
 
5
5
  {{#if this.isDriversVisible}}
6
6
  {{#each this.drivers as |driver|}}
7
- <layers.rotated-marker @icon={{icon iconUrl=driver.vehicle_avatar iconSize=(array 40 40)}} @location={{point-to-coordinates driver.location}} @onAdd={{fn this.onAction "onDriverAdded" driver}}>
8
- {{!-- <marker.popup @maxWidth="500" @minWidth="225">
7
+ <layers.rotated-marker @icon={{icon iconUrl=driver.vehicle_avatar iconSize=(array 32 32)}} @location={{point-to-coordinates driver.location}} @onAdd={{fn this.onAction "onDriverAdded" driver}} as |marker|>
8
+ <marker.popup @maxWidth="500" @minWidth="225">
9
9
  <DriverCard @driver={{driver}} @showCoordinates={{true}} @textClass="text-gray-900 dark:text-gray-100" />
10
- </marker.popup> --}}
10
+ </marker.popup>
11
+ <marker.tooltip @permanent={{true}} @sticky={{true}}>{{driver.name}}</marker.tooltip>
11
12
  </layers.rotated-marker>
12
13
  {{/each}}
13
14
  {{/if}}
14
15
 
16
+ {{#if this.isPlacesVisible}}
17
+ {{#each this.places as |place|}}
18
+ <layers.marker @icon={{icon iconUrl="/engines-dist/images/building-marker.png" iconSize=(array 32 32)}} @location={{point-to-coordinates place.location}} @riseOnHover={{true}} @title={{place.address}} @alt={{place.address}} as |marker|>
19
+ <marker.popup>
20
+ <div>{{place.address}}</div>
21
+ <div>{{format-point place.location}}</div>
22
+ </marker.popup>
23
+ <marker.tooltip @permanent={{false}} @sticky={{true}} @direction="bottom">{{place.name}}</marker.tooltip>
24
+ </layers.marker>
25
+ {{/each}}
26
+ {{/if}}
27
+
15
28
  {{!-- {{#if this.isRoutesVisible}}
16
29
  {{#each this.routes as |route|}}
17
30
  <layers.polyline @locations={{route.details.coordinates}} />
@@ -25,10 +25,12 @@ export default class LiveMapComponent extends Component {
25
25
 
26
26
  @tracked routes = [];
27
27
  @tracked drivers = [];
28
+ @tracked places = [];
28
29
  @tracked channels = [];
29
30
  @tracked isLoading = true;
30
31
  @tracked isReady = false;
31
32
  @tracked isDriversVisible = true;
33
+ @tracked isPlacesVisible = true;
32
34
  @tracked isRoutesVisible = true;
33
35
  @tracked isDrawControlsVisible = false;
34
36
  @tracked isCreatingServiceArea = false;
@@ -105,6 +107,7 @@ export default class LiveMapComponent extends Component {
105
107
 
106
108
  this.routes = await this.fetchActiveRoutes();
107
109
  this.drivers = await this.fetchActiveDrivers();
110
+ this.places = await this.fetchActivePlaces();
108
111
  this.serviceAreaRecords = await this.fetchServiceAreas();
109
112
  this.isReady = true;
110
113
 
@@ -478,6 +481,18 @@ export default class LiveMapComponent extends Component {
478
481
  this.isDriversVisible = !this.isDriversVisible;
479
482
  }
480
483
 
484
+ @action hidePlaces() {
485
+ this.isPlacesVisible = false;
486
+ }
487
+
488
+ @action showPlaces() {
489
+ this.isPlacesVisible = true;
490
+ }
491
+
492
+ @action togglePlaces() {
493
+ this.isPlacesVisible = !this.isPlacesVisible;
494
+ }
495
+
481
496
  @action hideRoutes() {
482
497
  this.isRoutesVisible = false;
483
498
  }
@@ -842,6 +857,25 @@ export default class LiveMapComponent extends Component {
842
857
  });
843
858
  }
844
859
 
860
+ @action fetchActivePlaces() {
861
+ this.isLoading = true;
862
+
863
+ // get the center of map
864
+ const center = this.leafletMap.getCenter();
865
+
866
+ return new Promise((resolve) => {
867
+ this.fetch.get('fleet-ops/live/places', { within: center }, { normalizeToEmberData: true, normalizeModelType: 'place' }).then((places) => {
868
+ this.isLoading = false;
869
+
870
+ if (typeof this.args.onPlacesLoaded === 'function') {
871
+ this.args.onPlacesLoaded(places);
872
+ }
873
+
874
+ resolve(places);
875
+ });
876
+ });
877
+ }
878
+
845
879
  @action fetchServiceAreas() {
846
880
  this.isLoading = true;
847
881
 
@@ -47,5 +47,11 @@
47
47
  <MapContainer::Toolbar::ZonesPanel @dd={{dd}} @map={{@map}} @onPressCreateServiceArea={{@onPressCreateServiceArea}} />
48
48
  </dd.Content>
49
49
  </BasicDropdown>
50
+ <button type="button" class="toolbar-button relative" {{on "click" (fn this.onAction "onPressDisplayPlaces")}}>
51
+ <FaIcon @icon="city" />
52
+ <Attach::Tooltip @class="clean" @animation="scale" @placement="right">
53
+ <InputInfo @text="Toggle Places" @iconClass="hidden" class="py-1 px-2 bg-gray-900 -mt-1" />
54
+ </Attach::Tooltip>
55
+ </button>
50
56
  </div>
51
57
  </MapContainer::ToolbarContainer>
@@ -384,13 +384,13 @@ export default class ManagementContactsIndexController extends Controller {
384
384
  {
385
385
  path: `uploads/${contact.company_uuid}/contacts/${contact.slug}`,
386
386
  subject_uuid: contact.id,
387
- subject_type: `contact`,
388
- type: `contact_photo`,
387
+ subject_type: 'contact',
388
+ type: 'contact_photo',
389
389
  },
390
390
  (uploadedFile) => {
391
391
  contact.setProperties({
392
392
  photo_uuid: uploadedFile.id,
393
- photo_url: uploadedFile.s3url,
393
+ photo_url: uploadedFile.url,
394
394
  photo: uploadedFile,
395
395
  });
396
396
  }
@@ -562,7 +562,7 @@ export default class ManagementVehiclesIndexController extends ManagementControl
562
562
  (uploadedFile) => {
563
563
  vehicle.setProperties({
564
564
  photo_uuid: uploadedFile.id,
565
- photo_url: uploadedFile.s3url,
565
+ photo_url: uploadedFile.url,
566
566
  photo: uploadedFile,
567
567
  });
568
568
  }
@@ -1220,7 +1220,7 @@ export default class OperationsOrdersIndexNewController extends Controller {
1220
1220
  (uploadedFile) => {
1221
1221
  entity.setProperties({
1222
1222
  photo_uuid: uploadedFile.id,
1223
- photo_url: uploadedFile.s3url,
1223
+ photo_url: uploadedFile.url,
1224
1224
  photo: uploadedFile,
1225
1225
  });
1226
1226
  }
@@ -833,7 +833,7 @@ export default class OperationsOrdersIndexViewController extends Controller {
833
833
  (uploadedFile) => {
834
834
  entity.setProperties({
835
835
  photo_uuid: uploadedFile.id,
836
- photo_url: uploadedFile.s3url,
836
+ photo_url: uploadedFile.url,
837
837
  photo: uploadedFile,
838
838
  });
839
839
  }
@@ -561,12 +561,25 @@ export default class OperationsOrdersIndexController extends Controller {
561
561
  this.query = value;
562
562
  }
563
563
 
564
+ @action viewPlacesOnMap() {
565
+ const {
566
+ leafletMap: { liveMap },
567
+ } = this;
568
+
569
+ if (liveMap) {
570
+ liveMap.togglePlaces();
571
+ }
572
+ }
573
+
564
574
  @action resetView() {
565
- const { leafletMap } = this;
575
+ const {
576
+ leafletMap: { liveMap },
577
+ } = this;
566
578
 
567
- leafletMap?.liveMap?.hideDrivers();
568
- leafletMap?.liveMap?.hideRoutes();
569
- // leafletMap?.remove();
579
+ if (liveMap) {
580
+ liveMap.hideDrivers();
581
+ liveMap.hideRoutes();
582
+ }
570
583
  }
571
584
 
572
585
  @action toggleSearch() {
@@ -13,7 +13,7 @@
13
13
  {{#if this.isMapLayout}}
14
14
  <MapContainer @layout={{this.layout}} @onReady={{this.onMapContainerReady}}>
15
15
  <GlobalSearch @visible={{this.isSearchVisible}} @onPressOrder={{this.viewOrder}} />
16
- <MapContainer::Toolbar @activeOrdersCount={{this.activeOrdersCount}} @map={{this.leafletMap}} @onPressViewOrders={{this.toggleOrdersPanel}} @onPressSearch={{this.toggleSearch}} @onPressCreateOrder={{this.createOrder}} @onPressCreateDriver={{this.driversController.createDriver}} @onPressDriverProfile={{this.driversController.viewDriver}} />
16
+ <MapContainer::Toolbar @activeOrdersCount={{this.activeOrdersCount}} @map={{this.leafletMap}} @onPressDisplayPlaces={{this.viewPlacesOnMap}} @onPressViewOrders={{this.toggleOrdersPanel}} @onPressSearch={{this.toggleSearch}} @onPressCreateOrder={{this.createOrder}} @onPressCreateDriver={{this.driversController.createDriver}} @onPressDriverProfile={{this.driversController.viewDriver}} />
17
17
  <OrderListOverlay @noBackdrop={{true}} @fullHeight={{true}} @outView={{not this.isOrdersPanelVisible}} @width={{if (media 'isMobile') "100%" "338px"}} @onPressCancel={{this.hideOrdersPanel}} @onPressCreateOrder={{this.createOrder}} @onPressViewOrder={{this.viewOrder}} @onPressCreateFleet={{this.fleetController.createFleet}} @onPressManageFleet={{this.fleetController.viewFleet}} @onPressCancelOrders={{this.bulkCancelOrders}} @onPressDeleteOrders={{this.bulkDeleteOrders}} />
18
18
  <LiveMap id="leafletMap" class="next-leaflet-container-map" @lat={{1.3521}} @lng={{103.8198}} @zoom={{12}} @zoomControl={{false}} @onLoad={{this.setMapReference}} {{set-container-dimensions}} />
19
19
  </MapContainer>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/fleetops-engine",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Fleetbase Fleet-Ops extension provides a fleet management and last mile delivery operations system module.",
5
5
  "fleetbase": {
6
6
  "route": "fleet-ops",
@@ -39,8 +39,8 @@
39
39
  "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
40
40
  },
41
41
  "dependencies": {
42
- "@fleetbase/ember-core": "^0.1.1",
43
- "@fleetbase/ember-ui": "^0.1.7",
42
+ "@fleetbase/ember-core": "^0.1.2",
43
+ "@fleetbase/ember-ui": "^0.1.8",
44
44
  "@fleetbase/fleetops-data": "^0.0.6",
45
45
  "@fleetbase/leaflet-routing-machine": "^3.2.16",
46
46
  "@fortawesome/ember-fontawesome": "^0.4.1",