@fleetbase/fleetops-engine 0.4.4 → 0.4.5

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.
Files changed (101) hide show
  1. package/addon/components/contact-form-panel.hbs +1 -0
  2. package/addon/components/driver-panel.hbs +1 -0
  3. package/addon/components/edit-order-route-panel.hbs +1 -0
  4. package/addon/components/fleet-form-panel.hbs +1 -0
  5. package/addon/components/fleet-panel.hbs +1 -0
  6. package/addon/components/fuel-report-form-panel.hbs +1 -0
  7. package/addon/components/fuel-report-panel.hbs +1 -0
  8. package/addon/components/issue-form-panel.hbs +1 -0
  9. package/addon/components/issue-panel.hbs +1 -0
  10. package/addon/components/place-form-panel.hbs +1 -0
  11. package/addon/components/place-panel.hbs +1 -0
  12. package/addon/components/vehicle-form-panel.hbs +1 -0
  13. package/addon/components/vehicle-panel.hbs +1 -0
  14. package/addon/components/vendor-form-panel.hbs +1 -0
  15. package/addon/components/vendor-panel.hbs +1 -0
  16. package/addon/components/widget/fleet-ops-key-metrics.hbs +19 -0
  17. package/addon/components/widget/fleet-ops-key-metrics.js +85 -0
  18. package/addon/controllers/operations/orders/index.js +1 -1
  19. package/addon/engine.js +18 -12
  20. package/addon/styles/fleetops-engine.css +2 -2
  21. package/app/components/widget/{issues.js → fleet-ops-key-metrics.js} +1 -1
  22. package/composer.json +6 -6
  23. package/extension.json +1 -1
  24. package/package.json +3 -4
  25. package/server/src/Casts/MultiPolygon.php +3 -3
  26. package/server/src/Casts/Point.php +2 -2
  27. package/server/src/Casts/Polygon.php +3 -3
  28. package/server/src/Console/Commands/DispatchAdhocOrders.php +1 -1
  29. package/server/src/Events/DriverSimulatedLocationChanged.php +1 -1
  30. package/server/src/Flow/Activity.php +12 -0
  31. package/server/src/Flow/Config.php +7 -0
  32. package/server/src/Flow/Logic.php +7 -0
  33. package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -1
  34. package/server/src/Http/Controllers/Api/v1/OrderController.php +3 -3
  35. package/server/src/Http/Controllers/Api/v1/PlaceController.php +1 -1
  36. package/server/src/Http/Controllers/Api/v1/ServiceAreaController.php +1 -1
  37. package/server/src/Http/Controllers/Api/v1/TrackingStatusController.php +1 -1
  38. package/server/src/Http/Controllers/Api/v1/ZoneController.php +1 -1
  39. package/server/src/Http/Controllers/Internal/v1/DriverController.php +1 -1
  40. package/server/src/Http/Controllers/Internal/v1/GeocoderController.php +2 -2
  41. package/server/src/Http/Controllers/Internal/v1/MetricsController.php +6 -50
  42. package/server/src/Http/Controllers/Internal/v1/OrderController.php +2 -2
  43. package/server/src/Http/Controllers/Internal/v1/PlaceController.php +1 -1
  44. package/server/src/Http/Filter/PlaceFilter.php +1 -1
  45. package/server/src/Http/Resources/v1/Driver.php +1 -1
  46. package/server/src/Http/Resources/v1/FuelReport.php +1 -1
  47. package/server/src/Http/Resources/v1/Issue.php +1 -1
  48. package/server/src/Http/Resources/v1/Payload.php +1 -0
  49. package/server/src/Http/Resources/v1/Place.php +1 -1
  50. package/server/src/Http/Resources/v1/TrackingStatus.php +1 -1
  51. package/server/src/Http/Resources/v1/Vehicle.php +1 -1
  52. package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +1 -1
  53. package/server/src/Http/Resources/v1/Waypoint.php +2 -4
  54. package/server/src/Integrations/Lalamove/LalamoveDeliveryStop.php +2 -2
  55. package/server/src/Jobs/SimulateWaypointReached.php +2 -2
  56. package/server/src/Models/Contact.php +6 -18
  57. package/server/src/Models/Driver.php +7 -19
  58. package/server/src/Models/Fleet.php +6 -25
  59. package/server/src/Models/FuelReport.php +1 -1
  60. package/server/src/Models/Issue.php +1 -1
  61. package/server/src/Models/Order.php +15 -19
  62. package/server/src/Models/Payload.php +7 -7
  63. package/server/src/Models/Place.php +14 -14
  64. package/server/src/Models/Position.php +1 -1
  65. package/server/src/Models/ServiceArea.php +14 -14
  66. package/server/src/Models/TrackingNumber.php +1 -1
  67. package/server/src/Models/TrackingStatus.php +1 -1
  68. package/server/src/Models/Vehicle.php +7 -19
  69. package/server/src/Models/VehicleDeviceEvent.php +1 -1
  70. package/server/src/Models/Vendor.php +8 -25
  71. package/server/src/Models/Waypoint.php +6 -6
  72. package/server/src/Models/Zone.php +8 -8
  73. package/server/src/Observers/DriverObserver.php +1 -1
  74. package/server/src/Observers/TrackingNumberObserver.php +1 -1
  75. package/server/src/Rules/ResolvablePoint.php +1 -1
  76. package/server/src/Support/Encoding/Polyline.php +1 -1
  77. package/server/src/Support/OSRM.php +1 -1
  78. package/server/src/Support/Utils.php +60 -60
  79. package/server/src/Traits/HasTrackingNumber.php +3 -3
  80. package/server/src/routes.php +1 -4
  81. package/translations/en-us.yaml +1 -0
  82. package/addon/components/widget/fleet-ops-quickstart.hbs +0 -40
  83. package/addon/components/widget/fleet-ops-quickstart.js +0 -59
  84. package/addon/components/widget/issues.hbs +0 -1
  85. package/addon/components/widget/key-metrics.hbs +0 -121
  86. package/addon/components/widget/key-metrics.js +0 -46
  87. package/addon/components/widget/live-order-map.hbs +0 -59
  88. package/addon/components/widget/live-order-map.js +0 -11
  89. package/addon/components/widget/recent-orders.hbs +0 -35
  90. package/addon/components/widget/recent-orders.js +0 -24
  91. package/addon/components/widget/transaction-earnings.hbs +0 -1
  92. package/addon/components/widget/transactions.hbs +0 -36
  93. package/addon/components/widget/transactions.js +0 -29
  94. package/addon/components/widget/weekly-orders.hbs +0 -1
  95. package/addon/components/widget/weekly-orders.js +0 -3
  96. package/app/components/widget/key-metrics.js +0 -1
  97. package/app/components/widget/live-order-map.js +0 -1
  98. package/app/components/widget/recent-orders.js +0 -1
  99. package/app/components/widget/transaction-earnings.js +0 -1
  100. package/app/components/widget/transactions.js +0 -1
  101. package/app/components/widget/weekly-orders.js +0 -1
