@fleetbase/fleetops-engine 0.4.3 → 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 (116) 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 +183 -0
  4. package/addon/components/edit-order-route-panel.js +265 -0
  5. package/addon/components/fleet-form-panel.hbs +1 -0
  6. package/addon/components/fleet-panel.hbs +1 -0
  7. package/addon/components/fleet-panel.js +3 -3
  8. package/addon/components/fuel-report-form-panel.hbs +1 -0
  9. package/addon/components/fuel-report-panel.hbs +1 -0
  10. package/addon/components/issue-form-panel.hbs +1 -0
  11. package/addon/components/issue-panel.hbs +1 -0
  12. package/addon/components/map-container/toolbar.hbs +2 -2
  13. package/addon/components/modals/order-route-form.hbs +1 -1
  14. package/addon/components/place-form-panel.hbs +1 -0
  15. package/addon/components/place-panel.hbs +1 -0
  16. package/addon/components/vehicle-form-panel.hbs +1 -0
  17. package/addon/components/vehicle-panel.hbs +1 -0
  18. package/addon/components/vendor-form-panel.hbs +1 -0
  19. package/addon/components/vendor-panel.hbs +1 -0
  20. package/addon/components/widget/fleet-ops-key-metrics.hbs +19 -0
  21. package/addon/components/widget/fleet-ops-key-metrics.js +85 -0
  22. package/addon/controllers/operations/orders/index/new.js +66 -22
  23. package/addon/controllers/operations/orders/index/view.js +131 -126
  24. package/addon/controllers/operations/orders/index.js +1 -1
  25. package/addon/engine.js +18 -12
  26. package/addon/routes/operations/orders/index/view.js +1 -1
  27. package/addon/services/context-panel.js +6 -0
  28. package/addon/styles/fleetops-engine.css +7 -2
  29. package/addon/templates/operations/orders/index/new.hbs +390 -58
  30. package/addon/templates/operations/orders/index/view.hbs +135 -105
  31. package/addon/templates/operations/service-rates/index/new.hbs +3 -1
  32. package/app/components/widget/{issues.js → fleet-ops-key-metrics.js} +1 -1
  33. package/composer.json +6 -6
  34. package/extension.json +1 -1
  35. package/package.json +5 -6
  36. package/server/src/Casts/MultiPolygon.php +3 -3
  37. package/server/src/Casts/Point.php +2 -2
  38. package/server/src/Casts/Polygon.php +3 -3
  39. package/server/src/Console/Commands/DispatchAdhocOrders.php +1 -1
  40. package/server/src/Events/DriverSimulatedLocationChanged.php +1 -1
  41. package/server/src/Flow/Activity.php +12 -0
  42. package/server/src/Flow/Config.php +7 -0
  43. package/server/src/Flow/Logic.php +7 -0
  44. package/server/src/Http/Controllers/Api/v1/DriverController.php +61 -21
  45. package/server/src/Http/Controllers/Api/v1/OrderController.php +5 -3
  46. package/server/src/Http/Controllers/Api/v1/PlaceController.php +1 -1
  47. package/server/src/Http/Controllers/Api/v1/ServiceAreaController.php +1 -1
  48. package/server/src/Http/Controllers/Api/v1/TrackingStatusController.php +1 -1
  49. package/server/src/Http/Controllers/Api/v1/ZoneController.php +1 -1
  50. package/server/src/Http/Controllers/Internal/v1/DriverController.php +17 -4
  51. package/server/src/Http/Controllers/Internal/v1/GeocoderController.php +2 -2
  52. package/server/src/Http/Controllers/Internal/v1/MetricsController.php +6 -50
  53. package/server/src/Http/Controllers/Internal/v1/OrderController.php +13 -2
  54. package/server/src/Http/Controllers/Internal/v1/PlaceController.php +1 -1
  55. package/server/src/Http/Filter/PlaceFilter.php +1 -1
  56. package/server/src/Http/Resources/v1/Driver.php +1 -1
  57. package/server/src/Http/Resources/v1/FuelReport.php +1 -1
  58. package/server/src/Http/Resources/v1/Issue.php +1 -1
  59. package/server/src/Http/Resources/v1/Order.php +3 -0
  60. package/server/src/Http/Resources/v1/Payload.php +1 -0
  61. package/server/src/Http/Resources/v1/Place.php +1 -1
  62. package/server/src/Http/Resources/v1/PurchaseRate.php +2 -1
  63. package/server/src/Http/Resources/v1/ServiceQuote.php +1 -0
  64. package/server/src/Http/Resources/v1/ServiceQuoteItem.php +29 -0
  65. package/server/src/Http/Resources/v1/TrackingStatus.php +1 -1
  66. package/server/src/Http/Resources/v1/Vehicle.php +1 -1
  67. package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +1 -1
  68. package/server/src/Http/Resources/v1/Waypoint.php +2 -4
  69. package/server/src/Integrations/Lalamove/LalamoveDeliveryStop.php +2 -2
  70. package/server/src/Jobs/SimulateWaypointReached.php +2 -2
  71. package/server/src/Models/Contact.php +6 -18
  72. package/server/src/Models/Driver.php +8 -20
  73. package/server/src/Models/Fleet.php +6 -25
  74. package/server/src/Models/FuelReport.php +1 -1
  75. package/server/src/Models/Issue.php +1 -1
  76. package/server/src/Models/Order.php +31 -19
  77. package/server/src/Models/Payload.php +7 -7
  78. package/server/src/Models/Place.php +16 -16
  79. package/server/src/Models/Position.php +1 -1
  80. package/server/src/Models/ServiceArea.php +14 -14
  81. package/server/src/Models/TrackingNumber.php +1 -1
  82. package/server/src/Models/TrackingStatus.php +1 -1
  83. package/server/src/Models/Vehicle.php +7 -19
  84. package/server/src/Models/VehicleDeviceEvent.php +1 -1
  85. package/server/src/Models/Vendor.php +8 -25
  86. package/server/src/Models/Waypoint.php +6 -6
  87. package/server/src/Models/Zone.php +8 -8
  88. package/server/src/Observers/DriverObserver.php +7 -2
  89. package/server/src/Observers/TrackingNumberObserver.php +1 -1
  90. package/server/src/Rules/ResolvablePoint.php +1 -1
  91. package/server/src/Support/Encoding/Polyline.php +1 -1
  92. package/server/src/Support/OSRM.php +1 -1
  93. package/server/src/Support/Utils.php +60 -60
  94. package/server/src/Traits/HasTrackingNumber.php +3 -3
  95. package/server/src/routes.php +2 -4
  96. package/translations/en-us.yaml +10 -2
  97. package/addon/components/widget/fleet-ops-quickstart.hbs +0 -40
  98. package/addon/components/widget/fleet-ops-quickstart.js +0 -59
  99. package/addon/components/widget/issues.hbs +0 -1
  100. package/addon/components/widget/key-metrics.hbs +0 -121
  101. package/addon/components/widget/key-metrics.js +0 -46
  102. package/addon/components/widget/live-order-map.hbs +0 -59
  103. package/addon/components/widget/live-order-map.js +0 -11
  104. package/addon/components/widget/recent-orders.hbs +0 -35
  105. package/addon/components/widget/recent-orders.js +0 -24
  106. package/addon/components/widget/transaction-earnings.hbs +0 -1
  107. package/addon/components/widget/transactions.hbs +0 -36
  108. package/addon/components/widget/transactions.js +0 -29
  109. package/addon/components/widget/weekly-orders.hbs +0 -1
  110. package/addon/components/widget/weekly-orders.js +0 -3
  111. package/app/components/widget/key-metrics.js +0 -1
  112. package/app/components/widget/live-order-map.js +0 -1
  113. package/app/components/widget/recent-orders.js +0 -1
  114. package/app/components/widget/transaction-earnings.js +0 -1
  115. package/app/components/widget/transactions.js +0 -1
  116. package/app/components/widget/weekly-orders.js +0 -1
