@fleetbase/fleetops-engine 0.4.1 → 0.4.3

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.
@@ -137,8 +137,8 @@ export default class ContactFormPanelComponent extends Component {
137
137
  {
138
138
  path: `uploads/${this.currentUser.companyId}/drivers/${this.contact.id}`,
139
139
  subject_uuid: this.contact.id,
140
- subject_type: `contact`,
141
- type: `contact_photo`,
140
+ subject_type: 'fleet-ops:contact',
141
+ type: 'contact_photo',
142
142
  },
143
143
  (uploadedFile) => {
144
144
  this.contact.setProperties({
@@ -184,7 +184,7 @@ export default class ContactFormPanelComponent extends Component {
184
184
  {
185
185
  path: `uploads/${this.contact.company_uuid}/contacts/${this.contact.slug}`,
186
186
  subject_uuid: this.contact.id,
187
- subject_type: 'contact',
187
+ subject_type: 'fleet-ops:contact',
188
188
  type: 'contact_photo',
189
189
  },
190
190
  (uploadedFile) => {
@@ -131,7 +131,7 @@ export default class DriverFormPanelComponent extends Component {
131
131
  {
132
132
  path: `uploads/${this.currentUser.companyId}/drivers/${this.driver.id}`,
133
133
  subject_uuid: this.driver.id,
134
- subject_type: 'driver',
134
+ subject_type: 'fleet-ops:driver',
135
135
  type: 'driver_photo',
136
136
  },
137
137
  (uploadedFile) => {
@@ -131,7 +131,7 @@ export default class VehicleFormPanelComponent extends Component {
131
131
  {
132
132
  path: `uploads/${this.currentUser.companyId}/vehicles/${this.vehicle.id}`,
133
133
  subject_uuid: this.vehicle.id,
134
- subject_type: 'vehicle',
134
+ subject_type: 'fleet-ops:vehicle',
135
135
  type: 'vehicle_photo',
136
136
  },
137
137
  (uploadedFile) => {
@@ -147,7 +147,7 @@ export default class VendorFormPanelComponent extends Component {
147
147
  {
148
148
  path: `uploads/${this.currentUser.companyId}/vendors/${this.vendor.id}`,
149
149
  subject_uuid: this.vendor.id,
150
- subject_type: 'vendor',
150
+ subject_type: 'fleet-ops:vendor',
151
151
  type: 'vendor_logo',
152
152
  },
153
153
  (uploadedFile) => {
@@ -571,7 +571,6 @@ export default class OperationsOrdersIndexNewController extends BaseController {
571
571
  is_route_optimized,
572
572
  })
573
573
  .then((serviceQuotes) => {
574
- console.log('[serviceQuotes]', serviceQuotes);
575
574
  set(this, 'serviceQuotes', isArray(serviceQuotes) ? serviceQuotes : []);
576
575
 
577
576
  if (this.serviceQuotes.length && this.isUsingIntegratedVendor) {
@@ -588,27 +587,21 @@ export default class OperationsOrdersIndexNewController extends BaseController {
588
587
 
589
588
  _getSerializedPayload(payload) {
590
589
  const serialized = {
591
- pickup: payload.pickup,
592
- dropoff: payload.dropoff,
590
+ pickup: this._seriailizeModel(payload.pickup),
591
+ dropoff: this._seriailizeModel(payload.dropoff),
592
+ entitities: this._serializeArray(payload.entities),
593
+ waypoints: this._serializeArray(payload.waypoint),
593
594
  };
594
595
 
595
- if (isModel(payload.pickup)) {
596
- serialized.pickup = payload.pickup.toJSON();
597
- }
598
-
599
- if (isModel(payload.dropoff)) {
600
- serialized.dropoff = payload.dropoff.toJSON();
601
- }
602
-
603
- if (isArray(payload.entities)) {
604
- serialized.entities = payload.entities.toArray();
605
- }
596
+ return serialized;
597
+ }
606
598
 
607
- if (isArray(payload.waypoints)) {
608
- serialized.waypoints = payload.waypoints.toArray();
609
- }
599
+ _seriailizeModel(model) {
600
+ return isModel(model) ? model.toJSON() : model;
601
+ }
610
602
 
611
- return serialized;
603
+ _serializeArray(array) {
604
+ return isArray(array) ? array.map((item) => this._seriailizeModel(item)) : array;
612
605
  }
613
606
 
614
607
  @action scheduleOrder(dateInstance) {
@@ -1324,24 +1317,30 @@ export default class OperationsOrdersIndexNewController extends BaseController {
1324
1317
  acceptButtonText: 'Save Changes',
1325
1318
  entity,
1326
1319
  uploadNewPhoto: (file) => {
1320
+ const fileUrl = URL.createObjectURL(file.file);
1321
+
1327
1322
  if (entity.get('isNew')) {
1328
1323
  const { queue } = file;
1329
- const fileUrl = URL.createObjectURL(file.blob);
1330
1324
 
1331
1325
  this.modalsManager.setOption('pendingFileUpload', file);
1332
1326
  entity.set('photo_url', fileUrl);
1333
- // entity.set('photo_upload', fileUrl);
1334
1327
  queue.remove(file);
1335
1328
  return;
1329
+ } else {
1330
+ entity.set('photo_url', fileUrl);
1336
1331
  }
1337
1332
 
1333
+ // Indicate loading
1334
+ this.modalsManager.startLoading();
1335
+
1336
+ // Perform upload
1338
1337
  return this.fetch.uploadFile.perform(
1339
1338
  file,
1340
1339
  {
1341
1340
  path: `uploads/${this.currentUser.companyId}/entities/${entity.id}`,
1342
1341
  subject_uuid: entity.id,
1343
- subject_type: `entity`,
1344
- type: `entity_photo`,
1342
+ subject_type: 'fleet-ops:entity',
1343
+ type: 'entity_photo',
1345
1344
  },
1346
1345
  (uploadedFile) => {
1347
1346
  entity.setProperties({
@@ -1349,6 +1348,13 @@ export default class OperationsOrdersIndexNewController extends BaseController {
1349
1348
  photo_url: uploadedFile.url,
1350
1349
  photo: uploadedFile,
1351
1350
  });
1351
+
1352
+ // Stop loading
1353
+ this.modalsManager.stopLoading();
1354
+ },
1355
+ () => {
1356
+ // Stop loading
1357
+ this.modalsManager.stopLoading();
1352
1358
  }
1353
1359
  );
1354
1360
  },
@@ -1356,7 +1362,6 @@ export default class OperationsOrdersIndexNewController extends BaseController {
1356
1362
  modal.startLoading();
1357
1363
 
1358
1364
  const pendingFileUpload = modal.getOption('pendingFileUpload');
1359
-
1360
1365
  return entity.save().then(() => {
1361
1366
  if (pendingFileUpload) {
1362
1367
  return modal.invoke('uploadNewPhoto', pendingFileUpload);
@@ -858,23 +858,30 @@ export default class OperationsOrdersIndexViewController extends BaseController
858
858
  acceptButtonText: 'Save Changes',
859
859
  entity,
860
860
  uploadNewPhoto: (file) => {
861
+ const fileUrl = URL.createObjectURL(file.blob);
862
+
861
863
  if (entity.get('isNew')) {
862
864
  const { queue } = file;
863
- const fileUrl = URL.createObjectURL(file.blob);
864
865
 
865
866
  this.modalsManager.setOption('pendingFileUpload', file);
866
867
  entity.set('photo_url', fileUrl);
867
868
  queue.remove(file);
868
869
  return;
870
+ } else {
871
+ entity.set('photo_url', fileUrl);
869
872
  }
870
873
 
874
+ // Indicate loading
875
+ this.modalsManager.startLoading();
876
+
877
+ // Perform upload
871
878
  return this.fetch.uploadFile.perform(
872
879
  file,
873
880
  {
874
881
  path: `uploads/${this.currentUser.companyId}/entities/${entity.id}`,
875
882
  subject_uuid: entity.id,
876
- subject_type: `entity`,
877
- type: `entity_photo`,
883
+ subject_type: 'fleet-ops:entity',
884
+ type: 'entity_photo',
878
885
  },
879
886
  (uploadedFile) => {
880
887
  entity.setProperties({
@@ -882,6 +889,13 @@ export default class OperationsOrdersIndexViewController extends BaseController
882
889
  photo_url: uploadedFile.url,
883
890
  photo: uploadedFile,
884
891
  });
892
+
893
+ // Stop loading
894
+ this.modalsManager.stopLoading();
895
+ },
896
+ () => {
897
+ // Stop loading
898
+ this.modalsManager.stopLoading();
885
899
  }
886
900
  );
887
901
  },
@@ -889,7 +903,6 @@ export default class OperationsOrdersIndexViewController extends BaseController
889
903
  modal.startLoading();
890
904
 
891
905
  const pendingFileUpload = modal.getOption('pendingFileUpload');
892
-
893
906
  return entity.save().then(() => {
894
907
  if (pendingFileUpload) {
895
908
  return modal.invoke('uploadNewPhoto', pendingFileUpload);
@@ -1,26 +1,7 @@
1
1
  import OperationsServiceRatesIndexNewController from './new';
2
- import { tracked } from '@glimmer/tracking';
3
2
  import { action } from '@ember/object';
4
- import { inject as service } from '@ember/object';
5
3
 
6
4
  export default class OperationsServiceRatesIndexEditController extends OperationsServiceRatesIndexNewController {
7
- /**
8
- * Inject the `intl` service
9
- *
10
- * @var {Service}
11
- */
12
- @service intl;
13
-
14
- /**
15
- * True if updating service rate.
16
- *
17
- * @var {Boolean}
18
- */
19
- @tracked isUpdatingServiceRate = false;
20
-
21
- // @alias('@model.rate_fees') rateFees;
22
- // @alias('@model.parcel_fees') parcelFees;
23
-
24
5
  /**
25
6
  * Updates the service rate to server
26
7
  *
@@ -6,10 +6,13 @@ import getResourceNameFromTransition from '@fleetbase/ember-core/utils/get-resou
6
6
  export default class ApplicationRoute extends Route {
7
7
  @service loader;
8
8
  @service fetch;
9
+ @service intl;
9
10
 
10
11
  @action loading(transition) {
11
- const resourceName = getResourceNameFromTransition(transition);
12
- this.loader.showOnInitialTransition(transition, 'section.next-view-section', { loadingMessage: resourceName ? `Loading ${resourceName}...` : `Loading...` });
12
+ const resourceName = getResourceNameFromTransition(transition, { humanize: true });
13
+ this.loader.showOnInitialTransition(transition, 'section.next-view-section', {
14
+ loadingMessage: resourceName ? this.intl.t('fleet-ops.common.loading-resource', { resourceName }) : this.intl.t('fleet-ops.common.loading'),
15
+ });
13
16
  }
14
17
 
15
18
  model() {
@@ -60,3 +60,9 @@ body[data-theme='dark'] .scheduler-left-sidebar {
60
60
  .next-sidebar .next-sidebar-panel-container.next-driver-listing > .next-sidebar-panel > .next-content-panel > .next-sidebar-panel-body .next-nav-item.driver-nav-item {
61
61
  padding-left: 3.5rem;
62
62
  }
63
+
64
+ .multi-drop-select-container .fleetbase-model-select.fleetbase-power-select.ember-model-select > .ember-model-select__loading {
65
+ background: none;
66
+ border: none;
67
+ box-shadow: none;
68
+ }
@@ -213,7 +213,7 @@
213
213
  </div>
214
214
 
215
215
  {{#if this.isMultipleDropoffOrder}}
216
- <DragSortList class="overflow-visible" @items={{this.waypoints}} @dragEndAction={{this.sortWaypoints}} as |waypoint index|>
216
+ <DragSortList class="multi-drop-select-container overflow-visible" @items={{this.waypoints}} @dragEndAction={{this.sortWaypoints}} as |waypoint index|>
217
217
  <div id={{concat "waypoint_" (add index 1)}} class="border rounded-md px-3 py-2 shadow-sm border-gray-300 dark:border-gray-900 mb-3">
218
218
  <div class="flex items-center justify-between">
219
219
  <div class="flex items-center justify-between cursor-move">
package/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/fleetops-api",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Fleet-Ops",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/fleetops",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/fleetops-engine",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "fleet-ops",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@babel/core": "^7.23.2",
46
- "@fleetbase/ember-core": "^0.2.0",
46
+ "@fleetbase/ember-core": "^0.2.1",
47
47
  "@fleetbase/ember-ui": "^0.2.9",
48
48
  "@fleetbase/fleetops-data": "^0.1.7",
49
49
  "@fleetbase/leaflet-routing-machine": "^3.2.16",
@@ -422,7 +422,10 @@ class DriverController extends Controller
422
422
  return 'Your ' . data_get($company, 'name', config('app.name')) . ' verification code is ' . $verification->code;
423
423
  });
424
424
  } catch (\Throwable $e) {
425
- return response()->apiError($e->getMessage());
425
+ if (app()->bound('sentry')) {
426
+ app('sentry')->captureException($e);
427
+ }
428
+ return response()->apiError('Unable to send SMS Verification code.');
426
429
  }
427
430
 
428
431
  return response()->json(['status' => 'OK']);
@@ -247,7 +247,7 @@ class Entity extends Model
247
247
  */
248
248
  public function getPhotoUrlAttribute()
249
249
  {
250
- return data_get($this, 'photo.s3url', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/parcels/medium.png');
250
+ return data_get($this, 'photo.url', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/parcels/medium.png');
251
251
  }
252
252
 
253
253
  /**
@@ -81,7 +81,7 @@ class Proof extends Model
81
81
  */
82
82
  public function getFileUrlAttribute()
83
83
  {
84
- return $this->fromCache('file.s3url', null);
84
+ return $this->fromCache('file.url', null);
85
85
  }
86
86
 
87
87
  /**
@@ -38,6 +38,7 @@ fleet-ops:
38
38
  length: Length
39
39
  license: License
40
40
  loading: Loading...
41
+ loading-resource: Loading {resourceName}...
41
42
  make: Make
42
43
  manage-message: Manage your vendors
43
44
  manpower: Manpower
@@ -1300,7 +1301,8 @@ fleet-ops:
1300
1301
  example-second-message: Then the following formula will calculate a service fee of $2.50, which will be added to the base fee.
1301
1302
  algorithm-label: Algorithm
1302
1303
  algorithm-help-text: Define a formula to be evaluated for this service rate calculation.
1303
- algorithm-placeholder: (( {distance} / 50 ) * .05 ) + (( {time} / 60 ) * .01)
1304
+ algorithm-placeholder: >-
1305
+ (( '{distance}' / 50 ) * .05 ) + (( '{time}' / 60 ) * .01)
1304
1306
  percel-fee-title: Parcel Fee's
1305
1307
  length-label: Length
1306
1308
  length-placeholder: Length in {parcelFeeDimension}