@@ -94,11 +94,11 @@ class Utils extends FleetbaseUtils
94
94
  /**
95
95
  * Unpacks a mysql POINT column from binary to array.
96
96
  */
97
- public static function mysqlPointAsGeometry(string $rawPoint): \Grimzy\LaravelMysqlSpatial\Types\Point
97
+ public static function mysqlPointAsGeometry(string $rawPoint): \Fleetbase\LaravelMysqlSpatial\Types\Point
98
98
  {
99
99
  $coordinates = static::unpackPoint($rawPoint);
100
100
 
101
- return new \Grimzy\LaravelMysqlSpatial\Types\Point($coordinates['lon'], $coordinates['lat']);
101
+ return new \Fleetbase\LaravelMysqlSpatial\Types\Point($coordinates['lon'], $coordinates['lat']);
102
102
  }
103
103
 
104
104
  /**
@@ -161,7 +161,7 @@ class Utils extends FleetbaseUtils
161
161
  public static function isCoordinates($coordinates): bool
162
162
  {
163
163
  try {
164
- return static::getPointFromMixed($coordinates) instanceof \Grimzy\LaravelMysqlSpatial\Types\Point;
164
+ return static::getPointFromMixed($coordinates) instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point;
165
165
  } catch (\Throwable $e) {
166
166
  return false;
167
167
  }
@@ -174,9 +174,9 @@ class Utils extends FleetbaseUtils
174
174
  *
175
175
  * @param mixed $coordinates the coordinates input value to extract a coordinate from
176
176
  *
177
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point the extracted Point object
177
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point the extracted Point object
178
178
  */
179
- public static function getPointFromMixed($coordinates): ?\Grimzy\LaravelMysqlSpatial\Types\Point
179
+ public static function getPointFromMixed($coordinates): ?\Fleetbase\LaravelMysqlSpatial\Types\Point
180
180
  {
181
181
  $latitude = null;
182
182
  $longitude = null;
@@ -194,11 +194,11 @@ class Utils extends FleetbaseUtils
194
194
  $coordinates = $coordinates->location;
195
195
  }
196
196
 
197
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression) {
197
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression) {
198
198
  $coordinates = $coordinates->getSpatialValue();
199
199
  }
200
200
 
201
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
201
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
202
202
  $latitude = $coordinates->getLat();