@@ -86,7 +86,7 @@ class Waypoint extends Model
86
86
  /**
87
87
  * @return \Illuminate\Database\Eloquent\Relations\HasMany
88
88
  */
89
- public function entities()
89
+ public function entities()
90
90
  {
91
91
  return $this->hasMany(Entity::class, 'destination_uuid', 'place_uuid')->where('payload_uuid', $this->payload_uuid);
92
92
  }
@@ -97,16 +97,16 @@ class Waypoint extends Model
97
97
  public function label()
98
98
  {
99
99
  $this->load(['trackingNumber', 'company', 'place', 'entities']);
100
-
100
+
101
101
  // $entities = Entity::where(['payload_uuid' => $this->payload_uuid, 'destination_uuid' => $this->place_uuid])->get();
102
102
  // dd($entities, );
103
103
 
104
104
  return view('fleetops::labels/waypoint-label', [
105
105
  'waypoint' => $this,
106
- 'dropoff' => $this->place,
107
- 'entities' => $this->entities()->get(),
108
- 'trackingNumber' => $this->trackingNumber,
109
- 'company' => $this->company,
106
+ 'dropoff' => $this->place,
107
+ 'entities' => $this->entities()->get(),
108
+ 'trackingNumber' => $this->trackingNumber,
109
+ 'company' => $this->company,
110
110
  ])->render();
111
111
  }