203
203
  $longitude = $coordinates->getLng();
204
204
  } elseif (static::isGeoJson($coordinates)) {
@@ -215,7 +215,7 @@ class Utils extends FleetbaseUtils
215
215
 
216
216
  if (static::isJson($coordinatesJson)) {
217
217
  try {
218
- $coordinates = \Grimzy\LaravelMysqlSpatial\Types\Point::fromJson($coordinatesJson);
218
+ $coordinates = \Fleetbase\LaravelMysqlSpatial\Types\Point::fromJson($coordinatesJson);
219
219
  } catch (\Throwable $e) {
220
220
  if ($coordinatesInGeoJson) {
221
221
  return static::getPointFromMixed($coordinatesInGeoJson);
@@ -311,7 +311,7 @@ class Utils extends FleetbaseUtils
311
311
  $longitude = $coords[1];
312
312
  }
313
313
 
314
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
314
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
315
315
  return $coordinates;
316
316
  }
317
317
 
@@ -320,7 +320,7 @@ class Utils extends FleetbaseUtils
320
320
  throw new \Exception('Attempted to resolve Point from invalid location.');
321
321
  }
322
322
 
323
- return new \Grimzy\LaravelMysqlSpatial\Types\Point((float) $latitude, (float) $longitude);
323
+ return new \Fleetbase\LaravelMysqlSpatial\Types\Point((float) $latitude, (float) $longitude);
324
324
  }
325
325
 
326
326
  /**
@@ -333,7 +333,7 @@ class Utils extends FleetbaseUtils
333
333
  */
334
334
  public static function isCoordinatesStrict($coordinates)
335
335
  {
336
- return static::getPointFromCoordinatesStrict($coordinates) instanceof \Grimzy\LaravelMysqlSpatial\Types\Point;
336
+ return static::getPointFromCoordinatesStrict($coordinates) instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point;
337
337
  }
338
338
 
339
339
  /**
@@ -342,15 +342,15 @@ class Utils extends FleetbaseUtils
342
342
  *
343
343
  * @param mixed $coordinates the coordinates, which can be an array, object, or string
344
344
  *
345
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point Returns the Point instance
345
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point Returns the Point instance
346
346
  */
347
- public static function getPointFromCoordinatesStrict($coordinates): ?\Grimzy\LaravelMysqlSpatial\Types\Point
347
+ public static function getPointFromCoordinatesStrict($coordinates): ?\Fleetbase\LaravelMysqlSpatial\Types\Point
348
348
  {
349
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression) {
349
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression) {
350
350
  $coordinates = $coordinates->getSpatialValue();
351
351
  }
352
352
 
353
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
353
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
354
354
  return $coordinates;
355
355
  }
356
356
 
@@ -362,7 +362,7 @@ class Utils extends FleetbaseUtils
362
362
  }
363
363
 
364
364
  if (static::isJson($coordinatesJson)) {
365
- $coordinates = \Grimzy\LaravelMysqlSpatial\Types\Point::fromJson($coordinatesJson);
365
+ $coordinates = \Fleetbase\LaravelMysqlSpatial\Types\Point::fromJson($coordinatesJson);
366
366
  }
367
367
  }
368
368
 
@@ -371,7 +371,7 @@ class Utils extends FleetbaseUtils
371
371
  $longitude = static::or($coordinates, ['lon', '_lon', 'long', 'lng', '_lng', '_longitude', 'longitude', 'y', '1']);
372
372
 
373
373
  if (is_numeric($latitude) && is_numeric($longitude)) {
374
- $coordinates = new \Grimzy\LaravelMysqlSpatial\Types\Point((float) $latitude, (float) $longitude);
374
+ $coordinates = new \Fleetbase\LaravelMysqlSpatial\Types\Point((float) $latitude, (float) $longitude);
375
375
  }
376
376
  }
377
377
 
@@ -411,11 +411,11 @@ class Utils extends FleetbaseUtils
411
411
  $longitude = $coords[1];
412
412
 
413
413
  if (is_numeric($latitude) && is_numeric($longitude)) {
414
- $coordinates = new \Grimzy\LaravelMysqlSpatial\Types\Point((float) $latitude, (float) $longitude);
414
+ $coordinates = new \Fleetbase\LaravelMysqlSpatial\Types\Point((float) $latitude, (float) $longitude);
415
415
  }
416
416
  }
417
417
 
418
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
418
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
419
419
  return $coordinates;
420
420
  }
421
421
 
@@ -435,7 +435,7 @@ class Utils extends FleetbaseUtils
435
435
  $latitude = null;
436
436
  $longitude = null;
437
437
 
438
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression) {
438
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression) {
439
439
  $coordinates = $coordinates->getSpatialValue();
440
440
  }
441
441
 
@@ -443,7 +443,7 @@ class Utils extends FleetbaseUtils
443
443
  $coordinates = $coordinates->location;
444
444
  }
445
445
 
446
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
446
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
447
447
  $latitude = $coordinates->getLat();
448
448
  $longitude = $coordinates->getLng();
449
449
  } elseif (is_array($coordinates) || is_object($coordinates)) {
@@ -533,22 +533,22 @@ class Utils extends FleetbaseUtils
533
533
  *
534
534
  * @param mixed $coordinates the input value representing a location or set of coordinates
535
535
  *
536
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point the extracted point value
536
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point the extracted point value
537
537
  */
538
- public static function getPointFromCoordinates($coordinates): \Grimzy\LaravelMysqlSpatial\Types\Point
538
+ public static function getPointFromCoordinates($coordinates): \Fleetbase\LaravelMysqlSpatial\Types\Point
539
539
  {
540
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
540
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
541
541
  return $coordinates;
542
542
  }
543
543
 
544
544
  if (is_null($coordinates) || !static::isCoordinates($coordinates)) {
545
- return new \Grimzy\LaravelMysqlSpatial\Types\Point(0, 0);
545
+ return new \Fleetbase\LaravelMysqlSpatial\Types\Point(0, 0);
546
546
  }
547
547
 
548
548
  $latitude = static::getLatitudeFromCoordinates($coordinates);
549
549
  $longitude = static::getLongitudeFromCoordinates($coordinates);
550
550
 
551
- return new \Grimzy\LaravelMysqlSpatial\Types\Point($latitude, $longitude);
551
+ return new \Fleetbase\LaravelMysqlSpatial\Types\Point($latitude, $longitude);
552
552
  }
553
553
 
554
554
  /**
@@ -562,19 +562,19 @@ class Utils extends FleetbaseUtils
562
562
  {
563
563
  $wkt = 'POINT(0 0)';
564
564
 
565
- if ($point instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
565
+ if ($point instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
566
566
  $wkt = $point->toWKT();
567
567
  }
568
568
 
569
569
  if (is_array($point)) {
570
570
  $json = json_encode($point);
571
- $p = \Grimzy\LaravelMysqlSpatial\Types\Point::fromJson($json);
571
+ $p = \Fleetbase\LaravelMysqlSpatial\Types\Point::fromJson($json);
572
572
 
573
573
  $wkt = $p->toWkt();
574
574
  }
575
575
 
576
576
  if (is_string($point)) {
577
- $p = \Grimzy\LaravelMysqlSpatial\Types\Point::fromString($point);
577
+ $p = \Fleetbase\LaravelMysqlSpatial\Types\Point::fromString($point);
578
578
 
579
579
  $wkt = $p->toWKT();
580
580
  }
@@ -604,23 +604,23 @@ class Utils extends FleetbaseUtils
604
604
  *
605
605
  * @param string $data the binary string representing the point
606
606
  *
607
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point the Laravel MySQL Spatial Point instance
607
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point the Laravel MySQL Spatial Point instance
608
608
  */
609
- public static function rawPointToPoint(string $data): \Grimzy\LaravelMysqlSpatial\Types\Point
609
+ public static function rawPointToPoint(string $data): \Fleetbase\LaravelMysqlSpatial\Types\Point
610
610
  {
611
611
  // Use the `unpack` function to extract the X, Y, and SRID values from the binary string.
612
612
  $res = unpack('lSRID/CByteOrder/lTypeInfo/dX/dY', $data);
613
613
 
614
614
  // Return a new Laravel MySQL Spatial Point instance with the X, Y, and SRID values.
615
- return new \Grimzy\LaravelMysqlSpatial\Types\Point($res['X'], $res['Y'], $res['SRID']);
615
+ return new \Fleetbase\LaravelMysqlSpatial\Types\Point($res['X'], $res['Y'], $res['SRID']);
616
616
  }
617
617
 
618
618
  /**
619
619
  * Calculates driving distance and time using Google distance matrix.
620
620
  * Returns distance in meters and time in seconds.
621
621
  *
622
- * @param \Fleetbase\FleetOps\Models\Place|\Grimzy\LaravelMysqlSpatial\Types\Point|array $origin
623
- * @param \Fleetbase\FleetOps\Models\Place|\Grimzy\LaravelMysqlSpatial\Types\Point|array $destination
622
+ * @param \Fleetbase\FleetOps\Models\Place|\Fleetbase\LaravelMysqlSpatial\Types\Point|array $origin
623
+ * @param \Fleetbase\FleetOps\Models\Place|\Fleetbase\LaravelMysqlSpatial\Types\Point|array $destination
624
624
  */