112
112
 
@@ -4,16 +4,16 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\FleetOps\Casts\Polygon as PolygonCast;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
+ use Fleetbase\LaravelMysqlSpatial\Types\LineString;
9
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
10
+ use Fleetbase\LaravelMysqlSpatial\Types\Polygon;
7
11
  use Fleetbase\Models\Model;
8
12
  use Fleetbase\Traits\HasApiModelBehavior;
9
13
  use Fleetbase\Traits\HasPublicId;
10
14
  use Fleetbase\Traits\HasUuid;
11
15
  use Fleetbase\Traits\SendsWebhooks;
12
16
  use Fleetbase\Traits\TracksApiCredential;
13
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
14
- use Grimzy\LaravelMysqlSpatial\Types\LineString;
15
- use Grimzy\LaravelMysqlSpatial\Types\Point;
16
- use Grimzy\LaravelMysqlSpatial\Types\Polygon;
17
17
  use Illuminate\Support\Arr;
18
18
 
19
19
  class Zone extends Model
@@ -104,7 +104,7 @@ class Zone extends Model
104
104
  /**
105
105
  * Retrieves the location attribute as a point.
106
106
  *
107
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
107
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
108
108
  */
109
109
  public function getLocationAttribute(): Point
110
110
  {
@@ -195,10 +195,10 @@ class Zone extends Model
195
195
  /**
196
196
  * Creates a polygon from a given point and radius.
197
197
  *
198
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
199
- * @param int $meters The radius in meters for the polygon. Default is 500 meters.
198
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
199
+ * @param int $meters The radius in meters for the polygon. Default is 500 meters.
200
200
  *
201
- * @return \Grimzy\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
201
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
202
202
  */
203
203
  public static function createPolygonFromPoint(Point $point, int $meters = 500): Polygon
204
204
  {
@@ -4,8 +4,9 @@ namespace Fleetbase\FleetOps\Observers;
4
4
 
5
5
  use Fleetbase\FleetOps\Models\Driver;
6
6
  use Fleetbase\FleetOps\Models\Order;
7
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
8
+ use Fleetbase\Models\CompanyUser;
7
9
  use Fleetbase\Models\User;
8
- use Grimzy\LaravelMysqlSpatial\Types\Point;
9
10
 
10
11
  class DriverObserver
11
12
  {
@@ -41,7 +42,11 @@ class DriverObserver
41
42
  public function deleted(Driver $driver)
42
43
  {
43
44
  // if the driver is deleted, delete their user account assosciated as well
44
- User::where(['uuid' => $driver->user_uuid, 'type' => 'driver'])->delete();
45
+ if ($driver->user->companies()->count() === 1) {
46
+ User::where(['uuid' => $driver->user_uuid, 'type' => 'driver'])->delete();
47
+ } else {
48
+ CompanyUser::where(['user_uuid' => $driver->user_uuid, 'company_uuid' => session('company')])->delete();
49
+ }
45
50
 
46
51
  // also unassign them from any order they are assigned to
47
52
  Order::where(['driver_assigned_uuid' => $driver->uuid])->update(['driver_assigned_uuid' => null]);
@@ -4,7 +4,7 @@ namespace Fleetbase\FleetOps\Observers;
4
4
 
5
5
  use Fleetbase\FleetOps\Models\TrackingNumber;
6
6
  use Fleetbase\FleetOps\Models\TrackingStatus;
7
- use Grimzy\LaravelMysqlSpatial\Types\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
8
8
  use Illuminate\Support\Str;
9
9
  use Milon\Barcode\Facades\DNS2DFacade as DNS2D;
10
10
 
@@ -19,7 +19,7 @@ class ResolvablePoint implements Rule
19
19
  try {
20
20
  $point = Utils::getPointFromMixed($value);
21
21
 
22
- return $point instanceof \Grimzy\LaravelMysqlSpatial\Types\Point;
22
+ return $point instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point;
23
23
  } catch (\Exception $e) {
24
24
  return false;
25
25
  }
@@ -125,7 +125,7 @@ class Polyline
125
125
  $lng = $number * 1 / (10 ** static::$precision); // Using ** operator for pow
126
126
  } else {
127
127
  $lat = $number * 1 / (10 ** static::$precision);
128
- $points[] = new \Grimzy\LaravelMysqlSpatial\Types\Point($lat, $lng); // Create Point object and add to the array
128
+ $points[] = new \Fleetbase\LaravelMysqlSpatial\Types\Point($lat, $lng); // Create Point object and add to the array
129
129
  }
130
130
 
131
131
  $index++;
@@ -3,7 +3,7 @@
3
3
  namespace Fleetbase\FleetOps\Support;
4
4
 
5
5
  use Fleetbase\FleetOps\Support\Encoding\Polyline;
6
- use Grimzy\LaravelMysqlSpatial\Types\Point;
6
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
7
7
  use Illuminate\Support\Facades\Cache;
8
8
  use Illuminate\Support\Facades\Http;
9
9
 
@@ -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
  */
@@ -40,6 +40,7 @@ Route::prefix(config('fleetops.api.routing.prefix', null))->namespace('Fleetbase
40
40
  $router->get('/', 'DriverController@query');
41
41
  $router->get('{id}', 'DriverController@find');
42
42
  $router->get('{id}/organizations', 'DriverController@listOrganizations');
43
+ $router->get('{id}/current-organization', 'DriverController@currentOrganization');
43
44
  $router->put('{id}', 'DriverController@update');
44
45
  $router->delete('{id}', 'DriverController@delete');
45
46
  });
@@ -389,9 +390,6 @@ Route::prefix(config('fleetops.api.routing.prefix', null))->namespace('Fleetbase
389
390
  $router->group(
390
391
  ['prefix' => 'fleet-ops'],
391
392
  function ($router) {
392
- /* Dashboard Build */
393
- $router->get('dashboard', 'MetricsController@dashboard');
394
-
395
393
  $router->group(
396
394
  ['prefix' => 'order-configs'],
397
395
  function () use ($router) {
@@ -431,7 +429,7 @@ Route::prefix(config('fleetops.api.routing.prefix', null))->namespace('Fleetbase
431
429
  $router->group(
432
430
  ['prefix' => 'metrics'],
433
431
  function ($router) {
434
- $router->get('all', 'MetricsController@all');
432
+ $router->get('/', 'MetricsController@all');
435
433
  }
436
434
  );
437
435
  }
@@ -8,6 +8,7 @@ fleet-ops:
8
8
  avatar: Avatar
9
9
  building: Building
10
10
  bulk-action: Bulk Action
11
+ cancel: Cancel
11
12
  category: Category
12
13
  city: City
13
14
  coordinates: Coordinates
@@ -185,8 +186,8 @@ fleet-ops:
185
186
  create-zone: Create zone inside...
186
187
  toolbar:
187
188
  create: Create Order
188
- view: View Orders
189
- service: Service Areas
189
+ view-order: View Orders
190
+ view-service-area: View Service Areas
190
191
  visibility: Visibility Controls
191
192
  scope: Scope
192
193
  modals:
@@ -540,6 +541,7 @@ fleet-ops:
540
541
  message: Let's see what you can do to jumpstart operations...
541
542
  start-task: Start Task
542
543
  key-metrics:
544
+ title: Fleet-Ops Metrics
543
545
  earnings: Earnings
544
546
  fuel-expenses: Fuel Expenses
545
547
  traveled: Distance Traveled
@@ -1157,6 +1159,12 @@ fleet-ops:
1157
1159
  edit-field-title: Edit custom field
1158
1160
  edit-metadata: Edit Metadata
1159
1161
  view:
1162
+ purchase-rate-panel-title: Purchase Rate
1163
+ documents-panel-title: Documents & Files
1164
+ route-panel-title: Route
1165
+ currency: Currency
1166
+ comments-title: Comments
1167
+ notes-title: Notes
1160
1168
  dispatch: Dispatch
1161
1169
  order-actions: Order Actions
1162
1170
  edit-details: Edit Details