625
625
  public static function getDrivingDistanceAndTime($origin, $destination): DistanceMatrix
626
626
  {
@@ -803,8 +803,8 @@ class Utils extends FleetbaseUtils
803
803
  * Calculates driving distance and time between two points using Vincenty's formula.
804
804
  * Returns distance in meters and time in seconds.
805
805
  *
806
- * @param \Fleetbase\FleetOps\Models\Place|\Grimzy\LaravelMysqlSpatial\Types\Point|array $origin
807
- * @param \Fleetbase\FleetOps\Models\Place|\Grimzy\LaravelMysqlSpatial\Types\Point|array $destination
806
+ * @param \Fleetbase\FleetOps\Models\Place|\Fleetbase\LaravelMysqlSpatial\Types\Point|array $origin
807
+ * @param \Fleetbase\FleetOps\Models\Place|\Fleetbase\LaravelMysqlSpatial\Types\Point|array $destination
808
808
  */
809
809
  public static function calculateDrivingDistanceAndTime($origin, $destination): DistanceMatrix
810
810
  {
@@ -822,8 +822,8 @@ class Utils extends FleetbaseUtils
822
822
  * Calculates driving distance and time between two points using Vincenty's formula.
823
823
  * Returns distance in meters and time in seconds.
824
824
  *
825
- * @param \Fleetbase\FleetOps\Models\Place|\Grimzy\LaravelMysqlSpatial\Types\Point|array $origin
826
- * @param \Fleetbase\FleetOps\Models\Place|\Grimzy\LaravelMysqlSpatial\Types\Point|array $destination
825
+ * @param \Fleetbase\FleetOps\Models\Place|\Fleetbase\LaravelMysqlSpatial\Types\Point|array $origin
826
+ * @param \Fleetbase\FleetOps\Models\Place|\Fleetbase\LaravelMysqlSpatial\Types\Point|array $destination
827
827
  */
828
828
  public static function getPreliminaryDistanceMatrix($origin, $destination): DistanceMatrix
829
829
  {
@@ -856,13 +856,13 @@ class Utils extends FleetbaseUtils
856
856
  * https://en.wikipedia.org/wiki/Great-circle_distance#Formulas
857
857
  * https://en.wikipedia.org/wiki/Antipodal_point
858
858
  *
859
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point Starting point
860
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point Ending point
859
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point Starting point
860
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point Ending point
861
861
  * @param float $earthRadius Mean earth radius in [m]
862
862
  *
863
863
  * @return float Distance between points in [m] (same as earthRadius)
864
864
  */
865
- public static function vincentyGreatCircleDistance(\Grimzy\LaravelMysqlSpatial\Types\Point $from, \Grimzy\LaravelMysqlSpatial\Types\Point $to, float $earthRadius = 6371000): float
865
+ public static function vincentyGreatCircleDistance(\Fleetbase\LaravelMysqlSpatial\Types\Point $from, \Fleetbase\LaravelMysqlSpatial\Types\Point $to, float $earthRadius = 6371000): float
866
866
  {
867
867
  // convert from degrees to radians
868
868
  $latFrom = deg2rad($from->getLat());
@@ -883,7 +883,7 @@ class Utils extends FleetbaseUtils
883
883
  /**
884
884
  * Finds the nearest timezone for a given coordinate point.
885
885
  */
886
- public static function getNearestTimezone(\Grimzy\LaravelMysqlSpatial\Types\Point $location, string $countryCode = ''): string
886
+ public static function getNearestTimezone(\Fleetbase\LaravelMysqlSpatial\Types\Point $location, string $countryCode = ''): string
887
887
  {
888
888
  $timezoneIds = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $countryCode);
889
889
  $lat = $location->getLat();
@@ -957,9 +957,9 @@ class Utils extends FleetbaseUtils
957
957
  *
958
958
  * @param string $country the ISO_A3 or ISO_A2 code of the country
959
959
  *
960
- * @return \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon|null the MultiPolygon object or null if not found
960
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon|null the MultiPolygon object or null if not found
961
961
  */
962
- public static function createPolygonFromCountry(string $country): ?\Grimzy\LaravelMysqlSpatial\Types\MultiPolygon
962
+ public static function createPolygonFromCountry(string $country): ?\Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon
963
963
  {
964
964
  $globe = static::getGlobeData();
965
965
  $country = strtolower($country);
@@ -975,7 +975,7 @@ class Utils extends FleetbaseUtils
975
975
  );
976
976
 
977
977
  if ($feature) {
978
- return \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon::fromJson(json_encode($feature->geometry));
978
+ return \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon::fromJson(json_encode($feature->geometry));
979
979
  }
980
980
 
981
981
  return null;
@@ -983,7 +983,7 @@ class Utils extends FleetbaseUtils
983
983
 
984
984
  public static function isPoint($point): bool
985
985
  {
986
- return $point instanceof \Grimzy\LaravelMysqlSpatial\Types\Point;
986
+ return $point instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point;
987
987
  }
988
988
 
989
989
  /**
@@ -1087,11 +1087,11 @@ class Utils extends FleetbaseUtils
1087
1087
  /**
1088
1088
  * Calculates the centroid of a polygon using the Grimzy Laravel MySQL spatial type.
1089
1089
  *
1090
- * @param \Grimzy\LaravelMysqlSpatial\Types\Polygon $polygon the Polygon object from which to calculate the centroid
1090
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Polygon $polygon the Polygon object from which to calculate the centroid
1091
1091
  *
1092
1092
  * @return array returns the centroid of the polygon as an array of coordinates
1093
1093
  */
1094
- public static function getPolygonCentroid(\Grimzy\LaravelMysqlSpatial\Types\Polygon $polygon)
1094
+ public static function getPolygonCentroid(\Fleetbase\LaravelMysqlSpatial\Types\Polygon $polygon)
1095
1095
  {
1096
1096
  $polygonArray = $polygon->jsonSerialize()->getCoordinates();
1097
1097
  $coordinates = array_merge(...$polygonArray);
@@ -1102,11 +1102,11 @@ class Utils extends FleetbaseUtils
1102
1102
  /**
1103
1103
  * Calculates the centroid of a multi-polygon using the Grimzy Laravel MySQL spatial type.
1104
1104
  *
1105
- * @param \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon $multiPolygon the MultiPolygon object from which to calculate the centroid
1105
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon $multiPolygon the MultiPolygon object from which to calculate the centroid
1106
1106
  *
1107
1107
  * @return array returns the centroid of the multi-polygon as an array of coordinates
1108
1108
  */
1109
- public static function getMultiPolygonCentroid(\Grimzy\LaravelMysqlSpatial\Types\MultiPolygon $multiPolygon)
1109
+ public static function getMultiPolygonCentroid(\Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon $multiPolygon)
1110
1110
  {
1111
1111
  $multiPolygonArray = $multiPolygon->jsonSerialize()->getCoordinates();
1112
1112
  $coordinates = [];
@@ -1123,11 +1123,11 @@ class Utils extends FleetbaseUtils
1123
1123
  /**
1124
1124
  * Extracts and returns the first set of coordinates from a given polygon.
1125
1125
  *
1126
- * @param \Grimzy\LaravelMysqlSpatial\Types\Polygon|null $polygon the Polygon object from which to extract coordinates
1126
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Polygon|null $polygon the Polygon object from which to extract coordinates
1127
1127
  *
1128
1128
  * @return array Returns an array of the first set of coordinates in the polygon. Returns an empty array if the polygon is null.
1129
1129
  */
1130
- public static function getCoordinatesFromPolygon(?\Grimzy\LaravelMysqlSpatial\Types\Polygon $polygon): array
1130
+ public static function getCoordinatesFromPolygon(?\Fleetbase\LaravelMysqlSpatial\Types\Polygon $polygon): array
1131
1131
  {
1132
1132
  return Arr::first($polygon->jsonSerialize()->getCoordinates());
1133
1133
  }
@@ -1193,11 +1193,11 @@ class Utils extends FleetbaseUtils
1193
1193
  *
1194
1194
  * @param mixed $geoJson the GeoJSON input, which can be an array, object, or JSON string representing a valid GeoJSON object
1195
1195
  *
1196
- * @return \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression|null returns a SpatialExpression object if the input is a valid GeoJSON, or null if the input is not valid
1196
+ * @return \Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression|null returns a SpatialExpression object if the input is a valid GeoJSON, or null if the input is not valid
1197
1197
  *
1198
1198
  * @throws \InvalidArgumentException if the input is not a valid GeoJSON object
1199
1199
  */
1200
- public static function createSpatialExpressionFromGeoJson($geoJson): ?\Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression
1200
+ public static function createSpatialExpressionFromGeoJson($geoJson): ?\Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression
1201
1201
  {
1202
1202
  if (!static::isGeoJson($geoJson)) {
1203
1203
  return null;
@@ -1209,10 +1209,10 @@ class Utils extends FleetbaseUtils
1209
1209
 
1210
1210
  // Convert the value to JSON and create a Geometry object
1211
1211
  $json = json_encode($geoJson);
1212
- $geo = \Grimzy\LaravelMysqlSpatial\Types\Geometry::fromJson($json);
1212
+ $geo = \Fleetbase\LaravelMysqlSpatial\Types\Geometry::fromJson($json);
1213
1213
 
1214
1214
  // Return a new SpatialExpression object
1215
- return new \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression($geo);
1215
+ return new \Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression($geo);
1216
1216
  }
1217
1217
 
1218
1218
  /**
@@ -1220,11 +1220,11 @@ class Utils extends FleetbaseUtils
1220
1220
  *
1221
1221
  * @param mixed $geoJson the GeoJSON input, which can be an array, object, or JSON string representing a valid GeoJSON object
1222
1222
  *
1223
- * @return \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialExpression|null returns a SpatialExpression object if the input is a valid GeoJSON, or null if the input is not valid
1223
+ * @return \Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialExpression|null returns a SpatialExpression object if the input is a valid GeoJSON, or null if the input is not valid
1224
1224
  *
1225
1225
  * @throws \InvalidArgumentException if the input is not a valid GeoJSON object
1226
1226
  */
1227
- public static function createGeometryObjectFromGeoJson($geoJson): ?\Grimzy\LaravelMysqlSpatial\Types\Geometry
1227
+ public static function createGeometryObjectFromGeoJson($geoJson): ?\Fleetbase\LaravelMysqlSpatial\Types\Geometry
1228
1228
  {
1229
1229
  if (!static::isGeoJson($geoJson)) {
1230
1230
  return null;
@@ -1237,7 +1237,7 @@ class Utils extends FleetbaseUtils
1237
1237
  // Convert the value to JSON and create a Geometry object
1238
1238
  $json = json_encode($geoJson);
1239
1239
 
1240
- return \Grimzy\LaravelMysqlSpatial\Types\Geometry::fromJson($json);
1240
+ return \Fleetbase\LaravelMysqlSpatial\Types\Geometry::fromJson($json);
1241
1241
  }
1242
1242
 
1243
1243
  /**
@@ -1248,7 +1248,7 @@ class Utils extends FleetbaseUtils
1248
1248
  *
1249
1249
  * @return float the heading in degrees from the starting point to the ending point
1250
1250
  */
1251
- public static function calculateHeading(\Grimzy\LaravelMysqlSpatial\Types\Point $point1, \Grimzy\LaravelMysqlSpatial\Types\Point $point2): float
1251
+ public static function calculateHeading(\Fleetbase\LaravelMysqlSpatial\Types\Point $point1, \Fleetbase\LaravelMysqlSpatial\Types\Point $point2): float
1252
1252
  {
1253
1253
  // Extract latitude and longitude from Point objects
1254
1254
  $lat1 = $point1->getLat();
@@ -6,7 +6,7 @@ use Fleetbase\FleetOps\Models\Proof;
6
6
  use Fleetbase\FleetOps\Models\TrackingNumber;
7
7
  use Fleetbase\FleetOps\Models\TrackingStatus;
8
8
  use Fleetbase\FleetOps\Support\Utils;
9
- use Grimzy\LaravelMysqlSpatial\Types\Point;
9
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
10
10
  use Illuminate\Database\Eloquent\Model;
11
11
  use Illuminate\Support\Facades\DB;
12
12
 
@@ -49,7 +49,7 @@ trait HasTrackingNumber
49
49
  *
50
50
  * @param string $status the short status update
51
51
  * @param string $details the detailed update
52
- * @param array|Point $location the location of the update, can be either [lat, lng] or a \Grimzy\LaravelMysqlSpatial\Types\Point instance
52
+ * @param array|Point $location the location of the update, can be either [lat, lng] or a \Fleetbase\LaravelMysqlSpatial\Types\Point instance
53
53
  * @param string $code the onew word status code
54
54
  * @param \Fleetbase\Models\Proof|string|null $proof resolvable proof of delivery/activity
55
55
  *
@@ -84,7 +84,7 @@ trait HasTrackingNumber
84
84
  *
85
85
  * @param string $status the short status update
86
86
  * @param string $details the detailed update
87
- * @param array|Point $location the location of the update, can be either [lat, lng] or a \Grimzy\LaravelMysqlSpatial\Types\Point instance
87
+ * @param array|Point $location the location of the update, can be either [lat, lng] or a \Fleetbase\LaravelMysqlSpatial\Types\Point instance
88
88
  * @param \Fleetbase\Models\Proof|string|null $proof resolvable proof of delivery/activity
89
89
  * @param string $code the onew word status code
90
90
  */
@@ -390,9 +390,6 @@ Route::prefix(config('fleetops.api.routing.prefix', null))->namespace('Fleetbase
390
390
  $router->group(
391
391
  ['prefix' => 'fleet-ops'],
392
392
  function ($router) {
393
- /* Dashboard Build */
394
- $router->get('dashboard', 'MetricsController@dashboard');
395
-
396
393
  $router->group(
397
394
  ['prefix' => 'order-configs'],
398
395
  function () use ($router) {
@@ -432,7 +429,7 @@ Route::prefix(config('fleetops.api.routing.prefix', null))->namespace('Fleetbase
432
429
  $router->group(
433
430
  ['prefix' => 'metrics'],
434
431
  function ($router) {
435
- $router->get('all', 'MetricsController@all');
432
+ $router->get('/', 'MetricsController@all');
436
433
  }
437
434
  );
438
435
  }
@@ -541,6 +541,7 @@ fleet-ops:
541
541
  message: Let's see what you can do to jumpstart operations...
542
542
  start-task: Start Task
543
543
  key-metrics:
544
+ title: Fleet-Ops Metrics
544
545
  earnings: Earnings
545
546
  fuel-expenses: Fuel Expenses
546
547
  traveled: Distance Traveled
@@ -1,40 +0,0 @@
1
- <div class="quickstart-widget {{if this.isHidden 'hidden'}}" {{did-insert this.getTasks}} ...attributes>
2
- <div class="shadow-sm content-panel">
3
- <div class="content-panel-header">
4
- <h3 class="text-sm font-bold dark:text-gray-100">
5
- {{this.title}}
6
- </h3>
7
- </div>
8
- <div class="text-sm content-panel-body no-padding dark:text-gray-100">
9
- <div class="p-3">
10
- {{#if this.isLoading}}
11
- <div class="flex text-center items-center justify-center p-4">
12
- <Spinner class="mr-2" />
13
- <span>{{t "fleet-ops.component.widget.fleet-ops-quickstart.message"}}</span>
14
- </div>
15
- {{else}}
16
- <div class="space-y-3">
17
- {{#each-in this.tasks as |action task|}}
18
- <div
19
- class="rounded-md bg-gray-900 px-3 py-2 flex items-center justify-between space-x-2">
20
- <div class="flex items-center">
21
- <div class="mr-4">
22
- <div class="text-center flex items-center justify-center w-6">
23
- <FaIcon @icon={{if task.should "lightbulb-exclamation" "check-circle"}} class={{if task.should "text-yellow-400" "text-green-500"}} @size="lg" />
24
- </div>
25
- </div>
26
- <div class="text-gray-100">{{task.description}}</div>
27
- </div>
28
- <div>
29
- {{#if task.should}}
30
- <a href="javascript:;" class="text-yellow-700 dark:text-yellow-700 hover:text-yellow-700 font-semibold underline" {{on "click" (fn this.startTask action)}}>{{t "fleet-ops.component.widget.fleet-ops-quickstart.start-task"}}</a>
31
- {{/if}}
32
- </div>
33
- </div>
34
- {{/each-in}}
35
- </div>
36
- {{/if}}
37
- </div>
38
- </div>
39
- </div>
40
- </div>
@@ -1,59 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { tracked } from '@glimmer/tracking';
3
- import { inject as service } from '@ember/service';
4
- import { action, computed } from '@ember/object';
5
-
6
- export default class WidgetFleetOpsQuickstartComponent extends Component {
7
- @service intl;
8
- @service fetch;
9
- @service hostRouter;
10
- @tracked tasks = {};
11
- @tracked isLoading = true;
12
- @tracked isHidden = false;
13
-
14
- @computed('args.title') get title() {
15
- return this.args.title || 'Quickstart tasks for Fleet Ops';
16
- }
17
-
18
- @action async getTasks() {
19
- this.tasks = await this.fetchTasks();
20
- }
21
-
22
- @action startTask(action) {
23
- switch (action) {
24
- case 'add_drivers':
25
- break;
26
- case 'add_fleet':
27
- break;
28
- case 'add_order_config':
29
- break;
30
- case 'add_service_area':
31
- break;
32
- case 'add_users':
33
- break;
34
- case 'add_vehicles':
35
- break;
36
- case 'create_first_order':
37
- break;
38
- }
39
- }
40
-
41
- fetchTasks() {
42
- this.isLoading = true;
43
-
44
- return new Promise((resolve) => {
45
- this.fetch.get('actions/get-fleet-ops-quickstart-actions').then((tasks) => {
46
- this.isLoading = false;
47
- resolve(tasks);
48
- });
49
- });
50
- }
51
-
52
- shouldHideWidget(tasks) {
53
- const shouldHide = Object.values(tasks).every((task) => task.should === false);
54
-
55
- if (shouldHide) {
56
- this.isHidden = true;
57
- }
58
- }
59
- }
@@ -1 +0,0 @@
1
- {{yield}}